Native gui usable for data editing. Lots of fixes and improvenemts

This commit is contained in:
thooge committed 2026-11-11 18:58:02 +01:00
1 parent a6abdaa614
commit 09387280fc
52 files changed
+1579 -294

No files matched your search

+27 -1
View File
@@ -53,6 +53,28 @@ class DocumentsView(View):
self.dd_access = self.context.lookup.enum('document.roleaccess')
combobox.load_from_dict(self.combo['accesslevel'], self.dd_access)
def get_refcount(self):
if self.doc.docid is None:
return 0
self.db.cur.execute("SELECT COUNT(*) FROM docref WHERE docid=%s", (self.doc.docid,))
return self.db.cur.fetchone()[0]
def get_list_row(self):
return (
self.doc.docid,
self.doc.doctype,
self.doc.filename,
self.doc.title,
self.get_refcount()
)
def add_row(self):
treeiter = self.lst_documents.append(self.get_list_row())
self.tree['documents'].get_selection().select_iter(treeiter)
def refresh_row(self):
treeview.set_row_values(self.tree['documents'], self.get_list_row())
def load_list(self):
selected_id = treeview.get_value(self.tree['documents'])
self.lst_documents.clear()
@@ -102,7 +124,7 @@ class DocumentsView(View):
def display_record(self):
print(self.doc)
self.label['title'].set_text(self.doc.title or '')
self.label['filename'].set_text(self.doc.filename)
self.label['filename'].set_text(self.doc.filename or '')
# self.label['extents'] -> see below
self.label['mimetype'].set_text(self.doc.mimetype)
self.label['filesize'].set_text(self.format_int(self.doc.docsize, suffix="Byte"))
@@ -264,6 +286,10 @@ class DocumentsView(View):
def on_but_save_clicked(self, widget):
print(self.doc)
if self.newrecord:
self.add_row()
else:
self.refresh_row()
def on_but_cancel_clicked(self, widget):
self.topwidget.set_visible_child(self.box['documents'])