Merge lp:~a1s/qbrz/fix-diff-button into lp:qbrz

Proposed by Aleksandr Smyshliaev
Status: Merged
Approved by: Robert Ladyman
Approved revision: 1642
Merged at revision: 1645
Proposed branch: lp:~a1s/qbrz/fix-diff-button
Merge into: lp:qbrz
Diff against target: 106 lines (+16/-13)
5 files modified
lib/diff.py (+12/-9)
lib/diffwindow.py (+1/-1)
lib/log.py (+1/-1)
lib/logwidget.py (+1/-1)
lib/treewidget.py (+1/-1)
To merge this branch: bzr merge lp:~a1s/qbrz/fix-diff-button
Reviewer Review Type Date Requested Status
Robert Ladyman Approve
Review via email: mp+413830@code.launchpad.net

Commit message

Fix launching diff viewers

Description of the change

In the diff push button and pop-up menu there is some confusion between Qt built-in signal, widget method with the same name, and custom signal bound to the QBrz classes.

With this patch, I rename the signal hanlder method, and connect the handlers to the QBrz signal instead of non-existing variant of the overloaded base signal.

Also, the syntax for external diff command lines has changed in Breezy config: now it's {old_path} and {new_path} instead of @old_path and @new_path. I've changed the external diff command in QBrz to use the new syntax.

To post a comment you must log in.
Revision history for this message
Robert Ladyman (saccadic-masking) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/diff.py'
2--- lib/diff.py 2021-01-08 13:56:34 +0000
3+++ lib/diff.py 2022-01-08 13:14:01 +0000
4@@ -131,11 +131,11 @@
5 self.setDefaultAction(action)
6 self.addAction(action)
7
8- self.triggered[QAction].connect(self.triggered)
9+ self.triggered[QtWidgets.QAction].connect(self.do_trigger)
10
11- def triggered(self, action):
12+ def do_trigger(self, action):
13 ext_diff = str(action.data())
14- self.triggered.emit(ext_diff)
15+ self._triggered.emit(ext_diff)
16
17
18 class DiffButtons(QtWidgets.QWidget):
19@@ -148,7 +148,7 @@
20 self.default_button = QtWidgets.QPushButton(gettext('Diff'), self)
21 layout.addWidget(self.default_button)
22 layout.setSpacing(0)
23- self.default_button.clicked.connect(self.triggered)
24+ self.default_button.clicked.connect(self.do_trigger)
25
26 if has_ext_diff():
27 self.menu = ExtDiffMenu(self)
28@@ -162,10 +162,13 @@
29 self.menu_button.style().pixelMetric(
30 QtWidgets.QStyle.PM_ButtonMargin)
31 )
32- self.menu.triggered['QString'].connect(self._triggered)
33+ self.menu._triggered.connect(self.do_trigger)
34
35- def triggered(self, ext_diff=None):
36- if ext_diff is None:
37+ def do_trigger(self, ext_diff=None):
38+ # Note: this is connected to default_button.clicked
39+ # as well as the menu events. The button passes it's
40+ # checked state (always False here) in arguments.
41+ if not ext_diff:
42 ext_diff = default_diff
43 self._triggered.emit(ext_diff)
44
45@@ -438,8 +441,8 @@
46
47 def set_command_string(self, command_string):
48 command_template = cmdline.split(command_string)
49- if '@' not in command_string:
50- command_template.extend(['@old_path', '@new_path'])
51+ if "{old_path}" not in command_string:
52+ command_template.extend(["{old_path}", "{new_path}"])
53 self.command_template = command_template
54
55 def finish(self):
56
57=== modified file 'lib/diffwindow.py'
58--- lib/diffwindow.py 2021-05-26 19:10:36 +0000
59+++ lib/diffwindow.py 2022-01-08 13:14:01 +0000
60@@ -244,7 +244,7 @@
61 action.setToolTip(gettext("Launch an external diff application"))
62 ext_diff_menu = ExtDiffMenu(parent=self, include_builtin = False)
63 action.setMenu(ext_diff_menu)
64- ext_diff_menu.triggered['QString'].connect(self.ext_diff_triggered)
65+ ext_diff_menu._triggered.connect(self.ext_diff_triggered)
66 return action
67
68 def create_view_menu(self):
69
70=== modified file 'lib/log.py'
71--- lib/log.py 2021-01-08 13:56:34 +0000
72+++ lib/log.py 2022-01-08 13:14:01 +0000
73@@ -527,7 +527,7 @@
74 if has_ext_diff():
75 diff_menu = ExtDiffMenu(self)
76 self.file_list_context_menu.addMenu(diff_menu)
77- diff_menu.triggered['QString'].connect(self.show_diff_files_ext)
78+ diff_menu._triggered.connect(self.show_diff_files_ext)
79 else:
80 show_diff_action = self.file_list_context_menu.addAction(gettext("Show &differences..."), self.show_diff_files)
81 self.file_list_context_menu.setDefaultAction(show_diff_action)
82
83=== modified file 'lib/logwidget.py'
84--- lib/logwidget.py 2021-01-08 11:30:55 +0000
85+++ lib/logwidget.py 2022-01-08 13:14:01 +0000
86@@ -140,7 +140,7 @@
87 if diff.has_ext_diff():
88 diff_menu = diff.ExtDiffMenu(self, set_default=diff_is_default_action)
89 self.context_menu.addMenu(diff_menu)
90- diff_menu.triggered['QString'].connect(self.show_diff_ext)
91+ diff_menu._triggered.connect(self.show_diff_ext)
92 else:
93 show_diff_action = self.context_menu.addAction(gettext("Show &differences..."), self.show_diff)
94 if diff_is_default_action:
95
96=== modified file 'lib/treewidget.py'
97--- lib/treewidget.py 2021-05-26 19:10:36 +0000
98+++ lib/treewidget.py 2022-01-08 13:14:01 +0000
99@@ -1804,7 +1804,7 @@
100 if has_ext_diff():
101 diff_menu = ExtDiffMenu(self)
102 self.action_show_diff = self.context_menu.addMenu(diff_menu)
103- diff_menu.triggered['QString'].connect(self.show_differences)
104+ diff_menu._triggered.connect(self.show_differences)
105 else:
106 self.action_show_diff = self.context_menu.addAction(gettext("Show &differences"), self.show_differences)
107

Subscribers

People subscribed via source and target branches