@@ -2886,31 +2886,32 @@ def getResolution(t, r):
2886
2886
if int(LCD4linux.xmlOffset.value) != 0:
2887
2887
MAX_W -= (int(LCD4linux.xmlOffset.value) * 2)
2888
2888
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":
2890
2891
MAX_W, MAX_H = 320, 240
2891
- elif t.endswith( "2") :
2892
+ elif t[1:] == "2":
2892
2893
MAX_W, MAX_H = 240, 320
2893
2894
elif t[1:] in ["3", "4", "5", "10", "15"]:
2894
2895
MAX_W, MAX_H = 800, 480
2895
2896
elif t[1:] in ["6", "9", "11", "12"]:
2896
2897
MAX_W, MAX_H = 800, 600
2897
2898
elif t[1:] in ["7", "8", "13", "14"]:
2898
2899
MAX_W, MAX_H = 1024, 600
2899
- elif t.endswith( "17") :
2900
+ elif t[1:] == "17":
2900
2901
MAX_W, MAX_H = 220, 176
2901
- elif t.endswith( "18") :
2902
+ elif t[1:] == "18":
2902
2903
MAX_W, MAX_H = 255, 64
2903
- elif t.endswith( "22") :
2904
+ elif t[1:] == "22":
2904
2905
MAX_W, MAX_H = 480, 320
2905
- elif t.endswith( "23") :
2906
+ elif t[1:] == "23":
2906
2907
MAX_W, MAX_H = 800, 480
2907
- elif t.endswith( "30") :
2908
+ elif t[1:] == "30":
2908
2909
MAX_W, MAX_H = 400, 240
2909
2910
elif t == "320":
2910
2911
MAX_W, MAX_H = LCD4linux.SizeW.value, LCD4linux.SizeH.value
2911
2912
elif t == "420":
2912
2913
MAX_W, MAX_H = LCD4linux.SizeW2.value, LCD4linux.SizeH2.value
2913
- elif t.endswith( "21") :
2914
+ elif t[1:] == "21":
2914
2915
MAX_W, MAX_H = 128, 128
2915
2916
else:
2916
2917
MAX_W, MAX_H = 132, 64
@@ -9506,14 +9507,14 @@ def rcKeyPressed(self, key, flag):
9506
9507
self.restartTimer()
9507
9508
if LCD4linux.KeySwitch.value == True:
9508
9509
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:
9510
9511
ScreenTime = 9999
9511
9512
L4logE("Restart at Scr-longkey")
9512
9513
NextScreen(True)
9513
9514
LCD4linux.ScreenActive.value = ScreenActive[0]
9514
9515
self.Refresh = "1"
9515
9516
self.restartTimer()
9516
- elif LCD4linux.KeyOff.value.endswith( "1") and key == self.ko:
9517
+ elif LCD4linux.KeyOff.value[-1:] == "1" and key == self.ko:
9517
9518
LCDon = True if LCDon == False else False
9518
9519
L4logE("Restart at Off-longkey")
9519
9520
self.Refresh = "1"
@@ -9524,12 +9525,12 @@ def rcKeyPressed(self, key, flag):
9524
9525
self.KeyTime = time()
9525
9526
if self.KeyDoppel == key and flag == 0:
9526
9527
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
9528
9529
LCDon = True if LCDon == False else False
9529
9530
L4logE("Restart at Off-doublekey %s" % key)
9530
9531
self.Refresh = "1"
9531
9532
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
9533
9534
ScreenTime = 9999
9534
9535
NextScreen(True)
9535
9536
LCD4linux.ScreenActive.value = ScreenActive[0]
@@ -12295,9 +12296,9 @@ def putProgress(workaround, draw, im):
12295
12296
POSX = getSplit(ConfigSplit, ConfigAlign, MAX_W, ProgressBar)
12296
12297
if self.LsreftoString is not None:
12297
12298
Minutes, Prozent = (" min", " %") if ConfigMinutes else ("", "")
12298
- if ConfigType.endswith( "1") :
12299
+ if ConfigType[1:] == "1":
12299
12300
ms = 1.5
12300
- elif ConfigType.endswith( "2") :
12301
+ elif ConfigType[1:] == "2":
12301
12302
ms = 2
12302
12303
else:
12303
12304
ms = 1
@@ -12663,7 +12664,7 @@ def putSat(workaround, draw, im):
12663
12664
x = int(float(CS) / yy * xx)
12664
12665
imW = imW.resize((x, CS))
12665
12666
POSX = getSplit(ConfigSplit, ConfigAlign, MAX_W, x)
12666
- if ConfigType.endswith( "A") :
12667
+ if ConfigType[1:] == "A":
12667
12668
ShadowText(draw, POSX, ConfigPos + int(ConfigSize / 4), Code_utf8(orbital), font, ConfigColor, ConfigShadow)
12668
12669
POSX += w
12669
12670
if str(LCD4linux.PiconTransparenz.value) == "2":
@@ -12673,9 +12674,9 @@ def putSat(workaround, draw, im):
12673
12674
self.im[im].paste(imW, (POSX, ConfigPos))
12674
12675
if not PY3: # correction for Python 2
12675
12676
POSX += x
12676
- if ConfigType.endswith( "C") :
12677
+ if ConfigType[1:] == "C":
12677
12678
ShadowText(draw, POSX, ConfigPos + int(ConfigSize / 4), Code_utf8(orbital), font, ConfigColor, ConfigShadow)
12678
- if ConfigType.endswith( "B") :
12679
+ if ConfigType[1:] == "B":
12679
12680
ShadowText(draw, POSX - int((x - w) / 2), ConfigPos + CS, Code_utf8(orbital), font, ConfigColor, ConfigShadow)
12680
12681
except Exception:
12681
12682
pass
@@ -13717,7 +13718,7 @@ def putMail(workaround, draw, im):
13717
13718
font = ImageFont.truetype(ConfigFont, ConfigSize, encoding='unic')
13718
13719
c = int(ConfigSize / 4)
13719
13720
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]):
13721
13722
break
13722
13723
i += 1
13723
13724
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):
14078
14079
staerke = staerkeVal2
14079
14080
dis_reason = Code_utf8(self.dis_reason[ConfigStation])
14080
14081
if ConfigType.startswith("0"):
14081
- if ConfigType.endswith( "9") :
14082
+ if ConfigType[1:] == "9":
14082
14083
S = 1.5 if ConfigSize <= 10 else 1.0
14083
14084
ZW = str(staerkeValOrg) # Value
14084
14085
font = ImageFont.truetype(FONT, int(ConfigSize * S), encoding='unic')
@@ -14105,7 +14106,7 @@ def putNetatmoIllu(workaround, draw, im):
14105
14106
except Exception:
14106
14107
L4log("Error Knob")
14107
14108
L4log("Error:", format_exc())
14108
- if ConfigType.endswith( "9") :
14109
+ if ConfigType[1:] == "9":
14109
14110
ZW = str(int(staerkeValOrg))
14110
14111
font = ImageFont.truetype(FONT, int(ConfigSize / 3), encoding='unic')
14111
14112
w, h = getFsize(ZW, font)
0 commit comments