some python import cleanups
[vuplus_dvbapp] / lib / python / Plugins / Extensions / CutListEditor / plugin.py
index 7e591d2..ba946f9 100644 (file)
@@ -5,11 +5,11 @@ from Screens.MessageBox import MessageBox
 from Components.ServicePosition import ServicePositionGauge
 from Components.ActionMap import HelpableActionMap
 from Components.MenuList import MenuList
-from Components.MultiContent import MultiContentEntryText, RT_HALIGN_RIGHT
+from Components.MultiContent import MultiContentEntryText
 from Components.ServiceEventTracker import ServiceEventTracker
 from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport
 from Components.GUIComponent import GUIComponent
-from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService
+from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService, RT_HALIGN_RIGHT
 from Screens.FixedMenu import FixedMenu
 import bisect
 
@@ -26,6 +26,8 @@ def CutListEntry(where, what):
                type = "OUT"
        elif what == 2:
                type = "MARK"
+       elif what == 3:
+               type = "LAST"
        res.append(MultiContentEntryText(size=(400, 20), text = "%dh:%02dm:%02ds:%03d" % (h, m, s, ms)))
        res.append(MultiContentEntryText(pos=(400,0), size=(130, 20), text = type, flags = RT_HALIGN_RIGHT))
 
@@ -111,21 +113,17 @@ class CutList(GUIComponent):
        def getCurrentIndex(self):
                return self.l.getCurrentSelectionIndex()
        
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(30)
-               self.instance.selectionChanged.get().append(self.selectionChanged)
+       GUI_WIDGET = eListbox
+       
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(30)
+               instance.selectionChanged.get().append(self.selectionChanged)
 
        def selectionChanged(self):
                for x in self.onSelectionChanged:
                        x()
        
-       def GUIdelete(self):
-               self.instance.selectionChanged.get().remove(self.selectionChanged)
-               self.instance.setContent(None)
-               self.instance = None
-       
        def invalidateEntry(self, index):
                self.l.invalidateEntry(index)
        
@@ -145,7 +143,7 @@ class CutListEditor(Screen, InfoBarSeek, InfoBarCueSheetSupport):
        skin = """
                <screen position="100,100" size="550,400" title="Test" >
                        <widget name="Timeline" position="10,0" size="530,40" 
-                               pointer="/usr/share/enigma2/position_pointer.png:3,5" />
+                               pointer="/usr/share/enigma2/position_pointer.png:3,5" foregroundColor="#225b7395" />
                        <widget name="Cutlist" position="10,50" size="530,300" scrollbarMode="showOnDemand" />
                </screen>"""
        def __init__(self, session, service):
@@ -178,7 +176,7 @@ class CutListEditor(Screen, InfoBarSeek, InfoBarCueSheetSupport):
                                "removeMark": (self.__removeMark, _("Remove a mark")),
                                "leave": (self.exit, _("Exit editor")),
                                "showMenu": self.showMenu,
-                       })
+                       }, prio=-4)
                
                self.tutorial_seen = False
                
@@ -207,8 +205,9 @@ Then seek to the end, press OK, select 'end cut'. That's it.
                pass
        
        def setType(self, index, type):
-               self.cut_list[index] = (self.cut_list[index][0], type)
-               self["Cutlist"].setIndex(index, CutListEntry(*self.cut_list[index]))
+               if len(self.cut_list):
+                       self.cut_list[index] = (self.cut_list[index][0], type)
+                       self["Cutlist"].setIndex(index, CutListEntry(*self.cut_list[index]))
        
        def setIn(self):
                m = self["Cutlist"].getCurrentIndex()