hide color buttons when no/only one page configured
authorChristian Weiske <cweiske@cweiske.de>
Mon, 21 Nov 2011 05:46:55 +0000 (06:46 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 21 Nov 2011 05:46:55 +0000 (06:46 +0100)
ChangeLog
src/CurlyTx.py

index a2d1750..942055c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-21  Christian Weiske  <cweiske@cweiske.de>
+
+       * hide color buttons when no/only one page configured
+
+
 2011-11-18  Christian Weiske  <cweiske@cweiske.de>
 
        * Add help screens
index d4853f9..85970ca 100644 (file)
@@ -57,6 +57,7 @@ class CurlyTx(Screen,HelpableScreen):
             }, -1)
 
         self.loadHelp()
+        self.loadButtons()
         self.loadUrl(config.plugins.CurlyTx.defaultPage.value)
 
     def loadHelp(self):
@@ -88,6 +89,21 @@ class CurlyTx(Screen,HelpableScreen):
                 self["actions"], "HelpActions",
                 [("displayHelp", _("Show this help screen"))]))
 
+    def loadButtons(self):
+        pageCount = len(config.plugins.CurlyTx.pages)
+        if pageCount == 0:
+            self["key_green"].setText("")
+            self["key_yellow"].setText("")
+            self["key_blue"].setText("")
+        elif pageCount == 1:
+            self["key_green"].setText(_("Reload"))
+            self["key_yellow"].setText("")
+            self["key_blue"].setText("")
+        else:
+            self["key_green"].setText(_("Reload"))
+            self["key_yellow"].setText(_("Prev"))
+            self["key_blue"].setText(_("Next"))
+
     def pageUp(self):
         self["text"].pageUp()
 
@@ -158,6 +174,7 @@ class CurlyTx(Screen,HelpableScreen):
         self.session.openWithCallback(self.onSettingsChanged, CurlyTxSettings)
 
     def onSettingsChanged(self):
+        self.loadButtons()
         if len(config.plugins.CurlyTx.pages) == 0:
             self.currentPage = None
             self.loadUrl(self.currentPage)