Merge lp:~abudden/bzr-explorer/customise-custom-dialogs into lp:bzr-explorer

Proposed by Dr Al
Status: Merged
Merged at revision: not available
Proposed branch: lp:~abudden/bzr-explorer/customise-custom-dialogs
Merge into: lp:bzr-explorer
Diff against target: 123 lines (+60/-5)
3 files modified
NEWS (+3/-0)
lib/custom_dialogs.py (+53/-0)
lib/explorer.py (+4/-5)
To merge this branch: bzr merge lp:~abudden/bzr-explorer/customise-custom-dialogs
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+18134@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dr Al (abudden) wrote :

This branch adds a new registry allowing plugins (e.g. those providing custom workspace models) to override Bazaar Explorer's custom (init, branch & checkout) dialogs in order to add specialist features or customise operation.

388. By Dr Al

Merge trunk.

389. By Dr Al

Merge trunk.

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

Cool. I'll merge this. Please provide a follow-on patch ASAP though with these changes:

1. rename the registry key from init-workspace to init
2. Add Neil's custom switch dialog.

review: Approve
Revision history for this message
Dr Al (abudden) wrote :

Done: https://code.edge.launchpad.net/~abudden/bzr-explorer/custom-dialog-follow-on/+merge/18601

I hadn't noticed that there was a new switch dialog, but having done this change, I also noticed a bug in that dialog: https://bugs.edge.launchpad.net/bzr-explorer/+bug/516957

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

Thanks. The diff below looks good but pulling your branch shows the last version as 389 (which doesn't include your latest changes). Maybe that's a Launchpad bug?

Could you push the latest code to another branch please so I can pull/merge from there instead?

review: Approve
Revision history for this message
Dr Al (abudden) wrote :

I think this is because I did it as a separate branch: I assumed I couldn't add more features to an approved branch, so I posted it as custom-dialog-follow-on:

https://code.edge.launchpad.net/~abudden/bzr-explorer/custom-dialog-follow-on/+merge/18601

It should be revision 407.

bzr branch lp:~abudden/bzr-explorer/custom-dialog-follow-on
[Skipped all the md5 sha module deprecation warnings]
Connected (version 2.0, client Twisted)
Authentication (publickey) successful!
Secsh channel 1 opened.
Branched 407 revision(s).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-02-02 07:24:22 +0000
3+++ NEWS 2010-02-02 08:14:12 +0000
4@@ -40,6 +40,9 @@
5 * A custom switch dialog is now provided that makes switching between
6 branches in a colocated workspace easier. (Neil Martinsen-Burrell)
7
8+* Plugins can now override Bazaar Explorer's custom dialogs in order
9+ to provide additional or alternative functionality.
10+
11 Improvements:
12
13 * The *Advanced Commands* action has been renamed to *All Commands* to
14
15=== added file 'lib/custom_dialogs.py'
16--- lib/custom_dialogs.py 1970-01-01 00:00:00 +0000
17+++ lib/custom_dialogs.py 2010-02-02 08:14:12 +0000
18@@ -0,0 +1,53 @@
19+# Copyright (C) 2010 Canonical Ltd
20+#
21+# This program is free software; you can redistribute it and/or
22+# modify it under the terms of the GNU General Public License
23+# as published by the Free Software Foundation; either version 2
24+# of the License, or (at your option) any later version.
25+#
26+# This program is distributed in the hope that it will be useful,
27+# but WITHOUT ANY WARRANTY; without even the implied warranty of
28+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+# GNU General Public License for more details.
30+#
31+# You should have received a copy of the GNU General Public License
32+# along with this program; if not, write to the Free Software
33+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34+
35+from bzrlib.lazy_import import lazy_import
36+lazy_import(globals(), '''
37+
38+import os
39+
40+from bzrlib import (
41+ builtins,
42+ bzrdir,
43+ commands,
44+ errors,
45+ osutils,
46+ registry,
47+ trace,
48+ transport,
49+ )
50+from bzrlib.trace import note, mutter
51+from bzrlib.plugins.explorer.lib.helpers import plural
52+''')
53+
54+import workspace_dialogs
55+import checkout_dialog
56+
57+class CustomDialogRegistry(registry.Registry):
58+ """Registry for custom dialogs.
59+
60+ The registered object should be a SubProcessDialog subclass.
61+ """
62+ pass
63+
64+custom_dialog_registry = CustomDialogRegistry()
65+
66+custom_dialog_registry.register('init-workspace',
67+ workspace_dialogs.QInitWorkspaceDialog)
68+custom_dialog_registry.register('branch',
69+ workspace_dialogs.QBranchExplorerStyleDialog)
70+custom_dialog_registry.register('checkout',
71+ checkout_dialog.QCheckoutExplorerStyleDialog)
72
73=== modified file 'lib/explorer.py'
74--- lib/explorer.py 2010-02-02 07:24:22 +0000
75+++ lib/explorer.py 2010-02-02 08:14:12 +0000
76@@ -32,7 +32,6 @@
77 accessories_dialog,
78 app_runner,
79 app_suite as mod_app_suite,
80- checkout_dialog,
81 desktop_env,
82 helpers,
83 history_manager,
84@@ -45,11 +44,11 @@
85 tool_dialogs,
86 ui_explorer,
87 welcome,
88- workspace_dialogs,
89 workspace_models,
90 wt_browser,
91 sidebar_toolbox,
92 )
93+from bzrlib.plugins.explorer.lib.custom_dialogs import custom_dialog_registry
94 from bzrlib.plugins.explorer.lib.builders import (
95 toolbar_builders,
96 )
97@@ -1296,7 +1295,7 @@
98 except KeyError:
99 # Use the default if the preference is no longer in the registry
100 model = workspace_models.workspace_model_registry.get()
101- return workspace_dialogs.QInitWorkspaceDialog(
102+ return custom_dialog_registry.get('init-workspace')(
103 default_init_location, model=model, parent=self)
104
105 def _finish_init(self, result, dialog):
106@@ -1311,7 +1310,7 @@
107 if from_location and from_location.startswith("file://"):
108 from_location = from_location[len("file://"):]
109 bind = self._preferences.get('bind-branches-by-default')
110- return workspace_dialogs.QBranchExplorerStyleDialog(from_location,
111+ return custom_dialog_registry.get('branch')(from_location,
112 bind=bind, parent=self)
113
114 def _finish_branch(self):
115@@ -1322,7 +1321,7 @@
116 self.open_location(new_location)
117
118 def _start_checkout(self, context=None):
119- return checkout_dialog.QCheckoutExplorerStyleDialog(parent=self)
120+ return custom_dialog_registry.get('checkout')(parent=self)
121
122 def _finish_checkout(self):
123 dialog = self._custom_modeless_dialogs['checkout']

Subscribers

People subscribed via source and target branches