kuuko pushed a commit to branch master.

http://git.enlightenment.org/apps/epour.git/commit/?id=c7f05643c46c6845dfb67adbffc27fee00ca9311

commit c7f05643c46c6845dfb67adbffc27fee00ca9311
Author: Kai Huuhko <[email protected]>
Date:   Sat Mar 21 01:39:26 2015 +0200

    Handle setting the standard icons better
---
 epour/gui/__init__.py | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/epour/gui/__init__.py b/epour/gui/__init__.py
index da17161..98ddcc1 100644
--- a/epour/gui/__init__.py
+++ b/epour/gui/__init__.py
@@ -309,13 +309,24 @@ class SessionStatus(Table):
 
         ses_pause_ic = self.ses_pause_ic = Icon(parent)
         ses_pause_ic.size_hint_align = -1.0, -1.0
-        try:
-            if session.is_paused():
+
+        if session.is_paused():
+            try:
                 ses_pause_ic.standard = "player_pause"
-            else:
+            except Exception:
+                try:
+                    ses_pause_ic.standard = "media-playback-pause"
+                except Exception:
+                    log.warn("the pause icon could not be set")
+        else:
+            try:
                 ses_pause_ic.standard = "player_play"
-        except RuntimeError:
-            log.debug("Setting session ic failed")
+            except Exception:
+                try:
+                    ses_pause_ic.standard = "media-playback-play"
+                except Exception:
+                    log.warn("the play icon could not be set")
+
         self.pack(ses_pause_ic, 1, 0, 1, 1)
         ses_pause_ic.show()
 
@@ -326,7 +337,7 @@ class SessionStatus(Table):
         d_ic = Icon(parent, size_hint_align=FILL_BOTH)
         try:
             d_ic.standard = "down"
-        except RuntimeError:
+        except Exception:
             log.debug("Setting d_ic failed")
         self.pack(d_ic, 0, 1, 1, 1)
         d_ic.show()
@@ -339,7 +350,7 @@ class SessionStatus(Table):
         u_ic = Icon(self, size_hint_align=FILL_BOTH)
         try:
             u_ic.standard = "up"
-        except RuntimeError:
+        except Exception:
             log.debug("Setting u_ic failed")
         self.pack(u_ic, 0, 2, 1, 1)
         u_ic.show()
@@ -460,11 +471,23 @@ class TorrentClass(GenlistItemClass):
         ic = Icon(obj)
         try:
             if h.is_paused():
-                ic.standard = "player_pause"
+                try:
+                    ic.standard = "player_pause"
+                except Exception:
+                    try:
+                        ic.standard = "media-playback-pause"
+                    except Exception:
+                        pass
             elif h.is_seed():
-                ic.standard = "up"
+                try:
+                    ic.standard = "up"
+                except Exception:
+                    pass
             else:
-                ic.standard = "down"
+                try:
+                    ic.standard = "down"
+                except Exception:
+                    pass
         except RuntimeError:
             log.debug("Setting torrent ic failed")
         ic.tooltip_text_set(self.state_str[s.state])

-- 


Reply via email to