Skip to content

Commit 8998e98

Browse files
MrServoHains
authored andcommitted
[LCD4linux] V5.0-r30 bugfixed and improved LCDdisplayMenu (#914)
THX to User KenTucky @ OpenA.TV details see: https://www.opena.tv/viewtopic.php?p=589547#p589520 HINT: **LCD4linux** is still working under Python2 and Python3
1 parent 95eba60 commit 8998e98

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

lcd4linux/src/plugin.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
if find_library("usb-0.1") is not None or find_library("usb-1.0") is not None:
173173
print("[LCD4linux] libusb found :-)", getEnigmaVersionString())
174174
USBok = True
175-
Version = "V5.0-r29"
175+
Version = "V5.0-r30"
176176
L4LElist = L4Lelement()
177177
L4LdoThread = True
178178
LCD4enigma2config = resolveFilename(SCOPE_CONFIG) # /etc/enigma2/
@@ -5264,12 +5264,13 @@ class LCDdisplayMenu(Screen):
52645264
skin = """
52655265
<screen position="center,center" size="600,380" title="LCD4linux - Config" >
52665266
<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" />
52675269
</screen>"""
52685270

52695271
def __init__(self, session, args=None):
52705272
Screen.__init__(self, session)
52715273
self.session = session
5272-
self.list = []
52735274
self.SetList()
52745275
self["menu"] = MenuList(self.list)
52755276
self["key_red"] = StaticText(_("Delete"))
@@ -5286,10 +5287,11 @@ def SetList(self):
52865287
self.list.append((_("Load Defaults / Empty Config"), "LoadDefault", ""))
52875288
self.list.append((_("Save Config to File... (%s)") % LCD4linux.ConfigPath.value, "SaveToConfig", ""))
52885289
Cdir = sorted(glob(join(LCD4linux.ConfigPath.value, "*.lcd")))
5289-
xx = 3
5290+
self.xx = 3
52905291
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
52935295

52945296
def entfernen(self):
52955297
current = self["menu"].getCurrent()
@@ -5310,31 +5312,38 @@ def keyOK(self):
53105312
LCD4linux.loadFromFile(LCD4default)
53115313
LCD4linux.loadFromFile(LCD4config)
53125314
LCD4linux.load()
5315+
self.cancel()
53135316
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)
53155319
elif currentEntry.startswith("LoadFile"):
53165320
if isfile(current[2]):
53175321
L4LoadNewConfig(current[2])
5322+
self.cancel()
53185323
elif currentEntry == "LoadDefault" and isfile(LCD4default):
53195324
L4log("Config-Load", LCD4default)
53205325
LCD4linux.loadFromFile(LCD4default)
53215326
LCD4linux.load()
5327+
self.cancel()
53225328

53235329
def askForConfigName(self, name):
53245330
if name is not None and isdir(LCD4linux.ConfigPath.value):
53255331
LCD4linux.save()
53265332
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
53285336

53295337
def askForDelete(self, retval):
53305338
if (retval):
53315339
current = self["menu"].getCurrent()
5332-
if len(current) > 1 and isfile(current[2]):
5340+
if current and isfile(current[2]):
53335341
currentEntry = current[1]
5334-
if len(currentEntry):
5335-
i = int(currentEntry.split()[1])
5336-
self.list[i] = (_("deleted"),) + self.list[i][1:]
5337-
rmFile(current[2])
5342+
i = int(currentEntry.split()[1])
5343+
if i == self.LastSavedConfig:
5344+
self.LastSavedConfig = 0
5345+
self.list[i] = (_("deleted"),) + self.list[i][1:]
5346+
rmFile(current[2])
53385347

53395348
def cancel(self):
53405349
self.close(False, self.session)

0 commit comments

Comments
 (0)