Native gui usable for data editing. Lots of fixes and improvenemts
This commit is contained in:
1 parent
a6abdaa614
commit
09387280fc
52 files changed
+1579
-294
No files matched your search
+22
-15
@@ -31,17 +31,23 @@ class StorageView(View):
|
||||
self.dd_stype = self.context.lookup.dropdown(Dropdown.STORAGE_TYPE)
|
||||
combobox.load_from_dict(self.combo['type'], self.dd_stype, storage.GENERIC)
|
||||
|
||||
self.dd_unit = self.context.lookup.enum('storage.capaunit')
|
||||
combobox.load_from_dict(self.combo['unit'], {"-1": _("─── none ───")} | self.dd_unit)
|
||||
self.dd_capaunit = self.context.lookup.enum('storage.capaunit')
|
||||
combobox.load_from_dict(self.combo['capaunit'], {"-1": _("─── none ───")} | self.dd_capaunit)
|
||||
|
||||
def get_list_row(self):
|
||||
return (
|
||||
self.storage.sid,
|
||||
self.storage.sname,
|
||||
f"{self.storage.x}, {self.storage.y}, {self.storage.z}",
|
||||
self.storage.remarks
|
||||
)
|
||||
|
||||
def add_row(self):
|
||||
pass
|
||||
treeiter = self.lst_storage.append(self.get_list_row())
|
||||
self.tree['storage'].get_selection().select_iter(treeiter)
|
||||
|
||||
def refresh_row(self):
|
||||
treeview.set_value(self.tree['storage'], 1, self.storage.name)
|
||||
position = f"({self.storage.x}, {self.storage.y}, {self.storage.z})"
|
||||
treeview.set_value(self.tree['storage'], 2, position)
|
||||
treeview.set_value(self.tree['storage'], 3, self.storage.remarks)
|
||||
treeview.set_row_values(self.tree['storage'], self.get_list_row())
|
||||
|
||||
def load_list(self):
|
||||
selected_id = treeview.get_value(self.tree['storage'])
|
||||
@@ -73,7 +79,7 @@ class StorageView(View):
|
||||
self.spin['angle'].set_value(0)
|
||||
self.spin['capacity'].set_value(0)
|
||||
combobox.activate_row(self.combo['type'], storage.GENERIC)
|
||||
combobox.activate_row(self.combo['unit'], "-1")
|
||||
combobox.activate_row(self.combo['capaunit'], "-1")
|
||||
self.text['remarks'].get_buffer().set_text('')
|
||||
self.entry['sname'].grab_focus()
|
||||
|
||||
@@ -83,7 +89,7 @@ class StorageView(View):
|
||||
self.label['position'].set_text(f"({self.storage.x}, {self.storage.y}, {self.storage.z})")
|
||||
self.label['dimension'].set_text(f"({self.storage.wx}, {self.storage.wy}, {self.storage.wz})")
|
||||
self.label['angle'].set_text(f"{self.storage.angle}°")
|
||||
self.label['capacity'].set_text(f"{self.storage.capacity} {self.storage.capaunit}")
|
||||
self.label['capacity'].set_text(f"{self.storage.capacity} {self.storage.capaunit or ''}")
|
||||
if self.storage.color:
|
||||
self.label['color'].set_markup(f'#{self.storage.color} <span foreground="#{self.storage.color}">●</span>')
|
||||
else:
|
||||
@@ -102,7 +108,7 @@ class StorageView(View):
|
||||
self.spin['angle'].set_value(self.storage.angle)
|
||||
self.spin['capacity'].set_value(self.storage.capacity or 0)
|
||||
combobox.activate_row(self.combo['type'], self.storage.stype)
|
||||
combobox.activate_row(self.combo['unit'], self.storage.capaunit or -1)
|
||||
combobox.activate_row(self.combo['capaunit'], self.storage.capaunit or "-1")
|
||||
self.entry['color'].set_text('#' + (self.storage.color or '000000'))
|
||||
rgba = Gdk.RGBA()
|
||||
rgba.parse('#' + (self.storage.color or '000000'))
|
||||
@@ -122,7 +128,7 @@ class StorageView(View):
|
||||
self.storage.wz = self.spin['wz'].get_value_as_int()
|
||||
self.storage.angle = self.spin['angle'].get_value_as_int()
|
||||
self.storage.capacity = self.spin['capacity'].get_value_as_int()
|
||||
self.storage.capaunit = combobox.get_list_value(self.combo['unit'])
|
||||
self.storage.capaunit = combobox.get_list_value(self.combo['capaunit'])
|
||||
if self.storage.capaunit == '-1':
|
||||
self.storage.capaunit = None
|
||||
self.storage.color = self.entry['color'].get_text().lstrip('#')
|
||||
@@ -191,12 +197,13 @@ class StorageView(View):
|
||||
pass
|
||||
self.record_unlock()
|
||||
if self.newrecord:
|
||||
self.load_list()
|
||||
self.context.publish("storage_added", (self.storage.pk_value, self.storage.sname))
|
||||
#self.load_list()
|
||||
self.add_row()
|
||||
self.context.publish("storage_modified", self.context.EVENT_ADD, (self.storage.pk_value, self.storage.sname))
|
||||
self.newrecord = False
|
||||
else:
|
||||
self.context.publish("storage_changed", (self.storage.pk_value, self.storage.sname))
|
||||
# TODO aktuelle Listenzeile aktualisieren!
|
||||
self.refresh_row()
|
||||
self.context.publish("storage_modified", self.context.EVENT_UPD, (self.storage.pk_value, self.storage.sname))
|
||||
self.display_record()
|
||||
self.topwidget.set_visible_child(self.box['stor_detail'])
|
||||
|
||||
|
||||
Reference in new issue
Block a user