[meld] filediff: Refactor merging actions to remove params from callback
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Refactor merging actions to remove params from callback
- Date: Sun, 14 Dec 2014 20:51:40 +0000 (UTC)
commit cd6166927bc26823c9c4f05fe691087c8d5ab3fc
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Dec 14 08:08:12 2014 +1000
filediff: Refactor merging actions to remove params from callback
data/ui/filediff.ui | 4 ++--
meld/filediff.py | 15 ++++++++++-----
2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 1dbadd4..58292ca 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -137,14 +137,14 @@
<object class="GtkAction" id="MergeFromLeft">
<property name="label" translatable="yes">Merge All from Left</property>
<property name="tooltip" translatable="yes">Merge all non-conflicting changes from the
left</property>
- <signal name="activate" handler="pull_all_non_conflicting_changes(-1)" swapped="no"/>
+ <signal name="activate" handler="action_pull_all_changes_left" swapped="no"/>
</object>
</child>
<child>
<object class="GtkAction" id="MergeFromRight">
<property name="label" translatable="yes">Merge All from Right</property>
<property name="tooltip" translatable="yes">Merge all non-conflicting changes from the
right</property>
- <signal name="activate" handler="pull_all_non_conflicting_changes(1)" swapped="no"/>
+ <signal name="activate" handler="action_pull_all_changes_right" swapped="no"/>
</object>
</child>
<child>
diff --git a/meld/filediff.py b/meld/filediff.py
index 3e3da6b..4dcfbd2 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -608,11 +608,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.copy_chunk(
src, dst, self.get_action_chunk(src, dst), copy_up=False)
- def pull_all_non_conflicting_changes(self, direction):
- assert direction in (-1, 1)
- dst = self._get_focused_pane()
- src = dst + direction
- assert src in range(self.num_panes)
+ def pull_all_non_conflicting_changes(self, src, dst):
merger = merge.Merger()
merger.differ = self.linediffer
merger.texts = self.buffer_texts
@@ -622,11 +618,20 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.on_textbuffer_begin_user_action()
self.textbuffer[dst].set_text(mergedfile)
self.on_textbuffer_end_user_action()
+
def resync():
self._sync_vscroll_lock = False
self._sync_vscroll(self.scrolledwindow[src].get_vadjustment(), src)
self.scheduler.add_task(resync)
+ def action_pull_all_changes_left(self, *args):
+ src, dst = self.get_action_panes(-1, reverse=True)
+ self.pull_all_non_conflicting_changes(src, dst)
+
+ def action_pull_all_changes_right(self, *args):
+ src, dst = self.get_action_panes(+1, reverse=True)
+ self.pull_all_non_conflicting_changes(src, dst)
+
def merge_all_non_conflicting_changes(self):
dst = 1
merger = merge.Merger()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]