[PATCH/RFC 1/2] Only transfer focus once when opening multiple file diffs
- From: Peter Tyser <ptyser gmail com>
- To: meld-list gnome org
- Subject: [PATCH/RFC 1/2] Only transfer focus once when opening multiple file diffs
- Date: Wed, 11 Apr 2012 01:10:51 -0500
Currently if a user opens multiple file diffs at the same time from a
DirDiff or VcView the following happens:
- the 1st diff is opened in a new tab and focus is moved to this tab
- the 2nd diff is opened in a new tab and focus is moved to this tab
- the 3rd diff is opened in a new tab and focus is moved to this tab
- etc...
This behavior has 2 shortcomings:
1. The user is presented with a window that cycles focus through
multiple diff tabs which is visually jarring.
2. During this period of time when tabs are being cycled through the
user can't interact with Meld - the focus shifts too fast to allow
the user to do anything. This is especially painful if the user
initiates a large number of diffs, the diffs are on a slow filesystem
(eg over a slow NFS share), or if the diffs are of version-controlled
files (VC-diffs have more overhead, which slows them down).
To resolve these issues, only transfer focus to a new tab if the current
tab is a DirDiff or VcView. This results in the following behavior:
- the 1st diff is opened in a new tab and focus is moved to this tab
- the 2nd diff is opened in a new background tab
- the 3rd diff is opened in a new background tab
- etc...
While the background tabs are being opened Meld is still usable.
Signed-off-by: Peter Tyser <ptyser gmail com>
---
I frequently diff large git-controlled repositories (eg the Linux
kernel) shared on an NFS server, which really brings this issue out.
meld/meldwindow.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 55e3061..5fe6ce5 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -578,7 +578,14 @@ class MeldWindow(gnomeglade.Component):
def _append_page(self, page, icon):
nbl = notebooklabel.NotebookLabel(icon, "", lambda b: self.try_remove_page(page))
self.notebook.append_page( page.widget, nbl)
- self.notebook.set_current_page( self.notebook.page_num(page.widget) )
+
+ # Change focus to the newly created page only if the user is on a
+ # DirDiff or VcView page. This prevents cycling through X pages
+ # when X diffs are initiated.
+ if isinstance(self.current_doc(), dirdiff.DirDiff) or \
+ isinstance(self.current_doc(), vcview.VcView):
+ self.notebook.set_current_page(self.notebook.page_num(page.widget))
+
self.scheduler.add_scheduler(page.scheduler)
page.connect("label-changed", self.on_notebook_label_changed)
page.connect("file-changed", self.on_file_changed)
--
1.7.7.431.g89633
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]