Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /leo/plugins/__wx_alt_gui.py

leo
Discussion topic

Back to topic list

CVS update: /leo/plugins/__wx_alt_gui.py

Author plumloco
Full name Robert Ledger
Date 2007-09-12 11:11:17 PDT
Message User: plumloco
Date: 2007-09-12 11:11:17-0700
Log:
 fix bugs in body editor, add toggle splitter

File Changes:

Directory: /leo/plugins/
========================

File [changed]: __wx_alt_gui.py
Url: http://leo.tigris.or​g/source/browse/leo/​plugins/__wx_alt_gui​.py?r1=1.4&r2=1.​5
Delta lines: +363 -148
-----------------------
--- __wx_alt_gui.py 2007-09-12 03:53:07-0700 1.4
+++ __wx_alt_gui.py 2007-09-12 11:11:12-0700 1.5
@@ -21,7 +21,7 @@
 
 import re
 
-__revision__ = re.sub(r'^\D+([\d\.]+)\D+$', r'\1', "$Revision: 1.4 $")
+__revision__ = re.sub(r'^\D+([\d\.]+)\D+$', r'\1', "$Revision: 1.5 $")
 
 __version__ = '0.2.%s'% __revision__
 
@@ -100,10 +100,6 @@
 #@-at
 #@-node:bob.20070813​163332.52:<< bug list & to-do >>
 #@nl
-#@<< constants >>
-#@+node:bob.2007090​7223746:<< constants >>
-#@-node:bob.2007090​7223746:<< constants >>
-#@nl
 
 #@<< imports >>
 #@+node:bob.20070813​163332.62:<< imports >>
@@ -159,9 +155,6 @@
 #@+node:bob.20070813163332.64: init
 def init():
 
- print('@@@@@@@@@@@@@@@@@@@@@@@@ __wx__alt_gui @@@@@@@@@@@@@@@@@@')
- print('g.app.unitTesting', g.app.unitTesting)
-
     if g.app.unitTesting: # Not Ok for unit testing!
         return False
 
@@ -175,7 +168,6 @@
     ok = wx and not g.app.gui
 
     if ok:
- print '__wx__alt_gui.py version:', __version__
         g.app.gui = wxGui()
         g.app.root = g.app.gui.createRootWindow()
         g.app.gui.finishCreate()
@@ -258,10 +250,10 @@
             event.Skip()
 #@-node:bob.20070910​165627:onGlobalChar
 #@+node:bob.20070910​192953:onRogueChar
-def onRogueChar(event, type):
- g.trace(type, event, '\n\n', g.callers())
- event.Skip()
-#@nonl
+def onRogueChar(self, event, type):
+ g.trace(type, g.callers())
+
+ onGlobalChar(self, event)
 #@-node:bob.20070910​192953:onRogueChar
 #@-others
 #@nonl
@@ -270,6 +262,15 @@
 
 if wx:
 
+ #@ << constants >>
+ #@+node:bob.20070907​223746:<< constants >>
+ if wx:
+ HORIZONTAL = wx.HORIZONTAL
+ VERTICAL = wx.VERTICAL
+
+ #@-node:bob.20070907​223746:<< constants >>
+ #@nl
+
     #@ @+others
     #@+node:bob.20070813​163332.136:=== TEXT WIDGETS ===
     #@<< baseTextWidget class >>
@@ -291,6 +292,8 @@
             **keys
         ):
 
+ self.name = name
+
             self.leoParent = leoParent
             self.ctrl = widget
 
@@ -325,17 +328,20 @@
                 lambda event: self.onGlobalLoseFocus(event)
             )
 
+ self.__repr__ = self.__str__ = lambda : myclass(self) + str(id(self))
+
+
 
         #@-node:bob.20070813​163332.138:__init__
         #@+node:bob.20070902​072600:setWidget
         #@-node:bob.20070902​072600:setWidget
- #@+node:bob.20070823​072419:GetName
+ #@+node:bob.20070823​072419:getName
 
- def GetName(self):
- return self.name
+ def getName(self):
+ return self.name or self.widget.GetName()
 
- getName = GetName
- #@-node:bob.20070823​072419:GetName
+ GetName = getName
+ #@-node:bob.20070823​072419:getName
         #@+node:bob.20070901042726:== Focus ==
         #@+node:bob.20070826​134115:onGlobalGainF​ocus
 
@@ -491,6 +497,13 @@
 
 
         #@-node:bob.20070813​163332.8:__init__
+ #@+node:bob.20070911​142138:__str__
+ def __str__(self):
+ return myclass(self) + str(id(self))
+
+
+ __repr__ = __str__
+ #@-node:bob.20070911​142138:__str__
         #@+node:bob.20070827​204727:initStc
         # Code copied from wxPython demo.
 
@@ -1402,20 +1415,6 @@
                 *args, **keys
             )
         #@-node:bob.20070821​163516.1:__init__
- #@+node:bob.20070901073324:def onChar
-
- ## fix me
-
- def onChar(self, event, keycode, keysym):
- """Intercept return and tab chars."""
-
- if keysym == 'Return':
- self.leoParent.findN​extCommand()
- return True
-
- if keysym == 'Tab':
- self.leoParent.toggl​eTextWidgetFocus(sel​f)
- #@-node:bob.20070901073324:def onChar
         #@-others
     #@nonl
     #@-node:bob.20070821​163516:findTextWidge​t (plainTextWidget)
@@ -1499,10 +1498,13 @@
             multiline=True,
             widget=None,
             name='text <unknown richTextWidget>',
+ **kw
         ):
 
+
+
             if not widget:
- widget = richtext.RichTextCtrl(parent, style=wx.WANTS_CHARS)
+ widget = richtext.RichTextCtrl(parent, style=wx.WANTS_CHARS, **kw)
 
             baseTextWidget.__init__(self, leoParent,
                 name=name, widget=widget,
@@ -2095,9 +2097,15 @@
         #@+node:bob.20070901​083131:toggleTextWid​getFocus
 
         def toggleTextWidgetFocus(self, widget):
- if widget is self.find_ctrl:
+
+ c = self.c
+
+ g.trace(c.widget_name(widget), widget)
+ if c.widget_name(widget) == 'find-text':
+ print 'chang', self.change_ctrl
                 self.change_ctrl.setFocus()
             else:
+ print 'find', self.find_ctrl
                 self.find_ctrl.setFocus()
 
         #@-node:bob.20070901​083131:toggleTextWid​getFocus
@@ -2887,10 +2895,13 @@
             #@ @+others
             #@+node:bob.20070830​070902:alert
 
- def alert(msg):
+ def alert(msg, caption='Alert'):
 
                 g.es('\n' + msg, color='cyan')
- g.app.gui.runAskOkDialog(None, 'Alert', msg)
+ dlg = wx.MessageDialog(Non​e,msg,'Alert')
+ dlg.ShowModal()
+ dlg.Destroy()
+
                 g.alert = alert
             #@-node:bob.20070830​070902:alert
             #@+node:bob.20070830080924:Tabs
@@ -3564,16 +3575,17 @@
         #@+node:bob.20070813​163332.212:gui utils (must add several)
         #@+node:bob.20070813​163332.213:Clipboard​
         def replaceClipboardWith (self,s):
- g.trace(s)
+ #g.trace(s)
 
             cb = wx.TheClipboard
             if cb.Open():
- g.trace('is open')
+ #g.trace('is open')
                 cb.Clear()
                 cb.SetData(wx.TextDa​taObject(s))
                 cb.Close()
             else:
- g.trace('is CLOSED')
+ #g.trace('is CLOSED')
+ pass
 
         def getTextFromClipboard (self):
 
@@ -3768,19 +3780,27 @@
         #@-node:bob.20070813​163332.53:isTextWidg​et
         #@+node:bob.20070813​163332.229:widget_na​me
         def widget_name (self,w):
+ """Returns the name of widget w.
 
- # all text widgets are instances of baseTextWidget
- # and will have a getName method
-
- # all widgets whose name is important should also
- # have a getName method, possibley put this in
- # in wxLeoObject or even leoObject?
+ First try the (gui)LeoObject getName method.
+ Second try wx widgets GetName method.
+ Third use repr(w)
+ """
 
- # anyway it should be an error if there is no getName
+ #g.trace(w)
 
+ if hasattr(w, 'getName'):
+ #print '\t ', w.getName()
             return w.getName()
 
+ if hasattr(w, 'GetName'):
+ #print '\t', w.GetName()
+ return w.GetName()
+
 
+ #g.trace('Object Has no name:\n\t', w)
+ #print '\trepr(w) = ', repr(w)
+ return repr(w)
         #@-node:bob.20070813​163332.229:widget_na​me
         #@-node:bob.20070813​163332.212:gui utils (must add several)
         #@-others
@@ -3866,90 +3886,123 @@
         #@-node:bob.20070830​065423:universalDisp​atcher
         #@+node:bob.20070901​065753:handleDefault​Char
         def handleDefaultChar(se​lf,event,stroke):
+ """Handle default actions for keystrokes not defined elsewhere.
 
- # try:
- # g.trace('=== eventwidget ===',event.widget)
- # g.trace('=== stroke ===', stroke)
- # #g.trace('callers:', g.callers())
- # except:
- # g.trace('no event!')
- # pass
+ If event is not none then it will be used to find the window
+ the wich caused the event otherwise the currently focused
+ window will be used.
 
+ If none is returned then the caller should call event.Skip()
+ to allow the gui to handle the keystroke itself.
 
- fw = wx.Window.FindFocus()
+ """
 
- #g.trace('focus:', fw)
+ k = self ; c = k.c
+
+
+ try:
+ g.trace('=== eventwidget ===',event.widget)
+ g.trace('=== stroke ===', stroke)
+ #g.trace('callers:', g.callers())
+ except:
+ g.trace('no event!')
+ pass
+
+
+
+ g.trace('focus:', self.c.get_focus())
 
             if event:
                 w = event.widget
             else:
- w = fw
-
- #print '\ttarget:', w
+ w = c.get_focus()
 
+ print '\ttarget:', w
 
+ name = c.widget_name(w)
 
- # NO widgets need not be text widgets eg the tree!
- #if not isinstance(w, baseTextWidget):
- # FIXME raise an error if we arrive here without a
- # a valid text window?
- # g.trace('Not a valid text window:', w)
- # return
+ g.trace('NAME', name)
 
- k = self ; c = k.c
-
- # all widgets that collect keys must have getName
- name = w.getName()
 
- #g.trace('NAME', name)
 
             if name.startswith('body'):
 
- #g.trace('body')
+ #<< handle char for body
+
+ g.trace('body')
                 action = k.unboundKeyAction
                 if action in ('insert','overwrite'):
                     c.editCommands.selfI​nsertCommand(event,a​ction=action)
- else:
- pass # Ignore the key.
-
                 return 'break'
 
+ return None
+
+ #>>
+
             elif name.startswith('head'):
+
+ #<< handle chars for headlines
+
                 #g.trace('head')
                 c.frame.tree.onHeadl​ineKey(event)
                 return 'break'
 
+ #>>
+
             elif name.startswith('canvas'):
+
+ #<< handle chars for tree canvas
+
                 #g.trace('canvas')
                 if not stroke: # Not exactly right, but it seems to be good enough.
                     c.onCanvasKey(event) # New in Leo 4.4.2
                 return 'break'
 
+ #>>
+
             elif name.startswith('log'):
+
+ #<< handle chars for log panes
+
                 #FIXME
+
+
                 # c.onLogKey(event)
                 g.trace('log')
                 pass
 
- elif name.startswith('find'):
+ #>>
+
+ elif name.startswith('find') or name.startswith('change'):
+
+ #<< handle chars for find\change entry
+
                 #FIXME
                 # c.onFindKey
 
                 # Intercept return and tab chars.
 
+
                 keysym = g.app.gui.eventKeysym(event)
 
+ g.trace('\tfind KEYSYM', keysym)
+
                 if keysym == 'Return':
+ g.trace('\tFOUND RETURN')
                     w.leoParent.findNextCommand()
                     return 'break'
 
                 if keysym == 'Tab':
- w.leoParent.toggleTe​xtWidgetFocus(self)
+ g.trace('\tFOUND TAB')
+ w.leoParent.toggleTe​xtWidgetFocus(w)
                     return 'break'
 
- #g.trace('find')
+
+ g.trace('NO SPECIAL CHARS FOUND FOR FIND')
                 return None
 
+ #>>
+
             else:
                 # Allow wx to handle the event.
                 # ch = event and event.char ; g.trace('to wx:',name,repr(ch))
@@ -4126,7 +4179,7 @@
             #globals icons, plusBoxIcon, minusBoxIcon, appIcon
             self.loadIcons()
 
- self.Bind(wx.EVT_CHAR, lambda event, type='app':onRogueChar(event, type))
+ #self.Bind(wx.EVT_CHAR, lambda event, type='app':onRogueChar(event, type))
 
 
 
@@ -4201,7 +4254,10 @@
         #@ @+others
         #@+node:bob.20070813​163332.237:Birth & death (wxLeoBody)
         #@+node:bob.20070813​163332.238:wxBody.__​init__
- def __init__ (self,frame,parentFrame):
+ def __init__ (self, c, parentFrame):
+
+ self.c = c
+ frame = c.frame
 
             # Init the base class: calls createControl.
             leoFrame.leoBody.__i​nit__(self,frame,par​entFrame)
@@ -4212,7 +4268,6 @@
 
             self.keyDownModifiers = None
             self.forceFullRecolorFlag = False
- #@nonl
         #@-node:bob.20070813​163332.238:wxBody.__​init__
         #@+node:bob.20070813​163332.239:wxBody.cr​eateControl
         def createControl (self,frame,parentFrame):
@@ -4756,7 +4811,24 @@
             leoNotebook.__init__(self, c)
             wxLeoObject.__init__(self)
 
- self.nb = wx.Notebook.__init__(self, parent)
+ wx.Notebook.__init__(self, parent)
+
+ self.Bind(wx.EVT_NOT​EBOOK_PAGE_CHANGED, self.onPageChanged)
+
+ def onPageChanged(self, event):
+ g.trace()
+ sel = event.GetSelection()
+ if sel < 0:
+ event.Skip()
+ return
+
+ page = self.GetPage(sel)
+ page.SetSize(self.Ge​tClientSize())
+
+
+
+
+
 
 
         #@-node:bob.20070908​081747.10:__init__
@@ -4884,6 +4956,8 @@
         def __init__(self, c, tabName=None, page=None, nb=None):
 
             leoTab.__init__(self, c, tabName, page, nb)
+
+ page.leoParent = self
         #@-node:bob.20070908​102321.7:__init__
         #@+node:bob.20070908​102321.8:TabName property
         def setTabName(self, tabName):
@@ -4970,9 +5044,16 @@
 
             sizer.Add(self.nb, 1, wx.EXPAND)
 
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
+
+ #self.Bind(wx.EVT_SIZE, self.onSize)
+
+ #self.Bind(wx.EVT_CHAR, lambda event, type='leonotebookpan​el':onRogueChar(even​t, type))
 
- self.Bind(wx.EVT_CHAR, lambda event, type='leonotebookpan​el':onRogueChar(even​t, type))
+
+ def onSize(self, event):
+ g.trace('notebook panel')
+ event.Skip()
         #@-node:bob.20070908​081747.13:__init__
         #@-others
 
@@ -4998,20 +5079,35 @@
             self.title = title
 
 
-
             # To be set in finishCreate.
             self.c = None
- self.bodyCtrl = None
+ #self.bodyCtrl = None
+
+ self.logPanel = None
+ self.treePanel = None
+ self.bodyPanel = None
+ self.splitter1 = None
+ self.splitter2 = None
+
             self.minibuffer =None
             self.statusLine = None
+ self.iconBar = None
+ self.menuBar = None
+
+ self.statusLineClass = wxLeoStatusLine
+ self.minibufferClass = wxLeoMinibuffer
+ self.iconBarClass = wxLeoIconBar
+
+ self.findTabHandler = None
+ self.spellTabHandler = None
 
 
             #g.trace("wxLeoFrame",title)
 
             self.activeFrame = None
             self.focusWidget = None
- self.iconBar = None
- self.iconBarClass = wxLeoIconBar
+
+
             self.killed = False
             self.lockout = 0 # Suppress further events
             self.quitting = False
@@ -5019,17 +5115,17 @@
             self.treeIniting = False
             self.drawing = False # Lockout recursive draws.
             self.menuIdDict = {}
- self.menuBar = None
+
             self.ratio = 0.5
             self.secondary_ratio = 0.5
             self.startupWindow=True
- self.statusLineClass = wxLeoStatusLine
- self.minibufferClass = wxLeoMinibuffer
+
+
 
             self.use_coloring = False # set True to enable coloring
 
- self.findTabHandler = None
- self.spellTabHandler = None
+ self._splitterOrientation = VERTICAL
+
         #@-node:bob.20070813​163332.259:__init__ (wxLeoFrame)
         #@+node:bob.20070813​163332.260:__repr__
         def __repr__ (self):
@@ -5044,6 +5140,14 @@
         #@nonl
         #@-node:bob.20070831​063515:setStatusLine​
         #@+node:bob.20070813​163332.261:finishCre​ate (wxLeoFrame)
+
+ # temp redirects
+ body = property(lambda self: self.bodyPanel)
+ bodyCtrl = property(lambda self: self.bodyPanel.bodyCtrl)
+
+ log = property(lambda self: self.logPanel.log)
+ nb = property(lambda self: self.logPanel.nb)
+
         def finishCreate (self,c):
 
             # g.trace('wxLeoFrame')
@@ -5067,7 +5171,7 @@
                 style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE
             )
 
- top.Bind(wx.EVT_CHAR, lambda event, type='leoframe':onRo​gueChar(event, type))
+ #top.Bind(wx.EVT_CHAR, lambda event, type='leoframe':onRo​gueChar(self, event, type))
 
 
             self.hiddenWindow = hw = wx.Window(top)
@@ -5083,43 +5187,50 @@
             # Create the main sizer
             box = wx.BoxSizer(wx.VERTICAL)
 
- # Create the splitters.
-
- style = wx.CLIP_CHILDREN|wx.​SP_LIVE_UPDATE|wx.SP​_3D
 
- # Splitter1 contains body & splitter2.
- self.splitter1 = splitter1 = \
- wx.SplitterWindow(top, style=style)
+ # tree panel
 
- # Splitter2 contains tree and log.
- self.splitter2 = splitter2 = \
- wx.SplitterWindow(splitter1, style=style)
+ self.treePanel = self.createTreePanel()
+ self.tree = self.treePanel
 
- splitter2.SetSashSize(5)
 
- # Create the tree.
- self.tree = wxLeoTree(self, parentFrame=splitter2)
+ # log panel
 
+ self.logPanel = lp = self.createLogPanel()
 
- # Create the log pane and its wx.Noteboook.
+ # redirects
+ # self.nb = nb = lp.nb
+ # self.log = lp.log
 
- self.logPanel = lp = wxLeoNotebookPanel(c, splitter2)
- self.nb = nb = lp.nb
- self.log = lp.log
+ nb = self.nb
 
             g.app.setLog(self.log) # writeWaitingLog hangs without this(!)
 
 
+ # body panel
+
+ self.bodyPanel = self.createBodyPanel()
+
+ # redirectes
+ # self.body = self.bodyPanel
+ # self.bodyCtrl = self.body.bodyCtrl
+
 
- # Create the body pane.
- self.body = wxLeoBody(self,paren​tFrame=splitter1)
- self.bodyCtrl = self.body.bodyCtrl
-
- # Add the panes to the splitters.
- splitter2.SplitVerti​cally(self.tree.tree​Ctrl, self.logPanel, 0)
- splitter1.SplitHoriz​ontally(splitter2, self.bodyCtrl.widget, 0)
+ # splitters
 
- box.Add(splitter1, 1, wx.EXPAND)
+ s1, s2 = self.createSplitters()
+
+ self.splitter1 = s1
+ self.splitter2 = s2
+
+
+ ##FIXME when panels finished
+ #self.setupSplitters​(self.treePanel, self.logPanel, self.bodyPanel, s1,s2)
+ self.setupSplitters(​self.tree.treeCtrl, self.logPanel, self.body.bodyCtrl, s1, s2)
+
+ s1.Reparent(self.top)
+
+ box.Add(s1, 1, wx.EXPAND)
 
             #@ << create and add minibuffer area >>
             #@+node:bob.20070825​182338:<< create and add minibuffer area >>
@@ -5142,7 +5253,6 @@
             #@nl
 
 
-
             # Create the menus & icon.
             self.menu = wxLeoMenu(self)
             self.setWindowIcon()
@@ -5211,11 +5321,46 @@
                 self.top.SetIcon(icon)
         #@-node:bob.20070813​163332.262:setWindow​Icon
         #@-node:bob.20070813​163332.261:finishCre​ate (wxLeoFrame)
+ #@+node:bob.20070912​144833.1:createSplit​ters
+ def createSplitters(self, parent=None, style=wx.CLIP_CHILDR​EN|wx.SP_LIVE_UPDATE​|wx.SP_3D):
+
+ parent = parent or self.hiddenWindow
+
+ return wx.SplitterWindow(parent, style), wx.SplitterWindow(parent, style)
+
+ #@-node:bob.20070912​144833.1:createSplit​ters
+ #@+node:bob.20070912​144833.2:setupSplitt​ers
+ def setupSplitters(self, tree, log, body, s1, s2):
+ """Initial setup of splitters.
+
+
+ This must be called with newly created splitters.
+ """
+
+ s2.Reparent(s1)
+ body.Reparent(s1)
+ tree.Reparent(s2)
+ log.Reparent(s2)
+
+
+ if self._splitterOrientation == HORIZONTAL:
+
+ s2.SplitVertically(tree, log, 0)
+ s1.SplitHorizontally(s2, body, 0)
+
+ else:
+
+ s2.SplitHorizontally(tree, log, 0)
+ s1.SplitVertically(s2, body, 0)
+
+ return s1
+ #@-node:bob.20070912​144833.2:setupSplitt​ers
         #@+node:bob.20070813​163332.264:initialRa​tios
         def initialRatios (self):
 
             config = g.app.config
             s = config.getWindowPref​("initial_splitter_o​rientation")
+
             verticalFlag = s == None or (s != "h" and s != "horizontal")
 
             # Tweaked for tk. Other tweaks may be best for wx.
@@ -5240,7 +5385,6 @@
                     r2 = 0.8
 
             return verticalFlag,r,r2
- #@nonl
         #@-node:bob.20070813​163332.264:initialRa​tios
         #@+node:bob.20070813​163332.265:injectCal​lbacks
         # ??? whats the point of this?
@@ -5294,6 +5438,29 @@
         #@nonl
         #@-node:bob.20070813​163332.268:destroySe​lf
         #@-node:bob.20070813​163332.258:Birth & death (wxLeoFrame)
+ #@+node:bob.20070912144833.3:-- Panel Creation Factories --
+ #@+node:bob.20070912​132540:createTreePan​el
+ def createTreePanel(self, parent=None):
+
+ parent = parent or self.hiddenWindow
+
+ return wxLeoTree(self.c, parent)
+ #@-node:bob.20070912​132540:createTreePan​el
+ #@+node:bob.20070912​144833.4:createBodyP​anel
+ def createBodyPanel(self, parent=None):
+
+ parent = parent or self.hiddenWindow
+
+ return wxLeoBody(self.c, parent)
+ #@-node:bob.20070912​144833.4:createBodyP​anel
+ #@+node:bob.20070912​144833.5:createLogPa​nel
+ def createLogPanel(self, parent=None):
+
+ parent = parent or self.hiddenWindow
+
+ return wxLeoNotebookPanel(self.c, parent)
+ #@-node:bob.20070912​144833.5:createLogPa​nel
+ #@-node:bob.20070912144833.3:-- Panel Creation Factories --
         #@+node:bob.20070813​163332.269:event handlers
         #@+node:bob.20070813​163332.263:setEventH​andlers
         def setEventHandlers (self):
@@ -5658,14 +5825,54 @@
         # The key invariant: self.splitVerticalFlag tells the alignment of the main splitter.
         def toggleSplitDirection​(self,event=None):
 
- g.es("toggleSplitDirection not ready yet")
- return
+ def po(o):
+ g.trace(g.choose(o==VERTICAL, 'vertical', 'horizontal'))
+
+
+ orient = self._splitterOrientation
+
+ g.trace(po(orient))
+
+ s1 = self.splitter1
+ s2 = self.splitter2
+
+
+ self._splitterOrientation = orient = g.choose(orient == VERTICAL, HORIZONTAL, VERTICAL)
+ g.trace(po(orient))
+
+
+ tree = s2.Window1
+ log = s2.Window2
+ body = s1.Window2
+
+ s1.Unsplit()
+ s2.Unsplit()
+
+ if self._splitterOrientation == HORIZONTAL:
+
+ s2.SplitVertically(tree, log, 0)
+ s1.SplitHorizontally(s2, body, 0)
+
+ else:
+
+ s2.SplitHorizontally(tree, log, 0)
+ s1.SplitVertically(s2, body, 0)
+
+ return s1
+
+
+
+
+
 
             # Abbreviations.
             frame = self
             bar1 = self.bar1 ; bar2 = self.bar2
             split1Pane1,split1Pane2 = self.split1Pane1,sel​f.split1Pane2
             split2Pane1,split2Pane2 = self.split2Pane1,sel​f.split2Pane2
+
+
+
             # Switch directions.
             verticalFlag = self.splitVerticalFlag = not self.splitVerticalFlag
             orientation = g.choose(verticalFla​g,"vertical","horizo​ntal")
@@ -5683,7 +5890,6 @@
             # Redraw with an appropriate ratio.
             vflag,ratio,secondary_ratio = frame.initialRatios()
             self.resizePanesToRa​tio(ratio,secondary_​ratio)
- #@nonl
         #@-node:bob.20070813​163332.293:toggleSpl​itDirection
         #@-node:bob.20070813​163332.287:Window Menu
         #@+node:bob.20070813​163332.294:Help Menu...
@@ -6318,32 +6524,37 @@
         def put(self, s, tabName='Log', **keys):
 
 
-
             self.selectTab(tabName)
 
             w = self.logCtrl.widget
 
             if not w:
                 g.alert('log.put, no widget!')
+ print 's'
+ print
+ return
 
             colour = keys.get('colour', '') or keys.get('color', '')
+ g.trace('colour')
 
+ if not colour:
+ colour='black'
 
             if w:
- if colour:
                     w.BeginTextColour(colour)
-
+ try:
                 w.AppendText(s)
-
- if colour:
+ finally:
                     w.EndTextColour()
 
                 w.MoveEnd()
                 w.ShowPosition(w.Get​LastPosition())
+ w.PageDown()
+
 
         def putnl (self, tabName=None):
 
- self.put ('\n', tabName)
+ self.put ('\n', tabName='Log')
 
 
         #@-node:bob.20070813​163332.315:wxLog.put​ & putnl
@@ -6459,33 +6670,24 @@
             nb = self.nb
             # g.trace(tabName)
 
-
             if createText:
- win = logFrame = wx.Panel(nb, style=wx.NO_BORDER)
 
- tab = wxLeoTab(self.c, tabName, win, nb)
+ w = logTextWidget(self, nb)
+ w.widget.BeginTextCo​lour('black')
 
- nb.appendTab(tab)
+ tab = wxLeoTab(self.c, tabName, w.widget, nb)
 
- w = logTextWidget(self, win)
+ nb.appendTab(tab)
 
                 w.setBackgroundColor​(name2color('leo blue'))
 
- sizer = wx.BoxSizer(wx.HORIZONTAL)
- sizer.Add(w.widget,1,wx.EXPAND)
- win.SetSizer(sizer)
- sizer.Fit(win)
-
                 self.textDict [tabName] = w
- self.frameDict [tabName] = win
-
+ self.frameDict [tabName] = w.widget
 
- # c.k doesn't exist when the log pane is created.
- # if tabName != 'Log':
- # # k.makeAllBindings will call setTabBindings('Log')
- # self.setTabBindings(tabName)
                 return w
+
             else:
+
                 win = wx.Panel(nb,name='tab:%s' % tabName)
                 self.textDict [tabName] = None
                 self.frameDict [tabName] = win
@@ -6543,13 +6745,15 @@
 
             nb = self.nb
 
- self.tabFrame.SetSiz​e(nb.GetClientSize()​)
 
             i = self.indexFromName(tabName)
             if i is not None:
                 nb.SetSelection(i)
                 assert nb.GetPage(i) == self.tabFrame
 
+ #g.trace(self.nb.Get​ClientSize())
+ self.tabFrame.SetSiz​e(nb.GetClientSize()​)
+
             return self.tabFrame
         #@-node:bob.20070813​163332.317:selectTab​
         #@+node:bob.20070813​163332.318:clearTab
@@ -7100,10 +7304,14 @@
 
         #@ @+others
         #@+node:bob.20070813​163332.372:__init__
- def __init__ (self,frame,parentFrame):
+ def __init__ (self, c, parentFrame):
+
+
+ self.c = c
+ self.frame = c.frame
 
             # Init the base class.
- leoFrame.leoTree.__init__(self, frame)
+ leoFrame.leoTree.__init__(self, self.frame)
 
 
             #@ << init config >>
@@ -8128,6 +8336,12 @@
 
         getName = GetName
         #@-node:bob.20070901​120931:GetName
+ #@+node:bob.20070912​132828:Reparent
+ def reparent(self, parent):
+ self.treeCtrl.Reparent(parent)
+
+ Reparent = reparent
+ #@-node:bob.20070912​132828:Reparent
         #@+node:bob.20070908231221:Font Property
         def getFont(self):
             g.trace('not ready')
@@ -8332,6 +8546,7 @@
                 self._canvas.resize(​self.GetClientSize()​.height)
             finally:
                 c.endUpdate(False)
+ event.Skip()
         #@-node:bob.20070813​173446.9:onSize
         #@+node:bob.20070813​173446.10:vscrollUpd​ate

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /leo/plugins/__wx_alt_gui.py plumloco Robert Ledger 2007-09-12 11:11:17 PDT
Messages per page: