More work on native gui. Make data editable.
This commit is contained in:
1 parent
5641e1706f
commit
7aa5d2af3b
43 files changed
+2686
-1037
No files matched your search
+15
-19
@@ -32,20 +32,6 @@ class View:
|
||||
self.topwidget = self.builder.get_object("topobject")
|
||||
gtkutils.init_named_controls(self, self.builder)
|
||||
|
||||
css = Gtk.CssProvider()
|
||||
css.load_from_data(b"""
|
||||
.invalid {
|
||||
color: #cc0000;
|
||||
background-color: #ffdddd;
|
||||
}
|
||||
""")
|
||||
|
||||
Gtk.StyleContext.add_provider_for_screen(
|
||||
Gdk.Screen.get_default(),
|
||||
css,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
)
|
||||
|
||||
def format_int(self, ival, separator=True, suffix=None, default=''):
|
||||
if ival is None:
|
||||
return default
|
||||
@@ -133,16 +119,26 @@ class View:
|
||||
else:
|
||||
context.add_class("invalid")
|
||||
|
||||
def set_color_from_entry(self, entry):
|
||||
def set_color_from_entry(self, entry, colorbutton):
|
||||
# TODO this was a fast hack!
|
||||
text = entry.get_text().strip()
|
||||
rgba = Gdk.RGBA()
|
||||
if len(text) == 7 and rgba.parse(text):
|
||||
self.last_valid_rgb = text.lstrip('#')
|
||||
self.entry['color'].set_text(text)
|
||||
self.button['color'].set_rgba(rgba)
|
||||
self.set_entry_valid(self.entry['color'], True)
|
||||
self.entry.set_text(text)
|
||||
colorbutton.set_rgba(rgba)
|
||||
self.set_entry_valid(entry, True)
|
||||
else:
|
||||
self.set_entry_valid(self.entry['color'], False)
|
||||
self.set_entry_valid(entry, False)
|
||||
|
||||
def get_checks(self, checkboxlist):
|
||||
# checkbox helper function
|
||||
# self.check[] from ui file
|
||||
checks = []
|
||||
for c in checkboxlist:
|
||||
if c in self.check and self.check[c].get_active():
|
||||
checks.append(c)
|
||||
return ','.join(checks)
|
||||
|
||||
class DatePicker:
|
||||
def __init__(self, entry, button, datefmt='"%d.%m.%Y"'):
|
||||
|
||||
Reference in new issue
Block a user