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
+48
-2
@@ -35,6 +35,24 @@ class CompaniesView(View):
|
||||
treeview.add_column(self.tree['companies'], _('Remarks'), 3)
|
||||
self.tree['companies'].set_model(self.lst_companies)
|
||||
|
||||
# subscribe to data change events
|
||||
self.context.subscribe("dd_comptype_modified", self.comptype_modified)
|
||||
|
||||
def get_list_row(self):
|
||||
return (
|
||||
self.comp.compid,
|
||||
self.comp.compname,
|
||||
self.dd_comptype.get(self.comp.comptype, ''),
|
||||
self.comp.remarks
|
||||
)
|
||||
|
||||
def add_row(self):
|
||||
treeiter = self.lst_companies.append(self.get_list_row())
|
||||
self.tree['companies'].get_selection().select_iter(treeiter)
|
||||
|
||||
def refresh_row(self):
|
||||
treeview.set_row_values(self.tree['companies'], self.get_list_row())
|
||||
|
||||
def load_list(self):
|
||||
selected_id = treeview.get_value(self.tree['companies'])
|
||||
self.lst_companies.clear()
|
||||
@@ -52,6 +70,25 @@ class CompaniesView(View):
|
||||
# restore previous selected row
|
||||
selection.select_iter(treeiter)
|
||||
|
||||
def comptype_modified(self, eventtype, data):
|
||||
self.dd_comptype[data[0]] = data[1]
|
||||
lst1 = self.combo['flt_type'].get_model()
|
||||
lst2 = self.combo['comptype'].get_model()
|
||||
lst3 = self.combo['comptype2'].get_model()
|
||||
if eventtype == self.context.EVENT_UPD:
|
||||
for l in (lst1, lst2, lst3):
|
||||
for row in l:
|
||||
if row[0] == data[0]:
|
||||
row[1] = data[1]
|
||||
return
|
||||
elif eventtype == self.context.EVENT_ADD:
|
||||
lst1.append(data)
|
||||
lst2.append(data)
|
||||
lst3.append(data)
|
||||
else:
|
||||
# not implemented
|
||||
pass
|
||||
|
||||
def clear_record(self):
|
||||
self.comp.clear()
|
||||
self.entry['compname'].set_text('')
|
||||
@@ -128,7 +165,7 @@ class CompaniesView(View):
|
||||
self.comp.web = self.entry['web'].get_text()
|
||||
self.comp.customerno = self.entry['customerno'].get_text()
|
||||
self.comp.contractno = self.entry['contractno'].get_text()
|
||||
self.comp.flags = self.get_checks(('historic', 'ordered'))
|
||||
self.comp.flags = self.get_checks(('historic', 'deleted'))
|
||||
self.comp.remarks = gtkutils.get_text_contents(self.text['remarks'])
|
||||
|
||||
# buttons on list page
|
||||
@@ -193,7 +230,16 @@ class CompaniesView(View):
|
||||
pass
|
||||
self.record_unlock()
|
||||
if self.newrecord:
|
||||
self.load_list()
|
||||
#self.load_list()
|
||||
self.add_row()
|
||||
self.context.publish("company_modified", self.context.EVENT_ADD,
|
||||
(self.comp.pk_value, self.comp.comptype, self.comp.compname)
|
||||
)
|
||||
else:
|
||||
self.refresh_row()
|
||||
self.context.publish("company_modified", self.context.EVENT_UPD,
|
||||
(self.comp.pk_value, self.comp.comptype, self.comp.compname)
|
||||
)
|
||||
self.newrecord = False
|
||||
self.display_record()
|
||||
self.topwidget.set_visible_child(self.box['comp_detail'])
|
||||
|
||||
Reference in new issue
Block a user