Initial commit (Vesion 0.1)
[tablet-suite] / src / ui / .svn / text-base / tsuigeneralmethods.py.svn-base
1 # Authors: Amaury Medeiros, Nicholas Alexander and Paulo Ouriques
2 # Software License: GPL
3
4 from PyQt4 import QtGui
5 from PyQt4 import QtCore
6
7 from ui.pcsuiutils import *
8 from style.styleTabletSuite import *
9
10 def centralize(widget):
11     screen = QtGui.QDesktopWidget().screenGeometry()
12     size = widget.geometry()
13     widget.move((screen.width() - size.width())/2, (screen.height() - size.height())/2)
14     
15 def showMessageBox(message, window_title = ""):
16     """ Creates a QMessageBox object and set its window title and text to the
17     given strings.
18     
19     Attributes:
20         String message - Message to be displayed inside the message box.
21         String window_title - String representing the title of the message box.
22     
23     """
24     message_box = QtGui.QMessageBox()
25     message_box.setStyleSheet(MESSAGE_BOX_DEFAULT)
26     message_box.setWindowFlags(QtCore.Qt.FramelessWindowHint)
27     message_box.setWindowTitle(window_title)
28     message_box.setWindowIcon(QtGui.QIcon(BACKUP_IMAGE))
29     message_box.setText(message)
30     message_box.exec_()
31     
32