bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/brz-gtk
1
by Gustav Hartvigsson
Inital code |
1 |
from breezy import ui |
2 |
import gi |
|
3 |
gi.require_version("Gtk", "3.0") |
|
4 |
from gi.repository import Gtk |
|
5 |
||
6 |
class GtkUI (ui.UIFactory): |
|
7 |
def __init__(self): |
|
8 |
super (GtkUI, self).__init__() |
|
9 |
||
10 |
def __enter__ (self): |
|
11 |
Gtk.init () |
|
12 |
return self |
|
13 |
||
14 |
def confirm_action (self, prompt, confirmation_id, prompt_kwargs): |
|
15 |
dialog = Gtk.MessageDialog ( |
|
16 |
flags=0, |
|
17 |
message_type=Gtk.MessageType.INFO, |
|
18 |
buttons=Gtk.Buttons.YES_NO, |
|
19 |
text = 'Breezy', |
|
20 |
)
|
|
21 |
dialog.format_secondary_text (prompt) |
|
22 |
response = dialog.run () |
|
23 |
dialog.destroy () |
|
24 |
if (response == Gtk.ResponseType.YES): |
|
25 |
return True |
|
26 |
else: |
|
27 |
return False |
|
28 |