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
=== modified file 'NEWS'
--- NEWS 2010-03-27 21:26:27 +0000
+++ NEWS 2010-03-31 09:07:18 +0000
@@ -11,6 +11,9 @@
1111
12* tree-style toolboxes are now available on Windows.12* tree-style toolboxes are now available on Windows.
1313
14* Added tool type 'bzr-exec' - tools with this type run immediately, when the
15 tool is selected, rather than requiring further user confirmation.
16
14Bug fixes:17Bug fixes:
1518
16* Fixed tools.xml parsing issues (Simon Kersey, #548971)19* Fixed tools.xml parsing issues (Simon Kersey, #548971)
1720
=== modified file 'lib/explorer.py'
--- lib/explorer.py 2010-03-07 05:30:33 +0000
+++ lib/explorer.py 2010-03-31 09:07:18 +0000
@@ -946,14 +946,18 @@
946 else:946 else:
947 args = mod_app_suite.command_to_args(tool.action,947 args = mod_app_suite.command_to_args(tool.action,
948 self._escape_context(self.location_context))948 self._escape_context(self.location_context))
949 if tool.type == 'bzr':949 if (tool.type == 'bzr') or (tool.type == 'bzr-exec'):
950 # If the command looks like it's a GUI one,950 # If the command looks like it's a GUI one,
951 # run it directly. Otherwise, run it via qrun951 # run it directly. Otherwise, run it via qrun
952 # making sure that we're passing --ui-mode.952 # making sure that we're passing --ui-mode.
953 if args[0][0] in ['q', 'g']:953 if args[0][0] in ['q', 'g']:
954 args = self._get_bzr_executable() + args954 args = self._get_bzr_executable() + args
955 elif tool.type == 'bzr-exec':
956 args = self._get_bzr_executable () + \
957 ['qrun', '--ui-mode', '--execute', '--'] + args
955 else:958 else:
956 args = self._get_bzr_executable() + ['qrun', '--ui-mode', '--'] + args959 args = self._get_bzr_executable() + \
960 ['qrun', '--ui-mode', '--'] + args
957 self.run_app(args)961 self.run_app(args)
958962
959 ## Show message helpers ##963 ## Show message helpers ##
960964
=== modified file 'lib/extensions/tools.py'
--- lib/extensions/tools.py 2010-03-30 21:04:31 +0000
+++ lib/extensions/tools.py 2010-03-31 09:07:18 +0000
@@ -269,6 +269,7 @@
269 return None269 return None
270 valid_type = type in [kinds.LINK_TOOL,270 valid_type = type in [kinds.LINK_TOOL,
271 kinds.BZR_TOOL,271 kinds.BZR_TOOL,
272 kinds.BZREXEC_TOOL,
272 kinds.APPLICATION_TOOL,273 kinds.APPLICATION_TOOL,
273 ]274 ]
274 if not valid_type:275 if not valid_type:
275276
=== modified file 'lib/kinds.py'
--- lib/kinds.py 2010-03-11 21:36:50 +0000
+++ lib/kinds.py 2010-03-31 09:07:18 +0000
@@ -46,6 +46,7 @@
46# Kinds of tools46# Kinds of tools
47LINK_TOOL = "link"47LINK_TOOL = "link"
48BZR_TOOL = "bzr"48BZR_TOOL = "bzr"
49BZREXEC_TOOL = "bzr-exec"
49APPLICATION_TOOL = "application"50APPLICATION_TOOL = "application"
5051
51# Kinds of preferences52# Kinds of preferences
@@ -344,6 +345,7 @@
344 # Tools345 # Tools
345 LINK_TOOL: "mimetypes/text-html",346 LINK_TOOL: "mimetypes/text-html",
346 BZR_TOOL: "bzr-16",347 BZR_TOOL: "bzr-16",
348 BZREXEC_TOOL: "bzr-16",
347 APPLICATION_TOOL: "mimetypes/application-x-executable",349 APPLICATION_TOOL: "mimetypes/application-x-executable",
348 # Preferences350 # Preferences
349 APPEARANCE_PREFS: "apps/preferences-desktop-theme",351 APPEARANCE_PREFS: "apps/preferences-desktop-theme",

Subscribers

People subscribed via source and target branches