Skip to content
4 changes: 3 additions & 1 deletion lcd4linux/src/myFileList.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ def canDescent(self):

def descent(self):
if self.getSelection() != "":
se = (self.current_directory if self.current_directory.endswith("/") else os_path.basename(self.current_directory)) if self.current_directory is not None else ""
se = ""
if self.current_directory is not None:
se = self.current_directory if self.current_directory.endswith("/") else os_path.basename(self.current_directory)
self.changeDir(self.getSelection()[0], select=se)

def getFilename(self):
Expand Down
75 changes: 36 additions & 39 deletions lcd4linux/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
if find_library("usb-0.1") is not None or find_library("usb-1.0") is not None:
print("[LCD4linux] libusb found :-)", getEnigmaVersionString())
USBok = True
Version = "V5.0-r29"
Version = "V5.0-r32"
L4LElist = L4Lelement()
L4LdoThread = True
LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/
Expand Down Expand Up @@ -3247,7 +3247,7 @@ def writeLCD1(s, im, quality, SAVE=True):
doDPF(1, im, s)
if "1" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate1.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
try:
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
Expand All @@ -3269,7 +3269,7 @@ def writeLCD1(s, im, quality, SAVE=True):
s.im[im].save("/tmp/usbtft-bmp", "BMP")
if "1" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate1.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
rename(bild, "%s.png" % PIC)
Expand All @@ -3280,7 +3280,7 @@ def writeLCD1(s, im, quality, SAVE=True):
try:
if "1" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate1.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
rename(bild, "%s.png" % PIC)
Expand Down Expand Up @@ -3331,7 +3331,7 @@ def writeLCD1(s, im, quality, SAVE=True):
try:
datei = "%s.jpg" % PICtmp
if str(LCD4linux.LCDRotate1.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True)
s.im[im].save(datei, "JPEG")
elif pic is not None:
open(datei, "wb").write(pic)
Expand Down Expand Up @@ -3367,7 +3367,7 @@ def writeLCD2(s, im, quality, SAVE=True):
doDPF(2, im, s)
if "2" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate2.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
try:
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
Expand All @@ -3389,7 +3389,7 @@ def writeLCD2(s, im, quality, SAVE=True):
s.im[im].save("/tmp/usbtft-bmp", "BMP")
if "2" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate2.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
rename(bild, "%s.png" % PIC2)
Expand All @@ -3400,7 +3400,7 @@ def writeLCD2(s, im, quality, SAVE=True):
try:
if "2" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate2.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
rename(bild, "%s.png" % PIC2)
Expand Down Expand Up @@ -3451,7 +3451,7 @@ def writeLCD2(s, im, quality, SAVE=True):
try:
datei = "%s.jpg" % PIC2tmp
if str(LCD4linux.LCDRotate2.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True)
s.im[im].save(datei, "JPEG")
elif pic is not None:
open(datei, "wb").write(pic)
Expand Down Expand Up @@ -3487,7 +3487,7 @@ def writeLCD3(s, im, quality, SAVE=True):
doDPF(3, im, s)
if "3" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate3.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
try:
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
Expand All @@ -3509,7 +3509,7 @@ def writeLCD3(s, im, quality, SAVE=True):
s.im[im].save("/tmp/usbtft-bmp", "BMP")
if "3" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate3.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
rename(bild, "%s.png" % PIC3)
Expand All @@ -3520,7 +3520,7 @@ def writeLCD3(s, im, quality, SAVE=True):
try:
if "3" in LCD4linux.SavePicture.value and SAVE == True:
if str(LCD4linux.LCDRotate3.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
if isfile(bild):
rename(bild, "%s.png" % PIC3)
Expand Down Expand Up @@ -3571,7 +3571,7 @@ def writeLCD3(s, im, quality, SAVE=True):
try:
datei = "%s.jpg" % PIC3tmp
if str(LCD4linux.LCDRotate3.value) != "0":
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True)
s.im[im].save(datei, "JPEG")
elif pic is not None:
open(datei, "wb").write(pic)
Expand Down Expand Up @@ -5264,12 +5264,13 @@ class LCDdisplayMenu(Screen):
skin = """
<screen position="center,center" size="600,380" title="LCD4linux - Config" >
<widget name="menu" position="10,20" size="580,350" scrollbarMode="showOnDemand" />
<eLabel name="button_red" position="10,340" size="6,36" backgroundColor="#00fe0000" zPosition="1" />
<widget source="key_red" render="Label" position="24,346" size="230,26" font="Regular;18" valign="center" halign="left" zPosition="1" />
</screen>"""

def __init__(self, session, args=None):
Screen.__init__(self, session)
self.session = session
self.list = []
self.SetList()
self["menu"] = MenuList(self.list)
self["key_red"] = StaticText(_("Delete"))
Expand All @@ -5286,10 +5287,11 @@ def SetList(self):
self.list.append((_("Load Defaults / Empty Config"), "LoadDefault", ""))
self.list.append((_("Save Config to File... (%s)") % LCD4linux.ConfigPath.value, "SaveToConfig", ""))
Cdir = sorted(glob(join(LCD4linux.ConfigPath.value, "*.lcd")))
xx = 3
self.xx = 3
for ii in Cdir:
self.list.append((_("Load File : %s") % basename(ii), "LoadFile %d" % xx, ii))
xx += 1
self.list.append((_("Load File : %s") % basename(ii), "LoadFile %d" % self.xx, ii))
self.xx += 1
self.LastSavedConfig = 0

def entfernen(self):
current = self["menu"].getCurrent()
Expand All @@ -5310,28 +5312,36 @@ def keyOK(self):
LCD4linux.loadFromFile(LCD4default)
LCD4linux.loadFromFile(LCD4config)
LCD4linux.load()
self.cancel()
elif currentEntry == "SaveToConfig":
self.session.openWithCallback(self.askForConfigName, InputBox, title="Save Filename", text="LCD4linux-%s" % (strftime("%Y%m%d_%H%M")), type=Input.TEXT)
if self.LastSavedConfig == 0:
self.session.openWithCallback(self.askForConfigName, InputBox, title="Save Filename", text="LCD4linux-%s" % (strftime("%Y%m%d_%H%M")), type=Input.TEXT)
elif currentEntry.startswith("LoadFile"):
if isfile(current[2]):
L4LoadNewConfig(current[2])
self.cancel()
elif currentEntry == "LoadDefault" and isfile(LCD4default):
L4log("Config-Load", LCD4default)
LCD4linux.loadFromFile(LCD4default)
LCD4linux.load()
self.cancel()

def askForConfigName(self, name):
if name is not None and isdir(LCD4linux.ConfigPath.value):
LCD4linux.save()
LCD4linux.saveToFile(join(LCD4linux.ConfigPath.value, "%s.lcd" % name))
self.list.append((_("Load File : %s") % ("%s.lcd" % name), "LoadFile", join(LCD4linux.ConfigPath.value, "%s.lcd" % name)))
self.list.append((_("Load File : %s") % ("%s.lcd" % name), "LoadFile %d" % self.xx, join(LCD4linux.ConfigPath.value, "%s.lcd" % name)))
self.LastSavedConfig = self.xx
self.xx += 1

def askForDelete(self, retval):
if (retval):
current = self["menu"].getCurrent()
if current and isfile(current[2]):
currentEntry = current[1]
i = int(currentEntry.split()[1])
if i == self.LastSavedConfig:
self.LastSavedConfig = 0
self.list[i] = (_("deleted"),) + self.list[i][1:]
rmFile(current[2])

Expand Down Expand Up @@ -5545,8 +5555,6 @@ def __init__(self, session, args=0):
self.mode = _("Global")
self.LastSelect = "4"
self.SetList()
if self.selectionChanged not in self["config"].onSelectionChanged:
self["config"].onSelectionChanged.append(self.selectionChanged)
if LCD4linux.LCDType3.value == "00":
self["LCD3"].hide()
if getDesktop(0).size().width() < 1000:
Expand Down Expand Up @@ -7920,7 +7928,7 @@ def keyOK(self):
elif sel in [LCD4linux.MPBildFile, LCD4linux.MPBild2File, LCD4linux.StandbyBildFile, LCD4linux.StandbyBild2File, LCD4linux.StandbyBild3File, LCD4linux.StandbyBild4File, LCD4linux.StandbyBild5File, LCD4linux.StandbyBild6File, LCD4linux.StandbyTextFile, LCD4linux.StandbyText2File, LCD4linux.StandbyText3File]:
L4log("select File 4")
self.session.openWithCallback(self.fileSelected, LCDdisplayFile, text=_("Choose file"), FileName=self["config"].getCurrent()[1].value, showFiles=True)
elif sel in [LCD4linux.Background1Bild, LCD4linux.LCD4linux.MPBackground1Bild, LCD4linux.StandbyBackground1Bild]:
elif sel in [LCD4linux.Background1Bild, LCD4linux.MPBackground1Bild, LCD4linux.StandbyBackground1Bild]:
L4log("select File 5")
self.session.openWithCallback(self.fileSelected, LCDdisplayFile, text=_("Choose file"), FileName=self["config"].getCurrent()[1].value, showFiles=True)
except Exception as err:
Expand Down Expand Up @@ -8167,6 +8175,7 @@ def selectionChanged(self):
L4log("removed old Skindata")
xmlWrite()
xmlClear()
self.SetList()

def getCurrentValue(self):
return str(self["config"].getCurrent()[1].getText())
Expand Down Expand Up @@ -8262,18 +8271,6 @@ def cancel(self):
isMediaPlayer = self.SaveisMediaPlayer
TFTCheck(False)

def keyLeft(self):
L4logE("key L")
self.LastSelect = str(self["config"].getCurrentIndex()) + self.getCurrentValue()[:3]
ConfigListScreen.keyLeft(self)
self.SetList()

def keyRight(self):
L4logE("key R")
self.LastSelect = str(self["config"].getCurrentIndex()) + self.getCurrentValue()[:3]
ConfigListScreen.keyRight(self)
self.SetList()

def restartGUI(self, answer):
if answer:
L4log("GUI Restart")
Expand Down Expand Up @@ -11712,7 +11709,7 @@ def putClock(workaround, draw, im):
else:
pil_image = pil_image.resize((x1, y1), Image.LANCZOS if PY3 else Image.ANTIALIAS)
S = int(strftime("%H")) % 12
pil_image = pil_image.rotate(360 - int(30 * S + int(int(strftime("%M")) / 2))).convert("RGBA") # 360/12
pil_image = pil_image.rotate(360 - int(30 * S + int(int(strftime("%M")) / 2)), expand=False).convert("RGBA") # 360/12
self.im[im].paste(pil_image, (POSX + int((x - x1) / 2), ConfigPos + int((y - y1) / 2)), pil_image)
# Minute
pil_image = Image.open(Clock + str(ConfigAnalog) + "/Minute.png")
Expand All @@ -11723,7 +11720,7 @@ def putClock(workaround, draw, im):
pil_image = pil_image.resize((x1, y1))
else:
pil_image = pil_image.resize((x1, y1), Image.LANCZOS if PY3 else Image.ANTIALIAS)
pil_image = pil_image.rotate(360 - int(6 * int(strftime("%M")))).convert("RGBA") # 360/60
pil_image = pil_image.rotate(360 - int(6 * int(strftime("%M"))), expand=False).convert("RGBA") # 360/60
self.im[im].paste(pil_image, (POSX + int((x - x1) / 2), ConfigPos + int((y - y1) / 2)), pil_image)
# Seconds: Due to the bad refresh rates, the second hand was deliberately not programmed!
# Date underneath clockface
Expand Down Expand Up @@ -15421,21 +15418,21 @@ def Lput4(LCD, SCR, FUNC, PARA):
self.draw[1].rectangle((0, 0, MAX_W, MAX_H), fill="black")
QuickList = [[], [], []]
if str(LCD4linux.LCDRotate1.value) != "0":
self.im[1] = self.im[1].rotate(int(LCD4linux.LCDRotate1.value))
self.im[1] = self.im[1].rotate(int(LCD4linux.LCDRotate1.value), expand=True)
Brief1.put([writeLCD1, self, 1, LCD4linux.BilderJPEG.value])
if LCD4linux.LCDType2.value != "00" and self.Refresh >= LCD4linux.LCDRefresh2.value and not (getSA(2) in LCD4linux.TV.value and "2" in LCD4linux.TVLCD.value and not Standby.inStandby):
if Dunkel and "2" in Dunkel:
MAX_W, MAX_H = self.im[2].size
self.draw[2].rectangle((0, 0, MAX_W, MAX_H), fill="black")
if str(LCD4linux.LCDRotate2.value) != "0":
self.im[2] = self.im[2].rotate(int(LCD4linux.LCDRotate2.value))
self.im[2] = self.im[2].rotate(int(LCD4linux.LCDRotate2.value), expand=True)
Brief2.put([writeLCD2, self, 2, LCD4linux.BilderJPEG.value])
if LCD4linux.LCDType3.value != "00" and self.Refresh >= LCD4linux.LCDRefresh3.value and not (getSA(3) in LCD4linux.TV.value and "3" in LCD4linux.TVLCD.value and not Standby.inStandby):
if Dunkel and "3" in Dunkel:
MAX_W, MAX_H = self.im[3].size
self.draw[3].rectangle((0, 0, MAX_W, MAX_H), fill="black")
if str(LCD4linux.LCDRotate3.value) != "0":
self.im[3] = self.im[3].rotate(int(LCD4linux.LCDRotate3.value))
self.im[3] = self.im[3].rotate(int(LCD4linux.LCDRotate3.value), expand=True)
Brief3.put([writeLCD3, self, 3, LCD4linux.BilderJPEG.value])
Brief1.join()
Brief2.join()
Expand Down
Loading