mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use icon instead of icon_name
More natural
This commit is contained in:
parent
f0b605595f
commit
13ddba374d
@ -30,15 +30,15 @@ def build_list(container, items, subtitle):
|
|||||||
c.appendChild(ul)
|
c.appendChild(ul)
|
||||||
has_icons = False
|
has_icons = False
|
||||||
for item in items:
|
for item in items:
|
||||||
if item.icon_name:
|
if item.icon:
|
||||||
has_icons = True
|
has_icons = True
|
||||||
break
|
break
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
ic = ''
|
ic = ''
|
||||||
if has_icons:
|
if has_icons:
|
||||||
if item.icon_name:
|
if item.icon:
|
||||||
ic = svgicon(item.icon_name)
|
ic = svgicon(item.icon)
|
||||||
ic = E.span(ic, '\xa0')
|
ic = E.span(ic, '\xa0')
|
||||||
ul.appendChild(E.li(E.a(href='javascript:void(0)',
|
ul.appendChild(E.li(E.a(href='javascript:void(0)',
|
||||||
E.div(ic, item.title, class_='item-title')
|
E.div(ic, item.title, class_='item-title')
|
||||||
@ -50,8 +50,8 @@ def build_list(container, items, subtitle):
|
|||||||
if item.action:
|
if item.action:
|
||||||
ul.lastChild.addEventListener('click', item.action)
|
ul.lastChild.addEventListener('click', item.action)
|
||||||
|
|
||||||
def create_item(title, action=None, subtitle=None, icon_name=None):
|
def create_item(title, action=None, subtitle=None, icon=None):
|
||||||
return {'title':title, 'action':action, 'subtitle':subtitle, 'icon_name':icon_name}
|
return {'title':title, 'action':action, 'subtitle':subtitle, 'icon':icon}
|
||||||
|
|
||||||
|
|
||||||
def create_item_list(container, items, subtitle=None):
|
def create_item_list(container, items, subtitle=None):
|
||||||
|
@ -125,7 +125,7 @@ class ModalContainer:
|
|||||||
return
|
return
|
||||||
self.clear_current_modal()
|
self.clear_current_modal()
|
||||||
|
|
||||||
def create_simple_dialog(title, msg, details, icon_name, prefix):
|
def create_simple_dialog(title, msg, details, icon, prefix):
|
||||||
details = details or ''
|
details = details or ''
|
||||||
def create_func(parent):
|
def create_func(parent):
|
||||||
show_details = E.a(class_='dialog-simple-link', style='cursor:pointer; color: blue; padding-top:1em; display:inline-block; margin-left: auto', _('Show details'))
|
show_details = E.a(class_='dialog-simple-link', style='cursor:pointer; color: blue; padding-top:1em; display:inline-block; margin-left: auto', _('Show details'))
|
||||||
@ -146,7 +146,7 @@ def create_simple_dialog(title, msg, details, icon_name, prefix):
|
|||||||
E.div(
|
E.div(
|
||||||
style='max-width:60em; text-align: left',
|
style='max-width:60em; text-align: left',
|
||||||
E.h2(
|
E.h2(
|
||||||
E.span(svgicon(icon_name), style='color:red'), E.span('\xa0' + prefix + '\xa0', style='font-variant:small-caps'), title,
|
E.span(svgicon(icon), style='color:red'), E.span('\xa0' + prefix + '\xa0', style='font-variant:small-caps'), title,
|
||||||
style='font-weight: bold; font-size: ' + get_font_size('title')
|
style='font-weight: bold; font-size: ' + get_font_size('title')
|
||||||
),
|
),
|
||||||
E.div((html_container if is_html_msg else msg), style='padding-top: 1em; margin-top: 1em; border-top: 1px solid currentColor'),
|
E.div((html_container if is_html_msg else msg), style='padding-top: 1em; margin-top: 1em; border-top: 1px solid currentColor'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user