1 from MyTubeService import GoogleSuggestions
2 from Screens.Screen import Screen
3 from Screens.LocationBox import MovieLocationBox
4 from Components.config import config, Config, ConfigSelection, ConfigText, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigIP, ConfigNumber,ConfigLocations
5 from Components.ConfigList import ConfigListScreen
6 from Components.config import KEY_DELETE, KEY_BACKSPACE, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT
7 from Components.ActionMap import ActionMap
8 from Components.Button import Button
9 from Components.Label import Label
10 from Components.ScrollLabel import ScrollLabel
11 from Components.Sources.List import List
12 from Components.Pixmap import Pixmap
13 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
14 from Components.Task import Task, Job, job_manager
15 from enigma import eListboxPythonMultiContent, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, gFont, eListbox,ePoint,eTimer
16 from Components.Task import job_manager
17 from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_HDD
18 from threading import Thread
19 from threading import Condition
20 from xml.etree.cElementTree import parse as cet_parse
21 from StringIO import StringIO
25 from urllib import FancyURLopener
27 class MyOpener(FancyURLopener):
28 version = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12'
31 class ConfigTextWithGoogleSuggestions(ConfigText):
32 class SuggestionsThread(Thread):
33 def __init__(self, suggestionsService):
35 self.suggestionsService = suggestionsService
38 self.condition = Condition()
42 self.condition.acquire()
43 if self.value is None:
47 self.condition.release()
49 self.suggestionsService.getSuggestions(value)
53 self.condition.acquire()
54 self.condition.notify()
55 self.condition.release()
58 def getSuggestions(self, value):
59 self.condition.acquire()
61 self.condition.notify()
62 self.condition.release()
64 def __init__(self, default = "", fixed_size = True, visible_width = False, threaded = False):
65 ConfigText.__init__(self, default, fixed_size, visible_width)
66 self.suggestions = GoogleSuggestions(self.propagateSuggestions, ds = "yt", hl = "en")
67 self.suggestionsThread = None
68 self.threaded = threaded
69 self.suggestionsListActivated = False
71 def propagateSuggestions(self, suggestionsList):
72 if self.suggestionsWindow:
73 self.suggestionsWindow.update(suggestionsList)
75 def getSuggestions(self):
76 if self.suggestionsThread is not None:
77 self.suggestionsThread.getSuggestions(self.value)
79 self.suggestions.getSuggestions(self.value)
81 def handleKey(self, key):
82 if not self.suggestionsListActivated:
83 ConfigText.handleKey(self, key)
84 if key in [KEY_DELETE, KEY_BACKSPACE, KEY_ASCII, KEY_TIMEOUT]:
87 def onSelect(self, session):
89 if self.suggestionsThread is not None:
90 self.suggestionsThread.stop()
91 self.suggestionsThread = ConfigTextWithGoogleSuggestions.SuggestionsThread(self.suggestions)
92 self.suggestionsThread.start()
94 self.suggestionsThread = None
95 ConfigText.onSelect(self, session)
96 if session is not None:
97 self.suggestionsWindow = session.instantiateDialog(MyTubeSuggestionsListScreen, self)
98 self.suggestionsWindow.deactivate()
99 self.suggestionsWindow.hide()
100 self.suggestions.getSuggestions(self.value)
102 def onDeselect(self, session):
103 if self.suggestionsThread is not None:
104 self.suggestionsThread.stop()
105 ConfigText.onDeselect(self, session)
106 if self.suggestionsWindow:
107 session.deleteDialog(self.suggestionsWindow)
108 self.suggestionsWindow = None
110 def suggestionListUp(self):
111 if self.suggestionsWindow.getlistlenght() > 0:
112 self.value = self.suggestionsWindow.up()
114 def suggestionListDown(self):
115 if self.suggestionsWindow.getlistlenght() > 0:
116 self.value = self.suggestionsWindow.down()
118 def suggestionListPageDown(self):
119 if self.suggestionsWindow.getlistlenght() > 0:
120 self.value = self.suggestionsWindow.pageDown()
122 def suggestionListPageUp(self):
123 if self.suggestionsWindow.getlistlenght() > 0:
124 self.value = self.suggestionsWindow.pageUp()
126 def activateSuggestionList(self):
128 if self.suggestionsWindow is not None and self.suggestionsWindow.shown:
129 self.tmpValue = self.value
130 self.value = self.suggestionsWindow.activate()
131 self.allmarked = False
132 self.suggestionsListActivated = True
136 def deactivateSuggestionList(self):
138 if self.suggestionsWindow is not None:
139 self.suggestionsWindow.deactivate()
140 self.getSuggestions()
141 self.allmarked = True
142 self.suggestionsListActivated = False
146 def cancelSuggestionList(self):
147 self.value = self.tmpValue
148 return self.deactivateSuggestionList()
150 def enableSuggestionSelection(self,value):
151 if self.suggestionsWindow is not None:
152 self.suggestionsWindow.enableSelection(value)
155 config.plugins.mytube = ConfigSubsection()
156 config.plugins.mytube.search = ConfigSubsection()
158 config.plugins.mytube.search.searchTerm = ConfigTextWithGoogleSuggestions("", False, threaded = True)
159 config.plugins.mytube.search.orderBy = ConfigSelection(
161 ("relevance", _("Relevance")),
162 ("viewCount", _("View Count")),
163 ("published", _("Published")),
164 ("rating", _("Rating"))
166 config.plugins.mytube.search.time = ConfigSelection(
168 ("all_time", _("All Time")),
169 ("this_month", _("This Month")),
170 ("this_week", _("This Week")),
171 ("today", _("Today"))
173 config.plugins.mytube.search.racy = ConfigSelection(
175 ("include", _("Yes")),
178 config.plugins.mytube.search.categories = ConfigSelection(
181 ("Film", _("Film & Animation")),
182 ("Autos", _("Autos & Vehicles")),
183 ("Music", _("Music")),
184 ("Animals", _("Pets & Animals")),
185 ("Sports", _("Sports")),
186 ("Travel", _("Travel & Events")),
187 ("Shortmov", _("Short Movies")),
188 ("Games", _("Gaming")),
189 ("Comedy", _("Comedy")),
190 ("People", _("People & Blogs")),
191 ("News", _("News & Politics")),
192 ("Entertainment", _("Entertainment")),
193 ("Education", _("Education")),
194 ("Howto", _("Howto & Style")),
195 ("Nonprofit", _("Nonprofits & Activism")),
196 ("Tech", _("Science & Technology"))
198 config.plugins.mytube.search.lr = ConfigSelection(
201 ("au", _("Australia")),
204 ("cz", _("Czech Republic")),
206 ("de", _("Germany")),
207 ("gb", _("Great Britain")),
208 ("au", _("Australia")),
209 ("nl", _("Holland")),
210 ("hk", _("Hong Kong")),
212 ("ie", _("Ireland")),
217 ("nz", _("New Zealand")),
220 ("kr", _("South Korea")),
224 ("us", _("United States"))
226 config.plugins.mytube.search.sortOrder = ConfigSelection(
228 ("ascending", _("Ascending")),
229 ("descending", _("Descending"))
232 config.plugins.mytube.general = ConfigSubsection()
233 config.plugins.mytube.general.showHelpOnOpen = ConfigYesNo(default = True)
234 config.plugins.mytube.general.loadFeedOnOpen = ConfigYesNo(default = True)
235 config.plugins.mytube.general.startFeed = ConfigSelection(
237 ("hd", _("HD videos")),
238 ("most_viewed", _("Most viewed")),
239 ("top_rated", _("Top rated")),
240 ("recently_featured", _("Recently featured")),
241 ("most_discussed", _("Most discussed")),
242 ("top_favorites", _("Top favorites")),
243 ("most_linked", _("Most linked")),
244 ("most_responded", _("Most responded")),
245 ("most_recent", _("Most recent"))
248 config.plugins.mytube.general.on_movie_stop = ConfigSelection(default = "ask", choices = [
249 ("ask", _("Ask user")), ("quit", _("Return to movie list")), ("playnext", _("Play next video")), ("playagain", _("Play video again")) ])
251 config.plugins.mytube.general.on_exit = ConfigSelection(default = "ask", choices = [
252 ("ask", _("Ask user")), ("quit", _("Return to movie list"))])
255 default = resolveFilename(SCOPE_HDD)
256 tmp = config.movielist.videodirs.value
257 if default not in tmp:
259 config.plugins.mytube.general.videodir = ConfigSelection(default = default, choices = tmp)
260 config.plugins.mytube.general.history = ConfigText(default="")
261 config.plugins.mytube.general.clearHistoryOnClose = ConfigYesNo(default = False)
263 #config.plugins.mytube.general.useHTTPProxy = ConfigYesNo(default = False)
264 #config.plugins.mytube.general.ProxyIP = ConfigIP(default=[0,0,0,0])
265 #config.plugins.mytube.general.ProxyPort = ConfigNumber(default=8080)
267 class MyTubeSuggestionsListScreen(Screen):
269 <screen name="MyTubeSuggestionsListScreen" position="60,93" zPosition="6" size="610,160" flags="wfNoBorder" >
270 <ePixmap position="0,0" zPosition="-1" size="610,160" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/MyTube/suggestions_bg.png" alphatest="on" transparent="1" backgroundColor="transparent"/>
271 <widget source="suggestionslist" render="Listbox" position="10,5" zPosition="7" size="580,150" scrollbarMode="showOnDemand" transparent="1" >
272 <convert type="TemplatedMultiContent">
274 MultiContentEntryText(pos = (0, 1), size = (340, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
275 MultiContentEntryText(pos = (350, 1), size = (180, 24), font=1, flags = RT_HALIGN_RIGHT, text = 1), # index 1 are the rtesults
277 "fonts": [gFont("Regular", 22),gFont("Regular", 18)],
284 def __init__(self, session, configTextWithGoogleSuggestion):
285 Screen.__init__(self, session)
286 self.activeState = False
288 self.suggestlist = []
289 self["suggestionslist"] = List(self.list)
290 self.configTextWithSuggestion = configTextWithGoogleSuggestion
292 def update(self, suggestions):
293 if suggestions and len(suggestions) > 0:
296 suggestions_tree = cet_parse(StringIO(suggestions)).getroot()
299 self.suggestlist = []
300 for suggestion in suggestions_tree.findall("CompleteSuggestion"):
303 for subelement in suggestion:
304 if subelement.attrib.has_key('data'):
305 name = subelement.attrib['data'].encode("UTF-8")
306 if subelement.attrib.has_key('int'):
307 numresults = subelement.attrib['int']
308 if name and numresults:
309 self.suggestlist.append((name, numresults ))
310 if len(self.suggestlist):
311 self.suggestlist.sort(key=lambda x: int(x[1]))
312 self.suggestlist.reverse()
313 for entry in self.suggestlist:
314 self.list.append((entry[0], entry[1] + _(" Results") ))
315 self["suggestionslist"].setList(self.list)
316 self["suggestionslist"].setIndex(0)
320 def getlistlenght(self):
321 return len(self.list)
325 if self.list and len(self.list) > 0:
326 self["suggestionslist"].selectPrevious()
327 return self.getSelection()
331 if self.list and len(self.list) > 0:
332 self["suggestionslist"].selectNext()
333 return self.getSelection()
337 if self.list and len(self.list) > 0:
338 self["suggestionslist"].selectPrevious()
339 return self.getSelection()
343 if self.list and len(self.list) > 0:
344 self["suggestionslist"].selectNext()
345 return self.getSelection()
349 self.activeState = True
350 return self.getSelection()
352 def deactivate(self):
354 self.activeState = False
355 return self.getSelection()
357 def getSelection(self):
358 if self["suggestionslist"].getCurrent() is None:
360 print self["suggestionslist"].getCurrent()[0]
361 return self["suggestionslist"].getCurrent()[0]
363 def enableSelection(self,value):
364 self["suggestionslist"].selectionEnabled(value)
367 class MyTubeSettingsScreen(Screen, ConfigListScreen):
369 <screen name="MyTubeSettingsScreen" flags="wfNoBorder" position="0,0" size="720,576" title="MyTubePlayerMainScreen..." >
370 <ePixmap position="0,0" zPosition="-1" size="720,576" pixmap="~/mytubemain_bg.png" alphatest="on" transparent="1" backgroundColor="transparent"/>
371 <widget name="title" position="60,50" size="600,50" zPosition="5" valign="center" halign="left" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
372 <widget name="config" zPosition="2" position="60,120" size="610,370" scrollbarMode="showOnDemand" transparent="1" />
374 <ePixmap position="100,500" size="100,40" zPosition="0" pixmap="~/plugin.png" alphatest="on" transparent="1" />
375 <ePixmap position="220,500" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
376 <ePixmap position="360,500" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
377 <widget name="key_red" position="220,500" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
378 <widget name="key_green" position="360,500" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
381 def __init__(self, session, plugin_path):
382 Screen.__init__(self, session)
383 self.skin_path = plugin_path
384 self.session = session
386 self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "MediaPlayerActions"],
389 "back": self.keyCancel,
390 "red": self.keyCancel,
391 "green": self.keySave,
393 "down": self.keyDown,
394 "left": self.keyLeft,
395 "right": self.keyRight,
398 self["key_red"] = Button(_("Close"))
399 self["key_green"] = Button(_("Save"))
400 self["title"] = Label()
402 self.searchContextEntries = []
403 self.ProxyEntry = None
404 self.loadFeedEntry = None
405 self.VideoDirname = None
406 ConfigListScreen.__init__(self, self.searchContextEntries, session)
408 self.onLayoutFinish.append(self.layoutFinished)
409 self.onShown.append(self.setWindowTitle)
411 def layoutFinished(self):
412 self["title"].setText(_("MyTubePlayer settings"))
414 def setWindowTitle(self):
415 self.setTitle(_("MyTubePlayer settings"))
417 def createSetup(self):
418 self.searchContextEntries = []
419 self.searchContextEntries.append(getConfigListEntry(_("Display search results by:"), config.plugins.mytube.search.orderBy))
420 self.searchContextEntries.append(getConfigListEntry(_("Search restricted content:"), config.plugins.mytube.search.racy))
421 self.searchContextEntries.append(getConfigListEntry(_("Search category:"), config.plugins.mytube.search.categories))
422 self.searchContextEntries.append(getConfigListEntry(_("Search region:"), config.plugins.mytube.search.lr))
423 self.loadFeedEntry = getConfigListEntry(_("Load feed on startup:"), config.plugins.mytube.general.loadFeedOnOpen)
424 self.searchContextEntries.append(self.loadFeedEntry)
425 if config.plugins.mytube.general.loadFeedOnOpen.value:
426 self.searchContextEntries.append(getConfigListEntry(_("Start with following feed:"), config.plugins.mytube.general.startFeed))
427 self.searchContextEntries.append(getConfigListEntry(_("Videoplayer stop/exit behavior:"), config.plugins.mytube.general.on_movie_stop))
428 self.searchContextEntries.append(getConfigListEntry(_("Videobrowser exit behavior:"), config.plugins.mytube.general.on_exit))
429 """self.ProxyEntry = getConfigListEntry(_("Use HTTP Proxy Server:"), config.plugins.mytube.general.useHTTPProxy)
430 self.searchContextEntries.append(self.ProxyEntry)
431 if config.plugins.mytube.general.useHTTPProxy.value:
432 self.searchContextEntries.append(getConfigListEntry(_("HTTP Proxy Server IP:"), config.plugins.mytube.general.ProxyIP))
433 self.searchContextEntries.append(getConfigListEntry(_("HTTP Proxy Server Port:"), config.plugins.mytube.general.ProxyPort))"""
434 # disabled until i have time for some proper tests
435 self.VideoDirname = getConfigListEntry(_("Download location"), config.plugins.mytube.general.videodir)
436 if config.usage.setup_level.index >= 2: # expert+
437 self.searchContextEntries.append(self.VideoDirname)
438 self.searchContextEntries.append(getConfigListEntry(_("Clear history on Exit:"), config.plugins.mytube.general.clearHistoryOnClose))
440 self["config"].list = self.searchContextEntries
441 self["config"].l.setList(self.searchContextEntries)
442 if not self.selectionChanged in self["config"].onSelectionChanged:
443 self["config"].onSelectionChanged.append(self.selectionChanged)
445 def selectionChanged(self):
446 current = self["config"].getCurrent()
449 print "newConfig", self["config"].getCurrent()
450 if self["config"].getCurrent() == self.loadFeedEntry:
454 cur = self["config"].getCurrent()
455 if config.usage.setup_level.index >= 2 and cur == self.VideoDirname:
456 self.session.openWithCallback(
459 _("Choose target folder"),
460 config.plugins.mytube.general.videodir.value,
461 minFree = 100 # We require at least 100MB free space
466 def pathSelected(self, res):
468 if config.movielist.videodirs.value != config.plugins.mytube.general.videodir.choices:
469 config.plugins.mytube.general.videodir.setChoices(config.movielist.videodirs.value, default=res)
470 config.plugins.mytube.general.videodir.value = res
473 self["config"].instance.moveSelection(self["config"].instance.moveUp)
476 self["config"].instance.moveSelection(self["config"].instance.moveDown)
479 ConfigListScreen.keyRight(self)
483 ConfigListScreen.keyLeft(self)
488 for x in self["config"].list:
494 config.plugins.mytube.search.orderBy.save()
495 config.plugins.mytube.search.racy.save()
496 config.plugins.mytube.search.categories.save()
497 config.plugins.mytube.search.lr.save()
498 config.plugins.mytube.general.loadFeedOnOpen.save()
499 config.plugins.mytube.general.startFeed.save()
500 config.plugins.mytube.general.on_movie_stop.save()
501 config.plugins.mytube.general.on_exit.save()
502 config.plugins.mytube.general.videodir.save()
503 config.plugins.mytube.general.clearHistoryOnClose.save()
504 if config.plugins.mytube.general.clearHistoryOnClose.value:
505 config.plugins.mytube.general.history.value = ""
506 config.plugins.mytube.general.history.save()
507 #config.plugins.mytube.general.useHTTPProxy.save()
508 #config.plugins.mytube.general.ProxyIP.save()
509 #config.plugins.mytube.general.ProxyPort.save()
510 for x in self["config"].list:
512 config.plugins.mytube.general.save()
513 config.plugins.mytube.search.save()
514 config.plugins.mytube.save()
515 """if config.plugins.mytube.general.useHTTPProxy.value is True:
516 proxy = {'http': 'http://'+str(config.plugins.mytube.general.ProxyIP.getText())+':'+str(config.plugins.mytube.general.ProxyPort.value)}
517 self.myopener = MyOpener(proxies=proxy)
518 urllib.urlopen = MyOpener(proxies=proxy).open
520 self.myopener = MyOpener()
521 urllib.urlopen = MyOpener().open"""
525 class MyTubeTasksScreen(Screen):
527 <screen name="MyTubeTasksScreen" flags="wfNoBorder" position="0,0" size="720,576" title="MyTubePlayerMainScreen..." >
528 <ePixmap position="0,0" zPosition="-1" size="720,576" pixmap="~/mytubemain_bg.png" alphatest="on" transparent="1" backgroundColor="transparent"/>
529 <widget name="title" position="60,50" size="600,50" zPosition="5" valign="center" halign="left" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
530 <widget source="tasklist" render="Listbox" position="60,120" size="610,370" zPosition="7" scrollbarMode="showOnDemand" transparent="1" >
531 <convert type="TemplatedMultiContent">
533 MultiContentEntryText(pos = (0, 1), size = (200, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the name
534 MultiContentEntryText(pos = (210, 1), size = (150, 24), font=1, flags = RT_HALIGN_RIGHT, text = 2), # index 2 is the state
535 MultiContentEntryProgress(pos = (370, 1), size = (100, 24), percent = -3), # index 3 should be progress
536 MultiContentEntryText(pos = (480, 1), size = (100, 24), font=1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 is the percentage
538 "fonts": [gFont("Regular", 22),gFont("Regular", 18)],
543 <ePixmap position="100,500" size="100,40" zPosition="0" pixmap="~/plugin.png" alphatest="on" transparent="1" />
544 <ePixmap position="220,500" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
545 <widget name="key_red" position="220,500" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
548 def __init__(self, session, plugin_path, tasklist):
549 Screen.__init__(self, session)
550 self.skin_path = plugin_path
551 self.session = session
552 self.tasklist = tasklist
553 self["tasklist"] = List(self.tasklist)
555 self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "MediaPlayerActions"],
558 "back": self.keyCancel,
559 "red": self.keyCancel,
562 self["key_red"] = Button(_("Close"))
563 self["title"] = Label()
565 self.onLayoutFinish.append(self.layoutFinished)
566 self.onShown.append(self.setWindowTitle)
567 self.onClose.append(self.__onClose)
568 self.Timer = eTimer()
569 self.Timer.callback.append(self.TimerFire)
574 def layoutFinished(self):
575 self["title"].setText(_("MyTubePlayer active video downloads"))
576 self.Timer.startLongTimer(2)
580 self.rebuildTaskList()
582 def rebuildTaskList(self):
584 for job in job_manager.getPendingJobs():
585 self.tasklist.append((job,job.name,job.getStatustext(),int(100*job.progress/float(job.end)) ,str(100*job.progress/float(job.end)) + "%" ))
586 self['tasklist'].setList(self.tasklist)
587 self['tasklist'].updateList(self.tasklist)
588 self.Timer.startLongTimer(2)
590 def setWindowTitle(self):
591 self.setTitle(_("MyTubePlayer active video downloads"))
594 current = self["tasklist"].getCurrent()
598 from Screens.TaskView import JobView
599 self.session.openWithCallback(self.JobViewCB, JobView, job)
601 def JobViewCB(self, why):
611 class MyTubeHistoryScreen(Screen):
613 <screen name="MyTubeHistoryScreen" position="60,93" zPosition="6" size="610,160" flags="wfNoBorder" >
614 <ePixmap position="0,0" zPosition="-1" size="610,160" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/MyTube/suggestions_bg.png" alphatest="on" transparent="1" backgroundColor="transparent"/>
615 <widget source="historylist" render="Listbox" position="10,5" zPosition="7" size="580,150" scrollbarMode="showOnDemand" transparent="1" >
616 <convert type="TemplatedMultiContent">
618 MultiContentEntryText(pos = (0, 1), size = (340, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
620 "fonts": [gFont("Regular", 22),gFont("Regular", 18)],
627 def __init__(self, session):
628 Screen.__init__(self, session)
629 self.session = session
630 self.historylist = []
631 print "self.historylist",self.historylist
632 self["historylist"] = List(self.historylist)
633 self.activeState = False
637 self.activeState = True
638 self.history = config.plugins.mytube.general.history.value.split(',')
639 if self.history[0] == '':
641 print "self.history",self.history
642 self.historylist = []
643 for entry in self.history:
644 self.historylist.append(( str(entry),))
645 self["historylist"].setList(self.historylist)
646 self["historylist"].updateList(self.historylist)
648 def deactivate(self):
650 self.activeState = False
653 print self.activeState
654 return self.activeState
656 def getSelection(self):
657 if self["historylist"].getCurrent() is None:
659 print self["historylist"].getCurrent()[0]
660 return self["historylist"].getCurrent()[0]
664 self["historylist"].selectPrevious()
665 return self.getSelection()
669 self["historylist"].selectNext()
670 return self.getSelection()
674 self["historylist"].selectPrevious()
675 return self.getSelection()
679 self["historylist"].selectNext()
680 return self.getSelection()