1 from Screens.Screen import Screen
2 from Screens.InputBox import InputBox
3 from Screens.ChoiceBox import ChoiceBox
4 from Components.ActionMap import ActionMap
5 from Components.Label import Label
6 from Components.Button import Button
7 from Components.MenuList import MenuList
8 from Components.Input import Input
9 from Plugins.Plugin import PluginDescriptor
10 from enigma import iPlayableService
11 from Components.ServiceEventTracker import ServiceEventTracker
12 from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigYesNo, ConfigText, ConfigSelection
13 from Components.ConfigList import ConfigListScreen
16 from enigma import ePoint, eSize
19 ###############################################################################
20 myname = "AntiScrollbar"
22 config.plugins.antiscrollbar = ConfigSubsection()
23 config.plugins.antiscrollbar.autostart = ConfigYesNo(default=True)
24 config.plugins.antiscrollbar.modescount = ConfigInteger(0)
25 config.plugins.antiscrollbar.mode = ConfigSubList()
28 modescount = config.plugins.antiscrollbar.modescount.value
34 print "["+myname+".initConfig] i is %s" % i
35 config.plugins.antiscrollbar.mode.append(ConfigSubsection())
36 config.plugins.antiscrollbar.mode[i].sref = ConfigText("")
37 config.plugins.antiscrollbar.mode[i].sizex = ConfigInteger(0)
38 config.plugins.antiscrollbar.mode[i].sizey = ConfigInteger(0)
39 config.plugins.antiscrollbar.mode[i].posx = ConfigInteger(0)
40 config.plugins.antiscrollbar.mode[i].posy = ConfigInteger(0)
41 config.plugins.antiscrollbar.mode[i].enabled = ConfigYesNo(default=True)
43 config.plugins.antiscrollbar.modescount.value = i + 1
51 for mode in config.plugins.antiscrollbar.mode:
52 sref = mode.sref.value
53 sizex = mode.sizex.value
54 sizey = mode.sizey.value
55 posx = mode.posx.value
56 posy = mode.posy.value
57 enabled = mode.enabled.value
58 srefs[sref]=[sizex,sizey,posx,posy,enabled]
61 ###############################################################################
62 class AntiScrollOverlay(Screen):
63 def __init__(self, session):
66 ss ="<screen position=\"0,0\" size=\"0,0\" title=\"AntiScrollOverlay\" flags=\"wfNoBorder\" zPosition=\"-1\">"
67 ss +="<widget name=\"label\" position=\"0,0\" size=\"0,0\" backgroundColor=\"black\" />"
70 self.session = session
71 Screen.__init__(self, session)
72 self["label"] = Label()
73 self.__event_tracker = ServiceEventTracker(screen=self,eventmap=
75 iPlayableService.evTunedIn: self.evStart,
76 iPlayableService.evEOF: self.hide,
81 service = self.session.nav.getCurrentlyPlayingServiceReference()
85 if service.toString() in srefs:
86 data = srefs[service.toString()]
88 self.resize(data[0],data[1])
89 self.move(data[2],data[3])
95 self.instance.move(ePoint(x, y))
97 def resize(self, w, h):
98 self.instance.resize(eSize(*(w, h)))
99 self["label"].instance.resize(eSize(*(w, h)))
102 #############################
103 class AntiScrollConfig(ConfigListScreen, Screen):
105 <screen position="100,100" size="550,400" title="%s">
106 <widget name="config" position="5,5" size="540,360" scrollbarMode="showOnDemand" zPosition="1"/>
108 <widget name="key_red" position="0,360" size="140,40" valign="center" halign="center" zPosition="5" transparent="1" foregroundColor="white" font="Regular;18"/>
109 <widget name="key_green" position="140,360" size="140,40" valign="center" halign="center" zPosition="5" transparent="1" foregroundColor="white" font="Regular;18"/>
110 <widget name="key_yellow" position="280,360" size="140,40" valign="center" halign="center" zPosition="5" transparent="1" foregroundColor="white" font="Regular;18"/>
112 <ePixmap name="red" pixmap="skin_default/buttons/red.png" position="0,360" size="140,40" zPosition="4" transparent="1" alphatest="on"/>
113 <ePixmap name="green" pixmap="skin_default/buttons/green.png" position="140,360" size="140,40" zPosition="4" transparent="1" alphatest="on"/>
114 <ePixmap name="yellow" pixmap="skin_default/buttons/yellow.png" position="280,360" size="140,40" zPosition="4" transparent="1" alphatest="on"/>
115 </screen>""" % _(myname+": Main Setup")
117 def __init__(self, session, args=0):
118 Screen.__init__(self, session)
120 getConfigListEntry(_("Start on Sessionstart"), config.plugins.Webinterface.enable),
123 ConfigListScreen.__init__(self, l)
124 self["key_red"] = Button(_("Cancel"))
125 self["key_green"] = Button(_("OK"))
126 self["key_yellow"] = Button(_("current Service"))
127 self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
131 "yellow": self.openCurrentSeviceConfig,
133 "cancel": self.cancel,
137 def openCurrentSeviceConfig(self):
140 for mode in config.plugins.antiscrollbar.mode:
141 if mode.sref.value == self.session.nav.getCurrentlyPlayingServiceReference().toString():
144 print "new config "*40
145 i = config.plugins.antiscrollbar.modescount.value
146 config.plugins.antiscrollbar.mode.append(ConfigSubsection())
147 config.plugins.antiscrollbar.mode[i].sref = ConfigText("")
148 config.plugins.antiscrollbar.mode[i].sizex = ConfigInteger(200)
149 config.plugins.antiscrollbar.mode[i].sizey = ConfigInteger(200)
150 config.plugins.antiscrollbar.mode[i].posx = ConfigInteger(100)
151 config.plugins.antiscrollbar.mode[i].posy = ConfigInteger(50)
152 config.plugins.antiscrollbar.mode[i].enabled = ConfigYesNo(default=True)
154 config.plugins.antiscrollbar.mode[i].save()
155 config.plugins.antiscrollbar.mode[i].sref.value = self.session.nav.getCurrentlyPlayingServiceReference().toString()
156 config.plugins.antiscrollbar.mode[i].save()
158 config.plugins.antiscrollbar.modescount.value +=1
159 config.plugins.antiscrollbar.modescount.save()
160 smode = config.plugins.antiscrollbar.mode[i]
161 self.session.open(CurrentSeviceConfig,smode)
165 for x in self["config"].list:
167 self.close(True, self.session)
171 for x in self["config"].list:
173 self.close(False, self.session)
175 class CurrentSeviceConfig(Screen):
177 def __init__(self, session, mode):
178 print "editing "+mode.sref.value
180 self.size = [mode.sizex.value,mode.sizey.value]
181 self.enabled = mode.enabled.value
182 self.position = [mode.posx.value,mode.posy.value]
183 ss ="<screen position=\"%i,%i\" size=\"%i,%i\" title=\"%s\" flags=\"wfNoBorder\" >" %(mode.posx.value,mode.posy.value,mode.sizex.value,mode.sizey.value,myname)
184 ss +="<widget name=\"label\" position=\"0,0\" size=\"%i,%i\" backgroundColor=\"black\" />" %(mode.sizex.value,mode.sizey.value)
187 self.session = session
188 Screen.__init__(self, session)
190 self["label"] = Label()
191 if self.enabled is not True:
192 self["label"].setText("disabled")
194 self["label"].setText("")
196 self["actions"] = ActionMap(["WizardActions", "DirectionActions","MenuActions","NumberActions"],
212 self.mode.posx.value = self.position[0]
213 self.mode.posy.value = self.position[1]
214 self.mode.sizex.value = self.size[0]
215 self.mode.sizey.value = self.size[1]
216 self.mode.enabled.value = self.enabled
226 self["label"].setText("disabled")
229 self["label"].setText("")
232 self.size= [self.size[0],self.size[1]-self.step]
233 self.resize(self.size[0],self.size[1])
236 self.size= [self.size[0],self.size[1]+self.step]
237 self.resize(self.size[0],self.size[1])
240 self.size= [self.size[0]-self.step,self.size[1]]
241 self.resize(self.size[0],self.size[1])
244 self.size= [self.size[0]+self.step,self.size[1]]
245 self.resize(self.size[0],self.size[1])
248 self.position = [self.position[0],self.position[1]+self.step]
249 self.move(self.position[0],self.position[1])
252 self.position = [self.position[0],self.position[1]-self.step]
253 self.move(self.position[0],self.position[1])
256 self.position = [self.position[0]-self.step,self.position[1]]
257 self.move(self.position[0],self.position[1])
260 self.position = [self.position[0]+self.step,self.position[1]]
261 self.move(self.position[0],self.position[1])
263 def move(self, x, y):
264 self.instance.move(ePoint(x, y))
267 def resize(self, w, h):
268 self.instance.resize(eSize(*(w, h)))
269 self["label"].instance.resize(eSize(*(w, h)))
271 #############################
276 def main(session, **kwargs):
280 session.openWithCallback(mainCB,AntiScrollConfig)
282 def mainCB(saved,session):
283 global activebar,doshow
286 def autostart(session, **kwargs):
288 if config.plugins.antiscrollbar.autostart.value:
289 activebar = session.instantiateDialog(AntiScrollOverlay)
291 def Plugins(**kwargs):
292 return [PluginDescriptor(name=myname,description="overlay for scrolling bars",where = PluginDescriptor.WHERE_PLUGINMENU,fnc = main, icon="plugin.png"),
293 PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART,fnc = autostart)]