1 from Screen import Screen
2 from Components.Button import Button
3 from Components.ServiceList import ServiceList
4 from Components.ActionMap import ActionMap
5 from Components.MovieList import MovieList
6 from Components.DiskInfo import DiskInfo
7 from Components.Label import Label
9 from Screens.MessageBox import MessageBox
10 from Screens.FixedMenu import FixedMenu
12 from Tools.Directories import *
14 from enigma import eServiceReference, eServiceCenter, eTimer
16 class ChannelContextMenu(FixedMenu):
17 def __init__(self, session, csel, service):
19 self.service = service
21 menu = [(_("back"), self.close), (_("delete..."), self.delete)]
23 FixedMenu.__init__(self, session, _("Movie Menu"), menu)
24 self.skinName = "Menu"
27 serviceHandler = eServiceCenter.getInstance()
28 offline = serviceHandler.offlineOperations(self.service)
30 if offline is not None:
32 if not offline.deleteFromDisk(1):
36 self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete this recording?"))
38 self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
40 def deleteConfirmed(self, confirmed):
44 serviceHandler = eServiceCenter.getInstance()
45 offline = serviceHandler.offlineOperations(self.service)
47 if offline is not None:
49 if not offline.deleteFromDisk(0):
53 self.session.openWithCallback(self.close, MessageBox, _("Delete failed!"), MessageBox.TYPE_ERROR)
55 list = self.csel["list"]
56 currentIndex = list.getCurrentIndex()
58 if list.getCurrentIndex() == currentIndex:
61 list.moveToIndex(currentIndex)
64 class MovieSelection(Screen):
65 def __init__(self, session, selectedmovie = None):
66 Screen.__init__(self, session)
69 self.bouquet_mark_edit = False
71 self.delayTimer = eTimer()
72 self.delayTimer.timeout.get().append(self.updateHDDData)
74 self["waitingtext"] = Label(_("Please wait... Loading list..."))
76 self["list"] = MovieList(None)
77 self.selectedmovie = selectedmovie
79 #self["okbutton"] = Button("ok", [self.channelSelected])
80 self["freeDiskSpace"] = DiskInfo(resolveFilename(SCOPE_HDD), DiskInfo.FREE, update=False)
82 self["actions"] = ActionMap(["OkCancelActions", "ContextMenuActions"],
85 "ok": self.movieSelected,
86 "contextMenu": self.doContext,
88 self["actions"].csel = self
89 self.onShown.append(self.go)
92 self.delayTimer.start(0, 1)
94 def updateHDDData(self):
95 self["list"].reload(eServiceReference("2:0:1:0:0:0:0:0:0:0:" + resolveFilename(SCOPE_HDD)))
96 if (self.selectedmovie is not None):
98 self["waitingtext"].instance.hide()
100 self["freeDiskSpace"].update()
103 self["list"].moveTo(self.selectedmovie)
105 def getCurrent(self):
106 return self["list"].getCurrent()[0]
108 def movieSelected(self):
109 self.close(self.getCurrent())
112 self.session.open(ChannelContextMenu, self, self.getCurrent())