1
from gi.repository import Gtk
5
RESPONSE_CANCEL = Gtk.ResponseType.CANCEL
11
def acquire(branch, lock_type):
12
if branch.get_physical_lock_status():
13
dialog = LockDialog(branch)
14
response = dialog.run()
17
if response == RESPONSE_BREAK:
24
elif lock_type == WRITE:
31
if branch.get_physical_lock_status():
32
dialog = LockDialog(branch)
33
response = dialog.run()
36
if response == RESPONSE_BREAK:
38
elif response == RESPONSE_CANCEL:
46
class LockDialog(Gtk.Dialog):
48
def __init__(self, branch):
49
GObject.GObject.__init__(self)
53
self.set_title('Lock Not Held')
55
self.vbox.add(Gtk.Label(label='This operation cannot be completed as ' \
56
'another application has locked the branch.'))
58
self.add_button('Break Lock', RESPONSE_BREAK)
59
self.add_button(Gtk.STOCK_CANCEL, RESPONSE_CANCEL)