CVS: anygui/lib/anygui/backends wxgui.py,1.46,1.47

Magnus Lie Hetland <[email protected]> Sun, 20 Oct 2002 05:27:56 -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-serv31806/lib/anygui/backends

Modified Files:
	wxgui.py 
Log Message:


Index: wxgui.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/backends/wxgui.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** wxgui.py	8 Aug 2002 07:24:24 -0000	1.46
--- wxgui.py	20 Oct 2002 12:27:54 -0000	1.47
***************
*** 46,50 ****
  from anygui.Utils import log
  from anygui.Applications import AbstractApplication
! from anygui.Wrappers import AbstractWrapper, DummyWidget, isDummy
  from anygui.Events import *
  from anygui import application
--- 46,50 ----
  from anygui.Utils import log
  from anygui.Applications import AbstractApplication
! from anygui.Wrappers import AbstractWrapper
  from anygui.Events import *
  from anygui import application
***************
*** 91,97 ****
              return
          parent = container.wrapper.widget
!         try:
!             assert parent.isDummy()
!         except (AttributeError, AssertionError):
              self.destroy()
              self.create(parent)
--- 91,95 ----
              return
          parent = container.wrapper.widget
!         if parent is not None:
              self.destroy()
              self.create(parent)
***************
*** 99,103 ****
  
      def setGeometry(self,x,y,width,height):
!         if self.noWidget(): return
          self.widget.SetPosition((int(x), int(y)))
          self.widget.SetSize((int(width), int(height)))
--- 97,102 ----
  
      def setGeometry(self,x,y,width,height):
!         #if self.noWidget(): return
!         if self.widget is None: return
          self.widget.SetPosition((int(x), int(y)))
          self.widget.SetSize((int(width), int(height)))
***************
*** 110,129 ****
      # COMMON W/MSWGUI
      def setX(self,x):
!         if self.noWidget(): return
          ox,y,w,h = self.getGeometry()
          self.setGeometry(x,y,w,h)
  
      def setY(self,y):
!         if self.noWidget(): return
          x,oy,w,h = self.getGeometry()
          self.setGeometry(x,y,w,h)
  
      def setWidth(self,width):
!         if self.noWidget(): return
          x,y,ow,h = self.getGeometry()
          self.setGeometry(x,y,width,h)
  
      def setHeight(self,height):
!         if self.noWidget(): return
          x,y,w,oh = self.getGeometry()
          self.setGeometry(x,y,w,height)
--- 109,128 ----
      # COMMON W/MSWGUI
      def setX(self,x):
!         if self.widget is None: return
          ox,y,w,h = self.getGeometry()
          self.setGeometry(x,y,w,h)
  
      def setY(self,y):
!         if self.widget is None: return
          x,oy,w,h = self.getGeometry()
          self.setGeometry(x,y,w,h)
  
      def setWidth(self,width):
!         if self.widget is None: return
          x,y,ow,h = self.getGeometry()
          self.setGeometry(x,y,width,h)
  
      def setHeight(self,height):
!         if self.widget is None: return
          x,y,w,oh = self.getGeometry()
          self.setGeometry(x,y,w,height)
***************
*** 131,153 ****
  
      def setSize(self,width,height):
!         if self.noWidget(): return
          self.widget.SetSize(width,height)
  
      def setPosition(self,x,y):
!         if self.noWidget(): return
          self.widget.SetPosition(x,y)
  
      def setVisible(self,visible):
!         if not self.noWidget():
              self.widget.Show(int(visible))
  
      def setEnabled(self,enabled):
!         if not self.noWidget():
              self.widget.Enable(int(enabled))
  
      def destroy(self):
!         if not self.noWidget():
              self.widget.Destroy()
!             self.widget = DummyWidget()
          try:
              self._forgetContents()
--- 130,153 ----
  
      def setSize(self,width,height):
!         if self.widget is None: return
          self.widget.SetSize(width,height)
  
      def setPosition(self,x,y):
!         if self.widget is None: return
          self.widget.SetPosition(x,y)
  
      def setVisible(self,visible):
!         if not self.widget is None:
              self.widget.Show(int(visible))
  
      def setEnabled(self,enabled):
!         if not self.widget is None:
              self.widget.Enable(int(enabled))
  
      def destroy(self):
!         if not self.widget is None:
              self.widget.Destroy()
!             #self.widget = DummyWidget()
!             self.widget = None # @@@
          try:
              self._forgetContents()
***************
*** 156,164 ****
  
      def setText(self,text):
!         if not self.noWidget() and hasattr(self.widget, 'SetLabel'):
              self.widget.SetLabel(str(text))
  
      def getText(self):
!         if not self.noWidget() and hasattr(self.widget, 'SetLabel'):
              return self.widget.GetLabel()
          return ""
--- 156,164 ----
  
      def setText(self,text):
!         if not self.widget is None and hasattr(self.widget, 'SetLabel'):
              self.widget.SetLabel(str(text))
  
      def getText(self):
!         if not self.widget is None and hasattr(self.widget, 'SetLabel'):
              return self.widget.GetLabel()
          return ""
***************
*** 192,200 ****
  
      def getSelection(self):
!         if not self.noWidget():
              return self.widget.GetSelection()
  
      def setItems(self,items):
!         if not self.noWidget():
              for index in range(self.widget.Number()):
                  self.widget.Delete(0)
--- 192,200 ----
  
      def getSelection(self):
!         if not self.widget is None:
              return self.widget.GetSelection()
  
      def setItems(self,items):
!         if not self.widget is None:
              for index in range(self.widget.Number()):
                  self.widget.Delete(0)
***************
*** 202,211 ****
  
      def setSelection(self,selection):
!         if not self.noWidget():
              if self.widget.Number() > 0:
                  self.widget.SetSelection(int(selection)) # Does not cause an event
  
      def widgetSetUp(self):
!         if not self.noWidget():
              EVT_LISTBOX(self.widget, self._wx_id, self._wx_clicked)
  
--- 202,211 ----
  
      def setSelection(self,selection):
!         if not self.widget is None:
              if self.widget.Number() > 0:
                  self.widget.SetSelection(int(selection)) # Does not cause an event
  
      def widgetSetUp(self):
!         if not self.widget is None:
              EVT_LISTBOX(self.widget, self._wx_id, self._wx_clicked)
  
***************
*** 218,226 ****
  
      def setOn(self,on):
!         if not self.noWidget():
              self.widget.SetValue(int(on))
  
      def getOn(self):
!         if not self.noWidget():
              return self.widget.GetValue()
  
--- 218,226 ----
  
      def setOn(self,on):
!         if not self.widget is None:
              self.widget.SetValue(int(on))
  
      def getOn(self):
!         if not self.widget is None:
              return self.widget.GetValue()
  
***************
*** 272,276 ****
  
      def getText(self):
!         if not self.noWidget():
              if sys.platform[:3] == 'win':
                  return self.widget.GetValue().replace('\r','')
--- 272,276 ----
  
      def getText(self):
!         if not self.widget is None:
              if sys.platform[:3] == 'win':
                  return self.widget.GetValue().replace('\r','')
***************
*** 279,283 ****
              
      def setText(self,text):
!         if not self.noWidget():
              # XXX Recursive updates seem to be no problem here,
              # wx does not seem to trigger the EVT_TEXT handler
--- 279,283 ----
              
      def setText(self,text):
!         if not self.widget is None:
              # XXX Recursive updates seem to be no problem here,
              # wx does not seem to trigger the EVT_TEXT handler
***************
*** 286,290 ****
  
      def setEditable(self,editable):
!         if not self.noWidget():
              self.widget.SetEditable(int(editable))
  
--- 286,290 ----
  
      def setEditable(self,editable):
!         if not self.widget is None:
              self.widget.SetEditable(int(editable))
  
***************
*** 293,301 ****
  
      def getSelection(self):
!         if not self.noWidget():
              return self.widget.GetSelection()
  
      def setSelection(self,selection):
!         if not self.noWidget():
              start, end = selection
              self.widget.SetSelection(int(start), int(end))
--- 293,301 ----
  
      def getSelection(self):
!         if not self.widget is None:
              return self.widget.GetSelection()
  
      def setSelection(self,selection):
!         if not self.widget is None:
              start, end = selection
              self.widget.SetSelection(int(start), int(end))
***************
*** 312,316 ****
  
      def getSelection(self):
!         if not self.noWidget():
              start, end = self.widget.GetSelection()
              if sys.platform[:3] == 'win':
--- 312,316 ----
  
      def getSelection(self):
!         if not self.widget is None:
              start, end = self.widget.GetSelection()
              if sys.platform[:3] == 'win':
***************
*** 341,345 ****
  
      def setSelection(self,selection):
!         if not self.noWidget():
              start, end = selection
              if sys.platform[:3] == 'win':
--- 341,345 ----
  
      def setSelection(self,selection):
!         if not self.widget is None:
              start, end = selection
              if sys.platform[:3] == 'win':
***************
*** 371,375 ****
              except AttributeError:
                  pass
!             comp.wrapper.widget = DummyWidget()
  
      def setContainer(self, *args, **kws):
--- 371,376 ----
              except AttributeError:
                  pass
!             #comp.wrapper.widget = DummyWidget()
!             comp.wrapper.widget = None # @@@
  
      def setContainer(self, *args, **kws):
***************
*** 398,402 ****
          # override this to set the CLIENT size (not the window size)
          # to take account for title bar, borders and so on.
!         if not self.noWidget():
              self.widget.SetPosition((int(x), int(y)))
              self.widget.SetClientSize((int(width), int(height)))
--- 399,403 ----
          # override this to set the CLIENT size (not the window size)
          # to take account for title bar, borders and so on.
!         if not self.widget is None:
              self.widget.SetPosition((int(x), int(y)))
              self.widget.SetClientSize((int(width), int(height)))
***************
*** 423,427 ****
  
      def setTitle(self,title):
!         if not self.noWidget():
              self.widget.SetTitle(str(title))
  
--- 424,428 ----
  
      def setTitle(self,title):
!         if not self.widget is None:
              self.widget.SetTitle(str(title))
  
***************
*** 429,433 ****
          if not application().isRunning(): return
          if container is None: return
!         if self.noWidget():
              self.create()
          self.proxy.push(blocked=['container'])
--- 430,434 ----
          if not application().isRunning(): return
          if container is None: return
!         if self.widget is None:
              self.create()
          self.proxy.push(blocked=['container'])
***************
*** 487,491 ****
  
      def createIfNeeded(self):
!         if self.noWidget():
              self.create()
              self._id = self.getId()
--- 488,492 ----
  
      def createIfNeeded(self):
!         if self.widget is None:
              self.create()
              self._id = self.getId()
***************
*** 493,497 ****
      def setEnabled(self,enabled):
          #print "setEnabled",self,enabled
!         if self.proxy.container is None or self.proxy.container.wrapper.noWidget():
              return
          self.rebuild_all()
--- 494,499 ----
      def setEnabled(self,enabled):
          #print "setEnabled",self,enabled
!         if self.proxy.container is None or \
!            self.proxy.container.wrapper.widget is None:
              return
          self.rebuild_all()
***************
*** 504,508 ****
              if self.proxy in self.proxy.container.contents:
                  self.proxy.container.contents.remove(self.proxy)
!             self.widget = DummyWidget()
              self.proxy.container.wrapper.rebuild()
          else:
--- 506,511 ----
              if self.proxy in self.proxy.container.contents:
                  self.proxy.container.contents.remove(self.proxy)
!             #self.widget = DummyWidget()
!             self.widget = None # @@@
              self.proxy.container.wrapper.rebuild()
          else:
***************
*** 511,515 ****
  
      def setText(self,text):
!         if self.proxy.container is None or self.proxy.container.wrapper.noWidget():
              return
          try:
--- 514,519 ----
  
      def setText(self,text):
!         if self.proxy.container is None or \
!            self.proxy.container.wrapper.widget is None:
              return
          try:
***************
*** 525,529 ****
  
      def __str__(self):
!         if self.noWidget():
              widg = "NOWIDGET"
          else:
--- 529,533 ----
  
      def __str__(self):
!         if self.widget is None:
              widg = "NOWIDGET"
          else:
***************
*** 542,552 ****
      def setContainer(self,container):
          if not container:
!             if self.noWidget:
                  return
              #print "DESTROYING",self
              #self.widget.destroy()
!             self.widget = DummyWidget()
          else:
!             if container.wrapper.noWidget():
                  return
              #print "Adding menubar",self,"to",self.proxy.container.wrapper
--- 546,557 ----
      def setContainer(self,container):
          if not container:
!             if self.widget is None:
                  return
              #print "DESTROYING",self
              #self.widget.destroy()
!             #self.widget = DummyWidget()
!             self.widget = None # @@@
          else:
!             if container.wrapper.widget is None:
                  return
              #print "Adding menubar",self,"to",self.proxy.container.wrapper
***************
*** 566,570 ****
          if self.proxy.container is None:
              return
!         if self.proxy.container.wrapper.noWidget():
              return
  
--- 571,575 ----
          if self.proxy.container is None:
              return
!         if self.proxy.container.wrapper.widget is None:
              return
  
***************
*** 575,579 ****
          pos = 0
          for item in self.proxy.contents:
!             item.wrapper.widget = DummyWidget()
              item.wrapper.rebuild()
              #print "\tAdding",item.wrapper
--- 580,585 ----
          pos = 0
          for item in self.proxy.contents:
!             #item.wrapper.widget = DummyWidget()
!             item.wrapper.widget = None # @@@
              item.wrapper.rebuild()
              #print "\tAdding",item.wrapper
***************
*** 602,606 ****
      def setContainer(self,container):
          if not container:
!             if self.noWidget:
                  return
              #if self.proxy in self.proxy.container.contents:
--- 608,612 ----
      def setContainer(self,container):
          if not container:
!             if self.widget is None:
                  return
              #if self.proxy in self.proxy.container.contents:
***************
*** 608,615 ****
              #print "DESTROYING",self
              #self.widget.destroy()
!             self.widget = DummyWidget()
              self.proxy.container.wrapper.rebuild()
          else:
!             if container.wrapper.noWidget():
                  return
              self.full = 0
--- 614,622 ----
              #print "DESTROYING",self
              #self.widget.destroy()
!             #self.widget = DummyWidget()
!             self.widget = None
              self.proxy.container.wrapper.rebuild()
          else:
!             if container.wrapper.widget is None:
                  return
              self.full = 0
***************
*** 625,631 ****
          if self.proxy.container is None:
              return
!         if self.noWidget():
              return
!         if self.proxy.container.wrapper.noWidget():
              return
          proxies = [self.proxy]
--- 632,638 ----
          if self.proxy.container is None:
              return
!         if self.widget is None:
              return
!         if self.proxy.container.wrapper.widget is None:
              return
          proxies = [self.proxy]
***************
*** 641,649 ****
          if self.proxy.container is None:
              return
!         if self.proxy.container.wrapper.noWidget():
              return
  
          #print "\tREBUILDING",self,self.proxy.contents
!         if not self.noWidget() and self.full:
              #print "\t\tDELETING CONTENTS OF",self.widget
              ids = [p.wrapper._id for p in self.proxy.contents]
--- 648,656 ----
          if self.proxy.container is None:
              return
!         if self.proxy.container.wrapper.widget is None:
              return
  
          #print "\tREBUILDING",self,self.proxy.contents
!         if not self.widget is None and self.full:
              #print "\t\tDELETING CONTENTS OF",self.widget
              ids = [p.wrapper._id for p in self.proxy.contents]
***************
*** 664,668 ****
          for item in self.proxy.contents:
              if isinstance(item,Menu):
!                 item.wrapper.widget = DummyWidget()
                  item.wrapper.rebuild()
                  #print "\t\t\tADDING",item.wrapper,item.wrapper._id
--- 671,676 ----
          for item in self.proxy.contents:
              if isinstance(item,Menu):
!                 #item.wrapper.widget = DummyWidget()
!                 item.wrapper.widget = None # @@@
                  item.wrapper.rebuild()
                  #print "\t\t\tADDING",item.wrapper,item.wrapper._id
***************
*** 712,716 ****
  
      def setOn(self,on):
!         if self.noWidget():
              return
          #print "setOn",self.proxy,self.proxy.container
--- 720,724 ----
  
      def setOn(self,on):
!         if self.widget is None:
              return
          #print "setOn",self.proxy,self.proxy.container
***************
*** 720,724 ****
  
      def getOn(self):
!         if self.noWidget():
              return
          #print "getOn",self.proxy,self.proxy.container
--- 728,732 ----
  
      def getOn(self):
!         if self.widget is None:
              return
          #print "getOn",self.proxy,self.proxy.container



-------------------------------------------------------
This sf.net email is sponsored by:
Access Your PC Securely with GoToMyPC. Try Free Now
https://www.gotomypc.com/s/OSND/DD