[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8698 - in trunk/gnue-forms/src/uidrivers/qt3: . widgets/form
From: |
johannes |
Subject: |
[gnue] r8698 - in trunk/gnue-forms/src/uidrivers/qt3: . widgets/form |
Date: |
Mon, 25 Sep 2006 09:27:15 -0500 (CDT) |
Author: johannes
Date: 2006-09-25 09:27:14 -0500 (Mon, 25 Sep 2006)
New Revision: 8698
Removed:
trunk/gnue-forms/src/uidrivers/qt3/QTSplashScreen.py
Modified:
trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py
trunk/gnue-forms/src/uidrivers/qt3/widgets/form/widget.py
Log:
Don't override inherited implementation of initialize(); added splash
screen support
Deleted: trunk/gnue-forms/src/uidrivers/qt3/QTSplashScreen.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/QTSplashScreen.py 2006-09-25
13:38:39 UTC (rev 8697)
+++ trunk/gnue-forms/src/uidrivers/qt3/QTSplashScreen.py 2006-09-25
14:27:14 UTC (rev 8698)
@@ -1,105 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# SplashScreen.py
-#
-# DESCRIPTION:
-"""
-A QT based splash screen
-"""
-# NOTES:
-#
-
-## FIXME ##
-
-from qt import *
-from gnue.common.apps import GConfig
-from gnue.forms import VERSION
-
-class QTSplashScreen: ###(SplashScreen):
- def __init__(self):
- return
-
- images_dir = GConfig.getInstalledBase('forms_images','common_images') + '/'
- bitmapFile=images_dir+gConfigForms('splashScreenPNG')
-
- SplashScreen.__init__(self,None,bitmapfile=bitmapFile,
- duration = 3000, callback=self.onCloseSplash,
-
style=wxCENTRE_ON_SCREEN|wxSIMPLE_BORDER|wxSTAY_ON_TOP
- ) # TODO: A 2.4 thing? ->
wxSPLASH_TIMEOUT|wxFRAME_NO_TASKBAR)
- swidth,sheight = self.GetSizeTuple()
-
- # Make the splash text print white
- self.SetForegroundColour(wxColour(0xFF, 0xFF, 0xFF))
- self.SetFont(wxFont(20,wxSWISS,wxNORMAL,wxBOLD))
-
- text = _("GNU Enterprise Forms")
- twidth,theight = self.GetTextExtent(text)
- wxStaticText(parent=self, id=-1, label=str(text),
-
size=wxSize(swidth,theight),pos=wxPoint(1,1),style=wxALIGN_CENTRE)
-
- self.SetFont(wxFont(10,wxSWISS,wxNORMAL,wxBOLD))
-
- text = _("Version %s") % VERSION
- twidth,theight = self.GetTextExtent(text)
- wxStaticText(parent=self, id=-1, label=str(text),
- size=wxSize(swidth,theight),
pos=wxPoint(1,25),style=wxALIGN_CENTRE)
-
- text = "(c)2000-2004 Free Software Foundation"
- twidth,theight = self.GetTextExtent(text)
- wxStaticText(self, -1, str(text),
- wxPoint(1,50),wxSize(swidth,theight),wxALIGN_CENTRE)
-
- text = _("Protected by GNU General Public Licence 2.0")
- wxStaticText(self, -1, str(text),
-
wxPoint(1,sheight-(theight+10)),wxSize(swidth-5,theight),wxALIGN_RIGHT)
-
- self.CenterOnScreen()
- self.Show(true)
-
- #
- # onCloseSplash
- #
- # Called by SplashScreen when timer expires
- #
- # If the splashscreen has timed out before the form is
- # ready then go ahead and display what we've got. This
- # is a desperate attempt to eliminate the vile
- #
- # Gdk-ERROR **: BadWindow (invalid Window parameter)
- # serial 1228 error_code 3 request_code 15 minor_code 0
- #
- # on heavily loaded machines. The key line seems to be
- # wxYield() but I'm leaving the others there because I
- # can :P The fix works for me all the way down to a
- # splash duration=1 millisecond
- #
- def onCloseSplash(self):
- #self._wxapp.SetTopWindow(self.mainWindow) #TODO: May need to put back
but doubt it
- #self.mainWindow.Show(true) #TODO: May need to put back
but doubt it
- wxYield() # Flush the pending queue to insure something is
- # there before the splashscreen dies
-
- # For some reason, a simple Close() doesn't cooperate with
- # the modal login box and all hell breaks loose
- self.Show(0)
- self.Destroy()
-
Modified: trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py 2006-09-25 13:38:39 UTC
(rev 8697)
+++ trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py 2006-09-25 14:27:14 UTC
(rev 8698)
@@ -25,6 +25,7 @@
"""
import sys
+import os.path
from gnue.forms.uidrivers._base import Exceptions
@@ -43,7 +44,6 @@
from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
from gnue.forms.uidrivers.qt3.QTApp import *
-from gnue.forms.uidrivers.qt3.QTSplashScreen import *
from gnue.forms.uidrivers.qt3.widgets._base import *
from gnue.forms.uidrivers.qt3.common import _eventObjToQtWindow,
setWidgetBaseFont
from common import *
@@ -51,17 +51,65 @@
from gnue.forms.uidrivers.qt3 import dialogs
# =============================================================================
+# Splash Screen
+# =============================================================================
+
+class UISplashScreen(QMainWindow):
+
+ # -------------------------------------------------------------------------
+ # Constructor
+ # -------------------------------------------------------------------------
+
+ def __init__(self):
+
+ QMainWindow.__init__(self, None, 'GNUeSplash', Qt.WStyle_Splash |
+ Qt.WStyle_StaysOnTop)
+
+ idir = GConfig.getInstalledBase('forms_images', 'common_images')
+ picture = gConfigForms ('splashScreenPNG')
+ if not os.path.isabs(picture):
+ picture = os.path.join (idir, picture)
+
+ image = QLabel('', self)
+ image.setPixmap(QPixmap(picture))
+
+ self.setCentralWidget(image)
+ self.show()
+ getQtApp().processEvents()
+
+
+
+# =============================================================================
# This class implements the User Interface for QT3
# =============================================================================
class GFUserInterface(commonToolkit.GFUserInterface):
# -------------------------------------------------------------------------
- # Initialization
+ # Constructor
# -------------------------------------------------------------------------
- def initialize(self):
+ def __init__(self, eventHandler, name="Undefined", disableSplash=None,
+ parentContainer=None, moduleName=None):
+ commonToolkit.GFUserInterface.__init__(self, eventHandler, name,
+ disableSplash, parentContainer, moduleName)
+ self.__splash = None
+
+
+ # -------------------------------------------------------------------------
+ # Initialize user interface
+ # -------------------------------------------------------------------------
+
+ def _initialize(self):
+
+ self.name = "QT3"
+
+ if not self._disableSplash:
+ self.__splash = UISplashScreen()
+ else:
+ self.__splash = None
+
self._disabledColour = None
self._qtapp = getQtApp()
fdb = QFontDatabase()
@@ -72,11 +120,6 @@
font.setPointSize(int(gConfigForms('pointSize')))
setWidgetBaseFont(font)
- #
- # SplashScreen
- #
- if not self._disableSplash:
- self.splash = QTSplashScreen()
fm = QFontMetrics(font)
# TODO: Making some assumptions here!!
@@ -104,7 +147,6 @@
# The pixel height of a 1 char widget (for things like buttons)
self.widgetHeight = self.textHeight + 4
-
# -------------------------------------------------------------------------
# Start the application's main loop
# -------------------------------------------------------------------------
@@ -120,7 +162,25 @@
assert gLeave(6)
+
# -------------------------------------------------------------------------
+ # Hide splash screen
+ # -------------------------------------------------------------------------
+
+ def hide_splash(self):
+ """
+ Hide the splash screen (if available)
+ """
+
+ if self.__splash:
+ try:
+ self.__splash.close()
+ self._qtapp.processEvents()
+ finally:
+ self.__splash = None
+
+
+ # -------------------------------------------------------------------------
# Clipbard routines
# -------------------------------------------------------------------------
@@ -139,6 +199,7 @@
def _ui_show_error_(self, message):
+ self.hide_splash()
QMessageBox.critical(None, "GNU Enterprise", message)
@@ -148,7 +209,7 @@
def _ui_show_exception_(self, group, name, message, detail):
- # TODO: check for splash screen
+ self.hide_splash()
dlg = dialogs.ExceptionDialog(group, name, message, detail)
dlg.exec_loop()
Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/form/widget.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/form/widget.py 2006-09-25
13:38:39 UTC (rev 8697)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/form/widget.py 2006-09-25
14:27:14 UTC (rev 8698)
@@ -122,9 +122,11 @@
def show(self):
#self.containerFrame.Show()
self.mainWindow.show()
+ self._uiDriver.hide_splash()
def show_modal(self):
#self.containerFrame.Show()
+ self._uiDriver.hide_splash()
self.mainWindow.exec_loop()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8698 - in trunk/gnue-forms/src/uidrivers/qt3: . widgets/form,
johannes <=