/[papo]/gnue/forms/src/uidrivers/wx/UIdriver.py
ViewVC logotype

Diff of /gnue/forms/src/uidrivers/wx/UIdriver.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19.2.1 by styxman, Mon Jan 27 14:17:41 2003 UTC revision 1.19.2.2 by styxman, Wed May 21 22:16:08 2003 UTC
# Line 76  def getWxApp(): Line 76  def getWxApp():
76    
77  class GFwxApp(wxApp):  class GFwxApp(wxApp):
78    _mainLoop= None    _mainLoop= None
79      
80    def OnInit(self):    def OnInit(self):
81      GDebug.printMesg(7,"WxApp initializing")      GDebug.printMesg(7,"WxApp initializing")
82      wxInitAllImageHandlers()      wxInitAllImageHandlers()
83      return true      return true
84        
85    def MainLoop (self):    def MainLoop (self):
86      # just to launch one wx's mainloop      # just to launch one wx's mainloop
87      # otherwise, the app does not finishes cleanly when several windows are open      # otherwise, the app does not finishes cleanly when several windows are open
# Line 128  class GFUserInterface(GFUserInterfaceBas Line 128  class GFUserInterface(GFUserInterfaceBas
128      _PROMPTFORRECORD = self.promptForRecordNumber      _PROMPTFORRECORD = self.promptForRecordNumber
129    
130      self.forms = {}      self.forms = {}
131        
132      self._windowId= wId      self._windowId= wId
133      self.init()      self.init()
134    
# Line 621  class UIMainMenuBar (UIHelper, UIWidget) Line 621  class UIMainMenuBar (UIHelper, UIWidget)
621      menuBar.Append( helpMenu, _("&Help") )      menuBar.Append( helpMenu, _("&Help") )
622    
623      window.SetMenuBar( menuBar )      window.SetMenuBar( menuBar )
624        
625      return menuBar      return menuBar
626    
627  class UIMainToolBar (UIHelper, UIWidget):  class UIMainToolBar (UIHelper, UIWidget):
628    def _createWidget (self, event, spacer):    def _createWidget (self, event, spacer):
629      window= event.interface.mainWindow      window= event.interface.mainWindow
630      eventBase= event.interface._windowId*1000      eventBase= event.interface._windowId*1000
631        
632      #      #
633      #  There has got to be better way to call events to ride off the EVT_MENU      #  There has got to be better way to call events to ride off the EVT_MENU
634      #  Ok if i give buttons same id as menu's they share events      #  Ok if i give buttons same id as menu's they share events
# Line 657  class UIMainToolBar (UIHelper, UIWidget) Line 657  class UIMainToolBar (UIHelper, UIWidget)
657      mainToolBar.AddSimpleTool(eventBase+102, wxImage(images_dir+gConfig('tb_rollback'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Clear Form"), _('Clear Form'))      mainToolBar.AddSimpleTool(eventBase+102, wxImage(images_dir+gConfig('tb_rollback'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Clear Form"), _('Clear Form'))
658      mainToolBar.AddSimpleTool(eventBase+101, wxImage(images_dir+gConfig('tb_exit'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Exit Form"), _('Exit Form'))      mainToolBar.AddSimpleTool(eventBase+101, wxImage(images_dir+gConfig('tb_exit'), wxBITMAP_TYPE_PNG).ConvertToBitmap(), _("Exit Form"), _('Exit Form'))
659      mainToolBar.Realize()      mainToolBar.Realize()
660        
661      return mainToolBar      return mainToolBar
662    
663    
# Line 717  class UIScrollBar(UIHelper, UIWidget): Line 717  class UIScrollBar(UIHelper, UIWidget):
717      10305: 3, # page down      10305: 3, # page down
718      10303: 4  # line down      10303: 4  # line down
719    }    }
720      
721    def _createWidget(self, event, spacer):    def _createWidget(self, event, spacer):
722      object = event.object      object = event.object
723      self._page= object.page      self._page= object.page
# Line 740  class UIScrollBar(UIHelper, UIWidget): Line 740  class UIScrollBar(UIHelper, UIWidget):
740        block.registerScrollBar (self)        block.registerScrollBar (self)
741    
742      return self._widget      return self._widget
743        
744    def scroll (self, event):    def scroll (self, event):
745      try:      try:
746        action = GFEvent('requestSCROLL', (self.wxToScroll[event.GetEventType()], self._page))        action = GFEvent('requestSCROLL', (self.wxToScroll[event.GetEventType()], self._page))
# Line 749  class UIScrollBar(UIHelper, UIWidget): Line 749  class UIScrollBar(UIHelper, UIWidget):
749        # ignore; it's not a event we want to handle        # ignore; it's not a event we want to handle
750        # e.g., click on the sb's handle        # e.g., click on the sb's handle
751        pass        pass
752        
753    # int position, int thumbSize, int range, int pageSize, const bool refresh = TRUE    # int position, int thumbSize, int range, int pageSize, const bool refresh = TRUE
754    def update (self, pos, range):    def update (self, pos, range):
755      # print pos, range      # print pos, range
756      self._widget.SetScrollbar (pos, 1, range, self._page-1)      self._widget.SetScrollbar (pos, 1, range, self._page-1)
757        
758    
759  #  #
760  # UIButton  # UIButton
# Line 866  class UIEntry(UIHelper, UIWidget): Line 866  class UIEntry(UIHelper, UIWidget):
866          value = ""          value = ""
867    
868        newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, defaultSize, styles)        newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, defaultSize, styles)
869          if object.readonly:
870            # set the font color to some shade of gray
871            # newWidget.SetForegroundColour (wxColour (255, 127, 127))
872            # almost there.
873            # newWidget.SetDefaultStyle (wxTextAttr (wxColour (191, 191, 191)))
874            pass
875    
876      self._eventHandler = event.eventHandler      self._eventHandler = event.eventHandler
877      _setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize)      _setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize)
# Line 984  class UIMessageBox(wxMessageDialog, UIHe Line 990  class UIMessageBox(wxMessageDialog, UIHe
990      message = lineWrap(message,60)      message = lineWrap(message,60)
991      wxMessageDialog.__init__(self, interface, message, caption, style=wxOK|wxICON_EXCLAMATION)      wxMessageDialog.__init__(self, interface, message, caption, style=wxOK|wxICON_EXCLAMATION)
992    
993    
994  #  #
995  # UIGenericBox  # UIGenericBox
996  #  #
# Line 1024  class UIGenericBox(wxDialog, UIHelper): Line 1030  class UIGenericBox(wxDialog, UIHelper):
1030          idx += 1          idx += 1
1031    
1032        button[0].SetDefault()        button[0].SetDefault()
1033        dlgWidth = max(dlgWidth, buttonSetWidth + 15 * (buttonCount- 1) + 40)        dlgWidth = max(dlgWidth, buttonSetWidth + 15 * (buttonCount- 1) + 40)
1034    
1035        dlgHeight += maxButtonHeight - 6        dlgHeight += maxButtonHeight - 6
1036    
# Line 1042  class UIGenericBox(wxDialog, UIHelper): Line 1048  class UIGenericBox(wxDialog, UIHelper):
1048        if buttonCount > 1:        if buttonCount > 1:
1049          incr = incr / (buttonCount - 1)          incr = incr / (buttonCount - 1)
1050    
1051        if buttonCount > 1:          if buttonCount > 1:
1052          currentX = 15          currentX = 15
1053        else:        else:
1054          currentX = (dlgWidth - buttonSetWidth) / 2          currentX = (dlgWidth - buttonSetWidth) / 2
1055            
1056        for buttonLabel in buttonSet:        for buttonLabel in buttonSet:
1057          button[idx].SetPosition(wxPoint(currentX, dlgHeight - 10 - maxButtonHeight))          button[idx].SetPosition(wxPoint(currentX, dlgHeight - 10 - maxButtonHeight))
1058          currentX += button[idx].GetSize().GetWidth() + incr          currentX += button[idx].GetSize().GetWidth() + incr
# Line 1063  class UIGenericBox(wxDialog, UIHelper): Line 1069  class UIGenericBox(wxDialog, UIHelper):
1069        self._result = 0        self._result = 0
1070    
1071        return dlg        return dlg
1072            
1073    def getResult(self):    def getResult(self):
1074      return self._result      return self._result
1075    
# Line 1174  class keyboardEvtHandler(uiBaseEvtHandle Line 1180  class keyboardEvtHandler(uiBaseEvtHandle
1180          not event.ControlDown() and \          not event.ControlDown() and \
1181          not event.AltDown() and \          not event.AltDown() and \
1182          int (gConfig('enterIsNewLine')) and \          int (gConfig('enterIsNewLine')) and \
1183          object.height > 1:          object.height and object._type != 'GFButton'> 1:
1184    
1185        command = 'NEWLINE'        command = 'NEWLINE'
1186    
# Line 1310  class UILoginHandler(GLoginHandler.Login Line 1316  class UILoginHandler(GLoginHandler.Login
1316    
1317        firstY = bmp.GetHeight() + messageField.GetSize().GetHeight() + 50        firstY = bmp.GetHeight() + messageField.GetSize().GetHeight() + 50
1318        lastY = firstY        lastY = firstY
1319        xSpacing += 10    # Add whitespace between widgets        xSpacing += 10  # Add whitespace between widgets
1320        ySpacing += 6     # Add whitespace between widgets        ySpacing += 6  # Add whitespace between widgets
1321        xPos = dlgWidth/2 - fieldLabelWidth/2        xPos = dlgWidth/2 - fieldLabelWidth/2
1322    
1323    

Legend:
Removed from v.1.19.2.1  
changed lines
  Added in v.1.19.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26