Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils.py
blob: 0fb2026ff1cc785fba8764b506c719c189dab929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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()