remove no more exist isTop argument
[enigma2.git] / lib / python / Plugins / Extensions / PicturePlayer / plugin.py
index 23c250efcdb931788ae180668b8ff9cc123c1b28..a426866e93ff3feba50ae55fffeb21e1926f4dc8 100644 (file)
@@ -8,8 +8,8 @@ from Components.Label import Label
 from Components.ConfigList import ConfigList
 from Components.config import *
 
-from Tools.Directories import resolveFilename, pathExists, createDir, SCOPE_MEDIA
-from Components.FileList import FileEntryComponent, FileList
+from Tools.Directories import resolveFilename, fileExists, pathExists, createDir, SCOPE_MEDIA
+from Components.FileList import FileList
 from Components.AVSwitch import AVSwitch
 
 from Plugins.Plugin import PluginDescriptor
@@ -94,7 +94,7 @@ class ThumbView(Screen):
                        self["label0"].setText(_("no Picture found"))
                
                self.ThumbTimer = eTimer()
-               self.ThumbTimer.timeout.get().append(self.showThumb)
+               self.ThumbTimer.callback.append(self.showThumb)
 
                self.fillPage()
                
@@ -196,13 +196,13 @@ class PicView(Screen):
                <screen position="0,0" size="720,576" flags="wfNoBorder" title="PicturePlayer" >
                        <eLabel position="0,0" zPosition="0" size="720,576" backgroundColor="black" />
                        <widget name="picture" position="80,50" size="560,450" zPosition="1" transparent="1" />
-                       <widget name="point" position="80,515" size="15,15" zPosition="1" pixmap="BlinkingPoint-fs8.png" alphatest="on" />
+                       <widget name="point" position="80,515" size="14,14" zPosition="1" pixmap="skin_default/icons/record.png" alphatest="on" />
                        <widget name="file" position="150,510" size="350,30" font="Regular;20" halign="center" zPosition="1" transparent="1" />
-                       <ePixmap position="500,515" size="36,20" pixmap="key_info-fs8.png" zPosition="1" alphatest="on" />
-                       <ePixmap position="550,515" size="20,20" pixmap="ico_mp_rewind.png"  zPosition="1" alphatest="on" />
-                       <widget name="play" position="575,515" size="20,20" pixmap="ico_mp_play.png"  zPosition="1" alphatest="on" />
-                       <widget name="pause" position="600,515" size="20,20" pixmap="ico_mp_pause.png"  zPosition="1" alphatest="on" />
-                       <ePixmap position="625,515" size="20,20" pixmap="ico_mp_forward.png"  zPosition="1" alphatest="on" />
+                       <ePixmap position="500,515" size="36,20" pixmap="skin_default/buttons/key_info.png" zPosition="1" alphatest="on" />
+                       <ePixmap position="550,515" size="20,20" pixmap="skin_default/icons/ico_mp_rewind.png"  zPosition="1" alphatest="on" />
+                       <widget name="play" position="575,515" size="20,20" pixmap="skin_default/icons/ico_mp_play.png"  zPosition="1" alphatest="on" />
+                       <widget name="pause" position="600,515" size="20,20" pixmap="skin_default/icons/ico_mp_pause.png"  zPosition="1" alphatest="on" />
+                       <ePixmap position="625,515" size="20,20" pixmap="skin_default/icons/ico_mp_forward.png"  zPosition="1" alphatest="on" />
                </screen>"""
        
        def __init__(self, session, filelist, name, path):
@@ -244,11 +244,11 @@ class PicView(Screen):
                self["pause"] = Pixmap()
                
                self.decodeTimer = eTimer()
-               self.decodeTimer.timeout.get().append(self.decodePic)
+               self.decodeTimer.callback.append(self.decodePic)
                self.decodeTimer.start(300, True)
 
                self.slideTimer = eTimer()
-               self.slideTimer.timeout.get().append(self.slidePic)
+               self.slideTimer.callback.append(self.slidePic)
                
                
        def Pause(self):
@@ -420,9 +420,9 @@ class PicSetup(Screen):
 class picmain(Screen):
        skin = """
                <screen position="160,90" size="400,390" title="PicturePlayer" >
-                       <ePixmap position="10,40" size="36,20" pixmap="key_menu-fs8.png" transparent="1" alphatest="on" />
-                       <ePixmap position="10,70" size="36,20" pixmap="key_info-fs8.png" transparent="1" alphatest="on" />
-                       <ePixmap position="12,100" size="36,20" pixmap="key_red-fs8.png" transparent="1" alphatest="on" />
+                       <ePixmap position="10,40" size="36,20" pixmap="skin_default/buttons/key_menu.png" transparent="1" alphatest="on" />
+                       <ePixmap position="10,70" size="36,20" pixmap="skin_default/buttons/key_info.png" transparent="1" alphatest="on" />
+                       <ePixmap position="12,100" size="36,20" pixmap="skin_default/buttons/key_red.png" transparent="1" alphatest="on" />
                        <eLabel text="Settings" position="60,40" size="120,25" font="Regular;20" transparent="1" />
                        <eLabel text="Exif-Data" position="60,70" size="120,25" font="Regular;20" transparent="1" />
                        <eLabel text="Thumbnails" position="60,100" size="120,25" font="Regular;20" transparent="1" />
@@ -452,12 +452,12 @@ class picmain(Screen):
                if not pathExists(currDir):
                        currDir = "/"
 
-               self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|png|bmp)")
+               self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)")
                self["filelist"] = self.filelist
                self["thumbnail"] = Pixmap()
                
                self.ThumbTimer = eTimer()
-               self.ThumbTimer.timeout.get().append(self.showThumb)
+               self.ThumbTimer.callback.append(self.showThumb)
                self.ThumbTimer.start(500, True)
                
        def up(self):
@@ -531,14 +531,20 @@ def main(session, **kwargs):
        session.open(picmain)
 
 def filescan_open(list, session, **kwargs):
-       session.open(picmain) # list
+       # Recreate List as expected by PicView
+       filelist = [((file.path, False), None) for file in list]
+       session.open(PicView, filelist, "", "")
+
+def filescan(**kwargs):
+       from Components.Scanner import Scanner, ScanPath
+
+       # Overwrite checkFile to only detect local
+       class LocalScanner(Scanner):
+               def checkFile(self, file):
+                       return fileExists(file.path)
 
-def filescan():
-       # we expect not to be called if the MediaScanner plugin is not available,
-       # thus we don't catch an ImportError exception here
-       from Plugins.Extensions.MediaScanner.plugin import Scanner, ScanPath
        return \
-               Scanner(extensions = ["jpg", "jpe", "jpeg"], 
+               LocalScanner(mimetypes = ["image/jpeg", "image/png", "image/gif", "image/bmp"],
                        paths_to_scan = 
                                [
                                        ScanPath(path = "DCIM", with_subdirs = True),