[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8834 - in trunk/gnue-forms/src/uidrivers/qt3: . widgets
From: |
johannes |
Subject: |
[gnue] r8834 - in trunk/gnue-forms/src/uidrivers/qt3: . widgets |
Date: |
Wed, 18 Oct 2006 03:07:45 -0500 (CDT) |
Author: johannes
Date: 2006-10-18 03:07:44 -0500 (Wed, 18 Oct 2006)
New Revision: 8834
Modified:
trunk/gnue-forms/src/uidrivers/qt3/dialogs.py
trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py
Log:
Fixed dialogs and added AboutBox
Modified: trunk/gnue-forms/src/uidrivers/qt3/dialogs.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/dialogs.py 2006-10-18 07:46:51 UTC
(rev 8833)
+++ trunk/gnue-forms/src/uidrivers/qt3/dialogs.py 2006-10-18 08:07:44 UTC
(rev 8834)
@@ -25,8 +25,9 @@
"""
import qt
-import gnue
+from gnue.forms import VERSION
+
__all__ = ['ExceptionDialog', 'InputDialog']
# =============================================================================
@@ -117,6 +118,88 @@
# =============================================================================
+# AboutDialog
+# =============================================================================
+
+class AboutBox(qt.QDialog):
+ """
+ Displays an about dialog for the current application
+ """
+
+ # -------------------------------------------------------------------------
+ # Constructor
+ # -------------------------------------------------------------------------
+
+ def __init__(self, parent, name, version, author, descr, icon):
+ """
+ @param parent: QT widget to be the parent of the dialog
+ @param name: name of the application
+ @param version: version of the application
+ @param author: author of the application
+ @param description: text describing the form
+ @param icon: path to the appication's icon
+ """
+
+ qt.QDialog.__init__(self, parent)
+
+ current = self.font()
+ small = qt.QFont(current.family(), current.pointSize()-1)
+ bold = qt.QFont(current.family(), current.pointSize(), qt.QFont.Bold)
+
+ self.setCaption(u_("About %s") % name)
+
+ vbox = qt.QVBoxLayout(self, 4)
+ vbox.setMargin(12)
+
+ if icon:
+ label = qt.QLabel(self)
+ label.setPixmap(qt.QPixmap(icon))
+ vbox.addWidget(label, 0, qt.Qt.AlignHCenter)
+
+ label = qt.QLabel(name, self)
+ label.setFont(bold)
+ vbox.addWidget(label, 0, qt.Qt.AlignHCenter)
+
+ if version:
+ label = qt.QLabel(u_("Version: %s") % version, self)
+ label.setFont(small)
+ vbox.addWidget(label, 0, qt.Qt.AlignHCenter)
+
+ if author:
+ label = qt.QLabel(author, self)
+ vbox.addWidget(label, 0, qt.Qt.AlignHCenter)
+
+ if descr:
+ label = qt.QLabel(descr, self)
+ vbox.addWidget(label, 1, qt.Qt.AlignHCenter | qt.Qt.WordBreak)
+
+ sep = qt.QFrame(self, "separatorline")
+ sep.setFrameStyle(qt.QFrame.HLine | qt.QFrame.Sunken)
+ vbox.addWidget(sep, 0)
+
+ label = qt.QLabel("GNU Enterprise Forms", self)
+ label.setFont(bold)
+ vbox.addWidget(label, 0, qt.Qt.AlignHCenter)
+
+ vers = "Version %s / %s %s" % (VERSION, 'QT', qt.qVersion())
+ label = qt.QLabel(vers, self)
+ label.setFont(small)
+ vbox.addWidget(label, 0, qt.Qt.AlignHCenter)
+
+ hbox = qt.QHBoxLayout(4)
+ hbox.addStretch(1)
+
+ ok = qt.QPushButton(u_("Ok"), self)
+ self.connect(ok, qt.SIGNAL('clicked()'), self.accept)
+ hbox.addWidget(ok, 0)
+
+ hbox.addStretch(1)
+
+ vbox.addLayout(hbox)
+
+
+
+# =============================================================================
# LineEdit widget for InputDialog
# =============================================================================
Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py 2006-10-18 07:46:51 UTC
(rev 8833)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/form.py 2006-10-18 08:07:44 UTC
(rev 8834)
@@ -25,7 +25,10 @@
"""
import qt
+import os
+from gnue.common.apps import GConfig
+from gnue.forms.uidrivers.qt3 import dialogs
from gnue.forms.uidrivers.qt3.MenuBar import MenuBar
from gnue.forms.uidrivers.qt3.ToolBar import ToolBar
from gnue.forms.uidrivers.qt3.widgets._base import UIHelper
@@ -90,7 +93,8 @@
self.main_window.setCaption(self._form.title)
self.main_widget = qt.QWidget(self.main_window)
- self.main_window.setCentralWidget(self.main_widget)
+ if self._form.style != 'dialog':
+ self.main_window.setCentralWidget(self.main_widget)
base_sizer = qt.QVBoxLayout(self.main_widget)
base_sizer.setMargin(6)
@@ -311,6 +315,19 @@
# -------------------------------------------------------------------------
+ def _ui_show_about_(self, name, version, author, description):
+ """
+ Show the about box describing the current application
+ """
+ idir = GConfig.getInstalledBase('forms_images', 'common_images')
+ icon = os.path.join(idir, 'gnue-icon.png')
+
+ dlg = dialogs.AboutBox(self.main_window, name, version, author,
+ description, icon)
+ dlg.exec_loop()
+
+ # -------------------------------------------------------------------------
+
def _ui_close_(self):
"""
Close the window (acutally only hide it)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8834 - in trunk/gnue-forms/src/uidrivers/qt3: . widgets,
johannes <=