File: utils.py

package info (click to toggle)
update-manager 0.42.2ubuntu22-11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,908 kB
  • ctags: 753
  • sloc: python: 3,738; sh: 2,971; xml: 1,571; makefile: 690; ansic: 38
file content (23 lines) | stat: -rw-r--r-- 578 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gtk

def str_to_bool(str):
  if str == "0" or str.upper() == "FALSE":
    return False
  return True

def utf8(str):
  return unicode(str, 'latin1').encode('utf-8')


def error(parent, summary, message):
  d = gtk.MessageDialog(parent=parent,
                        flags=gtk.DIALOG_MODAL,
                        type=gtk.MESSAGE_ERROR,
                        buttons=gtk.BUTTONS_CLOSE)
  d.set_markup("<big><b>%s</b></big>\n\n%s" % (summary, message))
  d.realize()
  d.window.set_functions(gtk.gdk.FUNC_MOVE)
  d.set_title("")
  res = d.run()
  d.destroy()
  return