Initial commit (Vesion 0.1)
[tablet-suite] / src / ui / tsuigeneralmethods.py
diff --git a/src/ui/tsuigeneralmethods.py b/src/ui/tsuigeneralmethods.py
new file mode 100644 (file)
index 0000000..1535527
--- /dev/null
@@ -0,0 +1,32 @@
+# Authors: Amaury Medeiros, Nicholas Alexander and Paulo Ouriques
+# Software License: GPL
+
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+from ui.pcsuiutils import *
+from style.styleTabletSuite import *
+
+def centralize(widget):
+    screen = QtGui.QDesktopWidget().screenGeometry()
+    size = widget.geometry()
+    widget.move((screen.width() - size.width())/2, (screen.height() - size.height())/2)
+    
+def showMessageBox(message, window_title = ""):
+    """ Creates a QMessageBox object and set its window title and text to the
+    given strings.
+    
+    Attributes:
+        String message - Message to be displayed inside the message box.
+        String window_title - String representing the title of the message box.
+    
+    """
+    message_box = QtGui.QMessageBox()
+    message_box.setStyleSheet(MESSAGE_BOX_DEFAULT)
+    message_box.setWindowFlags(QtCore.Qt.FramelessWindowHint)
+    message_box.setWindowTitle(window_title)
+    message_box.setWindowIcon(QtGui.QIcon(BACKUP_IMAGE))
+    message_box.setText(message)
+    message_box.exec_()
+    
+