/+junk/brz-gtk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/brz-gtk

« back to all changes in this revision

Viewing changes to gtk-ui-factory.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-07 22:07:05 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210107220705-91rr3apmlsgk1pas
Inital code
* I'm trying to figure out what the frying factory I'm doing,
  but I think I can get something up and running...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
from breezy import ui
 
3
import gi
 
4
gi.require_version("Gtk", "3.0")
 
5
from gi.repository import Gtk
 
6
 
 
7
class GtkUI (ui.UIFactory):
 
8
  def __init__(self):
 
9
    super (GtkUI, self).__init__()
 
10
  
 
11
  def __enter__ (self):
 
12
    Gtk.init ()
 
13
    return self
 
14
  
 
15
  def confirm_action (self, prompt, confirmation_id, prompt_kwargs):
 
16
    dialog = Gtk.MessageDialog (
 
17
      flags=0,
 
18
      message_type=Gtk.MessageType.INFO,
 
19
      buttons=Gtk.Buttons.YES_NO,
 
20
      text = 'Breezy',
 
21
    )
 
22
    dialog.format_secondary_text (prompt)
 
23
    response = dialog.run ()
 
24
    dialog.destroy ()
 
25
    if (response == Gtk.ResponseType.YES):
 
26
      return True
 
27
    else:
 
28
      return False