commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/forms/src/uidrivers _commonGuiToolkit/UIdr...


From: James Thompson
Subject: gnue/forms/src/uidrivers _commonGuiToolkit/UIdr...
Date: Tue, 04 Mar 2003 23:12:02 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 03/03/04 23:12:02

Modified files:
        forms/src/uidrivers/_commonGuiToolkit: UIdriver.py 
        forms/src/uidrivers/qt: UIdriver.py common.py 
        forms/src/uidrivers/qt/widgets: _base.py 
        forms/src/uidrivers/qt/widgets/form: widget.py 
        forms/src/uidrivers/wx: UIdriver.py 

Log message:
        work on ui driver (qt mainly)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_commonGuiToolkit/UIdriver.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/qt/UIdriver.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/qt/common.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/qt/widgets/_base.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/qt/widgets/form/widget.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?tr1=1.240&tr2=1.241&r1=text&r2=text

Patches:
Index: gnue/forms/src/uidrivers/_commonGuiToolkit/UIdriver.py
diff -c gnue/forms/src/uidrivers/_commonGuiToolkit/UIdriver.py:1.3 
gnue/forms/src/uidrivers/_commonGuiToolkit/UIdriver.py:1.4
*** gnue/forms/src/uidrivers/_commonGuiToolkit/UIdriver.py:1.3  Tue Mar  4 
21:04:32 2003
--- gnue/forms/src/uidrivers/_commonGuiToolkit/UIdriver.py      Tue Mar  4 
23:12:02 2003
***************
*** 65,73 ****
  
  
    def _activateForm(self, form, modal=0):
-     # Go ahead and display
- 
-     # TODO : hack!!!!!!!!!!!!!!
      for key in self._formNameToUIForm.keys():
        if self._formNameToUIForm[key]._form == form:
          break
--- 65,70 ----
***************
*** 109,153 ****
    def formAlert(self, event):
      self._beep()
      self.statusBar.SetStatusText(event.data,0)
- 
- 
-   
#############################################################################
-   #
-   # Internal Event Processors
-   #
-   # Processes the events from the widget set
-   #
- 
- 
-   #
-   # promptForRecordNumber
-   #
-   # Presents a dialog to user asking for the record number to jump to
-   #
- ##   def promptForRecordNumber(self, event=None):
- ##     dlg = wxTextEntryDialog(self.mainWindow, _('Enter record number to 
jump to'),
- ##                                                         _('Which record?'))
- 
- ##     if dlg.ShowModal() == wxID_OK:
- ##       action = self.dispatchEvent('requestRECORDNUMBER', dlg.GetValue(), 
_form=self._form)
- ##     else:
- ##       action = None
- 
- ##     dlg.Destroy()
- ##     return action
- 
-   #
-   # 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 = _eventObjTowxWindow(event)
- ##       object.Destroy()
- ##       # wxExit() TODO: Try and work this into navigator or here if it 
still hangs
  
--- 106,109 ----
Index: gnue/forms/src/uidrivers/qt/UIdriver.py
diff -c gnue/forms/src/uidrivers/qt/UIdriver.py:1.2 
gnue/forms/src/uidrivers/qt/UIdriver.py:1.3
*** gnue/forms/src/uidrivers/qt/UIdriver.py:1.2 Sat Feb 22 01:54:57 2003
--- gnue/forms/src/uidrivers/qt/UIdriver.py     Tue Mar  4 23:12:02 2003
***************
*** 38,44 ****
  
  from gnue.forms import VERSION
  from gnue.forms.GFForm import *
! from gnue.forms.uidrivers._base.UIdriver import *
  
  from gnue.forms.uidrivers.qt.QTApp import *
  from gnue.forms.uidrivers.qt.QTSplashScreen import *
--- 38,44 ----
  
  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 *
***************
*** 47,62 ****
  from common import *
  
  
- _PROMPTFORRECORD = None
- def treeShow(object, uiDriver):
-   pass 
- ##  try: 
- ##    print "Object ",object, object.Show(), object.GetParent(), 
uiDriver._IdToGFObj[object.GetId()]
- ##  except KeyError:
- ##    print "Object ",object, object.Show(), object.GetParent(), 
"NONE!!!!!!!!!!!!!"
- ##    
- ##  for child in object.GetChildren():
- ##    treeShow(child, uiDriver)
      
  #
  # GFUserInterface
--- 47,52 ----
***************
*** 64,85 ****
  # The public interface to the User Interface
  # All UIs must provide this class
  #
! class GFUserInterface(GFUserInterfaceBase):
    def __init__(self, eventController, disableSplash = None):
!     GFUserInterfaceBase.__init__(self,eventController)
! 
!     self._disableSplash = disableSplash
!     
!     self._DIALOGS = {'about'       :UIAbout,
!                      'messageBox'  :UIMessageBox,
!                      }
!     # Shortcut
!     self.images_dir = 
GConfig.getInstalledBase('forms_images','common_images') + '/'
! 
!     self._IdToQtObj = {}
!     self._IdToGFObj = {}
!     self._IdToUIObj = {}
! 
      self._disabledColour = Qt.lightGray
  
  
--- 54,62 ----
  # The public interface to the User Interface
  # All UIs must provide this class
  #
! class GFUserInterface(commonToolkit.GFUserInterface):
    def __init__(self, eventController, disableSplash = None):
!     commonToolkit.GFUserInterface.__init__(self,eventController)
      self._disabledColour = Qt.lightGray
  
  
***************
*** 103,130 ****
      if not self._disableSplash:
        self.splash = QTSplashScreen()
  
-     global _PROMPTFORRECORD
-     _PROMPTFORRECORD = self.promptForRecordNumber
- 
-     #
-     # Create a dummy window used to compute sizes 
-     #
- ##    dummyWindow = wxFrame(NULL, -1, "", wxDefaultPosition)
- ##    initFont(dummyWindow,1)
-     
-     #
-     # Find the max size of printable characters
-     #  used to setup the grid
-     #
- ##    maxWidth, maxHeight, maxDescent, maxLeading = [0,0,0,0]
- ##    checkchars = string.printable
- ##    for letter in checkchars:
- ##      width,height,descent,leading = dummyWindow.GetFullTextExtent(letter)
- ##      maxWidth = max(maxWidth,width)
- ##      maxHeight = max(maxHeight,height)
- ##      maxDescent = max(maxDescent,descent)
- ##      maxLeading = max(maxLeading,leading)
- 
      fm = QFontMetrics(font)
      # TODO: Making some assumptions here!!
      maxWidth=fm.width("W")
--- 80,85 ----
***************
*** 137,165 ****
      self.widgetWidth  = self.textWidth            # The pixel width of a 1 
char widget (for things like buttons)
      self.widgetHeight = self.textHeight + 3       # The pixel height of a 1 
char widget (for things like buttons)
  
-     #
-     # Close dummy window so app doesn't hang when all other windows closed
-     #
- ##    dummyWindow.Close()
- 
- 
- 
-   def _activateForm(self, form):
-   
-   
-     # Go ahead and display
- 
-     # TODO : hack!!!!!!!!!!!!!!
-     for key in self._formNameToUIForm.keys():
-       if self._formNameToUIForm[key]._form == form:
-         break
- 
- ##    self._formNameToUIForm[key].mainWindow.raise()
-     self._formNameToUIForm[key].mainWindow.show()
-     
-     self._formNameToUIForm[key].show()
-     
-     treeShow(self._formNameToUIForm[key].mainWindow, self)
  
  
    
#############################################################################
--- 92,97 ----
***************
*** 176,190 ****
    # Tells the application to close it's main window
    #
    def _exit(self):
!     #TODO
!     self._children[0].mainWindow.Close(true)
! 
! 
!   # Can be used by UI drivers to add more attributes to the creation event.
!   def _updateCreateEvent(self, event):
!     event.eventHandler = self.dispatchEvent
!     event.ui = self
!     return event
  
  
    
#############################################################################
--- 108,124 ----
    # Tells the application to close it's main window
    #
    def _exit(self):
!     exitApp = 1
!     for child in self._children:
!       if child._form.name == formName:
!         child.mainWindow.hide()
! 
!       exitApp = exitApp and not child.mainWindow.isVisible()
! 
!     if exitApp:
!       for child in self._children:
!         child.mainWindow.close(true)
!                                   
  
  
    
#############################################################################
***************
*** 201,233 ****
    # fully activated
    #
    def mainLoop(self):
- ##    self._wxapp.MainLoop() # simply call the wxApp's MainLoop method
- ##    self._qtapp.setMainWidget(self)
- ##    self.show()
      self._qtapp.exec_loop()
  
!   #
!   # formAlert
!   #
!   # Rings a bell and alters the statusbar to display
!   # a line of text
!   #
!   def formAlert(self, event):
      self._qtApp.bell()
-     self.statusFields[0].setText(event.data)
  
    #
    # Called whenever forms goes into a "wait" state in which user cannot
    # interact with interface (e.g., while waiting for a query or a commit)
    #
!   def beginWait (self, event):
!     wxBeginBusyCursor()
  
    #
    # Called whenever forms leaves a "wait" state
    #
!   def endWait (self, event):
!     wxEndBusyCursor()
  
  
    #
--- 135,158 ----
    # fully activated
    #
    def mainLoop(self):
      self._qtapp.exec_loop()
  
! 
!   def _bell(self, event):
      self._qtApp.bell()
  
    #
    # Called whenever forms goes into a "wait" state in which user cannot
    # interact with interface (e.g., while waiting for a query or a commit)
    #
!   #def beginWait (self, event):
!   #  wxBeginBusyCursor()
  
    #
    # Called whenever forms leaves a "wait" state
    #
!   #def endWait (self, event):
!   #  wxEndBusyCursor()
  
  
    #
***************
*** 237,273 ****
    # these methods should be overridden to use that
    # clipboard.
    #
!   def getClipboardContents(self, event):
  
!     if wxTheClipboard.Open():
!       data = wxTextDataObject()
!       success = wxTheClipboard.GetData(data)
!       wxTheClipboard.Close()
!     else:
!       success = 0
!       GDebug.printMesg(5,'Unable to open clipboard for read')
  
!     if success:
!       value = data.GetText()
!     else:
!       GDebug.printMesg(5,'Unable to obtain clipboard contents. Defaulting to 
Empty.')
!       value = None
  
!     GDebug.printMesg(5, "Getting clipboard value '%s'" % value)
!     event.__result__ = value
  
  
!   def setClipboardContents(self, event):
  
!     GDebug.printMesg(5,"Setting clipboard '%s'" % event.text)
  
!     if wxTheClipboard.Open():
!       value = wxTheClipboard.SetData(wxTextDataObject(event.text))
!       GDebug.printMesg(10,"Set Clipboard Status: %s" % value)
!       wxTheClipboard.Close()
  
!     else:
!       GDebug.printMesg(5,'Unable to open clipboard for write')
  
  
    
#############################################################################
--- 162,198 ----
    # these methods should be overridden to use that
    # clipboard.
    #
! ##   def getClipboardContents(self, event):
  
! ##     if wxTheClipboard.Open():
! ##       data = wxTextDataObject()
! ##       success = wxTheClipboard.GetData(data)
! ##       wxTheClipboard.Close()
! ##     else:
! ##       success = 0
! ##       GDebug.printMesg(5,'Unable to open clipboard for read')
  
! ##     if success:
! ##       value = data.GetText()
! ##     else:
! ##       GDebug.printMesg(5,'Unable to obtain clipboard contents. Defaulting 
to Empty.')
! ##       value = None
  
! ##     GDebug.printMesg(5, "Getting clipboard value '%s'" % value)
! ##     event.__result__ = value
  
  
! ##   def setClipboardContents(self, event):
  
! ##     GDebug.printMesg(5,"Setting clipboard '%s'" % event.text)
  
! ##     if wxTheClipboard.Open():
! ##       value = wxTheClipboard.SetData(wxTextDataObject(event.text))
! ##       GDebug.printMesg(10,"Set Clipboard Status: %s" % value)
! ##       wxTheClipboard.Close()
  
! ##     else:
! ##       GDebug.printMesg(5,'Unable to open clipboard for write')
  
  
    
#############################################################################
***************
*** 277,296 ****
    # Processes the events from the widget set
    #
  
- 
-   #
-   # promptForRecordNumber
-   #
-   # Presents a dialog to user asking for the record number to jump to
-   #
-   def promptForRecordNumber(self, event=None):
-     dlg = QInputDialog(_('Which record?'))
-     rs = dlg.getInteger(self.mainWindow, _('Enter record number to jump to'))
- 
-     action = self.dispatchEvent('requestRECORDNUMBER', rs, _form=self._form)
- 
-     return action
- 
    #
    # closeTrap
    #
--- 202,207 ----
***************
*** 311,334 ****
  ## Required Dialog box support
  ##
  #####################################################################
- 
- #
- # UIAbout
- #
- # A dialog box providing about info
- #
- class UIAbout(QMessageBox, UIHelper):
-   def __init__(self, interface, programVersion, formName, formVersion, 
author, description):
-     text = _("GNUE Forms")+"\n"+      \
-     _("  Version : ")+"%s\n"+         \
-     _("  Driver  : UIwxpython")+"\n"+ \
-     _("-= Form Info =-")+"\n"+        \
-     _("  Name   : ")+"%s\n"+          \
-     _("  Version: ")+"%s\n"+          \
-     _("  Author : ")+"%s\n"+          \
-     _("  Description:")+"%s\n"
-     QMessageBox.__init__(self, _("About"))  # interface,
-     self.information(text % (programVersion, formName 
,formVersion,author,description))
  #
  # UImessageBox
  #
--- 222,227 ----
Index: gnue/forms/src/uidrivers/qt/common.py
diff -c gnue/forms/src/uidrivers/qt/common.py:1.2 
gnue/forms/src/uidrivers/qt/common.py:1.3
*** gnue/forms/src/uidrivers/qt/common.py:1.2   Sat Feb 22 01:54:57 2003
--- gnue/forms/src/uidrivers/qt/common.py       Tue Mar  4 23:12:02 2003
***************
*** 113,119 ****
  #FIX#
  #FIX#    id = object.GetId()
  #FIX#    gfObject     = self._uiDriver._IdToGFObj[id]
! #FIX#    screenWidget = self._uiDriver._IdToQtObj[id]
  #FIX#    count        = 
self._uiDriver._IdToUIObj[id].widgets.index(screenWidget)
  #FIX#
  #FIX#    if event.GetTimestamp():
--- 113,119 ----
  #FIX#
  #FIX#    id = object.GetId()
  #FIX#    gfObject     = self._uiDriver._IdToGFObj[id]
! #FIX#    screenWidget = self._uiDriver._IdToTkObj[id]
  #FIX#    count        = 
self._uiDriver._IdToUIObj[id].widgets.index(screenWidget)
  #FIX#
  #FIX#    if event.GetTimestamp():
Index: gnue/forms/src/uidrivers/qt/widgets/_base.py
diff -c gnue/forms/src/uidrivers/qt/widgets/_base.py:1.3 
gnue/forms/src/uidrivers/qt/widgets/_base.py:1.4
*** gnue/forms/src/uidrivers/qt/widgets/_base.py:1.3    Tue Mar  4 21:04:33 2003
--- gnue/forms/src/uidrivers/qt/widgets/_base.py        Tue Mar  4 23:12:02 2003
***************
*** 59,65 ****
    #
    def _addToCrossRef(self, widget,gfobject, uiobject):
      i = id(widget)  # ????
!     self._uiDriver._IdToQtObj[i]=widget
      self._uiDriver._IdToGFObj[i]=gfobject
      self._uiDriver._IdToUIObj[i]=uiobject
  #    widget.__origBackgroundColor = Qt.White # widget.getBackgroundColor()
--- 59,65 ----
    #
    def _addToCrossRef(self, widget,gfobject, uiobject):
      i = id(widget)  # ????
!     self._uiDriver._IdToTkObj[i]=widget
      self._uiDriver._IdToGFObj[i]=gfobject
      self._uiDriver._IdToUIObj[i]=uiobject
  #    widget.__origBackgroundColor = Qt.White # widget.getBackgroundColor()
***************
*** 67,73 ****
    def _deleteFromCrossRef(self, widget, object):
      i = id(widget)
      try:
!       del self._uiDriver._IdToQtObj[i]
        del self._uiDriver._IdToGFObj[i]
        del self._uiDriver._IdToUIObj[i]
      except:
--- 67,73 ----
    def _deleteFromCrossRef(self, widget, object):
      i = id(widget)
      try:
!       del self._uiDriver._IdToTkObj[i]
        del self._uiDriver._IdToGFObj[i]
        del self._uiDriver._IdToUIObj[i]
      except:
Index: gnue/forms/src/uidrivers/qt/widgets/form/widget.py
diff -c gnue/forms/src/uidrivers/qt/widgets/form/widget.py:1.3 
gnue/forms/src/uidrivers/qt/widgets/form/widget.py:1.4
*** gnue/forms/src/uidrivers/qt/widgets/form/widget.py:1.3      Sun Mar  2 
13:46:31 2003
--- gnue/forms/src/uidrivers/qt/widgets/form/widget.py  Tue Mar  4 23:12:02 2003
***************
*** 191,193 ****
--- 191,201 ----
      
self.statusBar.SetStatusWidths([tipWidth,statusWidth,insertWidth,recordWidth,pageWidth])
  
               
+   def show(self):
+     #self.containerFrame.Show()
+     self.mainWindow.show()
+   def showModal(self):
+     #self.containerFrame.Show()
+     self.mainWindow.showModal()
+ 
+                       
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.240 
gnue/forms/src/uidrivers/wx/UIdriver.py:1.241
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.240       Tue Mar  4 21:04:33 2003
--- gnue/forms/src/uidrivers/wx/UIdriver.py     Tue Mar  4 23:12:02 2003
***************
*** 41,47 ****
  from gnue.forms.GFForm import *
  
  from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
- #from gnue.forms.uidrivers._base.UIdriver import *
  
  from gnue.forms.uidrivers.wx.GFwxApp import *
  from gnue.forms.uidrivers.wx.UIWXSplashScreen import *
--- 41,46 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]