[Python-checkins] python/dist/src/Demo/tix tixwidgets.py,1.10,1.11

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sun Jul 18 08:10:39 CEST 2004


Update of /cvsroot/python/python/dist/src/Demo/tix
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30843

Modified Files:
	tixwidgets.py 
Log Message:
Whitespace normalization, via reindent.py.


Index: tixwidgets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/tix/tixwidgets.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** tixwidgets.py	30 Dec 2002 23:52:00 -0000	1.10
--- tixwidgets.py	18 Jul 2004 06:10:36 -0000	1.11
***************
*** 5,14 ****
  # tixwidgets.py --
  #
! #	For Tix, see http://tix.sourceforge.net
  #
! # 	This is a demo program of some of the Tix widgets available in Python.
! #	If you have installed Python & Tix properly, you can execute this as
  #
! #		% python tixwidgets.py
  #
  
--- 5,14 ----
  # tixwidgets.py --
  #
! #       For Tix, see http://tix.sourceforge.net
  #
! #       This is a demo program of some of the Tix widgets available in Python.
! #       If you have installed Python & Tix properly, you can execute this as
  #
! #               % python tixwidgets.py
  #
  
***************
*** 17,26 ****
  import traceback, tkMessageBox
  
! TCL_DONT_WAIT		= 1<<1
! TCL_WINDOW_EVENTS	= 1<<2
! TCL_FILE_EVENTS		= 1<<3
! TCL_TIMER_EVENTS	= 1<<4
! TCL_IDLE_EVENTS		= 1<<5
! TCL_ALL_EVENTS		= 0
  
  class Demo:
--- 17,26 ----
  import traceback, tkMessageBox
  
! TCL_DONT_WAIT           = 1<<1
! TCL_WINDOW_EVENTS       = 1<<2
! TCL_FILE_EVENTS         = 1<<3
! TCL_TIMER_EVENTS        = 1<<4
! TCL_IDLE_EVENTS         = 1<<5
! TCL_ALL_EVENTS          = 0
  
  class Demo:
***************
*** 29,40 ****
          self.exit = -1
  
!         self.dir = None				# script directory
!         self.balloon = None			# balloon widget
          self.useBalloons = Tix.StringVar()
          self.useBalloons.set('0')
!         self.statusbar = None			# status bar widget
!         self.welmsg = None			# Msg widget
!         self.welfont = ''			# font name
!         self.welsize = ''			# font size
  
          progname = sys.argv[0]
--- 29,40 ----
          self.exit = -1
  
!         self.dir = None                         # script directory
!         self.balloon = None                     # balloon widget
          self.useBalloons = Tix.StringVar()
          self.useBalloons.set('0')
!         self.statusbar = None                   # status bar widget
!         self.welmsg = None                      # Msg widget
!         self.welfont = ''                       # font name
!         self.welsize = ''                       # font size
  
          progname = sys.argv[0]
***************
*** 73,77 ****
          # The trace variable option doesn't seem to work, instead I use 'command'
          #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w',
!         #		      ToggleHelp))
  
          return w
--- 73,77 ----
          # The trace variable option doesn't seem to work, instead I use 'command'
          #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w',
!         #                     ToggleHelp))
  
          return w
***************
*** 131,135 ****
          # Tkinter defines a Tcl tkerror procedure that in effect
          # silences all background Tcl error reporting.
! 	# root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}')
      def quitcmd (self):
          """Quit our mainloop. It is up to you to call root.destroy() after."""
--- 131,135 ----
          # Tkinter defines a Tcl tkerror procedure that in effect
          # silences all background Tcl error reporting.
!         # root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}')
      def quitcmd (self):
          """Quit our mainloop. It is up to you to call root.destroy() after."""
***************
*** 137,143 ****
  
      def loop(self):
! 	"""This is an explict replacement for _tkinter mainloop()
! 	It lets you catch keyboard interrupts easier, and avoids
! 	the 20 msec. dead sleep() which burns a constant CPU."""
          while self.exit < 0:
              # There are 2 whiles here. The outer one lets you continue
--- 137,143 ----
  
      def loop(self):
!         """This is an explict replacement for _tkinter mainloop()
!         It lets you catch keyboard interrupts easier, and avoids
!         the 20 msec. dead sleep() which burns a constant CPU."""
          while self.exit < 0:
              # There are 2 whiles here. The outer one lets you continue
***************
*** 222,228 ****
  
      demo.balloon.bind_widget(b1, msg='Choose\na font',
! 			     statusmsg='Choose a font for this page')
      demo.balloon.bind_widget(b2, msg='Point size',
! 			     statusmsg='Choose the font size for this page')
      return w
  
--- 222,228 ----
  
      demo.balloon.bind_widget(b1, msg='Choose\na font',
!                              statusmsg='Choose a font for this page')
      demo.balloon.bind_widget(b2, msg='Point size',
!                              statusmsg='Choose the font size for this page')
      return w
  
***************
*** 234,241 ****
      text = 'Welcome to TIX in Python'
      title = Tix.Label(win,
! 		      bd=0, width=30, anchor=Tix.N, text=text)
      msg = Tix.Message(win,
! 		      bd=0, width=400, anchor=Tix.N,
! 		      text='Tix is a set of mega-widgets based on TK. This program \
  demonstrates the widgets in the Tix widget set. You can choose the pages \
  in this window to look at the corresponding widgets. \n\n\
--- 234,241 ----
      text = 'Welcome to TIX in Python'
      title = Tix.Label(win,
!                       bd=0, width=30, anchor=Tix.N, text=text)
      msg = Tix.Message(win,
!                       bd=0, width=400, anchor=Tix.N,
!                       text='Tix is a set of mega-widgets based on TK. This program \
  demonstrates the widgets in the Tix widget set. You can choose the pages \
  in this window to look at the corresponding widgets. \n\n\
***************
*** 251,259 ****
  
      if not demo.welmsg:
! 	return
      font = demo.welfont['value']
      point = demo.welsize['value']
      if font == 'Times Roman':
! 	font = 'times'
      fontstr = '%s %s' % (font, point)
      demo.welmsg['font'] = fontstr
--- 251,259 ----
  
      if not demo.welmsg:
!         return
      font = demo.welfont['value']
      point = demo.welsize['value']
      if font == 'Times Roman':
!         font = 'times'
      fontstr = '%s %s' % (font, point)
      demo.welmsg['font'] = fontstr
***************
*** 261,267 ****
  def ToggleHelp():
      if demo.useBalloons.get() == '1':
! 	demo.balloon['state'] = 'both'
      else:
! 	demo.balloon['state'] = 'none'
  
  def MkChoosers(nb, name):
--- 261,267 ----
  def ToggleHelp():
      if demo.useBalloons.get() == '1':
!         demo.balloon['state'] = 'both'
      else:
!         demo.balloon['state'] = 'none'
  
  def MkChoosers(nb, name):
***************
*** 308,312 ****
      editable = Tix.ComboBox(w, label='Editable', editable=1, options=options)
      history = Tix.ComboBox(w, label='History', editable=1, history=1,
! 			   anchor=Tix.E, options=options)
      static.insert(Tix.END, 'January')
      static.insert(Tix.END, 'February')
--- 308,312 ----
      editable = Tix.ComboBox(w, label='Editable', editable=1, options=options)
      history = Tix.ComboBox(w, label='History', editable=1, history=1,
!                            anchor=Tix.E, options=options)
      static.insert(Tix.END, 'January')
      static.insert(Tix.END, 'February')
***************
*** 341,350 ****
      idx = states.index(demo_spintxt.get()) + inc
      if idx < 0:
! 	idx = len(states) - 1
      elif idx >= len(states):
! 	idx = 0
  # following doesn't work.
  #    return states[idx]
!     demo_spintxt.set(states[idx])	# this works
  
  def spin_validate(w):
--- 341,350 ----
      idx = states.index(demo_spintxt.get()) + inc
      if idx < 0:
!         idx = len(states) - 1
      elif idx >= len(states):
!         idx = 0
  # following doesn't work.
  #    return states[idx]
!     demo_spintxt.set(states[idx])       # this works
  
  def spin_validate(w):
***************
*** 352,358 ****
  
      try:
! 	i = states.index(demo_spintxt.get())
      except ValueError:
! 	return states[0]
      return states[i]
      # why this procedure works as opposed to the previous one beats me.
--- 352,358 ----
  
      try:
!         i = states.index(demo_spintxt.get())
      except ValueError:
!         return states[0]
      return states[i]
      # why this procedure works as opposed to the previous one beats me.
***************
*** 418,423 ****
  def MkFileEnt(w):
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
      ent = Tix.FileEntry(w, label='Select a file : ')
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
--- 418,423 ----
  def MkFileEnt(w):
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
      ent = Tix.FileEntry(w, label='Select a file : ')
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
***************
*** 430,435 ****
      """
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
      box = Tix.FileSelectBox(w)
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
--- 430,435 ----
      """
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
      box = Tix.FileSelectBox(w)
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
***************
*** 444,449 ****
  
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='The Select widget is also good for arranging buttons in a tool bar.')
      bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
      font = Tix.Select(w, allowzero=1, radio=0, label='', options=options)
--- 444,449 ----
  
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='The Select widget is also good for arranging buttons in a tool bar.')
      bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
      font = Tix.Select(w, allowzero=1, radio=0, label='', options=options)
***************
*** 467,472 ****
  def MkTitle(w):
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='There are many types of "chooser" widgets that allow the user to input different types of information')
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
  
--- 467,472 ----
  def MkTitle(w):
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='There are many types of "chooser" widgets that allow the user to input different types of information')
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
  
***************
*** 495,500 ****
      bot = Tix.Frame(w)
      msg = Tix.Message(top,
! 		      relief=Tix.FLAT, width=200, anchor=Tix.N,
! 		      text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.')
  
      list = Tix.ScrolledListBox(top, scrollbar='auto')
--- 495,500 ----
      bot = Tix.Frame(w)
      msg = Tix.Message(top,
!                       relief=Tix.FLAT, width=200, anchor=Tix.N,
!                       text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.')
  
      list = Tix.ScrolledListBox(top, scrollbar='auto')
***************
*** 509,514 ****
  
      rh = Tix.ResizeHandle(top, bg='black',
! 			  relief=Tix.RAISED,
! 			  handlesize=8, gridded=1, minwidth=50, minheight=30)
      btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x))
      top.propagate(0)
--- 509,514 ----
  
      rh = Tix.ResizeHandle(top, bg='black',
!                           relief=Tix.RAISED,
!                           handlesize=8, gridded=1, minwidth=50, minheight=30)
      btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x))
      top.propagate(0)
***************
*** 518,522 ****
      bot.pack(fill=Tix.BOTH)
      list.bind('<Map>', func=lambda arg=0, rh=rh, list=list:
! 	      list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
  
  def SList_reset(rh, list):
--- 518,522 ----
      bot.pack(fill=Tix.BOTH)
      list.bind('<Map>', func=lambda arg=0, rh=rh, list=list:
!               list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list)))
  
  def SList_reset(rh, list):
***************
*** 540,545 ****
      bot = Tix.Frame(w)
      msg = Tix.Message(top,
! 		      relief=Tix.FLAT, width=200, anchor=Tix.N,
! 		      text=text)
  
      win = Tix.ScrolledWindow(top, scrollbar='auto')
--- 540,545 ----
      bot = Tix.Frame(w)
      msg = Tix.Message(top,
!                       relief=Tix.FLAT, width=200, anchor=Tix.N,
!                       text=text)
  
      win = Tix.ScrolledWindow(top, scrollbar='auto')
***************
*** 552,557 ****
  
      rh = Tix.ResizeHandle(top, bg='black',
! 			  relief=Tix.RAISED,
! 			  handlesize=8, gridded=1, minwidth=50, minheight=30)
      btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x))
      top.propagate(0)
--- 552,557 ----
  
      rh = Tix.ResizeHandle(top, bg='black',
!                           relief=Tix.RAISED,
!                           handlesize=8, gridded=1, minwidth=50, minheight=30)
      btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x))
      top.propagate(0)
***************
*** 562,566 ****
  
      win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
! 	     win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
  
  def SWindow_reset(rh, win):
--- 562,566 ----
  
      win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
!              win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
  
  def SWindow_reset(rh, win):
***************
*** 575,592 ****
      bot = Tix.Frame(w)
      msg = Tix.Message(top,
! 		      relief=Tix.FLAT, width=200, anchor=Tix.N,
! 		      text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
  
      win = Tix.ScrolledText(top, scrollbar='auto')
      win.text['wrap'] = 'none'
      win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the
! scrollbars are shown only when needed. 
  Additional modifiers can be used to force a
! scrollbar to be shown or hidden. For example, 
! "auto -y" means the horizontal scrollbar 
! should be shown when needed but the vertical 
  scrollbar should always be hidden;
  "auto +x" means the vertical scrollbar
! should be shown when needed but the horizontal 
  scrollbar should always be shown, and so on.'''
  )
--- 575,592 ----
      bot = Tix.Frame(w)
      msg = Tix.Message(top,
!                       relief=Tix.FLAT, width=200, anchor=Tix.N,
!                       text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
  
      win = Tix.ScrolledText(top, scrollbar='auto')
      win.text['wrap'] = 'none'
      win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the
! scrollbars are shown only when needed.
  Additional modifiers can be used to force a
! scrollbar to be shown or hidden. For example,
! "auto -y" means the horizontal scrollbar
! should be shown when needed but the vertical
  scrollbar should always be hidden;
  "auto +x" means the vertical scrollbar
! should be shown when needed but the horizontal
  scrollbar should always be shown, and so on.'''
  )
***************
*** 594,599 ****
  
      rh = Tix.ResizeHandle(top, bg='black',
! 			  relief=Tix.RAISED,
! 			  handlesize=8, gridded=1, minwidth=50, minheight=30)
      btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x))
      top.propagate(0)
--- 594,599 ----
  
      rh = Tix.ResizeHandle(top, bg='black',
!                           relief=Tix.RAISED,
!                           handlesize=8, gridded=1, minwidth=50, minheight=30)
      btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x))
      top.propagate(0)
***************
*** 603,607 ****
      bot.pack(fill=Tix.BOTH)
      win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
! 	     win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
  
  def SText_reset(rh, win):
--- 603,607 ----
      bot.pack(fill=Tix.BOTH)
      win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
!              win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
  
  def SText_reset(rh, win):
***************
*** 629,634 ****
      """
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.')
      group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
      group.entry.insert(0,'comp.lang.python')
--- 629,634 ----
      """
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.')
      group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
      group.entry.insert(0,'comp.lang.python')
***************
*** 672,677 ****
  def MkNoteBook(w):
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='The NoteBook widget allows you to layout a complex interface into individual pages.')
      # prefix = Tix.OptionName(w)
      # if not prefix: prefix = ''
--- 672,677 ----
  def MkNoteBook(w):
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='The NoteBook widget allows you to layout a complex interface into individual pages.')
      # prefix = Tix.OptionName(w)
      # if not prefix: prefix = ''
***************
*** 739,744 ****
      """
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
      dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16')
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
--- 739,744 ----
      """
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
      dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16')
      msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
***************
*** 749,754 ****
      style FileSelectBox.  """
      msg = Tix.Message(w,
! 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
! 		      text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
      # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed
      box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED)
--- 749,754 ----
      style FileSelectBox.  """
      msg = Tix.Message(w,
!                       relief=Tix.FLAT, width=240, anchor=Tix.N,
!                       text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
      # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed
      box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED)
***************
*** 759,867 ****
  ### List of all the demos we want to show off
  comments = {'widget' : 'Widget Demos', 'image' : 'Image Demos'}
! samples = {'Balloon'		: 'Balloon',
! 	   'Button Box'		: 'BtnBox',
! 	   'Combo Box'		: 'ComboBox',
! 	   'Compound Image'	: 'CmpImg',
! 	   'Directory List'	: 'DirList',
! 	   'Directory Tree'	: 'DirTree',
! 	   'Control'		: 'Control',
! 	   'Notebook'		: 'NoteBook',
! 	   'Option Menu'	: 'OptMenu',
! 	   'Paned Window'	: 'PanedWin',
! 	   'Popup Menu'		: 'PopMenu',
! 	   'ScrolledHList (1)'	: 'SHList1',
! 	   'ScrolledHList (2)'	: 'SHList2',
! 	   'Tree (dynamic)'	: 'Tree'
  }
  
  # There are still a lot of demos to be translated:
! ##	set root {
! ##	    {d "File Selectors"		file	}
! ##	    {d "Hierachical ListBox"	hlist	}
! ##	    {d "Tabular ListBox"	tlist	{c tixTList}}
! ##	    {d "Grid Widget"		grid	{c tixGrid}}
! ##	    {d "Manager Widgets"	manager	}
! ##	    {d "Scrolled Widgets"	scroll	}
! ##	    {d "Miscellaneous Widgets"	misc	}
! ##	    {d "Image Types"		image	}
! ##	}
  ##
! ##	set image {
! ##	    {d "Compound Image"		cmpimg	}
! ##	    {d "XPM Image"		xpm	{i pixmap}}
! ##	}
  ##
! ##	set cmpimg {
! ##done	    {f "In Buttons"		CmpImg.tcl	}
! ##	    {f "In NoteBook"		CmpImg2.tcl	}
! ##	    {f "Notebook Color Tabs"	CmpImg4.tcl	}
! ##	    {f "Icons"			CmpImg3.tcl	}
! ##	}
  ##
! ##	set xpm {
! ##	    {f "In Button"		Xpm.tcl		{i pixmap}}
! ##	    {f "In Menu"		Xpm1.tcl	{i pixmap}}
! ##	}
  ##
! ##	set file {
! ##added	    {f DirList				DirList.tcl	}
! ##added	    {f DirTree				DirTree.tcl	}
! ##	    {f DirSelectDialog			DirDlg.tcl	}
! ##	    {f ExFileSelectDialog		EFileDlg.tcl	}
! ##	    {f FileSelectDialog			FileDlg.tcl	}
! ##	    {f FileEntry			FileEnt.tcl	}
! ##	}
  ##
! ##	set hlist {
! ##	    {f HList			HList1.tcl	}
! ##	    {f CheckList		ChkList.tcl	{c tixCheckList}}
! ##done	    {f "ScrolledHList (1)"	SHList.tcl	}
! ##done	    {f "ScrolledHList (2)"	SHList2.tcl	}
! ##done	    {f Tree			Tree.tcl	}
! ##done	    {f "Tree (Dynamic)"		DynTree.tcl	{v win}}
! ##	}
  ##
! ##	set tlist {
! ##	    {f "ScrolledTList (1)"	STList1.tcl	{c tixTList}}
! ##	    {f "ScrolledTList (2)"	STList2.tcl	{c tixTList}}
! ##	}
! ##	global tcl_platform
! ##	#  This demo hangs windows
! ##	if {$tcl_platform(platform) != "windows"} {
! ##na	lappend tlist     {f "TList File Viewer"	STList3.tcl	{c tixTList}}
! ##	}
  ##
! ##	set grid {
! ##na	    {f "Simple Grid"		SGrid0.tcl	{c tixGrid}}
! ##na	    {f "ScrolledGrid"		SGrid1.tcl	{c tixGrid}}
! ##na	    {f "Editable Grid"		EditGrid.tcl	{c tixGrid}}
! ##	}
  ##
! ##	set scroll {
! ##	    {f ScrolledListBox		SListBox.tcl	}
! ##	    {f ScrolledText		SText.tcl	}
! ##	    {f ScrolledWindow		SWindow.tcl	}
! ##na	    {f "Canvas Object View"	CObjView.tcl	{c tixCObjView}}
! ##	}
  ##
! ##	set manager {
! ##	    {f ListNoteBook		ListNBK.tcl	}
! ##done	    {f NoteBook			NoteBook.tcl	}
! ##done	    {f PanedWindow		PanedWin.tcl	}
! ##	}
  ##
! ##	set misc {
! ##done	    {f Balloon			Balloon.tcl	}
! ##done	    {f ButtonBox		BtnBox.tcl	}
! ##done	    {f ComboBox			ComboBox.tcl	}
! ##done	    {f Control			Control.tcl	}
! ##	    {f LabelEntry		LabEntry.tcl	}
! ##	    {f LabelFrame		LabFrame.tcl	}
! ##	    {f Meter			Meter.tcl	{c tixMeter}}
! ##done	    {f OptionMenu		OptMenu.tcl	}
! ##done	    {f PopupMenu		PopMenu.tcl	}
! ##	    {f Select			Select.tcl	}
! ##	    {f StdButtonBox		StdBBox.tcl	}
! ##	}
  ##
  
--- 759,867 ----
  ### List of all the demos we want to show off
  comments = {'widget' : 'Widget Demos', 'image' : 'Image Demos'}
! samples = {'Balloon'            : 'Balloon',
!            'Button Box'         : 'BtnBox',
!            'Combo Box'          : 'ComboBox',
!            'Compound Image'     : 'CmpImg',
!            'Directory List'     : 'DirList',
!            'Directory Tree'     : 'DirTree',
!            'Control'            : 'Control',
!            'Notebook'           : 'NoteBook',
!            'Option Menu'        : 'OptMenu',
!            'Paned Window'       : 'PanedWin',
!            'Popup Menu'         : 'PopMenu',
!            'ScrolledHList (1)'  : 'SHList1',
!            'ScrolledHList (2)'  : 'SHList2',
!            'Tree (dynamic)'     : 'Tree'
  }
  
  # There are still a lot of demos to be translated:
! ##      set root {
! ##          {d "File Selectors"         file    }
! ##          {d "Hierachical ListBox"    hlist   }
! ##          {d "Tabular ListBox"        tlist   {c tixTList}}
! ##          {d "Grid Widget"            grid    {c tixGrid}}
! ##          {d "Manager Widgets"        manager }
! ##          {d "Scrolled Widgets"       scroll  }
! ##          {d "Miscellaneous Widgets"  misc    }
! ##          {d "Image Types"            image   }
! ##      }
  ##
! ##      set image {
! ##          {d "Compound Image"         cmpimg  }
! ##          {d "XPM Image"              xpm     {i pixmap}}
! ##      }
  ##
! ##      set cmpimg {
! ##done      {f "In Buttons"             CmpImg.tcl      }
! ##          {f "In NoteBook"            CmpImg2.tcl     }
! ##          {f "Notebook Color Tabs"    CmpImg4.tcl     }
! ##          {f "Icons"                  CmpImg3.tcl     }
! ##      }
  ##
! ##      set xpm {
! ##          {f "In Button"              Xpm.tcl         {i pixmap}}
! ##          {f "In Menu"                Xpm1.tcl        {i pixmap}}
! ##      }
  ##
! ##      set file {
! ##added     {f DirList                          DirList.tcl     }
! ##added     {f DirTree                          DirTree.tcl     }
! ##          {f DirSelectDialog                  DirDlg.tcl      }
! ##          {f ExFileSelectDialog               EFileDlg.tcl    }
! ##          {f FileSelectDialog                 FileDlg.tcl     }
! ##          {f FileEntry                        FileEnt.tcl     }
! ##      }
  ##
! ##      set hlist {
! ##          {f HList                    HList1.tcl      }
! ##          {f CheckList                ChkList.tcl     {c tixCheckList}}
! ##done      {f "ScrolledHList (1)"      SHList.tcl      }
! ##done      {f "ScrolledHList (2)"      SHList2.tcl     }
! ##done      {f Tree                     Tree.tcl        }
! ##done      {f "Tree (Dynamic)"         DynTree.tcl     {v win}}
! ##      }
  ##
! ##      set tlist {
! ##          {f "ScrolledTList (1)"      STList1.tcl     {c tixTList}}
! ##          {f "ScrolledTList (2)"      STList2.tcl     {c tixTList}}
! ##      }
! ##      global tcl_platform
! ##      #  This demo hangs windows
! ##      if {$tcl_platform(platform) != "windows"} {
! ##na    lappend tlist     {f "TList File Viewer"        STList3.tcl     {c tixTList}}
! ##      }
  ##
! ##      set grid {
! ##na        {f "Simple Grid"            SGrid0.tcl      {c tixGrid}}
! ##na        {f "ScrolledGrid"           SGrid1.tcl      {c tixGrid}}
! ##na        {f "Editable Grid"          EditGrid.tcl    {c tixGrid}}
! ##      }
  ##
! ##      set scroll {
! ##          {f ScrolledListBox          SListBox.tcl    }
! ##          {f ScrolledText             SText.tcl       }
! ##          {f ScrolledWindow           SWindow.tcl     }
! ##na        {f "Canvas Object View"     CObjView.tcl    {c tixCObjView}}
! ##      }
  ##
! ##      set manager {
! ##          {f ListNoteBook             ListNBK.tcl     }
! ##done      {f NoteBook                 NoteBook.tcl    }
! ##done      {f PanedWindow              PanedWin.tcl    }
! ##      }
  ##
! ##      set misc {
! ##done      {f Balloon                  Balloon.tcl     }
! ##done      {f ButtonBox                BtnBox.tcl      }
! ##done      {f ComboBox                 ComboBox.tcl    }
! ##done      {f Control                  Control.tcl     }
! ##          {f LabelEntry               LabEntry.tcl    }
! ##          {f LabelFrame               LabFrame.tcl    }
! ##          {f Meter                    Meter.tcl       {c tixMeter}}
! ##done      {f OptionMenu               OptMenu.tcl     }
! ##done      {f PopupMenu                PopMenu.tcl     }
! ##          {f Select                   Select.tcl      }
! ##          {f StdButtonBox             StdBBox.tcl     }
! ##      }
  ##
  
***************
*** 869,874 ****
  stypes['widget'] = ['Balloon', 'Button Box', 'Combo Box', 'Control',
                      'Directory List', 'Directory Tree',
! 		    'Notebook', 'Option Menu', 'Popup Menu', 'Paned Window',
! 		    'ScrolledHList (1)', 'ScrolledHList (2)', 'Tree (dynamic)']
  stypes['image'] = ['Compound Image']
  
--- 869,874 ----
  stypes['widget'] = ['Balloon', 'Button Box', 'Combo Box', 'Control',
                      'Directory List', 'Directory Tree',
!                     'Notebook', 'Option Menu', 'Popup Menu', 'Paned Window',
!                     'ScrolledHList (1)', 'ScrolledHList (2)', 'Tree (dynamic)']
  stypes['image'] = ['Compound Image']
  
***************
*** 923,935 ****
  
      for type in ['widget', 'image']:
! 	if type != 'widget':
! 	    x = Tix.Frame(slb.hlist, bd=2, height=2, width=150,
! 			  relief=Tix.SUNKEN, bg=slb.hlist['bg'])
! 	    slb.hlist.add_child(itemtype=Tix.WINDOW, window=x, state='disabled')
! 	x = slb.hlist.add_child(itemtype=Tix.TEXT, state='disabled',
! 				text=comments[type])
! 	for key in stypes[type]:
! 	    slb.hlist.add_child(x, itemtype=Tix.TEXT, data=key,
! 				text=key)
      slb.hlist.selection_clear()
  
--- 923,935 ----
  
      for type in ['widget', 'image']:
!         if type != 'widget':
!             x = Tix.Frame(slb.hlist, bd=2, height=2, width=150,
!                           relief=Tix.SUNKEN, bg=slb.hlist['bg'])
!             slb.hlist.add_child(itemtype=Tix.WINDOW, window=x, state='disabled')
!         x = slb.hlist.add_child(itemtype=Tix.TEXT, state='disabled',
!                                 text=comments[type])
!         for key in stypes[type]:
!             slb.hlist.add_child(x, itemtype=Tix.TEXT, data=key,
!                                 text=key)
      slb.hlist.selection_clear()
  
***************
*** 943,951 ****
      anchor = hlist.info_anchor()
      if not anchor:
! 	run['state'] = 'disabled'
! 	view['state'] = 'disabled'
      elif not hlist.info_parent(anchor):
! 	# a comment
! 	return
  
      run['state'] = 'normal'
--- 943,951 ----
      anchor = hlist.info_anchor()
      if not anchor:
!         run['state'] = 'disabled'
!         view['state'] = 'disabled'
      elif not hlist.info_parent(anchor):
!         # a comment
!         return
  
      run['state'] = 'normal'
***************
*** 956,970 ****
  
      if action == 'run':
! 	exec('import ' + prog)
! 	w = Tix.Toplevel()
! 	w.title(title)
! 	rtn = eval(prog + '.RunSample')
! 	rtn(w)
      elif action == 'view':
! 	w = Tix.Toplevel()
! 	w.title('Source view: ' + title)
! 	LoadFile(w, demo.dir + '/samples/' + prog + '.py')
      elif action == 'browse':
! 	ReadFile(stext.text, demo.dir + '/samples/' + prog + '.py')
  
  def LoadFile(w, fname):
--- 956,970 ----
  
      if action == 'run':
!         exec('import ' + prog)
!         w = Tix.Toplevel()
!         w.title(title)
!         rtn = eval(prog + '.RunSample')
!         rtn(w)
      elif action == 'view':
!         w = Tix.Toplevel()
!         w.title('Source view: ' + title)
!         LoadFile(w, demo.dir + '/samples/' + prog + '.py')
      elif action == 'browse':
!         ReadFile(stext.text, demo.dir + '/samples/' + prog + '.py')
  
  def LoadFile(w, fname):
***************
*** 990,1004 ****
  
      try:
! 	f = open(fname)
! 	lines = f.readlines()
! 	for s in lines:
! 	    w.insert(Tix.END, s)
! 	f.close()
      finally:
! #	w.see('1.0')
! 	w['state'] = old_state
  
  if __name__ == '__main__':
      root = Tix.Tk()
      RunMain(root)
- 
--- 990,1003 ----
  
      try:
!         f = open(fname)
!         lines = f.readlines()
!         for s in lines:
!             w.insert(Tix.END, s)
!         f.close()
      finally:
! #       w.see('1.0')
!         w['state'] = old_state
  
  if __name__ == '__main__':
      root = Tix.Tk()
      RunMain(root)



More information about the Python-checkins mailing list