a working quit button wow how advanced
This commit is contained in:
parent
765f148805
commit
03376ffd7f
3 changed files with 16 additions and 9 deletions
16
buypeeb.py
16
buypeeb.py
|
@ -69,8 +69,22 @@ class BuypeebApp:
|
|||
self.settings.save()
|
||||
self.app.quit()
|
||||
|
||||
def msgBox(self, title, text, form = Gtk.MessageType.WARNING):
|
||||
msgbox = Gtk.MessageDialog(self.window, 0, form, Gtk.ButtonsType.OK, title)
|
||||
msgbox.format_secondary_text(text)
|
||||
response = msgbox.run()
|
||||
msgbox.destroy()
|
||||
return response
|
||||
|
||||
def btnAddClicked(self, widget):
|
||||
pass
|
||||
self.msgBox("good job", "succkeess")
|
||||
|
||||
def btnQuitClicked(self, widget):
|
||||
prompt = Gtk.MessageDialog(self.window, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, "Really quit?")
|
||||
prompt.format_secondary_text("Are you sure you want to quit buypeeb?")
|
||||
response = prompt.run()
|
||||
if response:
|
||||
self.shutdown(self)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = BuypeebApp()
|
||||
|
|
|
@ -12,12 +12,5 @@ def get_exchange_rate():
|
|||
except:
|
||||
return 76.15
|
||||
|
||||
def msgBox(title, text, form = Gtk.MessageType.WARNING):
|
||||
msgbox = Gtk.MessageDialog(app.window, 0, form, Gtk.ButtonsType.OK, title)
|
||||
msgbox.format_secondary_text(text)
|
||||
response = msgbox.run()
|
||||
msgbox.destroy()
|
||||
return response
|
||||
|
||||
def rmatch(pattern, string):
|
||||
return re.match(pattern, string) != None
|
||||
|
|
|
@ -322,10 +322,10 @@
|
|||
<object class="GtkToolButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="action_name">app.shutdown</property>
|
||||
<property name="label" translatable="yes">Quit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-quit</property>
|
||||
<signal name="clicked" handler="btnQuitClicked" swapped="no"/>
|
||||
<accelerator key="q" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
Loading…
Reference in a new issue