[wxPython] Anyone have this or working on it? Reconfigurable command mechanisms

One of the most useful tools I've seen in software recently is the ability to customize the interface at runtime, saving multiple interface configurations for various tasks, with the configurations including menu arrangements, toolbars and keyboard shortcuts (all basically command functions).

I've been considering implementing such a mechanism, but am daunted by the amount of custom display code I will need to produce (for the (extremely useful) drag and drop of items from one command holder to another, for instance, and for an icon editor to allow users to create new icons for their elements etc.).

From what I can see, it will be necessary to define "command" definitions which will be documents capable of storing icons, short and long descriptions, message ID values, control ID values etc. Then we'll need to create the run-time display code which will generate the menus, key bindings and toolbars.

From there, some standard dialogue to provide for explicit customization (for instance, allowing you to drag from a hierarchic list of commands into any given command holder, and allowing you to save/restore/manage your stored interface customization templates).

Some standard for creating and managing message IDs for the dynamic commands will need to be established. Similarly, will need to provide standardized mechanisms for getting the data objects of the current selection from an event.

Would be best to have the entire thing part of an IDE to allow for automatic generation of event handlers on appropriate windows or the application itself.

I don't think anyone currently has everything outlined above, but it might be interesting to see if there are parts of the code already available in an LGPL or BSD-licensed code base that could be adapted.

Pointers or ideas appreciated,
Mike

···

_______________________________________
   Mike C. Fletcher
   http://members.rogers.com/mcfletch/

"Mike C. Fletcher" schrieb:

One of the most useful tools I've seen in software recently is the
ability to customize the interface at runtime

Pointers or ideas appreciated,

XUL?: http://www.mozilla.org/xpfe/xulref/

Is XRCed in tools a base?

Regards, Udo

XUL is interesting. Not sure yet how one goes about making it do run-time configuration (it was actually the failure of an obvious run-time re-configurability of Mozilla that got me interested in this). From what I can see, you don't normally work with "pre-configured" commands, but are instead expected to use a programmer's reference to determine what functions/methods need to be called and write code for those calls.

From what I read, it should be possible to make a new file for each configurable command, then in the toolbar/menu/keybinding just include it with an ID link. You'd really need a run-time interface for that to make it usable.

Here's a more useful description of what types of interactions I'm interested in allowing:

User wants to remove a menu option from a menu. Clicks and holds the menu item, gets the drag-and-drop cursor, drags the item off the menu, drops it over a "no-drop" area.

User wants to re-arrange a menu. As above, but drags the menu item to the new position (with feedback given regarding the new position, likely as a line between current items).

User wants to add a menu item to a toolbar. Drags menu item from menu to the toolbar, item's icon (not previously used) is used for the toolbar button. (Same process in reverse).

User wants to change an item's text/icon. Right-clicks on the item, chooses "Properties", and is presented with a dialog allowing for the customisation (saved in their personal interface file).

User wants to bind a shortcut to an item. Right-clicks for properties of an item, chooses key bindings, gets a dialog that shows current bindings for key-presses, allows for re-binding, etceteas. (You see something like this in Office 2000 or 3DSMax).

User wants to perform large numbers of similar actions on a menu/toolbar/key-set. Opens a dialog with an explorer-like interface allowing multiple-selection w/drag and drop. Likely have a two-pane interface so that you could edit/view properties on the right without needing a modality switch.

User wants to revert some part of the interface to default state (a toolbar, or menu-item, for instance). For each properties dialog, have a "revert to default" (i.e. one for icon, one for key-binding, for containers one for reverting to original contents).

User wants to define a new command (such as a button on their toolbar triggering a locally-written macro). Right-clicks on whatever she wants to alter, chooses Add (or uses the explorer-style interface if they prefer), scrolls through available commands list to an "Add Macro" item, adds the information required to specify the particular macro (beyond the Macro-item's event ID), and chooses an icon (or draws one).

XRCed doesn't really seem like a customisation tool so much as an editor for static configurations. You could certainly use a recipe metaphor to accomplish a similar goal, but I'm looking to let the average power-user do this, rather than _just_ those who feel comfortable with abstract manipulations and computer-science concepts.

Anyway, I should probably just set some time aside to work on a prototype. Sigh :slight_smile: ,
Mike

Udo Floegel wrote:

"Mike C. Fletcher" schrieb:

One of the most useful tools I've seen in software recently is the
ability to customize the interface at runtime

Pointers or ideas appreciated,

XUL?: http://www.mozilla.org/xpfe/xulref/

Is XRCed in tools a base?

...

I'm using drag and drop from tree controls and list boxes.

I want to drag objects by pressing the left button as one
would expect. The problem is that not every EVT_LEFT_DOWN
is supposed to initiate a drag. I also click to select
items, expand/collapse trees etc. So, I check to see that
the mouse was over a previously selected object before I
start a drag.

In the tree control I do:

     def OnLeftDown(self, evt):
         item, flag = self.tree.HitTest(evt.GetPosition())
         if flag == wxTREE_HITTEST_ONITEMLABEL and \
            self.tree.IsSelected(item):
             # The object was selected, start dragging
             ...
         else:
             evt.Skip()
             return true

This works as expected.

But what do I do in the list box? I haven't found any method
corresponding to HitTest in wxListBox, that will convert x,y
to an item in the box. Have I overlooked something, or must I
switch to a wxListCtrl? Is there another approach?

/Magnus

···

--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se

Magnus Lyckå wrote:

I'm using drag and drop from tree controls and list boxes.

I want to drag objects by pressing the left button as one
would expect. The problem is that not every EVT_LEFT_DOWN
is supposed to initiate a drag. I also click to select
items, expand/collapse trees etc. So, I check to see that
the mouse was over a previously selected object before I
start a drag.

But what do I do in the list box? I haven't found any method
corresponding to HitTest in wxListBox, that will convert x,y
to an item in the box. Have I overlooked something, or must I
switch to a wxListCtrl? Is there another approach?

        Instead of processing the raw mouse up/down events,
        you should be using the special Drag/Drop events.

             EVT_TREE_START_DRAG
             EVT_LIST_START_DRAG

        I believe that the demo has examples of this ...

        Manoj

Thanks Manoj, it's EVT_TREE_BEGIN_DRAG and EVT_LIST_BEGIN_DRAG.
Took me a while to find... But it seems EVT_LIST_BEGIN_DRAG is
an event for wxListCtrl, not for wxListBox, so I guess I'm back
where I started. Do I have to switch control to a wxListCtrl?

/Magnus

···

At 11:38 2001-12-09 -0600, Manoj wrote:

      Instead of processing the raw mouse up/down events,
       you should be using the special Drag/Drop events.

            EVT_TREE_START_DRAG
            EVT_LIST_START_DRAG

       I believe that the demo has examples of this ...

--
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se

But what do I do in the list box? I haven't found any method
corresponding to HitTest in wxListBox, that will convert x,y
to an item in the box. Have I overlooked something, or must I
switch to a wxListCtrl? Is there another approach?

Not that I know of.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!