CVS: anygui/lib/anygui/backends javagui.py,1.53,1.54 javagui2.py,1.1,1.2

Magnus Lie Hetland <[email protected]> Sat, 31 Aug 2002 18:27:21 -0700
Newsgroups gmane.comp.python.anygui.cvs
Message-ID <[email protected]>
Update of /cvsroot/anygui/anygui/lib/anygui/backends
In directory usw-pr-cvs1:/tmp/cvs-serv20937/lib/anygui/backends

Modified Files:
	javagui.py javagui2.py 
Log Message:


Index: javagui.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/backends/javagui.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** javagui.py	1 Sep 2002 00:49:30 -0000	1.53
--- javagui.py	1 Sep 2002 01:27:18 -0000	1.54
***************
*** 6,38 ****
    Application
    ButtonWrapper
    LabelWrapper
-   TextFieldWrapper
-   TextAreaWrapper
    ListBoxWrapper
    WindowWrapper
  
  '''.split()
  
- #__all__ = '''
- #
- #  Application
- #  ButtonWrapper
- #  WindowWrapper
- #  LabelWrapper
- #  TextFieldWrapper
- #  TextAreaWrapper
- #  ListBoxWrapper
- #  RadioButtonWrapper
- #  CheckBoxWrapper
- #
- #'''.split()
- 
  ################################################################
  
  #@@@ FIXME: Implement getGeometry and friends...
  
- #@@@ FIXME: Components don't seem to appear if they are created before
- #@@@ their containing Window
- 
  #@@@ FIXME: Use isDummy instead of repeated try/except :)
  from anygui.Applications import AbstractApplication
--- 6,23 ----
    Application
    ButtonWrapper
+   CheckBoxWrapper
    LabelWrapper
    ListBoxWrapper
+   RadioButtonWrapper
+   TextAreaWrapper
+   TextFieldWrapper
    WindowWrapper
  
  '''.split()
  
  ################################################################
  
  #@@@ FIXME: Implement getGeometry and friends...
  
  #@@@ FIXME: Use isDummy instead of repeated try/except :)
  from anygui.Applications import AbstractApplication
***************
*** 116,120 ****
      def setGeometry(self, x, y, width, height):
          self.widget.bounds = x, y, width, height
!         self.widget.validate() # Needed? Needed in others?
  
      def setVisible(self, visible):
--- 101,106 ----
      def setGeometry(self, x, y, width, height):
          self.widget.bounds = x, y, width, height
!         if self.widget.layout:
!             self.widget.validate()
  
      def setVisible(self, visible):
***************
*** 175,178 ****
--- 161,201 ----
          else:
              return "" # @@@ What would be the best behaviour here? Should there be an exception?
+ 
+ ################################################################
+ 
+ class ToggleButtonMixin:
+                 
+     def setOn(self, on):
+         self.widget.selected = on
+ 
+     def getOn(self):
+         return self.widget.selected
+ 
+     def widgetSetUp(self): # Should perhaps be in a ButtonMixin superclass?
+         self.widget.actionPerformed = self.clickHandler
+ 
+     def clickHandler(self, event): # Should perhaps be in a ButtonMixin superclass?
+         send(self.proxy, 'click')
+ 
+ class CheckBoxWrapper(ToggleButtonMixin, ComponentWrapper):
+ 
+     def widgetFactory(self, *args, **kwds):
+         return swing.JCheckBox()
+ 
+ class RadioButtonWrapper(ToggleButtonMixin, ComponentWrapper):
+ 
+     def widgetFactory(self, *args, **kwds):
+         return swing.JRadioButton()
+ 
+     #FIXME: This is (semi-)eager behaviour, contrary to the current
+     #lazy pull mechanism... [mlh@20020831]
+     def clickHandler(self, event):
+         val = self.widget.selected
+         #FIXME: This doesn't seem right:
+         if val == self.proxy.state['on']:
+             return
+         if self.proxy.group is not None:
+             self.group.modify(value=self.value)
+         send(self.proxy, 'click')
  
  ################################################################

Index: javagui2.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/backends/javagui2.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** javagui2.py	18 Jul 2002 20:21:27 -0000	1.1
--- javagui2.py	1 Sep 2002 01:27:19 -0000	1.2
***************
*** 306,310 ****
              return
          self.modify(on=val)
!         send(self, 'click')
  
  class CheckBox(ToggleButtonMixin, AbstractCheckBox):
--- 306,310 ----
              return
          self.modify(on=val)
!         send(proxy, 'click')
  
  class CheckBox(ToggleButtonMixin, AbstractCheckBox):
***************
*** 322,326 ****
          else: # FIXME: is this branch needed?
            self.modify(on=val)
!         send(self, 'click')
  
  ################################################################
--- 322,326 ----
          else: # FIXME: is this branch needed?
            self.modify(on=val)
!         send(proxy, 'click')
  
  ################################################################



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390