Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rwxr-xr-xutils.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/utils.py b/utils.py
new file mode 100755
index 0000000..0fb2026
--- /dev/null
+++ b/utils.py
@@ -0,0 +1,32 @@
+# -*- mode:python; tab-width:4; indent-tabs-mode:t; -*-
+
+import os
+import gtk
+
+def getFileType(filename):
+ return os.path.basename(filename).split('.').pop()
+
+def copy_file(src, dest):
+ f1 = open(src, "rb")
+ data = f1.read()
+ f1.close()
+ f2 = open(dest, "wb")
+ f2.write(data)
+ f2.close()
+
+def run_dialog(header,msg):
+ """Pops up a blocking dialog box with 'msg'"""
+ dialog = gtk.Dialog(str(header), None, gtk.DIALOG_MODAL,
+ (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+
+ hbox = gtk.HBox(False, 12)
+ hbox.set_border_width(12)
+ dialog.vbox.pack_start(hbox, True, True, 0)
+ hbox.show()
+
+ label = gtk.Label(str(msg))
+ hbox.pack_start(label, False, False, 0)
+ label.show()
+
+ dialog.run()
+ dialog.destroy()