172
172
if find_library("usb-0.1") is not None or find_library("usb-1.0") is not None:
173
173
print("[LCD4linux] libusb found :-)", getEnigmaVersionString())
174
174
USBok = True
175
- Version = "V5.0-r29 "
175
+ Version = "V5.0-r32 "
176
176
L4LElist = L4Lelement()
177
177
L4LdoThread = True
178
178
LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/
@@ -3247,7 +3247,7 @@ def writeLCD1(s, im, quality, SAVE=True):
3247
3247
doDPF(1, im, s)
3248
3248
if "1" in LCD4linux.SavePicture.value and SAVE == True:
3249
3249
if str(LCD4linux.LCDRotate1.value) != "0":
3250
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3250
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True )
3251
3251
try:
3252
3252
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3253
3253
if isfile(bild):
@@ -3269,7 +3269,7 @@ def writeLCD1(s, im, quality, SAVE=True):
3269
3269
s.im[im].save("/tmp/usbtft-bmp", "BMP")
3270
3270
if "1" in LCD4linux.SavePicture.value and SAVE == True:
3271
3271
if str(LCD4linux.LCDRotate1.value) != "0":
3272
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3272
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True )
3273
3273
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3274
3274
if isfile(bild):
3275
3275
rename(bild, "%s.png" % PIC)
@@ -3280,7 +3280,7 @@ def writeLCD1(s, im, quality, SAVE=True):
3280
3280
try:
3281
3281
if "1" in LCD4linux.SavePicture.value and SAVE == True:
3282
3282
if str(LCD4linux.LCDRotate1.value) != "0":
3283
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3283
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True )
3284
3284
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3285
3285
if isfile(bild):
3286
3286
rename(bild, "%s.png" % PIC)
@@ -3331,7 +3331,7 @@ def writeLCD1(s, im, quality, SAVE=True):
3331
3331
try:
3332
3332
datei = "%s.jpg" % PICtmp
3333
3333
if str(LCD4linux.LCDRotate1.value) != "0":
3334
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value))
3334
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate1.value), expand=True )
3335
3335
s.im[im].save(datei, "JPEG")
3336
3336
elif pic is not None:
3337
3337
open(datei, "wb").write(pic)
@@ -3367,7 +3367,7 @@ def writeLCD2(s, im, quality, SAVE=True):
3367
3367
doDPF(2, im, s)
3368
3368
if "2" in LCD4linux.SavePicture.value and SAVE == True:
3369
3369
if str(LCD4linux.LCDRotate2.value) != "0":
3370
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3370
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True )
3371
3371
try:
3372
3372
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3373
3373
if isfile(bild):
@@ -3389,7 +3389,7 @@ def writeLCD2(s, im, quality, SAVE=True):
3389
3389
s.im[im].save("/tmp/usbtft-bmp", "BMP")
3390
3390
if "2" in LCD4linux.SavePicture.value and SAVE == True:
3391
3391
if str(LCD4linux.LCDRotate2.value) != "0":
3392
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3392
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True )
3393
3393
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3394
3394
if isfile(bild):
3395
3395
rename(bild, "%s.png" % PIC2)
@@ -3400,7 +3400,7 @@ def writeLCD2(s, im, quality, SAVE=True):
3400
3400
try:
3401
3401
if "2" in LCD4linux.SavePicture.value and SAVE == True:
3402
3402
if str(LCD4linux.LCDRotate2.value) != "0":
3403
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3403
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True )
3404
3404
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3405
3405
if isfile(bild):
3406
3406
rename(bild, "%s.png" % PIC2)
@@ -3451,7 +3451,7 @@ def writeLCD2(s, im, quality, SAVE=True):
3451
3451
try:
3452
3452
datei = "%s.jpg" % PIC2tmp
3453
3453
if str(LCD4linux.LCDRotate2.value) != "0":
3454
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value))
3454
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate2.value), expand=True )
3455
3455
s.im[im].save(datei, "JPEG")
3456
3456
elif pic is not None:
3457
3457
open(datei, "wb").write(pic)
@@ -3487,7 +3487,7 @@ def writeLCD3(s, im, quality, SAVE=True):
3487
3487
doDPF(3, im, s)
3488
3488
if "3" in LCD4linux.SavePicture.value and SAVE == True:
3489
3489
if str(LCD4linux.LCDRotate3.value) != "0":
3490
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3490
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True )
3491
3491
try:
3492
3492
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3493
3493
if isfile(bild):
@@ -3509,7 +3509,7 @@ def writeLCD3(s, im, quality, SAVE=True):
3509
3509
s.im[im].save("/tmp/usbtft-bmp", "BMP")
3510
3510
if "3" in LCD4linux.SavePicture.value and SAVE == True:
3511
3511
if str(LCD4linux.LCDRotate3.value) != "0":
3512
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3512
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True )
3513
3513
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3514
3514
if isfile(bild):
3515
3515
rename(bild, "%s.png" % PIC3)
@@ -3520,7 +3520,7 @@ def writeLCD3(s, im, quality, SAVE=True):
3520
3520
try:
3521
3521
if "3" in LCD4linux.SavePicture.value and SAVE == True:
3522
3522
if str(LCD4linux.LCDRotate3.value) != "0":
3523
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3523
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True )
3524
3524
s.im[im].save(bild, "PNG" if LCD4linux.BilderTyp.value == "png" else "JPEG")
3525
3525
if isfile(bild):
3526
3526
rename(bild, "%s.png" % PIC3)
@@ -3571,7 +3571,7 @@ def writeLCD3(s, im, quality, SAVE=True):
3571
3571
try:
3572
3572
datei = "%s.jpg" % PIC3tmp
3573
3573
if str(LCD4linux.LCDRotate3.value) != "0":
3574
- s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value))
3574
+ s.im[im] = s.im[im].rotate(-int(LCD4linux.LCDRotate3.value), expand=True )
3575
3575
s.im[im].save(datei, "JPEG")
3576
3576
elif pic is not None:
3577
3577
open(datei, "wb").write(pic)
@@ -5264,12 +5264,13 @@ class LCDdisplayMenu(Screen):
5264
5264
skin = """
5265
5265
<screen position="center,center" size="600,380" title="LCD4linux - Config" >
5266
5266
<widget name="menu" position="10,20" size="580,350" scrollbarMode="showOnDemand" />
5267
+ <eLabel name="button_red" position="10,340" size="6,36" backgroundColor="#00fe0000" zPosition="1" />
5268
+ <widget source="key_red" render="Label" position="24,346" size="230,26" font="Regular;18" valign="center" halign="left" zPosition="1" />
5267
5269
</screen>"""
5268
5270
5269
5271
def __init__(self, session, args=None):
5270
5272
Screen.__init__(self, session)
5271
5273
self.session = session
5272
- self.list = []
5273
5274
self.SetList()
5274
5275
self["menu"] = MenuList(self.list)
5275
5276
self["key_red"] = StaticText(_("Delete"))
@@ -5286,10 +5287,11 @@ def SetList(self):
5286
5287
self.list.append((_("Load Defaults / Empty Config"), "LoadDefault", ""))
5287
5288
self.list.append((_("Save Config to File... (%s)") % LCD4linux.ConfigPath.value, "SaveToConfig", ""))
5288
5289
Cdir = sorted(glob(join(LCD4linux.ConfigPath.value, "*.lcd")))
5289
- xx = 3
5290
+ self. xx = 3
5290
5291
for ii in Cdir:
5291
- self.list.append((_("Load File : %s") % basename(ii), "LoadFile %d" % xx, ii))
5292
- xx += 1
5292
+ self.list.append((_("Load File : %s") % basename(ii), "LoadFile %d" % self.xx, ii))
5293
+ self.xx += 1
5294
+ self.LastSavedConfig = 0
5293
5295
5294
5296
def entfernen(self):
5295
5297
current = self["menu"].getCurrent()
@@ -5310,28 +5312,36 @@ def keyOK(self):
5310
5312
LCD4linux.loadFromFile(LCD4default)
5311
5313
LCD4linux.loadFromFile(LCD4config)
5312
5314
LCD4linux.load()
5315
+ self.cancel()
5313
5316
elif currentEntry == "SaveToConfig":
5314
- self.session.openWithCallback(self.askForConfigName, InputBox, title="Save Filename", text="LCD4linux-%s" % (strftime("%Y%m%d_%H%M")), type=Input.TEXT)
5317
+ if self.LastSavedConfig == 0:
5318
+ self.session.openWithCallback(self.askForConfigName, InputBox, title="Save Filename", text="LCD4linux-%s" % (strftime("%Y%m%d_%H%M")), type=Input.TEXT)
5315
5319
elif currentEntry.startswith("LoadFile"):
5316
5320
if isfile(current[2]):
5317
5321
L4LoadNewConfig(current[2])
5322
+ self.cancel()
5318
5323
elif currentEntry == "LoadDefault" and isfile(LCD4default):
5319
5324
L4log("Config-Load", LCD4default)
5320
5325
LCD4linux.loadFromFile(LCD4default)
5321
5326
LCD4linux.load()
5327
+ self.cancel()
5322
5328
5323
5329
def askForConfigName(self, name):
5324
5330
if name is not None and isdir(LCD4linux.ConfigPath.value):
5325
5331
LCD4linux.save()
5326
5332
LCD4linux.saveToFile(join(LCD4linux.ConfigPath.value, "%s.lcd" % name))
5327
- self.list.append((_("Load File : %s") % ("%s.lcd" % name), "LoadFile", join(LCD4linux.ConfigPath.value, "%s.lcd" % name)))
5333
+ self.list.append((_("Load File : %s") % ("%s.lcd" % name), "LoadFile %d" % self.xx, join(LCD4linux.ConfigPath.value, "%s.lcd" % name)))
5334
+ self.LastSavedConfig = self.xx
5335
+ self.xx += 1
5328
5336
5329
5337
def askForDelete(self, retval):
5330
5338
if (retval):
5331
5339
current = self["menu"].getCurrent()
5332
5340
if current and isfile(current[2]):
5333
5341
currentEntry = current[1]
5334
5342
i = int(currentEntry.split()[1])
5343
+ if i == self.LastSavedConfig:
5344
+ self.LastSavedConfig = 0
5335
5345
self.list[i] = (_("deleted"),) + self.list[i][1:]
5336
5346
rmFile(current[2])
5337
5347
@@ -5545,8 +5555,6 @@ def __init__(self, session, args=0):
5545
5555
self.mode = _("Global")
5546
5556
self.LastSelect = "4"
5547
5557
self.SetList()
5548
- if self.selectionChanged not in self["config"].onSelectionChanged:
5549
- self["config"].onSelectionChanged.append(self.selectionChanged)
5550
5558
if LCD4linux.LCDType3.value == "00":
5551
5559
self["LCD3"].hide()
5552
5560
if getDesktop(0).size().width() < 1000:
@@ -7920,7 +7928,7 @@ def keyOK(self):
7920
7928
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]:
7921
7929
L4log("select File 4")
7922
7930
self.session.openWithCallback(self.fileSelected, LCDdisplayFile, text=_("Choose file"), FileName=self["config"].getCurrent()[1].value, showFiles=True)
7923
- elif sel in [LCD4linux.Background1Bild, LCD4linux.LCD4linux. MPBackground1Bild, LCD4linux.StandbyBackground1Bild]:
7931
+ elif sel in [LCD4linux.Background1Bild, LCD4linux.MPBackground1Bild, LCD4linux.StandbyBackground1Bild]:
7924
7932
L4log("select File 5")
7925
7933
self.session.openWithCallback(self.fileSelected, LCDdisplayFile, text=_("Choose file"), FileName=self["config"].getCurrent()[1].value, showFiles=True)
7926
7934
except Exception as err:
@@ -8167,6 +8175,7 @@ def selectionChanged(self):
8167
8175
L4log("removed old Skindata")
8168
8176
xmlWrite()
8169
8177
xmlClear()
8178
+ self.SetList()
8170
8179
8171
8180
def getCurrentValue(self):
8172
8181
return str(self["config"].getCurrent()[1].getText())
@@ -8262,18 +8271,6 @@ def cancel(self):
8262
8271
isMediaPlayer = self.SaveisMediaPlayer
8263
8272
TFTCheck(False)
8264
8273
8265
- def keyLeft(self):
8266
- L4logE("key L")
8267
- self.LastSelect = str(self["config"].getCurrentIndex()) + self.getCurrentValue()[:3]
8268
- ConfigListScreen.keyLeft(self)
8269
- self.SetList()
8270
-
8271
- def keyRight(self):
8272
- L4logE("key R")
8273
- self.LastSelect = str(self["config"].getCurrentIndex()) + self.getCurrentValue()[:3]
8274
- ConfigListScreen.keyRight(self)
8275
- self.SetList()
8276
-
8277
8274
def restartGUI(self, answer):
8278
8275
if answer:
8279
8276
L4log("GUI Restart")
@@ -11712,7 +11709,7 @@ def putClock(workaround, draw, im):
11712
11709
else:
11713
11710
pil_image = pil_image.resize((x1, y1), Image.LANCZOS if PY3 else Image.ANTIALIAS)
11714
11711
S = int(strftime("%H")) % 12
11715
- pil_image = pil_image.rotate(360 - int(30 * S + int(int(strftime("%M")) / 2))).convert("RGBA") # 360/12
11712
+ pil_image = pil_image.rotate(360 - int(30 * S + int(int(strftime("%M")) / 2)), expand=False ).convert("RGBA") # 360/12
11716
11713
self.im[im].paste(pil_image, (POSX + int((x - x1) / 2), ConfigPos + int((y - y1) / 2)), pil_image)
11717
11714
# Minute
11718
11715
pil_image = Image.open(Clock + str(ConfigAnalog) + "/Minute.png")
@@ -11723,7 +11720,7 @@ def putClock(workaround, draw, im):
11723
11720
pil_image = pil_image.resize((x1, y1))
11724
11721
else:
11725
11722
pil_image = pil_image.resize((x1, y1), Image.LANCZOS if PY3 else Image.ANTIALIAS)
11726
- pil_image = pil_image.rotate(360 - int(6 * int(strftime("%M")))).convert("RGBA") # 360/60
11723
+ pil_image = pil_image.rotate(360 - int(6 * int(strftime("%M"))), expand=False ).convert("RGBA") # 360/60
11727
11724
self.im[im].paste(pil_image, (POSX + int((x - x1) / 2), ConfigPos + int((y - y1) / 2)), pil_image)
11728
11725
# Seconds: Due to the bad refresh rates, the second hand was deliberately not programmed!
11729
11726
# Date underneath clockface
@@ -15421,21 +15418,21 @@ def Lput4(LCD, SCR, FUNC, PARA):
15421
15418
self.draw[1].rectangle((0, 0, MAX_W, MAX_H), fill="black")
15422
15419
QuickList = [[], [], []]
15423
15420
if str(LCD4linux.LCDRotate1.value) != "0":
15424
- self.im[1] = self.im[1].rotate(int(LCD4linux.LCDRotate1.value))
15421
+ self.im[1] = self.im[1].rotate(int(LCD4linux.LCDRotate1.value), expand=True )
15425
15422
Brief1.put([writeLCD1, self, 1, LCD4linux.BilderJPEG.value])
15426
15423
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):
15427
15424
if Dunkel and "2" in Dunkel:
15428
15425
MAX_W, MAX_H = self.im[2].size
15429
15426
self.draw[2].rectangle((0, 0, MAX_W, MAX_H), fill="black")
15430
15427
if str(LCD4linux.LCDRotate2.value) != "0":
15431
- self.im[2] = self.im[2].rotate(int(LCD4linux.LCDRotate2.value))
15428
+ self.im[2] = self.im[2].rotate(int(LCD4linux.LCDRotate2.value), expand=True )
15432
15429
Brief2.put([writeLCD2, self, 2, LCD4linux.BilderJPEG.value])
15433
15430
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):
15434
15431
if Dunkel and "3" in Dunkel:
15435
15432
MAX_W, MAX_H = self.im[3].size
15436
15433
self.draw[3].rectangle((0, 0, MAX_W, MAX_H), fill="black")
15437
15434
if str(LCD4linux.LCDRotate3.value) != "0":
15438
- self.im[3] = self.im[3].rotate(int(LCD4linux.LCDRotate3.value))
15435
+ self.im[3] = self.im[3].rotate(int(LCD4linux.LCDRotate3.value), expand=True )
15439
15436
Brief3.put([writeLCD3, self, 3, LCD4linux.BilderJPEG.value])
15440
15437
Brief1.join()
15441
15438
Brief2.join()
0 commit comments