[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8696 - in trunk/gnue-forms/src/uidrivers: . qt3
From: |
johannes |
Subject: |
[gnue] r8696 - in trunk/gnue-forms/src/uidrivers: . qt3 |
Date: |
Mon, 25 Sep 2006 08:34:47 -0500 (CDT) |
Author: johannes
Date: 2006-09-25 08:34:47 -0500 (Mon, 25 Sep 2006)
New Revision: 8696
Added:
trunk/gnue-forms/src/uidrivers/qt3/
trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py
trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py
trunk/gnue-forms/src/uidrivers/qt3/dialogs.py
trunk/gnue-forms/src/uidrivers/qt3/widgets/
Removed:
trunk/gnue-forms/src/uidrivers/qt/
trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py
trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py
trunk/gnue-forms/src/uidrivers/qt3/widgets/
Log:
Renamed uidriver from qt to qt3
issue88 in-progress
Copied: trunk/gnue-forms/src/uidrivers/qt3 (from rev 8694,
trunk/gnue-forms/src/uidrivers/qt)
Deleted: trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt/ToolBar.py 2006-09-25 09:27:22 UTC
(rev 8694)
+++ trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py 2006-09-25 13:34:47 UTC
(rev 8696)
@@ -1,125 +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:
-# qt/ToolBar.py
-#
-# DESCRIPTION:
-# NOTES:
-#
-
-import string, sys
-from qt import *
-from gnue.forms.uidrivers._commonGuiToolkit.ToolBar import ToolBar as
_BaseToolBar
-
-class ToolBar(_BaseToolBar):
-
- # Create the menu
- def init(self):
- self.toolbar = QToolBar(_("Forms Navigation"), self.container)
- self.toolbar.show()
- return self.toolbar
-
- # Add a menu item (action)
- def addAction(self, name, userAction):
- iconloc = userAction.getIconLocation(size="24x24")
- grayloc = userAction.getIconLocation(size="24x24-gray")
-
- # Set the action icon if available
- if iconloc:
- try:
- # Some caching logic for faster second/third forms
- icon = _cachedIcons[iconloc]
- except KeyError:
- icon = QIconSet(QPixmap(iconloc))
- _cachedIcons[iconloc] = icon
- if grayloc:
- icon.setPixmap(QPixmap(grayloc), QIconSet.Automatic,
QIconSet.Normal, QIconSet.Off)
- else:
- print "** WARNING: No gray version of '%s' to toolbar; no icon" %
userAction.event
-
- else:
- print "** WARNING: Cannot add '%s' to toolbar; no icon" %
userAction.event
- return
-
- action = QAction(self.toolbar, name)
- action.setIconSet(icon)
- action.setText(name)
- if userAction.canToggle:
- action.setToggleAction(True)
-
- # Set popup tooltip
- try:
- action.setToolTip(userAction.help)
- except AttributeError:
- action.setToolTip(userAction.description)
-
-
- # Set status tip TODO: Doesn't seem to do anything
- try:
- action.setStatusTip(userAction.description)
- except AttributeError:
- pass
-
- # Connect to the events
- event = 'request%s' % userAction.event
- function = '_%s_activate' % id(action)
- if userAction.canToggle:
- self.__dict__[function] = lambda state, l=self.driver, \
- e=event, a=action, \
- te='request%s' % userAction.canToggle, \
- f=self.form: l.dispatchEvent(state and e or te,_form=f)
-
- QObject.connect(action, SIGNAL('toggled(bool)'),self.__dict__[function])
- else:
- self.__dict__[function] = lambda l=self.driver, e=event, f=self.form:
l.dispatchEvent(e,_form=f)
- QObject.connect(action, SIGNAL('activated()'), self.__dict__[function])
-
- # Add ourself to toolbar
- action.addTo(self.toolbar)
-
- return action
-
-
- # Add a separator
- def addSeparator(self):
- self.toolbar.addSeparator()
-
- # Enable a menu item
- def enableItem(self, item):
- item.setEnabled(True)
-
- # Disable a menu item
- def disableItem(self, item):
- item.setEnabled(False)
-
- def startingItem(self, item):
- item.setOn(True)
-
- def endingItem(self, item):
- item.setOn(False)
-
- # A menu item was selected
- def __itemSelected(self, itemid):
- print "foobar"
- self.driver.dispatchEvent(self.__idmap[itemid], _form=self.form)
-
-
-_cachedIcons = {}
Copied: trunk/gnue-forms/src/uidrivers/qt3/ToolBar.py (from rev 8695,
trunk/gnue-forms/src/uidrivers/qt/ToolBar.py)
Deleted: trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt/UIdriver.py 2006-09-25 09:27:22 UTC
(rev 8694)
+++ trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py 2006-09-25 13:34:47 UTC
(rev 8696)
@@ -1,183 +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:
-# UIqt.py
-#
-# DESCRIPTION:
-"""
-A pyQT based user interface driver for GNUe forms.
-"""
-# NOTES:
-#
-
-import sys
-import string
-
-from gnue.forms.uidrivers._base import Exceptions
-
-try:
- from qt import *
-except ImportError:
- raise Exceptions.DriverNotSupported, _("The GNUe-Forms QT3 driver requires
PyQT.")
-
-from gnue.common import events
-from gnue.common.apps import GConfig
-from gnue.common.utils.TextUtils import lineWrap
-
-from gnue.forms import VERSION
-from gnue.forms.GFForm import *
-from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
-
-from gnue.forms.uidrivers.qt.QTApp import *
-from gnue.forms.uidrivers.qt.QTSplashScreen import *
-from gnue.forms.uidrivers.qt.widgets._base import *
-from gnue.forms.uidrivers.qt.common import _eventObjToQtWindow,
setWidgetBaseFont
-from common import *
-
-
-
-#
-# GFUserInterface
-#
-# The public interface to the User Interface
-# All UIs must provide this class
-#
-class GFUserInterface(commonToolkit.GFUserInterface):
-
- def initialize(self):
-
- self._disabledColour = None
-
- self._qtapp = getQtApp()
-
- fdb = QFontDatabase()
-
- #
- # TODO: Wouldn't it be nice if this actually picked a font
- # TODO: that didn't suck.
- #
- #fixedFont = ""
- #for family in fdb.families():
- # for style in fdb.styles(family):
- # if fdb.isFixedPitch(family,style):
- # fixedFont = fdb.font(family,style,int(gConfigForms('pointSize')))
- # break
- # if fixedFont != "":
- # break
- #font = fixedFont
-
- font = QFont("Courier 10 Pitch", int(gConfigForms('pointSize')))
- font.setFixedPitch(True)
-
- #info = QFontInfo(font)
- #print "DATA:", info.family(),info.fixedPitch()
- font.setPointSize(int(gConfigForms('pointSize')))
- setWidgetBaseFont(font)
-
- #
- # SplashScreen
- #
- if not self._disableSplash:
- self.splash = QTSplashScreen()
-
- fm = QFontMetrics(font)
- # TODO: Making some assumptions here!!
- maxWidth=0
- checkchars = string.printable
- for letter in checkchars:
- width = fm.width("W")
- maxWidth = max(maxWidth,width)
-
- print "Max Width = ", maxWidth, fm.width("i")
- #maxWidth=fm.width("W")
- maxHeight = fm.height()
- maxDescent = fm.descent()
- maxLeading = fm.leading()
-
- # The pixel width of text inside a widget
- self.textWidth = int(maxWidth+maxLeading)
-
- # The pixel height of text inside a widget
- self.textHeight = int(maxHeight+maxDescent)
-
- # The pixel width of a 1 char widget (for things like buttons)
- self.widgetWidth = self.textWidth
-
- # The pixel height of a 1 char widget (for things like buttons)
- self.widgetHeight = self.textHeight + 4
-
-
- #############################################################################
- #
- # Incoming Event Processors
- #
- # Processes the incoming events from other objects
- # From here down should be nothing but eventListeners listed
-
- #
- # mainLoop
- #
- # The primary loop of the user interface. Called once the UI is
- # fully activated
- #
- def mainLoop(self):
- self._qtapp.exec_loop()
-
- #
- # Clipboard routines
- #
- # If a particular UI has a system-wide clipboard,
- # these methods should be overridden to use that
- # clipboard.
- #
- def getClipboardContents(self, event):
- event.__result__ = str(self._qtapp.clipboard().text())
-
-
- def setClipboardContents(self, event):
- self._qtapp.clipboard().setText(event.text)
-
-
- #############################################################################
- #
- # Internal Event Processors
- #
- # Processes the events from the widget set
- #
- #
- # closeTrap
- #
- # intercepts the applications closure and generates an event to the form
requesting
- # closure. Allows the form to control closure. If the form approves it'll
send
- # back an event closing the application
- #`
- def closeTrap(self,event):
- if event.CanVeto():
- self.dispatchEvent('requestEXIT',_form=self._form)
- else:
- object = _eventObjToQtWindow(event)
- object.Destroy()
-
- def _ui_show_error_(self, message):
- QMessageBox.critical(None, "GNU Enterprise", message)
-
- def _ui_show_exception_(self, group, name, message, detail):
- self._ui_show_error_(detail)
Copied: trunk/gnue-forms/src/uidrivers/qt3/UIdriver.py (from rev 8695,
trunk/gnue-forms/src/uidrivers/qt/UIdriver.py)
Copied: trunk/gnue-forms/src/uidrivers/qt3/dialogs.py (from rev 8695,
trunk/gnue-forms/src/uidrivers/qt/dialogs.py)
Copied: trunk/gnue-forms/src/uidrivers/qt3/widgets (from rev 8695,
trunk/gnue-forms/src/uidrivers/qt/widgets)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8696 - in trunk/gnue-forms/src/uidrivers: . qt3,
johannes <=