1
from gi.repository import GObject
2
from gi.repository import Gtk
6
RESPONSE_CANCEL = Gtk.ResponseType.CANCEL
12
def acquire(branch, lock_type):
13
if branch.get_physical_lock_status():
14
dialog = LockDialog(branch)
15
response = dialog.run()
18
if response == RESPONSE_BREAK:
25
elif lock_type == WRITE:
32
if branch.get_physical_lock_status():
33
dialog = LockDialog(branch)
34
response = dialog.run()
37
if response == RESPONSE_BREAK:
39
elif response == RESPONSE_CANCEL:
47
class LockDialog(Gtk.Dialog):
49
def __init__(self, branch):
50
GObject.GObject.__init__(self)
54
self.set_title('Lock Not Held')
56
self.vbox.add(Gtk.Label(label='This operation cannot be completed as ' \
57
'another application has locked the branch.'))
59
self.add_button('Break Lock', RESPONSE_BREAK)
60
self.add_button(Gtk.STOCK_CANCEL, RESPONSE_CANCEL)