[Xfce4-commits] [apps/xfce4-panel-profiles] 19/162: Improve date readability by introducing Yesterday and Today

noreply at xfce.org noreply at xfce.org
Fri Jul 13 13:08:38 CEST 2018


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-panel-profiles.

commit 5e0fe38abde7b659c445cdc33634bc96d3cc51b6
Author: Simon Steinbeiß <ochosi at shimmerproject.org>
Date:   Fri Aug 14 00:28:26 2015 +0200

    Improve date readability by introducing Yesterday and Today
---
 xfpanel-switch/xfpanel-switch.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xfpanel-switch/xfpanel-switch.py b/xfpanel-switch/xfpanel-switch.py
index bb70bfe..1fdcfc1 100644
--- a/xfpanel-switch/xfpanel-switch.py
+++ b/xfpanel-switch/xfpanel-switch.py
@@ -57,6 +57,7 @@ class XfpanelSwitch:
         self.tree_model = self.treeview.get_model()
         for config in self.get_saved_configurations():
             self.tree_model.append(config)
+        self.tree_model.set_sort_column_id(1, Gtk.SortType.DESCENDING)
 
         if not os.path.exists(self.save_location):
             os.makedirs(self.save_location)
@@ -125,6 +126,7 @@ class XfpanelSwitch:
     def get_saved_configurations(self):
         results = []
         results.append(("", "Current Configuration", ""))
+        today_delta = datetime.datetime.today() - datetime.timedelta(days=1)
 
         for directory in self.get_data_dirs():
             for filename in os.listdir(directory):
@@ -134,7 +136,12 @@ class XfpanelSwitch:
                     path = os.path.join(directory, filename)
                     t = os.path.getmtime(path)
                     datetime_o = datetime.datetime.fromtimestamp(t)
-                    modified = datetime_o.strftime("%x")
+                    if datetime_o > today_delta:
+                        modified = ("Today")
+                    elif datetime_o == today_delta:
+                        modified = ("Yesterday")
+                    else:
+                        modified = datetime_o.strftime("%x")
                     results.append((path, name, modified))
 
         return results

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list