commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms/src/uidrivers/win32 UIdriver.py widg...


From: Bajusz Tamás
Subject: gnue/forms/src/uidrivers/win32 UIdriver.py widg...
Date: Wed, 05 Mar 2003 16:10:37 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Bajusz Tamás <address@hidden>   03/03/05 16:10:37

Modified files:
        forms/src/uidrivers/win32: UIdriver.py 
        forms/src/uidrivers/win32/widgets: _base.py entry.py 

Log message:
        more entry styles (checkbox, dropdown, multi-line edit)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/win32/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/win32/widgets/_base.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/win32/widgets/entry.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue/forms/src/uidrivers/win32/UIdriver.py
diff -c gnue/forms/src/uidrivers/win32/UIdriver.py:1.2 
gnue/forms/src/uidrivers/win32/UIdriver.py:1.3
*** gnue/forms/src/uidrivers/win32/UIdriver.py:1.2      Sun Mar  2 17:45:12 2003
--- gnue/forms/src/uidrivers/win32/UIdriver.py  Wed Mar  5 16:10:37 2003
***************
*** 185,191 ****
  
  
  
!   def _activateForm(self, form):
  
  
      # Go ahead and display
--- 185,191 ----
  
  
  
!   def _activateForm(self, form, modal=0):
  
  
      # Go ahead and display
Index: gnue/forms/src/uidrivers/win32/widgets/_base.py
diff -c gnue/forms/src/uidrivers/win32/widgets/_base.py:1.2 
gnue/forms/src/uidrivers/win32/widgets/_base.py:1.3
*** gnue/forms/src/uidrivers/win32/widgets/_base.py:1.2 Sun Mar  2 17:45:12 2003
--- gnue/forms/src/uidrivers/win32/widgets/_base.py     Wed Mar  5 16:10:37 2003
***************
*** 39,45 ****
  class Win32Base:
    _connectTable = {}
  
!   def Create(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
      if parent == 0:
        hparent = 0
      else:
--- 39,45 ----
  class Win32Base:
    _connectTable = {}
  
!   def Create(self, styleEx, className, windowTitle, style, x,y, width,height, 
parent,menu=0,instance=0):
      if parent == 0:
        hparent = 0
      else:
***************
*** 65,71 ****
      try:
        win32gui.ShowWindow(self._whnd, win32con.SW_SHOWNORMAL)
      except:
!       pass
  
    def Hide(self):
      try:
--- 65,71 ----
      try:
        win32gui.ShowWindow(self._whnd, win32con.SW_SHOWNORMAL)
      except:
!       print "Show failed"
  
    def Hide(self):
      try:
***************
*** 80,92 ****
      return self._children
  
    def SetFocus(self):
!     win32gui.SendMessage(self._whnd, WM_SETFOCUS, 0, 0)
! 
!   def SetValue(self, value):
!     win32gui.SetWindowText(self._whnd, str(value))
! 
!   def GetValue(self):
!     return win32gui.GetWindowText(self._whnd)
  
    def Enable(self, enabled):
      if enabled:
--- 80,86 ----
      return self._children
  
    def SetFocus(self):
!     win32gui.SendMessage(self._whnd, win32con.WM_SETFOCUS, 0, 0)
  
    def Enable(self, enabled):
      if enabled:
***************
*** 103,109 ****
  
  class Win32Window(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, uidriver, styleEx, className, windowTitle, 
style, x,y, width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
--- 97,103 ----
  
  class Win32Window(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
***************
*** 113,119 ****
  
  class Win32Box(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, uidriver, styleEx, className, windowTitle, 
style, x,y, width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
--- 107,113 ----
  
  class Win32Box(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
***************
*** 123,129 ****
  
  class Win32Label(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, uidriver, styleEx, className, windowTitle, 
style, x,y, width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
--- 117,123 ----
  
  class Win32Label(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
***************
*** 133,149 ****
  
  class Win32Entry(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, uidriver, styleEx, className, windowTitle, 
style, x,y, width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
! 
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
      print "OnWMCommand Win32Entry"
      return win32gui.DefWindowProc(hwnd, msg, wParam, lParam)
  
  
  class Win32Button(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, uidriver, styleEx, className, windowTitle, 
style, x,y, width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
--- 127,170 ----
  
  class Win32Entry(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
!     self._uiDriver = uidriver
!     
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
      print "OnWMCommand Win32Entry"
      return win32gui.DefWindowProc(hwnd, msg, wParam, lParam)
  
+   def SetValue(self, value):
+       object = self._uiDriver._IdToGFObj[self._whnd]
+       if object.style == 'checkbox':
+         if value:
+           val = win32con.BST_CHECKED
+         else:
+           val = win32con.BST_UNCHECKED
+         win32gui.SendMessage(self._whnd, win32con.BM_SETCHECK, val, 0)
+       elif object.style == 'dropdown':
+         win32gui.SendMessage(self._whnd, win32con.CB_SELECTSTRING, -1, value) 
# CB_SETCURSEL, value, 0)
+       else:
+         win32gui.SetWindowText(self._whnd, str(value))
+ 
+   def GetValue(self):
+       object = self._uiDriver._IdToGFObj[self._whnd]
+       if object.style == 'checkbox':
+         val = win32gui.SendMessage(self._whnd, win32con.BM_GETCHECK, 0, 0) & 
win32con.BST_CHECKED
+         if val:
+           return 1
+         else:
+           return 0
+       elif object.style == 'dropdown':
+         return win32gui.SendMessage(self._whnd, win32con.CB_GETCURSEL, 0, 0)
+       else:
+         return win32gui.GetWindowText(self._whnd)
+ 
  
  class Win32Button(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
***************
*** 157,163 ****
  
  class Win32Page(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, uidriver, styleEx, className, windowTitle, 
style, x,y, width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
--- 178,184 ----
  
  class Win32Page(Win32Base):
    def __init__(self, uidriver, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0):
!     whnd=Win32Base.Create(self, styleEx, className, windowTitle, style, x,y, 
width,height, parent,menu=0,instance=0)
      uidriver._IdToWin32Obj[whnd] = self
  
    def OnWMCommand(self, hwnd, msg, wParam, lParam):
Index: gnue/forms/src/uidrivers/win32/widgets/entry.py
diff -c gnue/forms/src/uidrivers/win32/widgets/entry.py:1.2 
gnue/forms/src/uidrivers/win32/widgets/entry.py:1.3
*** gnue/forms/src/uidrivers/win32/widgets/entry.py:1.2 Sun Mar  2 17:45:12 2003
--- gnue/forms/src/uidrivers/win32/widgets/entry.py     Wed Mar  5 16:10:37 2003
***************
*** 43,95 ****
    def _createWidget(self, event, spacer):
      object = event.object
  
!     style = object.style
  
! #    if style == 'dropdown':
! #      if event.initialize:
! #        choices = object._field.allowedValues()[1]
! #      else:
! #        choices = [""]
! #
! #      newWidget = wxComboBox(event.container, -1, "",defaultPoint,
! #                              wxSize(self.itemWidth,self.itemHeight),
! #                             choices, wxCB_DROPDOWN,) # |wxWANTS_CHARS,)
! #    elif style == 'label':
! #      newWidget = wxStaticText(event.container, -1, 
"",defaultPoint,defaultSize,
! #                               wxST_NO_AUTORESIZE)
!       # To make the label consistent with the other entry styles...
! #      newWidget.SetValue = newWidget.SetLabel
! #      newWidget.GetValue = newWidget.GetLabel
! #    elif style == 'checkbox':
! #      newWidget = wxCheckBox(event.container, -1, "",defaultPoint,
! #                             wxSize(2*event.textWidth,event.textHeight),
! #                             wxNO_BORDER)
! #    else: # Normal text box
! #      if event.initialize:
! #        styles = wxTE_PROCESS_TAB
! #        if hasattr(object,'Char__height') and object.Char__height > 1:
! #          styles = styles|wxTE_MULTILINE
! #        value = ""  ## object.getValue()
! #      else:
! #        styles = 0
! #        value = ""
! #      newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, 
defaultSize, styles)
! 
!     style = win32con.ES_NOHIDESEL | win32con.ES_AUTOHSCROLL | \
!                  win32con.WS_CHILD | win32con.WS_BORDER
!     styleEx = win32con.WS_EX_CLIENTEDGE
  
!     newWidget = Win32Entry(self._uiDriver, styleEx, 'EDIT', "entry", style,
                          object.Char__x*event.widgetWidth,
                          
(object.Char__y+spacer+(object._gap*spacer))*event.widgetHeight,
!                         self.itemWidth,
!                         self.itemHeight,
                          event.container)
  
!     value = ""
  
      self._eventHandler = event.eventHandler
!     _setDefaultEventHandlers(newWidget, event.eventHandler, 
event.initialize,self._uiDriver)
      return newWidget
  
  
--- 43,96 ----
    def _createWidget(self, event, spacer):
      object = event.object
  
!     ostyle = object.style
!     height = self.itemHeight
!     width = self.itemWidth
!     
!     if ostyle == 'dropdown':
!       style = win32con.WS_CHILD | win32con.WS_VSCROLL | win32con.WS_BORDER | 
win32con.LBS_NOTIFY | \
!                  win32con.CBS_DROPDOWNLIST | win32con.CBS_NOINTEGRALHEIGHT
!       styleEx = 0
!       className = "COMBOBOX"
!       height = self.itemHeight +100 # TODO
!       
!     elif ostyle == 'label':
!       style = win32con.WS_CHILD
!       styleEx = 0
!       className = "STATIC"
  
!     elif ostyle == 'checkbox':
!       style = win32con.WS_CHILD | win32con.BS_AUTOCHECKBOX
!       styleEx = 0
!       className = "BUTTON"
!       width = event.textWidth
!       height = event.textHeight
!       
!     else: # Normal text box
!       style = win32con.WS_CHILD | win32con.ES_AUTOHSCROLL | \
!                  win32con.ES_NOHIDESEL | win32con.WS_BORDER
  
!       if hasattr(object,'Char__height') and object.Char__height > 1:
!         style = style | win32con.ES_MULTILINE | win32con.WS_VSCROLL | \
!                win32con.ES_AUTOVSCROLL | win32con.ES_WANTRETURN
! 
!       styleEx = win32con.WS_EX_CLIENTEDGE
!       className = "EDIT"
! 
!     newWidget = Win32Entry(self._uiDriver, styleEx, className, "", style,
                          object.Char__x*event.widgetWidth,
                          
(object.Char__y+spacer+(object._gap*spacer))*event.widgetHeight,
!                         width,
!                         height,
                          event.container)
  
!     if ostyle == 'dropdown':
!       for item in object._field.allowedValues()[1]:
!         win32gui.SendMessage(newWidget.GetId(), win32con.CB_ADDSTRING, 0, 
item)
  
      self._eventHandler = event.eventHandler
!     if event.initialize:
!       _setDefaultEventHandlers(newWidget, event.eventHandler, 
event.initialize,self._uiDriver)
      return newWidget
  
  




reply via email to

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