from enigma import *
class Widget(GUIComponent):
-
- SHOWN = 0
- HIDDEN = 1
-
def __init__(self):
GUIComponent.__init__(self)
- self.instance = None
- self.state = self.SHOWN
def GUIcreate(self, parent):
self.instance = self.createWidget(parent)
+ if self.state == self.HIDDEN:
+ self.instance.hide()
def GUIdelete(self):
self.removeWidget(self.instance)
def removeWidget(self, w):
pass
- def showWidget(self):
- self.state = self.SHOWN
- self.instance.show()
-
- def hideWidget(self):
- self.state = self.HIDDEN
- self.instance.hide()
-
def move(self, x, y):
self.instance.move(ePoint(int(x), int(y)))
def activateCondition(self, condition):
if (condition):
- if (self.state == self.HIDDEN):
- self.showWidget()
+ if self.state == self.HIDDEN:
+ self.show()
else:
- if (self.state == self.SHOWN):
- self.hideWidget()
+ if self.state == self.SHOWN:
+ self.hide()
def update(self):
if (self.conditionalFunction != None):
def blink(self):
if self.blinking == True:
- if (self.state == self.SHOWN):
- self.hideWidget()
- elif (self.state == self.HIDDEN):
- self.showWidget()
+ if self.state == self.SHOWN:
+ self.hide()
+ elif self.state == self.HIDDEN:
+ self.show()
def startBlinking(self):
self.blinking = True
def stopBlinking(self):
self.blinking = False
- if (self.state == self.SHOWN):
- self.hideWidget()
+ if self.state == self.SHOWN:
+ self.hide()
self.timer.stop()
class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget):
self.startBlinking()
else:
if self.blinking: # we are blinking
- self.stopBlinking()
\ No newline at end of file
+ self.stopBlinking()
class GUIComponent:
""" GUI component """
+ SHOWN = 0
+ HIDDEN = 1
+
def __init__(self):
- pass
+ self.state = self.SHOWN
+ self.instance = None
def execBegin(self):
pass
# this works only with normal widgets - if you don't have self.instance, override this.
def applySkin(self, desktop):
+ if self.state == self.HIDDEN:
+ self.instance.hide()
skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
def move(self, x, y):
self.instance.move(ePoint(int(x), int(y)))
+
+ def show(self):
+ self.state = self.SHOWN
+ if self.instance is not None:
+ self.instance.show()
+
+ def hide(self):
+ self.state = self.HIDDEN
+ if self.instance is not None:
+ self.instance.hide()
else:
f()
-
-
def deleteGUIScreen(self):
for (name, val) in self.items():
if isinstance(val, GUIComponent):
if self.type == self.PIN or self.type == self.NUMBER:
self.right()
self.update()
-
- def show(self):
- self.instance.show()
-
- def hide(self):
- self.instance.hide()
\ No newline at end of file
s = self.instance.calculateSize()
return (s.width(), s.height())
- def show(self):
- self.instance.show()
-
- def hide(self):
- self.instance.hide()
-
class LabelConditional(Label, ConditionalWidget):
def __init__(self, text = "", withTimer = True):
ConditionalWidget.__init__(self, withTimer = withTimer)
def applyButtonState(self, state):
if state == 1:
- self["now_button_sel"].showWidget()
- self["now_button"].hideWidget()
+ self["now_button_sel"].show()
+ self["now_button"].hide()
else:
- self["now_button"].showWidget()
- self["now_button_sel"].hideWidget()
+ self["now_button"].show()
+ self["now_button_sel"].hide()
if state == 2:
- self["next_button_sel"].showWidget()
- self["next_button"].hideWidget()
+ self["next_button_sel"].show()
+ self["next_button"].hide()
else:
- self["next_button"].showWidget()
- self["next_button_sel"].hideWidget()
+ self["next_button"].show()
+ self["next_button_sel"].hide()
if state == 3:
- self["more_button_sel"].showWidget()
- self["more_button"].hideWidget()
+ self["more_button_sel"].show()
+ self["more_button"].hide()
else:
- self["more_button"].showWidget()
- self["more_button_sel"].hideWidget()
+ self["more_button"].show()
+ self["more_button_sel"].hide()
def onSelectionChanged(self):
if self.type == EPG_TYPE_MULTI:
def SelectionChanged(self):
selection = self["list"].getCurrent()[3]
+ arrow = self["arrowup"]
+
if selection is None:
- self["arrowup"].instance.hide()
+ arrow.hide()
else:
- self["arrowup"].moveTo(selection[1], selection[2], 1)
- self["arrowup"].startMoving()
- self["arrowup"].instance.show()
+ arrow.moveTo(selection[1], selection[2], 1)
+ arrow.startMoving()
+ arrow.show()
class HelpableScreen:
def __init__(self):
{
"displayHelp": self.showHelp,
})
+
def showHelp(self):
self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
+
def callHelpAction(self, *args):
if len(args):
(actionmap, context, action) = args