Debian Codegraph @

src/pyj/read_book/prefs/utils.pyj

raw
1 # vim:fileencoding=utf-8
2 # License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
3 from __python__ import bound_methods, hash_literals
4
5 from elementmaker import E
6 from gettext import gettext as _
7
8 from widgets import create_button
9
10
11 def create_button_box(restore_defaults_func, apply_func, cancel_func):
12 cbutton = create_button(_('Cancel'), action=cancel_func)
13 if restore_defaults_func:
14 rbutton = create_button(_('Restore defaults'), action=restore_defaults_func)
15 else:
16 rbutton = E.div('\xa0')
17 obutton = create_button(_('OK'), action=apply_func)
18 for b in (rbutton, obutton, cbutton):
19 b.style.marginTop = '1ex'
20 return E.div(
21 style='margin-top: 1rem; display: flex; justify-content: space-between; align-items: flex-start',
22 rbutton,
23 E.div(obutton, E.div('\xa0'), cbutton, style='margin-left: 1rem; display: flex; align-items: flex-start; flex-wrap: wrap'),
24 )