mirror of https://github.com/arendst/Tasmota.git
HASPmota use endswith (#20914)
This commit is contained in:
parent
bc9fd3cd92
commit
8ff9fffa0a
File diff suppressed because it is too large
Load Diff
|
@ -163,7 +163,8 @@ class lvh_root
|
|||
# I.e. ends with `color` (to not conflict with attributes containing `color_<x>`)
|
||||
#################################################################################
|
||||
def is_color_attribute(t)
|
||||
return self._page._oh.re_color_suffix.search(str(t))
|
||||
import string
|
||||
return string.endswith(str(t), "color")
|
||||
end
|
||||
|
||||
#- remove trailing NULL chars from a bytes buffer before converting to string -#
|
||||
|
@ -199,7 +200,6 @@ class lvh_root
|
|||
# parse_hex(string) -> int
|
||||
# skip any `#` prefix, or `0x` and `0X` prefix
|
||||
import string
|
||||
s = string.toupper(s) # turn to uppercase
|
||||
var val = 0
|
||||
for i:0..size(s)-1
|
||||
var c = s[i]
|
||||
|
@ -209,6 +209,8 @@ class lvh_root
|
|||
|
||||
if c >= "A" && c <= "F"
|
||||
val = (val << 4) | string.byte(c) - 55
|
||||
elif c >= "a" && c <= "f"
|
||||
val = (val << 4) | string.byte(c) - 87
|
||||
elif c >= "0" && c <= "9"
|
||||
val = (val << 4) | string.byte(c) - 48
|
||||
end
|
||||
|
@ -257,7 +259,6 @@ class lvh_root
|
|||
end
|
||||
elif type(t) == 'string'
|
||||
import string
|
||||
import re
|
||||
# look for 'A:name.font' style font file name
|
||||
var drive_split = string.split(t, ':', 1)
|
||||
var fn_split = string.split(t, '-')
|
||||
|
@ -271,7 +272,7 @@ class lvh_root
|
|||
sz = int(fn_split[-1])
|
||||
name = fn_split[0..-2].concat('-') # rebuild the font name
|
||||
end
|
||||
if re.match(".*\\.ttf$", name)
|
||||
if string.endswith(name, ".ttf", true)
|
||||
# ttf font
|
||||
name = string.split(name, ':')[-1] # remove A: if any
|
||||
is_ttf = true
|
||||
|
@ -1973,7 +1974,6 @@ class HASPmota
|
|||
var lvh_page_cur_idx # (int) current page index number
|
||||
# regex patterns
|
||||
var re_page_target # compiled regex for action `p<number>`
|
||||
var re_color_suffix # compiled regex for detecting a color
|
||||
# specific event_cb handling for less memory usage since we are registering a lot of callbacks
|
||||
var event # try to keep the event object around and reuse it
|
||||
var event_cb # the low-level callback for the closure to be registered
|
||||
|
@ -2018,7 +2018,6 @@ class HASPmota
|
|||
self.fix_lv_version()
|
||||
import re
|
||||
self.re_page_target = re.compile("p\\d+")
|
||||
self.re_color_suffix = re.compile("color$")
|
||||
# nothing to put here up to now
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue