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
super(LockDialog, self).__init__()
53
self.set_title('Lock Not Held')
55
self.get_content_area().add(
57
'This operation cannot be completed as '
58
'another application has locked the branch.')))
60
self.add_button('Break Lock', RESPONSE_BREAK)
61
self.add_button(Gtk.STOCK_CANCEL, RESPONSE_CANCEL)
63
self.get_content_area().show_all()