X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/5eb41508927a7f48d09d52e158e136fa07252dac..a9e7c6c8a0aa95dfcea880b6caf1d4d0dbbcc023:/lib/python/Plugins/Extensions/PicturePlayer/plugin.py
diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py
old mode 100644
new mode 100755
index 7d62d2be..3925b07c
--- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py
@@ -1,21 +1,20 @@
from enigma import ePicLoad, eTimer, getDesktop
from Screens.Screen import Screen
-from Tools.Directories import resolveFilename, pathExists, SCOPE_MEDIA
+from Tools.Directories import resolveFilename, pathExists, fileExists, SCOPE_MEDIA
from Plugins.Plugin import PluginDescriptor
from Components.Pixmap import Pixmap, MovingPixmap
from Components.ActionMap import ActionMap, NumberActionMap
-from Components.Label import Label
-from Components.Button import Button
+from Components.Sources.StaticText import StaticText
from Components.FileList import FileList
from Components.AVSwitch import AVSwitch
from Components.Sources.List import List
-from Components.ConfigList import ConfigList
+from Components.ConfigList import ConfigList, ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, ConfigText, ConfigEnableDisable, KEY_LEFT, KEY_RIGHT, KEY_0, getConfigListEntry
-def getAspectforPic():
+def getScale():
return AVSwitch().getFramebufferScale()
config.pic = ConfigSubsection()
@@ -30,37 +29,39 @@ config.pic.bgcolor = ConfigSelection(default="#00000000", choices = [("#00000000
config.pic.textcolor = ConfigSelection(default="#0038FF48", choices = [("#00000000", _("black")),("#009eb9ff", _("blue")),("#00ff5a51", _("red")), ("#00ffe875", _("yellow")), ("#0038FF48", _("green"))])
class picshow(Screen):
- def __init__(self, session):
- self.skin = """
-
-
-
-
-
-
-
-
-
+ skin = """
+
+
+
+
+
+
+
+
+
+
- """
+ """
+ def __init__(self, session):
Screen.__init__(self, session)
self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
{
"cancel": self.KeyExit,
- "red": self.KeyRed,
+ "red": self.KeyExit,
+ "green": self.KeyGreen,
"yellow": self.KeyYellow,
"blue": self.KeyBlue,
"ok": self.KeyOk
}, -1)
- self["key_red"] = Button(_("Thumbnails"))
- self["key_green"] = Button()
- self["key_yellow"] = Button(_("Exif"))
- self["key_blue"] = Button(_("Setup"))
- self["label"] = Label()
+ self["key_red"] = StaticText(_("Close"))
+ self["key_green"] = StaticText(_("Thumbnails"))
+ self["key_yellow"] = StaticText("")
+ self["key_blue"] = StaticText(_("Setup"))
+ self["label"] = StaticText("")
self["thn"] = Pixmap()
currDir = config.pic.lastDir.value
@@ -70,13 +71,13 @@ class picshow(Screen):
self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif)")
self["filelist"] = self.filelist
self["filelist"].onSelectionChanged.append(self.selectionChanged)
-
+
self.ThumbTimer = eTimer()
self.ThumbTimer.callback.append(self.showThumb)
self.picload = ePicLoad()
self.picload.PictureData.get().append(self.showPic)
-
+
self.onLayoutFinish.append(self.setConf)
def showPic(self, picInfo=""):
@@ -87,28 +88,30 @@ class picshow(Screen):
text = picInfo.split('\n',1)
self["label"].setText(text[1])
- self["label"].show()
-
+ self["key_yellow"].setText(_("Exif"))
+
def showThumb(self):
if not self.filelist.canDescent():
- if self.picload.getThumbnail(self.filelist.getCurrentDirectory() + self.filelist.getFilename()) == 1:
- self.ThumbTimer.start(500, True)
+ if self.filelist.getCurrentDirectory() and self.filelist.getFilename():
+ if self.picload.getThumbnail(self.filelist.getCurrentDirectory() + self.filelist.getFilename()) == 1:
+ self.ThumbTimer.start(500, True)
def selectionChanged(self):
if not self.filelist.canDescent():
self.ThumbTimer.start(500, True)
else:
- self["label"].hide()
+ self["label"].setText("")
self["thn"].hide()
-
- def KeyRed(self):
+ self["key_yellow"].setText("")
+
+ def KeyGreen(self):
#if not self.filelist.canDescent():
self.session.openWithCallback(self.callbackView, Pic_Thumb, self.filelist.getFileList(), self.filelist.getSelectionIndex(), self.filelist.getCurrentDirectory())
-
+
def KeyYellow(self):
if not self.filelist.canDescent():
self.session.open(Pic_Exif, self.picload.getInfo(self.filelist.getCurrentDirectory() + self.filelist.getFilename()))
-
+
def KeyBlue(self):
self.session.openWithCallback(self.setConf ,Pic_Setup)
@@ -119,9 +122,11 @@ class picshow(Screen):
self.session.openWithCallback(self.callbackView, Pic_Full_View, self.filelist.getFileList(), self.filelist.getSelectionIndex(), self.filelist.getCurrentDirectory())
def setConf(self):
+ self.setTitle(_("PicturePlayer"))
+ sc = getScale()
#0=Width 1=Height 2=Aspect 3=use_cache 4=resize_type 5=Background(#AARRGGBB)
- self.picload.setPara([self["thn"].instance.size().width(), self["thn"].instance.size().height(), getAspectforPic(), config.pic.cache.value, int(config.pic.resize.value), "#00000000"])
-
+ self.picload.setPara((self["thn"].instance.size().width(), self["thn"].instance.size().height(), sc[0], sc[1], config.pic.cache.value, int(config.pic.resize.value), "#00000000"))
+
def callbackView(self, val=0):
if val > 0:
self.filelist.moveToIndex(val)
@@ -137,71 +142,84 @@ class picshow(Screen):
config.pic.save()
self.close()
-#------------------------------------------------------------------------------------------
-class Pic_Setup(Screen):
+class Pic_Setup(Screen, ConfigListScreen):
+ skin = """
+
+
+
+
+
+
+ """
def __init__(self, session):
- self.skin = """
-
- """
Screen.__init__(self, session)
+ self.session = session
+
+ self["actions"] = ActionMap(["SetupActions", "ColorActions"],
+ {
+ "cancel": self.keyCancel,
+ "save": self.keySave,
+ }, -2)
+
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("OK"))
+
+ self.list = []
+ ConfigListScreen.__init__(self, self.list, session = self.session)
+ self.createSetup()
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ self.setTitle(_("Settings"))
+
+ def createSetup(self):
+ self.list = []
+ self.list.append(getConfigListEntry(_("Slideshow Interval (sec.)"), config.pic.slidetime))
+ self.list.append(getConfigListEntry(_("Scaling Mode"), config.pic.resize))
+ self.list.append(getConfigListEntry(_("Cache Thumbnails"), config.pic.cache))
+ self.list.append(getConfigListEntry(_("show Infoline"), config.pic.infoline))
+ self.list.append(getConfigListEntry(_("Frame size in full view"), config.pic.framesize))
+ self.list.append(getConfigListEntry(_("slide picture in loop"), config.pic.loop))
+ self.list.append(getConfigListEntry(_("backgroundcolor"), config.pic.bgcolor))
+ self.list.append(getConfigListEntry(_("textcolor"), config.pic.textcolor))
+ self["config"].list = self.list
+ self["config"].l.setList(self.list)
- self["actions"] = NumberActionMap(["SetupActions"],
- {
- "cancel": self.close,
- "left": self.keyLeft,
- "right": self.keyRight,
- "0": self.keyNumber,
- "1": self.keyNumber,
- "2": self.keyNumber,
- "3": self.keyNumber,
- "4": self.keyNumber,
- "5": self.keyNumber,
- "6": self.keyNumber,
- "7": self.keyNumber,
- "8": self.keyNumber,
- "9": self.keyNumber
- }, -1)
-
- list = []
- self["liste"] = ConfigList(list)
- list.append(getConfigListEntry(_("Slideshow Interval (sec.)"), config.pic.slidetime))
- list.append(getConfigListEntry(_("Scaling Mode"), config.pic.resize))
- list.append(getConfigListEntry(_("Cache Thumbnails"), config.pic.cache))
- list.append(getConfigListEntry(_("show Infoline"), config.pic.infoline))
- list.append(getConfigListEntry(_("Frame size in full view"), config.pic.framesize))
- list.append(getConfigListEntry(_("slide picture in loop"), config.pic.loop))
- list.append(getConfigListEntry(_("backgroundcolor"), config.pic.bgcolor))
- list.append(getConfigListEntry(_("textcolor"), config.pic.textcolor))
-
def keyLeft(self):
- self["liste"].handleKey(KEY_LEFT)
+ ConfigListScreen.keyLeft(self)
def keyRight(self):
- self["liste"].handleKey(KEY_RIGHT)
-
- def keyNumber(self, number):
- self["liste"].handleKey(KEY_0 + number)
+ ConfigListScreen.keyRight(self)
-#---------------------------------------------------------------------------
class Pic_Exif(Screen):
- def __init__(self, session, exiflist):
- self.skin = """
-
+ skin = """
+
+
+
+
- {"template": [ MultiContentEntryText(pos = (5, 5), size = (250, 30), flags = RT_HALIGN_LEFT, text = 0), MultiContentEntryText(pos = (260, 5), size = (290, 30), flags = RT_HALIGN_LEFT, text = 1)], "fonts": [gFont("Regular", 20)], "itemHeight": 30 }
+ {
+ "template": [ MultiContentEntryText(pos = (5, 5), size = (250, 30), flags = RT_HALIGN_LEFT, text = 0), MultiContentEntryText(pos = (260, 5), size = (290, 30), flags = RT_HALIGN_LEFT, text = 1)],
+ "fonts": [gFont("Regular", 20)],
+ "itemHeight": 30
+ }
-
- """
+
+ """
+
+ def __init__(self, session, exiflist):
Screen.__init__(self, session)
self["actions"] = ActionMap(["OkCancelActions"],
{
"cancel": self.close
}, -1)
-
- exifdesc = [_("Filename:"), "EXIF-Version:", "Make:", "Camera:", "Date/Time:", "Width / Height:", "Flash used:", "Orientation:", "User Comments:", "Metering Mode:", "Exposure Program:", "Light Source:", "CompressedBitsPerPixel:", "ISO Speed Rating:", "X-Resolution:", "Y-Resolution:", "Resolution Unit:", "Brightness:", "Exposure Time:", "Exposure Bias:", "Distance:", "CCD-Width:", "ApertureFNumber:"]
+
+ self["key_red"] = StaticText(_("Close"))
+
+ exifdesc = [_("filename")+':', "EXIF-Version:", "Make:", "Camera:", "Date/Time:", "Width / Height:", "Flash used:", "Orientation:", "User Comments:", "Metering Mode:", "Exposure Program:", "Light Source:", "CompressedBitsPerPixel:", "ISO Speed Rating:", "X-Resolution:", "Y-Resolution:", "Resolution Unit:", "Brightness:", "Exposure Time:", "Exposure Bias:", "Distance:", "CCD-Width:", "ApertureFNumber:"]
list = []
for x in range(len(exiflist)):
@@ -211,8 +229,11 @@ class Pic_Exif(Screen):
name = exiflist[x].split('/')[-1]
list.append((exifdesc[x], name))
self["menu"] = List(list)
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ self.setTitle(_("Info"))
-#----------------------------------------------------------------------------------------
T_INDEX = 0
T_FRAME_POS = 1
@@ -250,7 +271,7 @@ class Pic_Thumb(Screen):
absX = self.spaceX + (posX*(self.spaceX + self.picX))
absY = self.spaceY + (posY*(self.spaceY + self.picY))
self.positionlist.append((absX, absY))
- skincontent += ""
+ skincontent += ""
skincontent += ""
@@ -274,7 +295,7 @@ class Pic_Thumb(Screen):
self["frame"] = MovingPixmap()
for x in range(self.thumbsC):
- self["label"+str(x)] = Label()
+ self["label"+str(x)] = StaticText()
self["thumb"+str(x)] = Pixmap()
self.Thumbnaillist = []
@@ -311,10 +332,10 @@ class Pic_Thumb(Screen):
self.ThumbTimer.callback.append(self.showPic)
def setPicloadConf(self):
- self.picload.setPara([self["thumb0"].instance.size().width(), self["thumb0"].instance.size().height(), getAspectforPic(), config.pic.cache.value, int(config.pic.resize.value), self.color])
+ sc = getScale()
+ self.picload.setPara([self["thumb0"].instance.size().width(), self["thumb0"].instance.size().height(), sc[0], sc[1], config.pic.cache.value, int(config.pic.resize.value), self.color])
self.paintFrame()
-
-
+
def paintFrame(self):
#print "index=" + str(self.index)
if self.maxentry < self.index or self.index < 0:
@@ -416,7 +437,7 @@ class Pic_Full_View(Screen):
\
\
\
- "
+ "
Screen.__init__(self, session)
@@ -435,7 +456,7 @@ class Pic_Full_View(Screen):
self["point"] = Pixmap()
self["pic"] = Pixmap()
self["play_icon"] = Pixmap()
- self["file"] = Label(_("please wait, loading picture..."))
+ self["file"] = StaticText(_("please wait, loading picture..."))
self.old_index = 0
self.filelist = []
@@ -450,6 +471,11 @@ class Pic_Full_View(Screen):
self.filelist.append(path + x[0][0])
else:
self.dirlistcount += 1
+ elif len(filelist[0]) == 2: #scanlist
+ if x[0][1] == False:
+ self.filelist.append(x[0][0])
+ else:
+ self.dirlistcount += 1
else: # thumbnaillist
self.filelist.append(x[T_FULL])
@@ -468,11 +494,12 @@ class Pic_Full_View(Screen):
self.onLayoutFinish.append(self.setPicloadConf)
def setPicloadConf(self):
- self.picload.setPara([self["pic"].instance.size().width(), self["pic"].instance.size().height(), getAspectforPic(), 0, int(config.pic.resize.value), self.bgcolor])
+ sc = getScale()
+ self.picload.setPara([self["pic"].instance.size().width(), self["pic"].instance.size().height(), sc[0], sc[1], 0, int(config.pic.resize.value), self.bgcolor])
self["play_icon"].hide()
if config.pic.infoline.value == False:
- self["file"].hide()
+ self["file"].setText("")
self.start_decode()
def ShowPicture(self):
@@ -578,7 +605,7 @@ def filescan(**kwargs):
ScanPath(path = "", with_subdirs = False),
],
name = "Pictures",
- description = "View Photos...",
+ description = _("View Photos..."),
openfnc = filescan_open,
)