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
@@ -2,6 +2,7 @@
|
||||
|
||||
import os
|
||||
from gi.repository import Gtk
|
||||
from dateutil.parser import parse
|
||||
from gettext import pgettext
|
||||
|
||||
from .view import View
|
||||
@@ -120,11 +121,13 @@ class ProjectsView(View):
|
||||
self.topwidget.set_visible_child(self.box['proj_edit'])
|
||||
|
||||
def on_but_edit_clicked(self, widget):
|
||||
self.newrecord = False
|
||||
self.label['title_edit'].set_text(_("Edit Project"))
|
||||
projid = treeview.get_value(self.tree['projects'], 0)
|
||||
if not projid:
|
||||
return
|
||||
self.newrecord = False
|
||||
self.label['title_edit'].set_text(_("Edit Project"))
|
||||
if not self.record_lock('project', projid):
|
||||
return
|
||||
self.project.load(projid)
|
||||
self.edit_record()
|
||||
self.topwidget.set_visible_child(self.box['proj_edit'])
|
||||
@@ -172,6 +175,7 @@ class ProjectsView(View):
|
||||
# TODO error in infobox
|
||||
print(self.context.db.last_error())
|
||||
return
|
||||
self.record_unlock()
|
||||
if self.newrecord:
|
||||
self.load_list()
|
||||
self.newrecord = False
|
||||
@@ -179,4 +183,5 @@ class ProjectsView(View):
|
||||
self.topwidget.set_visible_child(self.box['proj_detail'])
|
||||
|
||||
def on_but_cancel_clicked(self, widget):
|
||||
self.record_unlock()
|
||||
self.topwidget.set_visible_child(self.box['projects'])
|
||||
Reference in new issue
Block a user