Skip to content

Commit 891216e

Browse files
MrServoHains
authored andcommitted
[LCD4linux] v5.0-r25 bugfix for AX206 displays
- bugfixed troubles with AX206 displays HINT: **LCD4linux** is still working under Python2 and Python3
1 parent 046bcde commit 891216e

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

lcd4linux/src/plugin.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,31 +2886,32 @@ def getResolution(t, r):
28862886
if int(LCD4linux.xmlOffset.value) != 0:
28872887
MAX_W -= (int(LCD4linux.xmlOffset.value) * 2)
28882888
MAX_H -= (int(LCD4linux.xmlOffset.value) * 2)
2889-
elif t.endswith("1"):
2889+
# ATTENTION: must not be changed to 'endswith()' under any circumstances
2890+
elif t[1:] == "1":
28902891
MAX_W, MAX_H = 320, 240
2891-
elif t.endswith("2"):
2892+
elif t[1:] == "2":
28922893
MAX_W, MAX_H = 240, 320
28932894
elif t[1:] in ["3", "4", "5", "10", "15"]:
28942895
MAX_W, MAX_H = 800, 480
28952896
elif t[1:] in ["6", "9", "11", "12"]:
28962897
MAX_W, MAX_H = 800, 600
28972898
elif t[1:] in ["7", "8", "13", "14"]:
28982899
MAX_W, MAX_H = 1024, 600
2899-
elif t.endswith("17"):
2900+
elif t[1:] == "17":
29002901
MAX_W, MAX_H = 220, 176
2901-
elif t.endswith("18"):
2902+
elif t[1:] == "18":
29022903
MAX_W, MAX_H = 255, 64
2903-
elif t.endswith("22"):
2904+
elif t[1:] == "22":
29042905
MAX_W, MAX_H = 480, 320
2905-
elif t.endswith("23"):
2906+
elif t[1:] == "23":
29062907
MAX_W, MAX_H = 800, 480
2907-
elif t.endswith("30"):
2908+
elif t[1:] == "30":
29082909
MAX_W, MAX_H = 400, 240
29092910
elif t == "320":
29102911
MAX_W, MAX_H = LCD4linux.SizeW.value, LCD4linux.SizeH.value
29112912
elif t == "420":
29122913
MAX_W, MAX_H = LCD4linux.SizeW2.value, LCD4linux.SizeH2.value
2913-
elif t.endswith("21"):
2914+
elif t[1:] == "21":
29142915
MAX_W, MAX_H = 128, 128
29152916
else:
29162917
MAX_W, MAX_H = 132, 64
@@ -9506,14 +9507,14 @@ def rcKeyPressed(self, key, flag):
95069507
self.restartTimer()
95079508
if LCD4linux.KeySwitch.value == True:
95089509
if flag == 3:
9509-
if LCD4linux.KeyScreen.value.endswith("1") and key == self.k:
9510+
if LCD4linux.KeyScreen.value[-1:] == "1" and key == self.k:
95109511
ScreenTime = 9999
95119512
L4logE("Restart at Scr-longkey")
95129513
NextScreen(True)
95139514
LCD4linux.ScreenActive.value = ScreenActive[0]
95149515
self.Refresh = "1"
95159516
self.restartTimer()
9516-
elif LCD4linux.KeyOff.value.endswith("1") and key == self.ko:
9517+
elif LCD4linux.KeyOff.value[-1:] == "1" and key == self.ko:
95179518
LCDon = True if LCDon == False else False
95189519
L4logE("Restart at Off-longkey")
95199520
self.Refresh = "1"
@@ -9524,12 +9525,12 @@ def rcKeyPressed(self, key, flag):
95249525
self.KeyTime = time()
95259526
if self.KeyDoppel == key and flag == 0:
95269527
self.KeyDoppel = 0
9527-
if not LCD4linux.KeyOff.value.endswith("1") and key == self.ko: # PREVIOUS
9528+
if LCD4linux.KeyOff.value[-1:] != "1" and key == self.ko: # PREVIOUS
95289529
LCDon = True if LCDon == False else False
95299530
L4logE("Restart at Off-doublekey %s" % key)
95309531
self.Refresh = "1"
95319532
self.restartTimer()
9532-
elif not LCD4linux.KeyScreen.value.endswith("1") and key == self.k: # FORWARD / INFO
9533+
elif LCD4linux.KeyScreen.value[-1:] != "1" and key == self.k: # FORWARD / INFO
95339534
ScreenTime = 9999
95349535
NextScreen(True)
95359536
LCD4linux.ScreenActive.value = ScreenActive[0]
@@ -12295,9 +12296,9 @@ def putProgress(workaround, draw, im):
1229512296
POSX = getSplit(ConfigSplit, ConfigAlign, MAX_W, ProgressBar)
1229612297
if self.LsreftoString is not None:
1229712298
Minutes, Prozent = (" min", " %") if ConfigMinutes else ("", "")
12298-
if ConfigType.endswith("1"):
12299+
if ConfigType[1:] == "1":
1229912300
ms = 1.5
12300-
elif ConfigType.endswith("2"):
12301+
elif ConfigType[1:] == "2":
1230112302
ms = 2
1230212303
else:
1230312304
ms = 1
@@ -12663,7 +12664,7 @@ def putSat(workaround, draw, im):
1266312664
x = int(float(CS) / yy * xx)
1266412665
imW = imW.resize((x, CS))
1266512666
POSX = getSplit(ConfigSplit, ConfigAlign, MAX_W, x)
12666-
if ConfigType.endswith("A"):
12667+
if ConfigType[1:] == "A":
1266712668
ShadowText(draw, POSX, ConfigPos + int(ConfigSize / 4), Code_utf8(orbital), font, ConfigColor, ConfigShadow)
1266812669
POSX += w
1266912670
if str(LCD4linux.PiconTransparenz.value) == "2":
@@ -12673,9 +12674,9 @@ def putSat(workaround, draw, im):
1267312674
self.im[im].paste(imW, (POSX, ConfigPos))
1267412675
if not PY3: # correction for Python 2
1267512676
POSX += x
12676-
if ConfigType.endswith("C"):
12677+
if ConfigType[1:] == "C":
1267712678
ShadowText(draw, POSX, ConfigPos + int(ConfigSize / 4), Code_utf8(orbital), font, ConfigColor, ConfigShadow)
12678-
if ConfigType.endswith("B"):
12679+
if ConfigType[1:] == "B":
1267912680
ShadowText(draw, POSX - int((x - w) / 2), ConfigPos + CS, Code_utf8(orbital), font, ConfigColor, ConfigShadow)
1268012681
except Exception:
1268112682
pass
@@ -13717,7 +13718,7 @@ def putMail(workaround, draw, im):
1371713718
font = ImageFont.truetype(ConfigFont, ConfigSize, encoding='unic')
1371813719
c = int(ConfigSize / 4)
1371913720
for M in PopMail[CP]:
13720-
if i >= int(ConfigLines) or (ConfigType.endswith("2") and M[2] == PopMailUid[CP][0]):
13721+
if i >= int(ConfigLines) or (ConfigType[1:] == "2" and M[2] == PopMailUid[CP][0]):
1372113722
break
1372213723
i += 1
1372313724
self.draw[draw].ellipse((POSX, POSY + int(ConfigSize / 2) - c, POSX + (2 * c), POSY + int(ConfigSize / 2) + c), fill=ConfigColor)
@@ -14078,7 +14079,7 @@ def putNetatmoIllu(workaround, draw, im):
1407814079
staerke = staerkeVal2
1407914080
dis_reason = Code_utf8(self.dis_reason[ConfigStation])
1408014081
if ConfigType.startswith("0"):
14081-
if ConfigType.endswith("9"):
14082+
if ConfigType[1:] == "9":
1408214083
S = 1.5 if ConfigSize <= 10 else 1.0
1408314084
ZW = str(staerkeValOrg) # Value
1408414085
font = ImageFont.truetype(FONT, int(ConfigSize * S), encoding='unic')
@@ -14105,7 +14106,7 @@ def putNetatmoIllu(workaround, draw, im):
1410514106
except Exception:
1410614107
L4log("Error Knob")
1410714108
L4log("Error:", format_exc())
14108-
if ConfigType.endswith("9"):
14109+
if ConfigType[1:] == "9":
1410914110
ZW = str(int(staerkeValOrg))
1411014111
font = ImageFont.truetype(FONT, int(ConfigSize / 3), encoding='unic')
1411114112
w, h = getFsize(ZW, font)

0 commit comments

Comments
 (0)