Add manifest to manifest
[gpytage.git] / window.py
blob5e28df554f28d159384988b63e5c25b85ec71e9c
1 #!/usr/bin/env python
3 # GPytage window.py module
5 ############################################################################
6 # Copyright (C) 2008 by Kenneth Prugh #
7 # ken69267@gmail.com #
8 # #
9 # This program is free software; you can redistribute it and#or modify #
10 # it under the terms of the GNU General Public License as published by #
11 # the Free Software Foundation under version 2 of the license. #
12 # #
13 # This program is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
17 # #
18 # You should have received a copy of the GNU General Public License #
19 # along with this program; if not, write to the #
20 # Free Software Foundation, Inc., #
21 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
22 ############################################################################
24 import pygtk; pygtk.require("2.0")
25 import gtk
27 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
29 def title(text):
30 """Set the title of the window. Used to indicate changes *"""
31 window.set_title(text)
33 def createMessageDialog(parent, flags, type, buttons, mtitle, message_format):
34 md = gtk.MessageDialog(None, flags, type, buttons, message_format)
35 md.set_title(mtitle)
36 md.run()
37 md.destroy()
39 def unsavedDialog():
40 """
41 Spawn Generic Yes/No/Save Dialog when unsaved changes are present.
43 YES returns -8. NO returns -9. Save returns 1.
45 """
46 uD = gtk.MessageDialog(parent=None, flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_YES_NO, message_format="You have unsaved changes, if you proceed these changes will be lost.\n\n Do you wish to continue?")
47 uD.set_title("You have unsaved changes")
48 uD.set_default_response(gtk.RESPONSE_NO)
49 RESPONSE_SAVE = 1
50 uD.add_button("_Save and Continue", 1)
51 status = uD.run()
52 return status, uD