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

Subscribers

People subscribed via source and target branches

to status/vote changes: