summaryrefslogtreecommitdiff
path: root/rapid/misc.py
diff options
context:
space:
mode:
authorJulien Valroff <julien@kirya.net>2009-11-23 20:25:27 +0100
committerJulien Valroff <julien@kirya.net>2009-11-23 20:25:27 +0100
commit1c557f52d4963e0ecf4f8a53a9099b2118137d5f (patch)
treebaa1fddd7d2db087fe253b79b7ea5aaee5484a9f /rapid/misc.py
parent2776d880a5614382f94985bf314ef48b388cc5ae (diff)
Imported Upstream version 0.1.0~b2
Diffstat (limited to 'rapid/misc.py')
-rw-r--r--rapid/misc.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/rapid/misc.py b/rapid/misc.py
new file mode 100644
index 0000000..1e023ad
--- /dev/null
+++ b/rapid/misc.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- coding: latin1 -*-
+
+### Copyright (C) 2002-2006 Stephen Kennedy <stevek@gnome.org>
+
+### This program is free software; you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 2 of the License, or
+### (at your option) any later version.
+
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+
+### You should have received a copy of the GNU General Public License
+### along with this program; if not, write to the Free Software
+### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# modified by Damon Lynch 2009 to remove default bold formatting and alignment
+"""Module of commonly used helper classes and functions
+
+"""
+
+import gtk
+
+def run_dialog( text, secondarytext=None, parent=None, messagetype=gtk.MESSAGE_WARNING, buttonstype=gtk.BUTTONS_OK, extrabuttons=[]):
+ """Run a dialog with text 'text'.
+ Extra buttons are passed as tuples of (button label, response id).
+ """
+ d = gtk.MessageDialog(None,
+ gtk.DIALOG_DESTROY_WITH_PARENT,
+ messagetype,
+ buttonstype,
+ text
+ )
+ if parent:
+ d.set_transient_for(parent.widget.get_toplevel())
+ for b,rid in extrabuttons:
+ d.add_button(b,rid)
+ d.vbox.set_spacing(12)
+ d.format_secondary_text(secondarytext)
+ ret = d.run()
+ d.destroy()
+ return ret