[hamster-applet] ellipsizing panel label at 25 symbols. fixes bug 597748



commit 530e923d08268ebe0dc0c5cd8536db2be25e3caa
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sat Dec 26 12:29:11 2009 +0000

    ellipsizing panel label at 25 symbols. fixes bug 597748

 hamster/applet.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/hamster/applet.py b/hamster/applet.py
index 1bb5851..a30ab74 100755
--- a/hamster/applet.py
+++ b/hamster/applet.py
@@ -110,6 +110,10 @@ class PanelButton(gtk.ToggleButton):
         self.set_property('active', is_active)
 
     def set_text(self, activity, duration):
+        activity = stuff.escape_pango(activity)
+        if len(activity) > 25:  #ellipsize at some random length
+            activity = "%s%s" % (activity[:25], "&#8230;")
+
         self.activity = activity
         self.duration = duration
         self.reformat_label()
@@ -122,7 +126,7 @@ class PanelButton(gtk.ToggleButton):
             else:
                 label = "%s %s" % (self.activity, self.duration)
         
-        label = '<span gravity="south">%s</span>' % stuff.escape_pango(label)
+        label = '<span gravity="south">%s</span>' % label
         self.label.set_markup("") #clear - seems to fix the warning
         self.label.set_markup(label)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]