The first time g.openWithFilename() opens a file in the tabbed
interface the new tab becomes the visible tab, and all is well.
If the same file is requested again, as happens with onUrlDoubleClick
on a link to a file already loaded, the file's tab isn't raised, so the
link effectively doesn't work.
It's hard to know where this should be fixed encapsulation wise,
because focus fiddling is already deeper in the openWithFilename
call chain than you might expect. Below is a patch which fixes the
problem, but in the path I put the required call to the new
g.app.gui.ensure_commander_visible(c) in handleUrlInUrlNode, I think it
should really go at the end of openWithFilename.
With that change, would this new leoGuiClass level method be acceptable?
Cheers -Terry
=== modified file 'leo/core/leoGlobals.py'
--- leo/core/leoGlobals.py 2011-06-12 11:43:29 +0000
+++ leo/core/leoGlobals.py 2011-06-18 16:12:16 +0000
@@ -2061,6 +2061,9 @@
# Disable later call to c.onClick so
# the focus stays in frame.c (DOESN'T WORK?)
c.doubleClickFlag = True
+
+ g.app.gui.ensure_commander_visible(frame.c)
+
return
if parsed.scheme in ('', 'file'):
=== modified file 'leo/core/leoGui.py'
--- leo/core/leoGui.py 2011-06-13 16:01:29 +0000
+++ leo/core/leoGui.py 2011-06-18 15:57:02 +0000
@@ -383,6 +383,10 @@
return w._name
else:
return repr(w)
+ #@+node:tbrown.20110618095626.22068: *4* ensure_commander_visible
+ def ensure_commander_visible(self, c):
+ """E.g. if commanders are in tabs, make sure c's tab is
visible"""
+ pass
#@-others
#@+node:ekr.20031218072017.2223: ** class nullGui (leoGui)
class nullGui(leoGui):
=== modified file 'leo/plugins/qtGui.py'
--- leo/plugins/qtGui.py 2011-06-15 14:18:33 +0000
+++ leo/plugins/qtGui.py 2011-06-18 15:57:02 +0000
@@ -8099,6 +8099,19 @@
if w:
if trace:
print('qtGui.set_focus',gui.widget_name(w),w,g.callers(2)) w.setFocus()
+
+ def ensure_commander_visible(self, c1):
+ """Check to see if c.frame is in a tabbed ui, and if so, make
sure
+ the tab is visible"""
+
+ # START: copy from Code-->Startup & external files-->@file
runLeo.py -->run & helpers-->doPostPluginsInit & helpers (runLeo.py)
+ # For qttabs gui, select the first-loaded tab.
+ if hasattr(g.app.gui,'frameFactory'):
+ factory = g.app.gui.frameFactory
+ if factory and hasattr(factory,'setTabForCommander'):
+ c = c1
+ factory.setTabForCommander(c)
+ # END: copy
#@+node:ekr.20110605121601.18509: *4* Font
#@+node:ekr.20110605121601.18510: *5* qtGui.getFontFromParams
def
getFontFromParams(self,family,size,slant,weight,defaultSize=12):
> It's hard to know where this should be fixed encapsulation wise,
> because focus fiddling is already deeper in the openWithFilename
> call chain than you might expect. Below is a patch which fixes the
> problem, but in the patch I put the required call to the new
> g.app.gui.ensure_commander_visible(c) in handleUrlInUrlNode, I think it
> should really go at the end of openWithFilename.
or better yet, in c.bringToFront()
Cheers -Terry
> Below is a patch which fixes the
> problem, but in the path I put the required call to the new
> g.app.gui.ensure_commander_visible(c) in handleUrlInUrlNode, I think it
> should really go at the end of openWithFilename.
Thanks for this. I'll take a look at this issue after 4.9 final.
Edward
So, now that I referred to the thread from the thread, will Google
crash next time it updates its search db? :-)
On Sat, 18 Jun 2011 15:58:06 -0500
> Just wanted to bump this thread:
> https://groups.google.com/d/topic/leo-editor/z_7CXsMZk2Y/discussion
What's the present status of this? Is there anything I need to do?
Edward
I think that's all done, c.frame.bringToFront() also makes sure the tab
is on top.
Cheers -Terry
> I think that's all done, c.frame.bringToFront() also makes sure the tab
> is on top.
Oh good. Thanks.
Edward