Two new plugins (OOo Impress & OS Menu) - help with English

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Mon Jul 21, 2008 8:10 pm

Finally I am done for long time prepare plugin for control OOo Impress.
His a part of is also own On Screen Menu. Perhaps would be useful, if
this menu subsist like a independent plugin. Made am so derivative and this plugin
has name "OS Menu". Urgently please for checking and corrections mine bad English.
All strings they are partly in class "text", partly in list "ACTIONS".

Thanks !

Pako
Attachments
__init__.py
Plugin OOo Impress (folder plugins/OOo_Impress)
(34.66 KiB) Downloaded 349 times
__init__.py
Plugin OS Menu (folder plugins/OSM)
(23.65 KiB) Downloaded 358 times
You know flattr ? You can Image

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by jsonnabend » Tue Jul 22, 2008 2:08 pm

Pako -

The English all looks good to me.

"Colour" is the British spelling. In the States, we spell it "color".

- Jeff

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by jsonnabend » Tue Jul 22, 2008 2:13 pm

Pako -

I've installed the OSM, but I can't get the menu to display (show on the screen). Any idea what I might be doing wrong?

- Jeff

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Tue Jul 22, 2008 3:50 pm

Hi Jeff !
jsonnabend wrote:The English all looks good to me. "Colour" is the British spelling. In the States, we spell it "color".
- Jeff
Thanks, I retain British spelling.
jsonnabend wrote:I've installed the OSM, but I can't get the menu to display (show on the screen). Any idea what I might be doing wrong?
Really I don't know, as it is possible.
What OS You using ?
I'm tried OSM in three computers with Windows XP Home and problem I have not.

Somebody else has also that problem ?
Pako

luigi108
Posts: 2
Joined: Wed Feb 06, 2008 9:53 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by luigi108 » Sun Jul 27, 2008 5:55 pm

Hi folks, hi Paco,

I love this OSM-Plugin :)
I actually tried something similar, but got stuck. Now I thought it would be nice to add some support for nested menus; so I added 3 Actions. I did not change the Code, just added something on top. I transferred the core code to the plugin class so I could use it for my ShowMenuTree action.

This new Action does not have a Config, but is for use in Scripts only.
You have to create a nested Structure like this:

exampleTree=(
('label 11','event 11'),
('label 12','event 12'),
('label 13','event 13'),
('submenu 14', (
('label 21', 'event 21'),
('label 22', 'event 22'),
('label 23', 'event 23'),
('submenu 24', (
('label 241','event241'),
('label 242','event 242'),
('label 243','event 243'),
('submenu 244',(
('label 2441', 'event 2441'),
('label 2442', 'event 2442'))),
('label 245', 'event 245'))),
('label 25', 'event 25'))),
('label 15','event 15'),
('submenu 16',(
('label 161', 'event 161'),
('label 162', 'event 162'))),
('label 17','event 17'),
('label 18','event 18'),
('label 19','event 19'),)

It's quite the same, only nested. Left are labels, right values (or the submenu structure)

Hope you like it. I tested it; should work. Boldly, I called it version 0.1.1. :D
Attachments
__init__.py
Plugin OS Menu (folder plugins/OSM)
(27.78 KiB) Downloaded 338 times

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Mon Jul 28, 2008 3:20 pm

luigi108 wrote: I love this OSM-Plugin :)
:D :D :D
luigi108 wrote: I actually tried something similar, but got stuck. Now I thought it would be nice to add some support for nested menus.
...
Hope you like it. I tested it; should work. Boldly, I called it version 0.1.1. :D
Heavy nut for my crappy English... :)
I thought about support for nested menus, but appear me to be low-useful. I can make haphazard number of menus and jump between them simply through the events. Each menu/submenu can have the different colours and font.

Well, shall reflect on implementation of support for nested menus. But I have a bit other conception. Action "Select submenu" (push-button right) appear me to be completely redundant. Only action "Close submenu" (push-button left) is something new and perhaps also useful. In my conception would every menu was in EG tree independent item (and so she should have also own configuration dialog) and forward binding between menus would do nothing but through the events. Return to previous menu would did either through the action "Close submenu" (cursor anywhere in menu) or through the action "OK" (cursor on item "Back").
Advantage: isn't need tree-editor of menus and bindings between menus may be also multilinked.

I perhaps try it make, but I'd wanted know opinion the others thereon.

In the meantime I'm made little enhancement of plugin (version 0.1.2). Nowadays menu automatic disappear after five seconds, if was running by push-button "Test" in configuration dialog.

Pako
Attachments
__init__.py
OSM plugin - version 0.1.2
(24.64 KiB) Downloaded 319 times

luigi108
Posts: 2
Joined: Wed Feb 06, 2008 9:53 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by luigi108 » Mon Jul 28, 2008 5:47 pm

Yes, you are probably right, nested menus can be created in a better way by connecting menus with events. That tree browsing function might be useful for exploring tree structures that already exist, like moving in a directory tree, were you would like to have it all in one go.

Everything built on top of your plugin does not need to be part of it. To be flexible please add an action "Get Value" or "Peek" (just looking... :) ) which gets the value of the selected item without triggering the event or closing the menu:

#====================================================================
class Peek_Btn (eg.ActionClass):

def __call__(self):
if self.menuDlg is not None:
sel=self.menuDlg.GetSizer().GetChildren()[0].GetWindow().\
GetSelection()
eg.result=(self.choices[sel][1])

Anyway it might be good to keep the code for showing the menu seperated from the actual plugin __init__ , in an extra file that can be imported, as it is so essential.

Thanks, Luigi

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by jsonnabend » Mon Jul 28, 2008 6:24 pm

I got my OSM plugin working. Don't know what I did differently, but it works now.

Next question: how do I tie events to the OSM to control it (for example, up and down arrows on my remote, the enter key on the keyboard, etc.).

Thanks again for a really great plugin.

- Jeff

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Mon Jul 28, 2008 8:02 pm

luigi108 wrote: To be flexible please add an action "Get Value" or "Peek" (just looking... :) ) which gets the value of the selected item without triggering the event or closing the menu.
This time I completely agree with You :) . Action "Get value" can be very usefull.
I'm made option, whether get Label, Event string or Both.
jsonnabend wrote:Next question: how do I tie events to the OSM to control it (for example, up and down arrows on my remote, the enter key on the keyboard, etc.).
I actually haven't understood you. Please try to describe it in another way. I need short and simple sentences. Sorry !

Pako
Attachments
__init__.py
Plugin OSM - version 0.1.3
(26.04 KiB) Downloaded 337 times

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by jsonnabend » Mon Jul 28, 2008 8:37 pm

The menu comes on the screen.

I can use the arrows on my keyboard to move the selection up and down.

I can't hit enter to select the current selection.

I can double click on the selection with the mouse to select it.

How do I move the selection bar with my remote and how do I select a menu item hitting enter (for example)? In other words, how do I control the OSM UI?

- Jeff

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Tue Jul 29, 2008 7:11 am

"OSM" is primitive window, which contains only one element namely wx.ListBox.
wx.ListBox has property, that native control is only mouse. Control by keyboard
is restricted only on up-and-down motion.
jsonnabend wrote:How do I move the selection bar with my remote and how do I select a menu item hitting enter (for example)? In other words, how do I control the OSM UI?
Plugin "OSM" has actions/macros, which name "Cursor Down", "Cursor Up", "OK" and "Cancel".
Try this procedure:
1) Uncheck "Log only assigned and activated events"
2) Press any button on the remote. After that the pressed button should be shown event in the log on the left side.
3) You can now just drag and drop the event to the macro you want (for example "Cursor Down").
You can also add the keyboard plugin and "remap" some keys. Press the key combinations you want to assign and drag'n drop the events from the log window to the macros.
But attention ! Read this description:
"This plugin generates events on keypresses (hotkeys).
Notice: If such a keyboard event is assigned to a macro, the
plugin will block the key, so Windows or another application will
not see it anymore. This is needed to permit remapping of keys as
otherwise the old key would reach the target in conjunction of
another action you might want to do and this is mostly not what you
intend.But this blocking only happens, if a macro would actually execute in
succession of the event. So if the macro or any of its parents is
disabled, the keypress will pass through.
"
You can so use only that combination keys, which no application use or You must make use of actions "Disable an item" and "Enable an item".

Pako

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Tue Jul 29, 2008 9:22 am

Fix a small bug -> version 0.1.4
Pako
Attachments
__init__.py
Plugin OSM - version 0.1.4
(25.42 KiB) Downloaded 341 times

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by jsonnabend » Tue Jul 29, 2008 1:26 pm

Thanks, Pako. I understand now.

One issue: since OSM cannot multi-load, we can only have one menu for the entire system. Any thoughts on making it multi-load?

Thanks again for the plugin and the help.

[edit]
Is there a way to add/delete/modify menu items (listbox items) through Python script?
[/edit]

- Jeff

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by Pako » Tue Jul 29, 2008 1:52 pm

jsonnabend wrote:One issue: since OSM cannot multi-load, we can only have one menu for the entire system. Any thoughts on making it multi-load?
It is very simple. You otherwise cannot add whole plugin, but you can add an Action (For example: Configuration - Add Action - Show menu).
jsonnabend wrote:Is there a way to add/delete/modify menu items (listbox items) through Python script?
Meanwhile isn't. Why it need? I can think about it.

Pako

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: Two new plugins (OOo Impress & OS Menu) - help with English

Post by jsonnabend » Tue Jul 29, 2008 2:48 pm

Ah! Ok, I see. Since I can only have one OSM active at a time, I don't need multi-load. I just create a new OSM and launch that.

Excellent.

I think I am all set.

- Jeff

Post Reply