CVS: anygui/lib/anygui Applications.py,1.26,1.27 ComboBoxes.py,1.1,1.2 __init__.py,1.74,1.75

Magnus Lie Hetland <[email protected]> Sun, 17 Nov 2002 10:42:09 -0800
Newsgroups gmane.comp.python.anygui.cvs
Message-ID <[email protected]>
Update of /cvsroot/anygui/anygui/lib/anygui
In directory usw-pr-cvs1:/tmp/cvs-serv11968/lib/anygui

Modified Files:
	Applications.py ComboBoxes.py __init__.py 
Log Message:
Started to fiddle with a Borg Application, and tried to fix line endings.


Index: Applications.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/Applications.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** Applications.py	16 Nov 2002 17:50:03 -0000	1.26
--- Applications.py	17 Nov 2002 18:42:07 -0000	1.27
***************
*** 10,15 ****
--- 10,17 ----
      _name = 'Anygui App'
      _version = '0'
+     #__shared_state = {} # For the Borg pattern
  
      def __init__(self, **kwds):
+         #self.__dict__ = self.__shared_state # Borg behaviour
          Attrib.__init__(self)
          self.parseKwds(**kwds)

Index: ComboBoxes.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/ComboBoxes.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ComboBoxes.py	16 Nov 2002 12:45:23 -0000	1.1
--- ComboBoxes.py	17 Nov 2002 18:42:07 -0000	1.2
***************
*** 1,10 ****
! from anygui.Components import Component
! from anygui import Defaults, backendModule, frontEndWrappers
! 
! class ComboBox(Component, Defaults.ComboBox):
! 
!     def wrapperFactory(self):
!         try:
!             return backendModule().ComboBoxWrapper(self)
!         except(AttributeError):
              return frontEndWrappers().ComboBoxWrapper(self)
--- 1,10 ----
! from anygui.Components import Component
! from anygui import Defaults, backendModule, frontEndWrappers
! 
! class ComboBox(Component, Defaults.ComboBox):
! 
!     def wrapperFactory(self):
!         try:
!             return backendModule().ComboBoxWrapper(self)
!         except(AttributeError):
              return frontEndWrappers().ComboBoxWrapper(self)

Index: __init__.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/__init__.py,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -r1.74 -r1.75
*** __init__.py	16 Nov 2002 12:41:10 -0000	1.74
--- __init__.py	17 Nov 2002 18:42:07 -0000	1.75
***************
*** 1,178 ****
! #_backends = 'msw gtk java wx tk beos qt curses text'
! _backends = 'java msw wx qt tk'
! 
! # 20020208:mlh -- starting to experiment with new architecture
! __all__ = """
! 
!   Application
!   Frame
!   GroupBox
!   Button
!   CheckBox
!   Options
!   Window
!   Label
!   TextField
!   TextArea
!   ListBox
!   ComboBox
!   RadioButton
!   RadioGroup
!   BooleanModel
!   ListModel
!   TextModel
!   any
!   application
!   backend
!   link
!   send
!   sender
!   setup
!   unlink
!   unlinkHandler
!   unlinkMethods
!   unlinkSource
!   AboutDialog
!   OpenFileDialog
! 
! """.split()
! 
! def application():
!     'Returns the global application object'
!     #global _application
!     if not _application:
!         #_application = factory()._map['Application']()
!         raise RuntimeError, 'no application exists'
!     return _application
! 
! def backend():
!     'Returns the name of the current backend'
!     if not _backend_name:
!         raise RuntimeError, 'no backend exists'
!     return _backend_name
! 
! def backendModule():
!     'Returns the current backend module'
!     if not _backend:
!         raise RuntimeError, 'no backend exists'
!     return _backend
! 
! def frontEndWrappers():
!     'Returns the list of available frontend widgets'
!     if not _frontend_wrappers:
!         raise RuntimeError, 'no frontend wrappers exists'
!     return _frontend_wrappers
! 
! def setup(self, **kwds):
!     'Used to configure Anygui'
!     raise NotImplementedError
! 
! 
! ########## Get the list of frontend wrappers ##############################
! import anygui.frontend_wrappers as few
! _frontend_wrappers = few
! ########## End get list of frontend wrappers ##############################
! 
! ########## Begin Imports ##################################################
! 
! import os, sys
! from anygui.Attribs          import Attrib
! from anygui.Utils            import Options
! #from anygui.Applications     import AbstractApplication
! from anygui.Windows          import Window
! from anygui.Buttons          import Button
! #from anygui.Canvases         import Canvas
! #from anygui                  import Colors
! from anygui.Labels           import Label
! from anygui.CheckBoxes       import CheckBox
! from anygui.RadioButtons     import RadioButton
! from anygui.RadioGroups      import RadioGroup
! from anygui.TextFields       import TextField
! from anygui.TextAreas        import TextArea
! from anygui.ListBoxes        import ListBox
! from anygui.ComboBoxes       import ComboBox
! from anygui.Models           import BooleanModel, ListModel, TextModel
! from anygui.Events           import *
! from anygui.Frames           import Frame, GroupBox
! from anygui.LayoutManagers   import LayoutManager, Placer
! from anygui.Menus            import MenuBar, Menu, MenuCommand, MenuCheck, MenuSeparator
! 
! # import objects from dialogs
! from anygui.dialogs          import *
! 
! ########### End Imports ###################################################
! 
! """
! # Original export list:
! __all__ = ['application', 'Application',
!            'Window', 'Button', 'CheckBox', 'Label',
!            'RadioButton', 'RadioGroup', 'ListBox', 'TextField', 'TextArea',
!            'BooleanModel', 'ListModel', 'TextModel', 'Options',
!            'LayoutManager', 'Placer',
!            'send', 'sender', 'link', 'unlink', 'any', 'unlinkSource', 'unlinkHandler',
!            'unlinkMethods', 'Frame', 'Placer', 'backend'
!            ] # FIXME: Add stuff from Colors and Fonts
! """
! 
! # Try to get the environment variables ANYGUI_WISHLIST (overrides
! # anygui.wishlist), and ANYGUI_DEBUG (to print out stacktraces when
! # importing backends):
! 
! if hasattr(sys, 'registry'):
!     # Jython:
!     wishlist = sys.registry.getProperty('ANYGUI_WISHLIST', _backends).split()
!     DEBUG = sys.registry.getProperty('ANYGUI_DEBUG', '0')
! else:
!     # CPython:
!     wishlist = os.environ.get('ANYGUI_WISHLIST', _backends).split()
!     DEBUG = os.environ.get('ANYGUI_DEBUG', '0')
! 
! # Non-empty string may be zero (i.e. false):
! if DEBUG:
!     try:
!         DEBUG = int(DEBUG)
!     except ValueError:
!         pass
! 
! _application  = None
! _backend      = None
! _backend_name = None
! 
! def _dotted_import(name):
!     # version of __import__ which handles dotted names
!     # copied from python docs for __import__
!     import string
!     mod = __import__(name, globals(), locals(), [])
!     components = string.split(name, '.')
!     for comp in components[1:]:
!         mod = getattr(mod, comp)
!     return mod
! 
! def _backend_passthrough():
!     global _backends, _backend, _backend_name
!     _backends = _backends.split()
!     _backends = [b for b in _backends if not b in wishlist]
!     if wishlist:
!         try:
!             idx = wishlist.index('*')
!             wishlist[idx:idx+1] = _backends
!         except ValueError: pass
!         _backends = wishlist
!     for name in _backends:
!         try:
!             mod = _dotted_import('anygui.backends.%sgui' % name,)
!             for key in mod.__all__:
!                 globals()[key] = mod.__dict__[key]
!         except (ImportError, AttributeError, KeyError):
!             if DEBUG and not (DEBUG in _backends and not DEBUG==name):
!                 import traceback
!                 traceback.print_exc()
!             continue
!         else:
!             _backend_name = name
!             _backend      = mod
!             return
!     raise RuntimeError, "no usable backend found"
! 
! # Pass the backend namespace through:
! _backend_passthrough()
--- 1,179 ----
! #_backends = 'msw gtk java wx tk beos qt curses text'
! _backends = 'java msw wx qt tk'
! 
! # 20020208:mlh -- starting to experiment with new architecture
! __all__ = """
! 
!   Application
!   Frame
!   GroupBox
!   Button
!   CheckBox
!   Options
!   Window
!   Label
!   TextField
!   TextArea
!   ListBox
!   ComboBox
!   RadioButton
!   RadioGroup
!   BooleanModel
!   ListModel
!   TextModel
!   any
!   application
!   backend
!   link
!   send
!   sender
!   setup
!   unlink
!   unlinkHandler
!   unlinkMethods
!   unlinkSource
!   AboutDialog
!   OpenFileDialog
! 
! """.split()
! 
! # When the Borg pattern is in use, this is no longer needed:
! def application():
!     'Returns the global application object'
!     #global _application
!     if not _application:
!         #_application = backendModule().Application()
!         raise RuntimeError, 'no application exists'
!     return _application
! 
! def backend():
!     'Returns the name of the current backend'
!     if not _backend_name:
!         raise RuntimeError, 'no backend exists'
!     return _backend_name
! 
! def backendModule():
!     'Returns the current backend module'
!     if not _backend:
!         raise RuntimeError, 'no backend exists'
!     return _backend
! 
! def frontEndWrappers():
!     'Returns the list of available frontend widgets'
!     if not _frontend_wrappers:
!         raise RuntimeError, 'no frontend wrappers exists'
!     return _frontend_wrappers
! 
! def setup(self, **kwds):
!     'Used to configure Anygui'
!     raise NotImplementedError
! 
! 
! ########## Get the list of frontend wrappers ##############################
! import anygui.frontend_wrappers as few
! _frontend_wrappers = few
! ########## End get list of frontend wrappers ##############################
! 
! ########## Begin Imports ##################################################
! 
! import os, sys
! from anygui.Attribs          import Attrib
! from anygui.Utils            import Options
! #from anygui.Applications     import AbstractApplication
! from anygui.Windows          import Window
! from anygui.Buttons          import Button
! #from anygui.Canvases         import Canvas
! #from anygui                  import Colors
! from anygui.Labels           import Label
! from anygui.CheckBoxes       import CheckBox
! from anygui.RadioButtons     import RadioButton
! from anygui.RadioGroups      import RadioGroup
! from anygui.TextFields       import TextField
! from anygui.TextAreas        import TextArea
! from anygui.ListBoxes        import ListBox
! from anygui.ComboBoxes       import ComboBox
! from anygui.Models           import BooleanModel, ListModel, TextModel
! from anygui.Events           import *
! from anygui.Frames           import Frame, GroupBox
! from anygui.LayoutManagers   import LayoutManager, Placer
! from anygui.Menus            import MenuBar, Menu, MenuCommand, MenuCheck, MenuSeparator
! 
! # import objects from dialogs
! from anygui.dialogs          import *
! 
! ########### End Imports ###################################################
! 
! """
! # Original export list:
! __all__ = ['application', 'Application',
!            'Window', 'Button', 'CheckBox', 'Label',
!            'RadioButton', 'RadioGroup', 'ListBox', 'TextField', 'TextArea',
!            'BooleanModel', 'ListModel', 'TextModel', 'Options',
!            'LayoutManager', 'Placer',
!            'send', 'sender', 'link', 'unlink', 'any', 'unlinkSource', 'unlinkHandler',
!            'unlinkMethods', 'Frame', 'Placer', 'backend'
!            ] # FIXME: Add stuff from Colors and Fonts
! """
! 
! # Try to get the environment variables ANYGUI_WISHLIST (overrides
! # anygui.wishlist), and ANYGUI_DEBUG (to print out stacktraces when
! # importing backends):
! 
! if hasattr(sys, 'registry'):
!     # Jython:
!     wishlist = sys.registry.getProperty('ANYGUI_WISHLIST', _backends).split()
!     DEBUG = sys.registry.getProperty('ANYGUI_DEBUG', '0')
! else:
!     # CPython:
!     wishlist = os.environ.get('ANYGUI_WISHLIST', _backends).split()
!     DEBUG = os.environ.get('ANYGUI_DEBUG', '0')
! 
! # Non-empty string may be zero (i.e. false):
! if DEBUG:
!     try:
!         DEBUG = int(DEBUG)
!     except ValueError:
!         pass
! 
! _application  = None
! _backend      = None
! _backend_name = None
! 
! def _dotted_import(name):
!     # version of __import__ which handles dotted names
!     # copied from python docs for __import__
!     import string
!     mod = __import__(name, globals(), locals(), [])
!     components = string.split(name, '.')
!     for comp in components[1:]:
!         mod = getattr(mod, comp)
!     return mod
! 
! def _backend_passthrough():
!     global _backends, _backend, _backend_name
!     _backends = _backends.split()
!     _backends = [b for b in _backends if not b in wishlist]
!     if wishlist:
!         try:
!             idx = wishlist.index('*')
!             wishlist[idx:idx+1] = _backends
!         except ValueError: pass
!         _backends = wishlist
!     for name in _backends:
!         try:
!             mod = _dotted_import('anygui.backends.%sgui' % name,)
!             for key in mod.__all__:
!                 globals()[key] = mod.__dict__[key]
!         except (ImportError, AttributeError, KeyError):
!             if DEBUG and not (DEBUG in _backends and not DEBUG==name):
!                 import traceback
!                 traceback.print_exc()
!             continue
!         else:
!             _backend_name = name
!             _backend      = mod
!             return
!     raise RuntimeError, "no usable backend found"
! 
! # Pass the backend namespace through:
! _backend_passthrough()



-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html