Merge lp:~javierder/qbzr/send into lp:~qbzr-dev/qbzr/trunk

Proposed by Javier Derderyan
Status: Merged
Merged at revision: not available
Proposed branch: lp:~javierder/qbzr/send
Merge into: lp:~qbzr-dev/qbzr/trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~javierder/qbzr/send
Reviewer Review Type Date Requested Status
Gary van der Merwe Approve
Alexander Belchenko Needs Fixing
Review via email: mp+7340@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Javier Derderyan (javierder) wrote :

I've built a QT dialog for Send Command.

Features:
* loads into target branch combobox the saved submit branch
* Allows to send email or save to file, allowing to choose which file to save using a filesave dialog
* Allows to add a message
* Allows "no bundle", "no patch" and "remember" options
* Validates email

I'm eager to hear you inputs!

lp:~javierder/qbzr/send updated
764. By Alexander Belchenko

NEWS.txt updated for 0.11

765. By Alexander Belchenko

0.11 release.

766. By Alexander Belchenko

started 0.12

767. By Gary van der Merwe

Add some comment to loggraphprovider.py regarding unfiltered/filtered lists.

768. By Gary van der Merwe

Remove a whole bunch of unnessery imports, thanks to pyflakes.

769. By Gary van der Merwe

Restore remove import which caused icons not to show.

770. By Gary van der Merwe

qannotate: Refactor so that we only load revisions if there lines that the revision touches on screen.

This give a small perforamnce increase for local branches and a big performance increase for remote branches.

Most of the code to do this is now common with qlog.

771. By Gary van der Merwe

Commit: Fix api skew.

772. By Gary van der Merwe

qlog: Fix api skew.

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

Javier Der Derian пишет:
> Javier Der Derian has proposed merging lp:~javierder/qbzr/send into lp:qbzr.
>
> Requested reviews:
> QBzr Developers (qbzr-dev)
>
> I've built a QT dialog for Send Command.
>
> Features:
> * loads into target branch combobox the saved submit branch
> * Allows to send email or save to file, allowing to choose which file to save using a filesave dialog
> * Allows to add a message
> * Allows "no bundle", "no patch" and "remember" options
> * Validates email
>
> I'm eager to hear you inputs!

Several small tweaks needed:

1) Help string:

C:\work\Bazaar\plugins\qbzr>bzr qsend -h
Purpose: Dialog for creating and sending patchs and bundles
Usage: bzr qsend [SUBMIT_BRANCH] [PUBLIC_BRANCH]

Fix spelling in help string: s/patchs/patches/

2) When I'm running qsend I'm get warning in the console:

C:\work\Bazaar\plugins\qbzr>bzr qsend
Object::connect: No such slot QVBoxLayout::setDisabled(bool)

So you're using not compatible API with PyQt 4.3. Please look at other dialogs, and fix this.

3) You shows internal bzr name in the title of group box:

Branch to submit:BzrBranch7('file:///C:/work/Bazaar/repos/qbzr-repo-1.9/send')

Instead you should use url_for_display(branch.base) to obtain fine string.

4) I found your dialog is hard to understand: what all this options means and in which lineedit
element I should enter what? Especially lineedit below radiobuttons. Why for Message is needed?

I'd like to rework the UI. I'll explain it shortly. But to discuss the UI it's better to see
screenshots, so it's better to continue discussion in the google group.

lp:~javierder/qbzr/send updated
773. By Gary van der Merwe

qlog: Fix diff and show tree.

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

More detailed review have sent to qbzr ML.

Revision history for this message
Alexander Belchenko (bialix) :
review: Needs Fixing
lp:~javierder/qbzr/send updated
774. By Gary van der Merwe

Make PyQT not show lots of warinings when debuging.

775. By Gary van der Merwe

Refactor RevisionTreeView so that for log - it queries rowCount for the proxy model and not the source model.

776. By Gary van der Merwe

qannotate: Make compatable with older versions of QT.

777. By Alexander Belchenko

improvements for windows installer.

778. By Alexander Belchenko

add qgetup as alias for qgetupdates command.

779. By Alexander Belchenko

qversion: new command to display Bazaar & Python installation information.

780. By Gary van der Merwe

Merge qbrowse new model changes which allows qbrowse to only load revisions if they are visible.

781. By Alexander Belchenko

qupdate: simple dialog to update working tree in the branch.

782. By Alexander Belchenko

qmerge: revision no more ignored.

783. By Alexander Belchenko

setup.py build_pot: get rid of hardwired `qbzr` string, using self.distribution.get_name() instead.

784. By Alexander Belchenko

build_ui: using plugin name from setup() metadata (argument `name`) instead of hardwired `qbzr`.

785. By Gary van der Merwe

Make SubprocessUIFactory compatable with bzr.dev

786. By Gary van der Merwe

qlog: Fix bug when searching for revno/revid.

787. By Gary van der Merwe

Remove a bunch of SubprocessUIFactory compatibility code.

788. By Gary van der Merwe

Remove unused QUIFactory code.

789. By Gary van der Merwe

qbranch/qmerge: Override correct SubprocessDialog method (start, not accept.)

790. By Gary van der Merwe

qannotate: Get "Annotate this revision." working again.

791. By Gary van der Merwe

Simpler revno painter.

792. By Alexander Belchenko

some ideas about qdiff optimisation.

793. By Alexander Belchenko

setup.py build_mo: get rid of hardwired `qbzr` string, using self.distribution.get_name() instead.

794. By Alexander Belchenko

main.py: double-click on file will open it in the native application (proof of concept for BzrExplorer).

795. By Alexander Belchenko

qbranch: when launching branch command use flag --use-existing-dir if it's available.

796. By Alexander Belchenko

Makefile: added target "tags".

797. By Alexander Belchenko

import_po: changed code to be more universal and suitable for other projects too.

798. By Alexander Belchenko

improved support of `setup.py build_mo --lang XXX`

799. By methane

use u'.' as default path when none given; we should use unicode there to avoid problems with non-ascii paths.

800. By Javier Derderyan

Merged with trunk

801. By Javier Derderyan

Merged with diverged ~javierder/qbzr/send

802. By Javier Derderyan

Small fixes from review

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

So your updated seem to address all of Alex's points.

I've fix some small issues, and merged this into trunk. The things I fixed were:
* The author in the copyright should be changed to your name.
* I move the validation code to validate.

Thanks for the contribution.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2009-06-10 08:17:53 +0000
3+++ __init__.py 2009-06-11 14:31:32 +0000
4@@ -87,6 +87,7 @@
5 register_lazy_command('bzrlib.plugins.qbzr.lib.commands', 'cmd_qsubprocess', [])
6 register_lazy_command('bzrlib.plugins.qbzr.lib.commands', 'cmd_qtag', [])
7 register_lazy_command('bzrlib.plugins.qbzr.lib.commands', 'cmd_qviewer', [])
8+register_lazy_command('bzrlib.plugins.qbzr.lib.commands', 'cmd_qsend', ['qsend'])
9
10 register_lazy_command('bzrlib.plugins.qbzr.lib.extra.bugurl', 'cmd_bug_url', [])
11 register_lazy_command('bzrlib.plugins.qbzr.lib.extra.isignored', 'cmd_is_ignored', [])
12
13=== modified file 'lib/commands.py'
14--- lib/commands.py 2009-06-11 01:04:46 +0000
15+++ lib/commands.py 2009-06-11 14:31:32 +0000
16@@ -75,6 +75,7 @@
17 is_valid_encoding,
18 )
19 from bzrlib.plugins.qbzr.lib.uifactory import QUIFactory
20+from bzrlib.plugins.qbzr.lib.send import SendWindow
21 ''')
22
23 from bzrlib.plugins.qbzr.lib import MS_WINDOWS
24@@ -843,3 +844,19 @@
25 window = QBzrViewWindow(filename=filename, encoding=encoding)
26 window.show()
27 app.exec_()
28+
29+class cmd_qsend(QBzrCommand):
30+ """Dialog for creating and sending patchs and bundles"""
31+
32+ encoding_type = 'exact'
33+
34+ takes_args = ['submit_branch?', 'public_branch?']
35+
36+
37+ def _qbzr_run(self, submit_branch=".", public_branch=None):
38+ branch = Branch.open_containing(submit_branch)[0]
39+
40+ app = QtGui.QApplication(sys.argv)
41+ window = SendWindow(branch)
42+ window.show()
43+ app.exec_()
44\ No newline at end of file
45
46=== added file 'lib/send.py'
47--- lib/send.py 1970-01-01 00:00:00 +0000
48+++ lib/send.py 2009-06-11 14:31:32 +0000
49@@ -0,0 +1,236 @@
50+# -*- coding: utf-8 -*-
51+#
52+# QBzr - Qt frontend to Bazaar commands
53+#
54+# Contributors:
55+# Mark Hammond <mhammond@skippinet.com.au>
56+#
57+# This program is free software; you can redistribute it and/or
58+# modify it under the terms of the GNU General Public License
59+# as published by the Free Software Foundation; either version 2
60+# of the License, or (at your option) any later version.
61+#
62+# This program is distributed in the hope that it will be useful,
63+# but WITHOUT ANY WARRANTY; without even the implied warranty of
64+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65+# GNU General Public License for more details.
66+#
67+# You should have received a copy of the GNU General Public License
68+# along with this program; if not, write to the Free Software
69+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
70+
71+import os
72+import re
73+from PyQt4 import QtCore, QtGui
74+
75+from bzrlib.plugins.qbzr.lib.i18n import gettext
76+from bzrlib.plugins.qbzr.lib.subprocess import SubProcessDialog
77+from bzrlib.plugins.qbzr.lib.wtlist import (
78+ ChangeDesc,
79+ WorkingTreeFileList,
80+ closure_in_selected_list,
81+ )
82+from bzrlib.plugins.qbzr.lib.util import url_for_display
83+
84+from bzrlib.branch import Branch
85+
86+class SendWindow(SubProcessDialog):
87+
88+ def __init__(self, branch):#tree, selected_list, dialog=True, ui_mode=True, parent=None, local=None, message=None):
89+ """self.tree = tree
90+ self.initial_selected_list = selected_list"""
91+
92+ super(SendWindow, self).__init__(
93+ gettext("Send"),
94+ name = "send",
95+ default_size = (400, 400),
96+ ui_mode = None,
97+ dialog = True,
98+ parent = None,
99+ hide_progress=False,
100+ )
101+
102+ groupbox = QtGui.QGroupBox(gettext("Branch to submit:")+str(branch), self)
103+ vbox = QtGui.QVBoxLayout(groupbox)
104+ vbox.addStrut(0)
105+
106+
107+ self.branch = branch
108+
109+ target_hbox = QtGui.QHBoxLayout()
110+
111+ target_branch_label = QtGui.QLabel(gettext("Target Branch:"))
112+ target_branch_combo = QtGui.QComboBox()
113+ submitbranch = branch.get_submit_branch()
114+ if submitbranch != None:
115+ target_branch_combo.addItem(submitbranch)
116+
117+ self.target_branch_combo = target_branch_combo
118+ target_branch_combo.setEditable(True)
119+ target_hbox.addWidget(target_branch_label)
120+ target_hbox.addWidget(target_branch_combo)
121+
122+ target_hbox.setStretchFactor(target_branch_combo,1)
123+
124+ vbox.addLayout(target_hbox)
125+
126+
127+ groupbox_submit = QtGui.QGroupBox(gettext("Enter submit location:"))
128+ hbox_submit = QtGui.QHBoxLayout(groupbox_submit)
129+ vbox.addWidget(groupbox_submit)
130+
131+
132+ submit_email_radio = QtGui.QRadioButton("Send to email")
133+ self.submit_email_radio = submit_email_radio
134+ submit_email_radio.toggle()
135+
136+
137+ location_save_radio = QtGui.QRadioButton("Save to location")
138+ self.location_save_radio = location_save_radio
139+
140+
141+
142+ hbox_submit.addWidget(submit_email_radio)
143+ hbox_submit.addWidget(location_save_radio)
144+ hbox_submit.setStretchFactor(submit_email_radio,0)
145+ hbox_submit.setStretchFactor(location_save_radio,1)
146+
147+
148+ hbox_location_edit = QtGui.QHBoxLayout()
149+
150+ submit_location_edit = QtGui.QLineEdit()
151+ hbox_location_edit.addWidget(submit_location_edit)
152+ self.browse_location_button = QtGui.QPushButton("Browse")
153+
154+ self.sendtype_presed() # to set the browse button disabled as default
155+
156+ hbox_location_edit.addWidget(self.browse_location_button)
157+
158+ self.submit_location_edit = submit_location_edit
159+
160+ vbox.addLayout(hbox_location_edit)
161+
162+ label_message = QtGui.QLabel(gettext("Message:"))
163+ vbox.addWidget(label_message)
164+ self.message_edit = QtGui.QLineEdit()
165+ vbox.addWidget(self.message_edit)
166+
167+
168+
169+
170+
171+ options_group = QtGui.QGroupBox("Options")
172+ vbox.addWidget(options_group)
173+ options_vbox = QtGui.QHBoxLayout(options_group)
174+
175+ self.remember_check = QtGui.QCheckBox("Remember")
176+ options_vbox.addWidget(self.remember_check)
177+ options_vbox.setStretchFactor(self.remember_check,0)
178+
179+ self.nobundle_check = QtGui.QCheckBox("No bundle")
180+ options_vbox.addWidget(self.nobundle_check)
181+ options_vbox.setStretchFactor(self.nobundle_check,0)
182+
183+ self.nopatch_check = QtGui.QCheckBox("No patch")
184+ options_vbox.addWidget(self.nopatch_check)
185+ options_vbox.setStretchFactor(self.nopatch_check,1)
186+
187+ # groupbox gets disabled as we are executing.
188+ QtCore.QObject.connect(self,
189+ QtCore.SIGNAL("subprocessStarted(bool)"),
190+ vbox,
191+ QtCore.SLOT("setDisabled(bool)"))
192+
193+ # connect submit type to enable/disable browse button.
194+ QtCore.QObject.connect(self.submit_email_radio, QtCore.SIGNAL("toggled(bool)"), self.sendtype_presed)
195+
196+ # connect "browse" button with dialog
197+ QtCore.QObject.connect(self.browse_location_button, QtCore.SIGNAL("clicked(bool)"), self.browse_location_clicked)
198+
199+ self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
200+ self.splitter.addWidget(groupbox)
201+ self.splitter.addWidget(self.make_default_status_box())
202+
203+ self.splitter.setStretchFactor(0, 10)
204+ self.restoreSplitterSizes([150, 150])
205+
206+
207+ layout = QtGui.QVBoxLayout(self)
208+ #layout.addWidget(vbox)
209+ layout.addWidget(self.splitter)
210+ layout.addWidget(self.buttonbox)
211+
212+
213+ def sendtype_presed(self):
214+ if self.submit_email_radio.isChecked():
215+ self.browse_location_button.setDisabled(True)
216+ else:
217+ self.browse_location_button.setDisabled(False)
218+
219+ def browse_location_clicked(self):
220+ fileName = QtGui.QFileDialog.getSaveFileName(self, ("Select destination"));
221+ self.submit_location_edit.setText(fileName)
222+
223+ def start(self):
224+ target_branch = str(self.target_branch_combo.currentText())
225+ location = str(self.submit_location_edit.text())
226+
227+ error = []
228+
229+ if target_branch == '':
230+ error.append("Please fill in target branch")
231+
232+ if location == '':
233+ error.append("Please fill in target location")
234+ else:
235+ if self.submit_email_radio.isChecked():
236+ if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", location) == None:
237+ error.append("Please enter a valid email address")
238+
239+ if len(error) > 0:
240+ msgBox = QtGui.QMessageBox(self)
241+ msgBox.setText("There are erros in your request.")
242+ msgBox.setInformativeText("\n".join(error))
243+ msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
244+ msgBox.setDefaultButton(QtGui.QMessageBox.Ok)
245+ msgBox.setIcon(QtGui.QMessageBox.Critical)
246+ ret = msgBox.exec_()
247+ return
248+
249+
250+ mylocation = url_for_display(self.branch.base)
251+
252+ args = ["-f", mylocation]
253+
254+
255+ if self.submit_email_radio.isChecked():
256+ args.append("--mail-to=%s" % location)
257+ else:
258+ args.append("-o")
259+ args.append(location)
260+
261+
262+ if self.remember_check.isChecked():
263+ args.append("--remember")
264+
265+ if self.nopatch_check.isChecked():
266+ args.append("--no-patch")
267+
268+ if self.nobundle_check.isChecked():
269+ args.append("--no-bundle")
270+
271+ if self.message_edit.text() != '':
272+ args.append("--message=%s" % str(self.message_edit.text()))
273+
274+ args.append("--revision=-1")
275+
276+
277+
278+
279+
280+ self.process_widget.start(None, 'send', target_branch, *args)
281+
282+
283+ def saveSize(self):
284+ SubProcessDialog.saveSize(self)
285+ self.saveSplitterSizes()

Subscribers

People subscribed via source and target branches

to status/vote changes: