Merge lp:~simon-kersey/bzr-explorer/add-bzrexec-tool into lp:bzr-explorer

Proposed by Simon Kersey
Status: Merged
Merged at revision: not available
Proposed branch: lp:~simon-kersey/bzr-explorer/add-bzrexec-tool
Merge into: lp:bzr-explorer
Diff against target: 70 lines (+12/-2)
4 files modified
NEWS (+3/-0)
lib/explorer.py (+6/-2)
lib/extensions/tools.py (+1/-0)
lib/kinds.py (+2/-0)
To merge this branch: bzr merge lp:~simon-kersey/bzr-explorer/add-bzrexec-tool
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+22522@code.launchpad.net

Description of the change

Adds tool type 'bzr-exec'. Tools with this type invoke qrun with the '--execute' option so that the tool command is run immediately, without further user confirmation.

This provides the user with the beginnings of the functionality to allow 'click and do'. At the moment, when using tools, the user has to click the tool and then supply parameter(s) to the command and then click again to run the command.

The next step will be to add functionality to support %(selected)s in the tool action - initially the idea will be to populate this with the selected items from the working tree browser. In this way a tool can be defined that will operate immediately on a selected file.

To test this change add a tool based on 'ls'. Then edit the tools.xml file to change the type to 'bzr-exec'. With the working tree browser visible click on the tool, the results of the ls should be visible.

To post a comment you must log in.
Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Hi Simon,

This all looks ok to me. FWIW, your suggested test fails for me gumbling about ...

'QBzrRunDialog' object has no attribute 'init_button_status'.

That doesn't look like it's your fault though.

Before I merge this, I'd like slightly more detail on your plans. For example, are you planning to make "bzr-exec" a new kind inside tool_dialogs.py? Or a checkbox that only becomes active when the "Bazaar Command" kind is selected? If the latter, maybe we ought to model it that way inside the XML as well?

review: Needs Information
Revision history for this message
Simon Kersey (simon-kersey) wrote :
Download full text (3.7 KiB)

> Hi Simon,
>
> This all looks ok to me. FWIW, your suggested test fails for me gumbling about
> ...
>
> 'QBzrRunDialog' object has no attribute 'init_button_status'.
>
> That doesn't look like it's your fault though.

Mine is working with the following environment:

Bazaar (bzr) 2.1.0rc1
  Python interpreter: C:\Program Files\Bazaar\python25.dll 2.5.4
  Python standard library: C:\Program Files\Bazaar\lib\library.zip
  Platform: Windows-XP-5.1.2600-SP3
  bzrlib: C:\Program Files\Bazaar\lib\library.zip\bzrlib
  Bazaar configuration: C:\Documents and Settings\simon.kersey\Application Data\bazaar\2.0
  Bazaar log file: C:\SJK\Bazaar\log\.bzr.log

With the following plugins:

bzrtools 2.1.0b1
    Various useful commands for working with bzr.

explorer 1.1.0dev
    Version Control for Human Beings.

fastimport 0.9.0dev
    FastImport Plugin

launchpad 2.1.0rc1
    Launchpad.net integration plugin for Bazaar.

netrc_credential_store 2.1.0rc1
    Use ~/.netrc as a credential store for authentication.conf.

qbzr 0.18.0
    QBzr - Qt-based frontend for Bazaar

rebase 0.5.5
    Rebase support.

trunk 0.1.0dev
    Commands and Hooks to support Reserved Edit of files in Bazaar.

upload 1.0.0dev
    Upload a working tree, incrementally.

xmloutput 0.8.5
    This plugin provides xml output for status, log, annotate, missing, info,

>
> Before I merge this, I'd like slightly more detail on your plans. For example,
> are you planning to make "bzr-exec" a new kind inside tool_dialogs.py? Or a
> checkbox that only becomes active when the "Bazaar Command" kind is selected?
> If the latter, maybe we ought to model it that way inside the XML as well?

I hadn't given much thought to the UI. I was initially going to put this feature and support for %(selected)s in just through editing the tools.xml file. Then once that was working OK, look at UI support.

I suppose I would probably just add it as a different command type in tool_dialogs.py in the end.

The reason I wouldn't expose it on the UI initially is that it really only makes sense once you can select items on which to run the tool.

With regard to support for selecting items I was going use the fact that the tool action contained %(selected)s to determine whether it should be displayed or not. If it contained %(selected)s then it would only be shown if the working tree browser was shown. Then when you run the tool anything that was selected in the working tree would replace %(selected)s. (This goes back to a branch I submitted some months ago about toolbars and stuff)

The next part of my grand plan is to add tools to the working tree right-click menu. You outlined some thoughts you had on this. From that I sort of inferred the following as a way forward and would be interested in knowing what you thought.

Add a new file type, ContextMenus.xml.

Have separate <folder> elements within this file relate to particular UI features that might support a context menu, e.g. working_tree. Within the UI feature folder specify folders of tools that apply to items displayed in the UI feature. It's at this point that it starts to get complicated when you consider the working tree. The working tree displays...

Read more...

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

OK. I'm happy with this patch so I'm merging it.

Can you email the qbzr mailing list please about supporting right click menus in Explorer's WT browser? I think that conversation is best held there (vs on this merge request).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-03-27 21:26:27 +0000
3+++ NEWS 2010-03-31 09:07:18 +0000
4@@ -11,6 +11,9 @@
5
6 * tree-style toolboxes are now available on Windows.
7
8+* Added tool type 'bzr-exec' - tools with this type run immediately, when the
9+ tool is selected, rather than requiring further user confirmation.
10+
11 Bug fixes:
12
13 * Fixed tools.xml parsing issues (Simon Kersey, #548971)
14
15=== modified file 'lib/explorer.py'
16--- lib/explorer.py 2010-03-07 05:30:33 +0000
17+++ lib/explorer.py 2010-03-31 09:07:18 +0000
18@@ -946,14 +946,18 @@
19 else:
20 args = mod_app_suite.command_to_args(tool.action,
21 self._escape_context(self.location_context))
22- if tool.type == 'bzr':
23+ if (tool.type == 'bzr') or (tool.type == 'bzr-exec'):
24 # If the command looks like it's a GUI one,
25 # run it directly. Otherwise, run it via qrun
26 # making sure that we're passing --ui-mode.
27 if args[0][0] in ['q', 'g']:
28 args = self._get_bzr_executable() + args
29+ elif tool.type == 'bzr-exec':
30+ args = self._get_bzr_executable () + \
31+ ['qrun', '--ui-mode', '--execute', '--'] + args
32 else:
33- args = self._get_bzr_executable() + ['qrun', '--ui-mode', '--'] + args
34+ args = self._get_bzr_executable() + \
35+ ['qrun', '--ui-mode', '--'] + args
36 self.run_app(args)
37
38 ## Show message helpers ##
39
40=== modified file 'lib/extensions/tools.py'
41--- lib/extensions/tools.py 2010-03-30 21:04:31 +0000
42+++ lib/extensions/tools.py 2010-03-31 09:07:18 +0000
43@@ -269,6 +269,7 @@
44 return None
45 valid_type = type in [kinds.LINK_TOOL,
46 kinds.BZR_TOOL,
47+ kinds.BZREXEC_TOOL,
48 kinds.APPLICATION_TOOL,
49 ]
50 if not valid_type:
51
52=== modified file 'lib/kinds.py'
53--- lib/kinds.py 2010-03-11 21:36:50 +0000
54+++ lib/kinds.py 2010-03-31 09:07:18 +0000
55@@ -46,6 +46,7 @@
56 # Kinds of tools
57 LINK_TOOL = "link"
58 BZR_TOOL = "bzr"
59+BZREXEC_TOOL = "bzr-exec"
60 APPLICATION_TOOL = "application"
61
62 # Kinds of preferences
63@@ -344,6 +345,7 @@
64 # Tools
65 LINK_TOOL: "mimetypes/text-html",
66 BZR_TOOL: "bzr-16",
67+ BZREXEC_TOOL: "bzr-16",
68 APPLICATION_TOOL: "mimetypes/application-x-executable",
69 # Preferences
70 APPEARANCE_PREFS: "apps/preferences-desktop-theme",

Subscribers

People subscribed via source and target branches