mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A spot of refactoring
This commit is contained in:
parent
b7a0bdf4fe
commit
fb183bc6c6
@ -92,14 +92,17 @@ def element(elem_id, child_selector):
|
|||||||
ans = ans.querySelector(child_selector)
|
ans = ans.querySelector(child_selector)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
def unique_id():
|
||||||
|
unique_id.count += 1
|
||||||
|
return 'auto-id-' + unique_id.count
|
||||||
|
unique_id.count = 0
|
||||||
|
|
||||||
def ensure_id(w):
|
def ensure_id(w):
|
||||||
ans = w.getAttribute('id')
|
ans = w.getAttribute('id')
|
||||||
if not ans:
|
if not ans:
|
||||||
ensure_id.count += 1
|
ans = unique_id()
|
||||||
ans = 'auto-id-' + ensure_id.count
|
|
||||||
w.setAttribute('id', ans)
|
w.setAttribute('id', ans)
|
||||||
return ans
|
return ans
|
||||||
ensure_id.count = 0
|
|
||||||
|
|
||||||
extra_css = v'[]'
|
extra_css = v'[]'
|
||||||
|
|
||||||
@ -108,4 +111,3 @@ def add_extra_css(func):
|
|||||||
|
|
||||||
def get_widget_css():
|
def get_widget_css():
|
||||||
return extra_css.join('\n')
|
return extra_css.join('\n')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user