From: Andreas Monzner Date: Wed, 22 Nov 2006 13:06:20 +0000 (+0000) Subject: some picplayer fixes X-Git-Tag: 2.6.0~2691 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/e5784ad0bf002b26befbbffbf5ebea5a01ceb2c7 some picplayer fixes --- diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 0c8a8814..7621ccb0 100644 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -25,6 +25,7 @@ EXTENSIONS = { "jpg": "picture", "jpeg": "picture", "png": "picture", + "bmp": "picture", "ts": "movie", "avi": "movie", "mpg": "movie", @@ -86,7 +87,10 @@ class FileList(MenuList, HTMLComponent, GUIComponent): if directory is None: # present available mountpoints print "listing partitions:" for p in harddiskmanager.getMountedPartitions(): - self.list.append(FileEntryComponent(name = p.description, absolute = p.mountpoint, isDir = True)) + if p.mountpoint == "/": + self.list.append(FileEntryComponent(name = p.description, absolute = p.mountpoint, isDir = True)) + else: + self.list.append(FileEntryComponent(name = p.description, absolute = p.mountpoint + "/", isDir = True)) files = [ ] directories = [ ] elif self.useServiceRef: diff --git a/lib/python/Plugins/Extensions/PicturePlayer/data/pic_frame.png b/lib/python/Plugins/Extensions/PicturePlayer/data/pic_frame.png index eb9ae771..11a97521 100644 Binary files a/lib/python/Plugins/Extensions/PicturePlayer/data/pic_frame.png and b/lib/python/Plugins/Extensions/PicturePlayer/data/pic_frame.png differ diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index c4d36d6b..91644a21 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -93,6 +93,9 @@ class ThumbView(Screen): count += 1 self.maxentry = len(self.list)-1 + if self.maxentry < 0: + self["label0"].setText(_("no Picture found")) + self.ThumbTimer = eTimer() self.ThumbTimer.timeout.get().append(self.showThumb) @@ -123,6 +126,9 @@ class ThumbView(Screen): self.fillPage() def fillPage(self): + if self.maxentry < 0: + return + self["frame"].moveTo(self.poslist[self.list[self.index][3]][0], self.poslist[self.list[self.index][3]][1], 1) self["frame"].startMoving() @@ -165,9 +171,15 @@ class ThumbView(Screen): self.thumbindex = 0 def StartExif(self): + if self.maxentry < 0: + return + self.session.open(ExifView, self.list[self.index][1], self.list[self.index][0]) def KeyOk(self): + if self.maxentry < 0: + return + self.old_index = self.index self.session.openWithCallback(self.returnView ,PicView, self.filelist, self.list[self.index][0], self.path) @@ -215,6 +227,7 @@ class PicView(Screen): self.slideOn = False self.pauseOn = False self.index = 0 + self.old = 0 self.list = [] count=0 @@ -437,11 +450,11 @@ class picmain(Screen): }, -1) self.aspect = getAspect() - self.currDir = config.pic.lastDir.value - if not os.path.exists(self.currDir): - self.currDir = "/" + currDir = config.pic.lastDir.value + if not os.path.exists(currDir): + currDir = "/" - self.filelist = FileList(self.currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|png|bmp)") + self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|png|bmp)") self["filelist"] = self.filelist self["thumbnail"] = Pixmap() @@ -467,14 +480,15 @@ class picmain(Screen): def showThumb(self): if not self.filelist.canDescent(): + print self.filelist.getCurrentDirectory() cachefile = "" if config.pic.cache.value: - cachedir = self.currDir + ".Thumbnails/" + cachedir = self.filelist.getCurrentDirectory() + ".Thumbnails/" if not os.path.exists(cachedir): os.mkdir(cachedir) cachefile = cachedir + self.filelist.getSelection()[0] + str(180) + str(160) + str(self.aspect) - ptr = loadPic(self.currDir + self.filelist.getSelection()[0], 180, 160, self.aspect, int(config.pic.resize.value), 0, 0, cachefile) + ptr = loadPic(self.filelist.getCurrentDirectory() + self.filelist.getSelection()[0], 180, 160, self.aspect, int(config.pic.resize.value), 0, 0, cachefile) if ptr != None: self["thumbnail"].show() self["thumbnail"].instance.setPixmap(ptr.__deref__()) @@ -483,26 +497,32 @@ class picmain(Screen): def KeyOk(self): if self.filelist.canDescent(): - self.currDir = self.filelist.getSelection()[0] self.filelist.descent() else: - self.session.openWithCallback(self.returnVal, PicView, self.filelist.getFileList(), self.filelist.getSelection()[0], self.currDir) + self.session.openWithCallback(self.returnVal, PicView, self.filelist.getFileList(), self.filelist.getSelection()[0], self.filelist.getCurrentDirectory()) def StartThumb(self): - self.session.openWithCallback(self.returnVal, ThumbView, self.filelist.getFileList(), self.filelist.getSelection()[0], self.currDir) + self.session.openWithCallback(self.returnVal, ThumbView, self.filelist.getFileList(), self.filelist.getSelection()[0], self.filelist.getCurrentDirectory()) def returnVal(self, val=0): - print val + if val > 0: + for x in self.filelist.getFileList(): + if x[0][1] == True: + val += 1 + self.filelist.moveToIndex(val) def StartExif(self): if not self.filelist.canDescent(): - self.session.open(ExifView, self.currDir + self.filelist.getSelection()[0], self.filelist.getSelection()[0]) + self.session.open(ExifView, self.filelist.getCurrentDirectory() + self.filelist.getFilename(), self.filelist.getSelection()[0]) def Settings(self): self.session.open(PicSetup) def Exit(self): - config.pic.lastDir.value = self.currDir + if self.filelist.getCurrentDirectory() is None: + config.pic.lastDir.value = "/" + else: + config.pic.lastDir.value = self.filelist.getCurrentDirectory() config.pic.save() self.close()