commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms/src GFClient.py uidrivers/_base/UIWi...


From: James Thompson
Subject: gnue/forms/src GFClient.py uidrivers/_base/UIWi...
Date: Fri, 22 Feb 2002 20:08:16 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/02/22 20:08:16

Modified files:
        forms/src      : GFClient.py 
        forms/src/uidrivers/_base: UIWidget.py UIdriver.py 
        forms/src/uidrivers/wx: UIdriver.py 

Log message:
        Misc ui updates

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFClient.py.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIWidget.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIdriver.py.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?tr1=1.152&tr2=1.153&r1=text&r2=text

Patches:
Index: gnue/forms/src/GFClient.py
diff -c gnue/forms/src/GFClient.py:1.35 gnue/forms/src/GFClient.py:1.36
*** gnue/forms/src/GFClient.py:1.35     Sun Feb 17 14:54:06 2002
--- gnue/forms/src/GFClient.py  Fri Feb 22 20:08:16 2002
***************
*** 108,113 ****
--- 108,114 ----
          uiloaded = 1
        except ImportError, err:
          GDebug.printMesg(0,'Unable to load UI driver %s' % (self.ui_type))
+         GDebug.printMesg(1,err)    
          if self.ui_type != 'nstti':
            self.ui_type = 'nstti'
          else:
Index: gnue/forms/src/uidrivers/_base/UIWidget.py
diff -c gnue/forms/src/uidrivers/_base/UIWidget.py:1.1 
gnue/forms/src/uidrivers/_base/UIWidget.py:1.2
*** gnue/forms/src/uidrivers/_base/UIWidget.py:1.1      Sun Feb 17 17:26:45 2002
--- gnue/forms/src/uidrivers/_base/UIWidget.py  Fri Feb 22 20:08:16 2002
***************
*** 50,55 ****
--- 50,60 ----
        self.itemWidth = -1
        self.itemHeight = -1
  
+     if hasattr(object,'x'):
+       self.itemX = object.x*int(widgetWidth)
+     else:
+       self.itemX = -1
+ 
      if not object.hidden:
        for spacer in range(int(object._rows)):
          newWidget = self.createWidget(object, container, textWidth, 
textHeight,
Index: gnue/forms/src/uidrivers/_base/UIdriver.py
diff -c gnue/forms/src/uidrivers/_base/UIdriver.py:1.62 
gnue/forms/src/uidrivers/_base/UIdriver.py:1.63
*** gnue/forms/src/uidrivers/_base/UIdriver.py:1.62     Wed Feb 20 12:27:49 2002
--- gnue/forms/src/uidrivers/_base/UIdriver.py  Fri Feb 22 20:08:16 2002
***************
*** 39,47 ****
                  'deleted':'DEL',
                  'query':'QRY'}
  
- 
- 
- 
  #
  # GFUserInterfaceBase
  #
--- 39,44 ----
***************
*** 91,123 ****
      # A dictionary of functions used by buildUI to build the widgets.  Can 
override in
      # UI specific module if necessary.
      self.widgetConstructorFunction = {
!       'GFBox'         : self.stdHandler,
!       'GFButton'      : self.stdHandler,
!       'GFEntry'       : self.stdHandler,
!       'GFForm'        : self.stdHandler,
!       'GFLabel'       : self.stdHandler,
!       'GFScrollBar'   : self.stdHandler,
!       'GFPage'        : self.stdHandler,
        }
  
!   def stdHandler(self):
      object = self._currentObject[0]
      container = self.currentWidget[0]
      newWidget = self.widgets[object.getObjectType()](object,container, 
self.textWidth, self.textHeight,
                                                       self.widgetWidth, 
self.widgetHeight, self)
      return newWidget
  
- 
-   #
-   #Note: new api. onInit is called during the main event loop of
-   #      the UI (i.e. wxPython.mainLoop in this case)
-   #
-   def buildForm(self, form):
-     self._currentObject = [form]
-     self._form = form
-     # Create the UI from the GFForm passed in
-     self.buildUI()
-     
    #
    # buildUI
    #
--- 88,109 ----
      # A dictionary of functions used by buildUI to build the widgets.  Can 
override in
      # UI specific module if necessary.
      self.widgetConstructorFunction = {
!       'GFBox'         : self._stdHandler,
!       'GFButton'      : self._stdHandler,
!       'GFEntry'       : self._stdHandler,
!       'GFForm'        : self._stdHandler,
!       'GFLabel'       : self._stdHandler,
!       'GFScrollBar'   : self._stdHandler,
!       'GFPage'        : self._stdHandler,
        }
  
!   def _stdHandler(self):
      object = self._currentObject[0]
      container = self.currentWidget[0]
      newWidget = self.widgets[object.getObjectType()](object,container, 
self.textWidth, self.textHeight,
                                                       self.widgetWidth, 
self.widgetHeight, self)
      return newWidget
  
    #
    # buildUI
    #
***************
*** 126,132 ****
    # form to UI cross reference used by the UI to match
    # form objects to the UI counterparts
    #
!   def buildUI(self):
      try:
        uiWidget = 
self.widgetConstructorFunction[self._currentObject[0].getObjectType()] ()
        widget = uiWidget.widgets 
--- 112,118 ----
    # form to UI cross reference used by the UI to match
    # form objects to the UI counterparts
    #
!   def _buildUI(self):
      try:
        uiWidget = 
self.widgetConstructorFunction[self._currentObject[0].getObjectType()] ()
        widget = uiWidget.widgets 
***************
*** 150,171 ****
        for child in self._currentObject[0]._children:
          if isinstance(child, GObj):
            self._currentObject.insert(0,child)
!           self.buildUI()
            self._currentObject.pop(0)
  
      if self._currentObject[0].getObjectType() in self.containerWidgets:
        self.currentWidget.pop(0)
  
  
    
#############################################################################
    #
    # Generic Incoming Event Handlers
    #
    # Handles incoming events and calls UI instance specific functions to
!   # execute the actions
    #
! 
! 
    #
    # Clipboard routines
    #
--- 136,178 ----
        for child in self._currentObject[0]._children:
          if isinstance(child, GObj):
            self._currentObject.insert(0,child)
!           self._buildUI()
            self._currentObject.pop(0)
  
      if self._currentObject[0].getObjectType() in self.containerWidgets:
        self.currentWidget.pop(0)
  
+   
#############################################################################
+   #
+   # Public Interface
+   #
+   # The interface exposed to the forms backend
+   #
+   #
+   
+   #
+   # buildForm
+   #
+   # when passed a GObj tree constructed from a .gfd file
+   # it handles the creatation of the user interface
+   #
+   def buildForm(self, form):
+     self._currentObject = [form]
+     self._form = form
+     # Create the UI from the GFForm passed in
+     self._buildUI()
+     
+ 
+ 
  
    
#############################################################################
    #
    # Generic Incoming Event Handlers
    #
    # Handles incoming events and calls UI instance specific functions to
!   # execute the actions.  These events come from the forms back end.
    #
!   
    #
    # Clipboard routines
    #
***************
*** 181,187 ****
      GDebug.printMesg(5, "Setting clipboard '%s'" % event.text)
      self.__clipboard = "%s" % event.text
  
- 
    #
    # exitApplication
    #
--- 188,193 ----
***************
*** 301,335 ****
          value = 
handler.getDisplayFiller(block._resultSet.getRecord(currentRecord- \
                                  (index-count)).getField(entry.field))
  
- ##        if value == None: value = ""
- ##        value = str(value) # Done to remove unicode types which wxpython 
doesn't like
- ## ??????
-        ## if style == 'dropdown':
-        ##   value = entry.allowedValues()[value]
- ## ??????
- ##        elif style == 'checkbox':
- ##          value = value in (1,'1','T','t','TRUE','true')
          self._formToUIWidget[entry].setValue(value,count)
  
-     # fill currently indexed spot
- ##    if style == 'dropdown':
- ##      value = entry.allowedValues()["%s" % entry.getValue()]
- ##    else:
- ##      value = handler.getDisplay()
- ##    value = str(value) # Done to remove unicode types which wxpython 
doesn't like
- ##
- ##    if style == 'checkbox':
- ##      value = entry.getValue()
- ##      value = value in (1,'1','T','t','TRUE','true')
- ##      self._formToUIWidget[entry].setValue(value, index)
- ##    else:
- 
- ##      if not prehandling:
        value = handler.getDisplayFiller(entry.getValue())
        self._formToUIWidget[entry].setValue(value, index)
  
- ##    self._formToUIWidget[entry].setCursorPosition(0, index)
- 
      # Fill trailing spots
      #
      # You must skip the matching index but
--- 307,317 ----
***************
*** 346,359 ****
            value = handler.getDisplayFiller(rec.getField(entry.field))
  
          self._formToUIWidget[entry].setValue(value, count)
- 
- ##
- ##          if value == None: value = ""
- ##          value = str(value) # Done to remove unicode types which wxpython 
doesn't like
- ##          if style == 'dropdown':
- ##            value = event.data.allowedValues()[value]
- ##          elif style == 'checkbox':
- ##            value = value in (1,'1','T','t','TRUE','true') # sets to 1 or 0
        count += 1
  
      handler.editing = prehandling
--- 328,333 ----
***************
*** 368,370 ****
--- 342,350 ----
    # Called whenever forms leaves a "wait" state
    def endWait (self, event):
      pass
+ 
+ 
+ 
+ 
+ 
+ 
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.152 
gnue/forms/src/uidrivers/wx/UIdriver.py:1.153
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.152       Wed Feb 20 15:44:46 2002
--- gnue/forms/src/uidrivers/wx/UIdriver.py     Fri Feb 22 20:08:16 2002
***************
*** 30,43 ****
  
  from wxPython.wx import *
  from wxPython.lib.splashscreen import SplashScreen
- 
  from gnue.forms.GFForm import *
  from gnue.forms.GFEvent import *
  from gnue.forms import GFKeyMapper
  from gnue.forms.uidrivers._base.UIdriver import *
  from gnue.forms.uidrivers._base.UIWidget import *
  
- 
  import os
  import sys
  import string
--- 30,41 ----
***************
*** 54,66 ****
  _IdToGFObj = {}
  _IdToUIObj = {}
  
- 
  # hack for wxPython 2.2 (2.3+ doesn't need this)
  def _eventObjTowxWindow(event):
    eo = event.GetEventObject()
    return wxPyTypeCast(eo, 'wxWindow')
            
- 
  ##
  ## Only create one instance of wxApp
  ## Use getWxApp() to get or create the
--- 52,62 ----
***************
*** 79,92 ****
      __wxApp = GFwxApp(0)
    return __wxApp
  
- 
  class GFwxApp(wxApp):
    def OnInit(self):
      GDebug.printMesg(7,"WxApp initializing")
      wxInitAllImageHandlers()
      return true
  
- 
  #
  # Little global helper routine to set font according to options
  #
--- 75,86 ----
***************
*** 187,202 ****
        maxDescent = max(maxDescent,descent)
        maxLeading = max(maxLeading,leading)
  
!     self.charWidth = maxWidth+maxLeading
!     self.charHeight = maxHeight+maxDescent
!     global _charWidth
  
!     _charWidth = int(self.charWidth)
  
-     self.widgetWidth = self.charWidth
-     self.widgetHeight = self.charHeight + 3
-     self.textWidth = self.charWidth
-     self.textHeight = self.charHeight
  
      self.menu_sb_space=4 # the extra spaces needed by the menu, toolbar and 
statusbar
      
--- 181,197 ----
        maxDescent = max(maxDescent,descent)
        maxLeading = max(maxLeading,leading)
  
!     self.charWidth = int(maxWidth+maxLeading)
!     self.charHeight = int(maxHeight+maxDescent)
  
!     self.widgetWidth = self.charWidth       # The pixel width of a 1 char 
widget (for things like buttons)
!     self.widgetHeight = self.charHeight + 3 # The pixel height of a 1 char 
widget (for things like buttons)
!     self.textWidth = self.charWidth         # The pixel width of text inside 
a widget 
!     self.textHeight = self.charHeight       # The pixel height of text inside 
a widget 
! 
!     global _charWidth
!     _charWidth = self.charWidth             # Used by the mouse handler to 
compute char offset into widget
  
  
      self.menu_sb_space=4 # the extra spaces needed by the menu, toolbar and 
statusbar
      
***************
*** 294,304 ****
      return true
  
    def activateForm(self, form):
!     width = int(self._form.width)
!     height = int(self._form.height)
  
!     formSize = wxSize(width*int(self.widgetWidth),
!                       int(height+self.menu_sb_space)*int(self.widgetHeight))
  
      self.mainWindow.SetSize(formSize)
      self.mainWindow.SetTitle(str(self._form.title))
--- 289,299 ----
      return true
  
    def activateForm(self, form):
!     width = self._form.width
!     height = self._form.height
  
!     formSize = wxSize(width*self.widgetWidth,
!                       (height+self.menu_sb_space)*self.widgetHeight)
  
      self.mainWindow.SetSize(formSize)
      self.mainWindow.SetTitle(str(self._form.title))
***************
*** 399,406 ****
        self.visiblePage.Show(FALSE)
        self.visiblePage = self._formToUI[event.data][0]
        # TODO: move the calculatoin out of here
!       
self.visiblePage.SetSize(wxSize(int(self._form.width)*int(self.widgetWidth),
!                                       
int(int(self._form.height)+self.menu_sb_space)*int(self.widgetHeight)))
      else:
        self.visiblePage = self._formToUI[event.data][0]
        for count in range(_NOTEBOOK.GetPageCount()):
--- 394,401 ----
        self.visiblePage.Show(FALSE)
        self.visiblePage = self._formToUI[event.data][0]
        # TODO: move the calculatoin out of here
!       self.visiblePage.SetSize(wxSize(self._form.width*self.widgetWidth,
!                                       
(self._form.height+self.menu_sb_space)*self.widgetHeight))
      else:
        self.visiblePage = self._formToUI[event.data][0]
        for count in range(_NOTEBOOK.GetPageCount()):
***************
*** 593,600 ****
                     widgetHeight,interface,spacer,initialize=1):
      style = self.alignmentStyle[object.alignment]
      newWidget = wxStaticText(container, -1, str(object.text),
!                              wxPoint(object.x*int(widgetWidth),
!                                      
(object.y+spacer+(spacer*object._gap))*int(widgetHeight)),
                               wxSize(self.itemWidth,self.itemHeight), style)
      return newWidget
  
--- 588,595 ----
                     widgetHeight,interface,spacer,initialize=1):
      style = self.alignmentStyle[object.alignment]
      newWidget = wxStaticText(container, -1, str(object.text),
!                              wxPoint(object.x*widgetWidth,
!                                      
(object.y+spacer+(spacer*object._gap))*widgetHeight),
                               wxSize(self.itemWidth,self.itemHeight), style)
      return newWidget
  
***************
*** 607,616 ****
    def _createWidget(self, object, container, textWidth, textHeight,
                     widgetWidth, widgetHeight,interface,spacer,initialize=1):
      newWidget = wxStaticBox(container,-1,str(object.label),
!                             
wxPoint(object.x*int(widgetWidth)+(int(widgetWidth)/2),
!                                     
(object.y+spacer+(spacer*object._gap))*int(widgetHeight)+(int(widgetHeight)/2)),
!                             wxSize((object.width-1)*int(widgetWidth),
!                                    (object.height-1)*int(widgetHeight)))
      return newWidget
  
  #
--- 602,611 ----
    def _createWidget(self, object, container, textWidth, textHeight,
                     widgetWidth, widgetHeight,interface,spacer,initialize=1):
      newWidget = wxStaticBox(container,-1,str(object.label),
!                             wxPoint(object.x*widgetWidth+(widgetWidth/2),
!                                     
(object.y+spacer+(spacer*object._gap))*widgetHeight+(widgetHeight/2)),
!                             wxSize((object.width-1)*widgetWidth,
!                                    (object.height-1)*widgetHeight))
      return newWidget
  
  #
***************
*** 623,630 ****
    def _createWidget(self, object, container, textWidth, textHeight,
                     widgetWidth, widgetHeight,interface,spacer,initialize=1):
      newWidget =wxScrollBar(container,-1,
!                            
wxPoint(object.x*int(widgetWidth),(object.y+spacer)*int(widgetHeight)),
!                            
wxSize(object.width*int(widgetWidth),object.height*int(widgetHeight)),
                             wxSB_VERTICAL)
      return newWidget
    
--- 618,625 ----
    def _createWidget(self, object, container, textWidth, textHeight,
                     widgetWidth, widgetHeight,interface,spacer,initialize=1):
      newWidget =wxScrollBar(container,-1,
!                            
wxPoint(object.x*widgetWidth,(object.y+spacer)*widgetHeight),
!                            
wxSize(object.width*widgetWidth,object.height*widgetHeight),
                             wxSB_VERTICAL)
      return newWidget
    
***************
*** 637,644 ****
    def _createWidget(self, object, container, textWidth, textHeight,
                     widgetWidth, widgetHeight,interface,spacer,initialize=1):
      newWidget = wxButton(container,-1,str(object.label),
!                          
wxPoint(object.x*int(widgetWidth),(object.y+spacer)*int(widgetHeight)),
!                          
wxSize(object.width*int(widgetWidth),object.height*int(widgetHeight))
                           )
      if initialize:
        EVT_BUTTON(newWidget,newWidget.GetId(),self.buttonHandler)
--- 632,639 ----
    def _createWidget(self, object, container, textWidth, textHeight,
                     widgetWidth, widgetHeight,interface,spacer,initialize=1):
      newWidget = wxButton(container,-1,str(object.label),
!                          
wxPoint(object.x*widgetWidth,(object.y+spacer)*widgetHeight),
!                          
wxSize(object.width*widgetWidth,object.height*widgetHeight)
                           )
      if initialize:
        EVT_BUTTON(newWidget,newWidget.GetId(),self.buttonHandler)
***************
*** 692,700 ****
  
      style = object.style
  
!     defaultPoint =  wxPoint(object.x*int(widgetWidth),
!                             
(object.y+spacer+(object._gap*spacer))*int(widgetHeight))
!     defaultSize  = 
wxSize(object.width*int(textWidth),object.height*int(textHeight)+1)
  
      if style == 'dropdown':
        if initialize:
--- 687,695 ----
  
      style = object.style
  
!     defaultPoint =  wxPoint(object.x*widgetWidth,
!                             
(object.y+spacer+(object._gap*spacer))*widgetHeight)
!     defaultSize  = wxSize(self.itemWidth,self.itemHeight+1)
  
      if style == 'dropdown':
        if initialize:
***************
*** 705,711 ****
        choices.sort()
        
        newWidget = wxComboBox(container, -1, "",defaultPoint,
!                               
wxSize(object.width*int(textWidth),object.height*int(textHeight)),
                               choices, wxCB_DROPDOWN,) # |wxWANTS_CHARS,)
        newWidget.SetValue("")
        EVT_COMBOBOX(newWidget, newWidget.GetId(), self.comboHandler)
--- 700,706 ----
        choices.sort()
        
        newWidget = wxComboBox(container, -1, "",defaultPoint,
!                               wxSize(self.itemWidth,self.itemHeight),
                               choices, wxCB_DROPDOWN,) # |wxWANTS_CHARS,)
        newWidget.SetValue("")
        EVT_COMBOBOX(newWidget, newWidget.GetId(), self.comboHandler)
***************
*** 720,726 ****
  
      elif style == 'checkbox':
        newWidget = wxCheckBox(container, -1, "",defaultPoint,
!                              
wxSize(int(2)*int(textWidth),int(1)*int(textHeight)),
                               wxNO_BORDER)
        newWidget.SetValue(0)
  
--- 715,721 ----
  
      elif style == 'checkbox':
        newWidget = wxCheckBox(container, -1, "",defaultPoint,
!                              wxSize(2*textWidth,textHeight),
                               wxNO_BORDER)
        newWidget.SetValue(0)
  
***************
*** 1020,1026 ****
                                       s.GetSize().GetWidth() + 
t.GetSize().GetWidth() + 10)   
  
          dlgWidth = max(dlgWidth, \
!                               s.GetSize().GetWidth() + t.GetSize().GetWidth() 
+ 10)
  
          xSpacing = max(xSpacing, s.GetSize().GetWidth())
          ySpacing = max(ySpacing, s.GetSize().GetHeight())
--- 1015,1021 ----
                                       s.GetSize().GetWidth() + 
t.GetSize().GetWidth() + 10)   
  
          dlgWidth = max(dlgWidth, \
!                        s.GetSize().GetWidth() + t.GetSize().GetWidth() + 10)
  
          xSpacing = max(xSpacing, s.GetSize().GetWidth())
          ySpacing = max(ySpacing, s.GetSize().GetHeight())
***************
*** 1078,1091 ****
        self.loginButton = loginButton
  
        self.dlg.SetSize(wxSize(dlgWidth, dlgHeight))
! 
! 
        self.dlg.Refresh()
        self.dlg.Fit()
        self.dlg.Raise()
        self.dlg.CenterOnScreen()
! 
! 
      # If user cancels, this will be set to 0
      self._completed = 0
      self.dlg.ShowModal()
--- 1073,1084 ----
        self.loginButton = loginButton
  
        self.dlg.SetSize(wxSize(dlgWidth, dlgHeight))
!       
        self.dlg.Refresh()
        self.dlg.Fit()
        self.dlg.Raise()
        self.dlg.CenterOnScreen()
!       
      # If user cancels, this will be set to 0
      self._completed = 0
      self.dlg.ShowModal()



reply via email to

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