Implement record locking for native gui
This commit is contained in:
1 parent
1a6674c819
commit
669c15109a
16 files changed
+162
-66
No files matched your search
+10
-3
@@ -133,11 +133,13 @@ class MaintenanceView(View):
|
||||
self.topwidget.set_visible_child(self.box['maint_edit'])
|
||||
|
||||
def on_but_edit_clicked(self, widget):
|
||||
self.newrecord = False
|
||||
self.label['title_edit'].set_text(_("Edit Maintenance"))
|
||||
maintid = treeview.get_value(self.tree['maintenance'], 0)
|
||||
if not maintid:
|
||||
return
|
||||
self.newrecord = False
|
||||
self.label['title_edit'].set_text(_("Edit Maintenance"))
|
||||
if not self.record_lock('maintenance', maintid):
|
||||
return
|
||||
self.maint.load(maintid)
|
||||
self.edit_record()
|
||||
self.topwidget.set_visible_child(self.box['maint_edit'])
|
||||
@@ -178,13 +180,17 @@ class MaintenanceView(View):
|
||||
if not self.entry['activities'].get_text().strip():
|
||||
# TODO error marker
|
||||
return
|
||||
self.save_record()
|
||||
if not self.save_record():
|
||||
pass
|
||||
if not self.record_lock('maintenance', self.maint.maintid):
|
||||
return
|
||||
print(self.maint)
|
||||
if not self.maint.save():
|
||||
print("Save error")
|
||||
# TODO error in infobox
|
||||
print(self.context.db.last_error())
|
||||
return
|
||||
self.record_unlock()
|
||||
if self.newrecord:
|
||||
self.load_list()
|
||||
self.newrecord = False
|
||||
@@ -192,4 +198,5 @@ class MaintenanceView(View):
|
||||
self.topwidget.set_visible_child(self.box['maint_detail'])
|
||||
|
||||
def on_but_cancel_clicked(self, widget):
|
||||
self.record_unlock()
|
||||
self.topwidget.set_visible_child(self.box['maintenance'])
|
||||
Reference in new issue
Block a user