tabbed interface, tab to front

20 views
Skip to first unread message

Terry Brown

unread,
Jun 18, 2011, 12:24:10 PM6/18/11
to leo-e...@googlegroups.com
Here's a problem that's come up before, but I was reminded because it
interferes with cross file links, whether they be UNLs or whatever.

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):

Terry Brown

unread,
Jun 18, 2011, 4:58:06 PM6/18/11
to leo-e...@googlegroups.com
On Sat, 18 Jun 2011 11:24:10 -0500
Terry Brown <terry_...@yahoo.com> wrote:

> 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

Edward K. Ream

unread,
Jun 20, 2011, 8:06:28 AM6/20/11
to leo-e...@googlegroups.com
On Sat, Jun 18, 2011 at 11:24 AM, Terry Brown <terry_...@yahoo.com> wrote:
> Here's a problem that's come up before, but I was reminded because it
> interferes with cross file links, whether they be UNLs or whatever.

> 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

Terry Brown

unread,
Jul 8, 2011, 2:04:06 PM7/8/11
to leo-e...@googlegroups.com

Just wanted to bump this thread:
https://groups.google.com/d/topic/leo-editor/z_7CXsMZk2Y/discussion

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

Edward K. Ream

unread,
Oct 21, 2011, 12:20:40 PM10/21/11
to leo-e...@googlegroups.com
On Fri, Jul 8, 2011 at 1:04 PM, Terry Brown <terry_...@yahoo.com> wrote:

What's the present status of this? Is there anything I need to do?

Edward

Terry Brown

unread,
Oct 21, 2011, 12:57:34 PM10/21/11
to leo-e...@googlegroups.com

I think that's all done, c.frame.bringToFront() also makes sure the tab
is on top.

Cheers -Terry

Edward K. Ream

unread,
Oct 21, 2011, 1:25:01 PM10/21/11
to leo-e...@googlegroups.com
On Fri, Oct 21, 2011 at 11:57 AM, Terry Brown <terry_...@yahoo.com> wrote:

> I think that's all done, c.frame.bringToFront() also makes sure the tab
> is on top.

Oh good. Thanks.

Edward

Reply all
Reply to author
Forward
0 new messages