[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    RE: [PyKDE] KDE XML GUI ActionLists
From:       Jim Bublitz <jbublitz () nwinternet ! com>
Date:       2003-04-22 6:02:52
[Download RAW message or body]

On 22-Apr-03 Gordon Tyler wrote:
>  action = KAction(service.name(), KShortcut(), \
>                   self.fileOpenWith, 
>                   None,
>                   "file_open_with_" + \
>                       str(service.desktopEntryName()))
>  self.openWithActions.append(action)
>  self.plugActionList("file_open_with_list", self.openWithActions) 

> I've verified that the KActions are being created and added to
> the self.openWithActions list. However, when I run the
> scriptand open either of the menus that contain the ActionList,
> there are no items. No errors, just an empty menu.
 
> Has anybody else used ActionLists in PyKDE?

From kaction.cpp
----------------
* KActionCollection is an organizing container for KActions.
* KActionCollection keeps track of the information necessary to
* handle configuration and shortcuts.

From the class ref docs:
------------------------
"""
Usage Within the XML Framework:

If you are using KAction within the context of the XML menu and
toolbar building framework, then there are a few tiny changes. The
first is that ****you must insert your new action into an action
collection****. The action collection (a KActionCollection) is,
logically enough, a central collection of all of the actions
defined in your application. The XML UI framework code in KXMLGUI
classes needs access to this collection in order to build up the
GUI (****it's how the builder code knows which actions are valid and
which aren't****).
"""



KActionList (the 'type' of the second arg of plugActionList, which
is QPtrList<KAction> in C++) works fine - it does conversions
between a Python list and the C++ type. I'd suspect from the above
that you have to use the KActionCollection arg that you have set to
None in the sample code, but I was off target in suggesting that you
replace the 'openWithActions' list - you probably want both (so the
'actions()' bug shouldn't affect you).

Try replacing 'None' with self.actionCollection () It shouldn't
make a difference in being able to plug/unplug the KActions - it's
mostly a container and it isn't real obvious from the C++ code
exactly how it's used (at least not in the short look I gave it -
looking at the kxmlguiclient.cpp code might be more informative,
esp. plugActionList).

I really appreciate that you're testing this stuff - there's
obviously a lot I haven't been able to get to, and even the testing
I'm implementing now wouldn't have caught the %ConvertToSubClass
stuff -- thanks!

Jim
 

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic