Merge lp:~simon-kersey/qbzr/590229-fix into lp:qbzr

Proposed by Simon Kersey
Status: Merged
Merge reported by: Alexander Belchenko
Merged at revision: not available
Proposed branch: lp:~simon-kersey/qbzr/590229-fix
Merge into: lp:qbzr
Diff against target: 152 lines (+38/-28)
3 files modified
NEWS.txt (+2/-0)
lib/run.py (+19/-12)
lib/subprocess.py (+17/-16)
To merge this branch: bzr merge lp:~simon-kersey/qbzr/590229-fix
Reviewer Review Type Date Requested Status
Alexander Belchenko Approve
Review via email: mp+33901@code.launchpad.net

Commit message

Fix qrun --execute mode.

Description of the change

Changing implementation of 'Retry' button in SubProcessWindowBase broke QBzrRunDialog --execute mode.

Fixed by:

Updating the interface to SubProcessWindowBase to expose the control buttons so that QBzrRunDialog can change their behaviour when running in --execute mode.
Updated QBzrRunDialog to implement --execute mode with the current SubProcessWindowBase interface.

To test:
Run qrun command with -e (or --execute) option.

To post a comment you must log in.
Revision history for this message
Alexander Belchenko (bialix) wrote :

I don't like the idea of exposing buttons as private members (names started with underscore, self._closeButton and so on).

Instead either make them as public (without underscore) or better create (resurrect) methods to control these buttons for various situations.

review: Needs Fixing
Revision history for this message
Alexander Belchenko (bialix) wrote :

To clarify my point: if you keep buttons as private variables then please create public methods in SubProcessBase dialog to control these buttons. Otherwise buttons should be exposed as public variables.

Revision history for this message
Simon Kersey (simon-kersey) wrote :

> To clarify my point: if you keep buttons as private variables then please
> create public methods in SubProcessBase dialog to control these buttons.
> Otherwise buttons should be exposed as public variables.

I'll probably make them public variables to allow for maximum flexibilty if that is OK.
I was trying for the concept of inherited class variables (not public but available to derived classes).

lp:~simon-kersey/qbzr/590229-fix updated
1312. By Simon Kersey

Make subprocess buttons public

Revision history for this message
Alexander Belchenko (bialix) wrote :

Simon, thanks for the change. I did not notice your latest change earlier because launchpad did not send any mails about new revisions. So next time when you will update your patch, please write some comment in corresponding merge proposal, so I will know that there is something to look at.

review: Approve
Revision history for this message
Alexander Belchenko (bialix) wrote :

Merged into 0.18, 0.19 and trunk (0.20).

Thank you!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS.txt'
2--- NEWS.txt 2010-08-09 17:02:40 +0000
3+++ NEWS.txt 2010-08-28 13:13:42 +0000
4@@ -1,6 +1,8 @@
5 0.20 Beta 1 - In development
6 ----------------------------
7
8+ * qrun:
9+ * Fixed '--execute' mode. (Bug #590229, Simon Kersey)
10
11 0.19.1 - In development
12 -----------------------
13
14=== modified file 'lib/run.py'
15--- lib/run.py 2010-06-06 08:40:13 +0000
16+++ lib/run.py 2010-08-28 13:13:42 +0000
17@@ -116,25 +116,31 @@
18 self.ui.help_browser.hide()
19
20 # create edit button
21- self._editButton = QtGui.QPushButton(gettext('&Edit'))
22- QtCore.QObject.connect(self._editButton,
23+ self.editButton = QtGui.QPushButton(gettext('&Edit'))
24+ QtCore.QObject.connect(self.editButton,
25 QtCore.SIGNAL("clicked()"),
26 self.enable_command_edit)
27
28 # cause edit button to be shown if command fails
29 QtCore.QObject.connect(self,
30 QtCore.SIGNAL("subprocessFailed(bool)"),
31- self._editButton,
32+ self.editButton,
33 QtCore.SLOT("setHidden(bool)"))
34-
35- # add edit button to dialog buttons
36- self.buttonbox.addButton(self._editButton,
37+
38+ # add edit button to dialog buttons
39+ self.buttonbox.addButton(self.editButton,
40 QtGui.QDialogButtonBox.ResetRole)
41
42 # setup initial dialog button status
43- self.init_button_status()
44- self._okButton.setHidden(True)
45- self._editButton.setHidden(True)
46+ self.closeButton.setHidden(True)
47+ self.okButton.setHidden(True)
48+ self.editButton.setHidden(True)
49+
50+ # cancel button gets hidden when finished.
51+ QtCore.QObject.connect(self,
52+ QtCore.SIGNAL("subprocessFinished(bool)"),
53+ self.cancelButton,
54+ QtCore.SLOT("setHidden(bool)"))
55
56 # run command
57 self.do_start()
58@@ -146,13 +152,14 @@
59
60 def enable_command_edit(self):
61 """Hide Edit button and make user edit fields visible"""
62- self._editButton.setHidden(True)
63+ self.editButton.setHidden(True)
64 QtCore.QObject.disconnect(self,
65 QtCore.SIGNAL("subprocessFailed(bool)"),
66- self._editButton,
67+ self.editButton,
68 QtCore.SLOT("setHidden(bool)"))
69- self.ui.frame.show()
70+ self.ui.run_container.show()
71 self.ui.help_browser.show()
72+ self.okButton.setShown(True)
73
74 def set_default_help(self):
75 """Set default text in help widget."""
76
77=== modified file 'lib/subprocess.py'
78--- lib/subprocess.py 2010-06-25 11:36:02 +0000
79+++ lib/subprocess.py 2010-08-28 13:13:42 +0000
80@@ -110,55 +110,56 @@
81 QtCore.SIGNAL("error()"),
82 self.on_error)
83
84- closeButton = StandardButton(BTN_CLOSE)
85- okButton = StandardButton(BTN_OK)
86- cancelButton = StandardButton(BTN_CANCEL)
87-
88+ self.closeButton = StandardButton(BTN_CLOSE)
89+ self.okButton = StandardButton(BTN_OK)
90+ self.cancelButton = StandardButton(BTN_CANCEL)
91+
92 # ok button gets disabled when we start.
93 QtCore.QObject.connect(self,
94 QtCore.SIGNAL("subprocessStarted(bool)"),
95- okButton,
96+ self.okButton,
97 QtCore.SLOT("setDisabled(bool)"))
98
99 # ok button gets hidden when we finish.
100 QtCore.QObject.connect(self,
101 QtCore.SIGNAL("subprocessFinished(bool)"),
102- okButton,
103+ self.okButton,
104 QtCore.SLOT("setHidden(bool)"))
105
106 # close button gets shown when we finish.
107 QtCore.QObject.connect(self,
108 QtCore.SIGNAL("subprocessFinished(bool)"),
109- closeButton,
110+ self.closeButton,
111 QtCore.SLOT("setShown(bool)"))
112
113 # cancel button gets disabled when finished.
114 QtCore.QObject.connect(self,
115 QtCore.SIGNAL("subprocessFinished(bool)"),
116- cancelButton,
117+ self.cancelButton,
118 QtCore.SLOT("setDisabled(bool)"))
119
120 # ok button gets enabled when we fail.
121 QtCore.QObject.connect(self,
122 QtCore.SIGNAL("subprocessFailed(bool)"),
123- okButton,
124+ self.okButton,
125 QtCore.SLOT("setDisabled(bool)"))
126
127 # Change the ok button to 'retry' if we fail.
128 QtCore.QObject.connect(self,
129 QtCore.SIGNAL("subprocessFailed(bool)"),
130- lambda failed: okButton.setText(gettext('&Retry')))
131+ lambda failed: self.okButton.setText(
132+ gettext('&Retry')))
133
134 self.buttonbox = QtGui.QDialogButtonBox(self)
135- self.buttonbox.addButton(okButton,
136- QtGui.QDialogButtonBox.AcceptRole)
137- self.buttonbox.addButton(closeButton,
138- QtGui.QDialogButtonBox.AcceptRole)
139- self.buttonbox.addButton(cancelButton,
140+ self.buttonbox.addButton(self.okButton,
141+ QtGui.QDialogButtonBox.AcceptRole)
142+ self.buttonbox.addButton(self.closeButton,
143+ QtGui.QDialogButtonBox.AcceptRole)
144+ self.buttonbox.addButton(self.cancelButton,
145 QtGui.QDialogButtonBox.RejectRole)
146 self.connect(self.buttonbox, QtCore.SIGNAL("accepted()"), self.do_accept)
147 self.connect(self.buttonbox, QtCore.SIGNAL("rejected()"), self.do_reject)
148- closeButton.setHidden(True) # but 'close' starts as hidden.
149+ self.closeButton.setHidden(True) # but 'close' starts as hidden.
150
151 self.uncommitted_info = InfoWidget(self)
152 uncommitted_info_layout = QtGui.QHBoxLayout(self.uncommitted_info)

Subscribers

People subscribed via source and target branches