plugin menuCommandFor issue

Any trouble you encounter with the Pedias, here's the place to ask for help.
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

great,

i also try to use setparent method, it seems to work, do you see any reason to not use it ?

do you think you could add a function for template similar to the existing one : "pedia://bruji.com/findTitle=" in order to select a Collection,
something like pedia://bruji.com/findCollection=Collection Title

i would be huge !
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: plugin menuCommandFor issue

Post by Conor »

You can select a collection from inside the plug-in by using the selectCollection: method in the collections instance. Just like the setParent: method I not going to officially recommend the following because these are not exposed methods. But if you hold on to the "collections" instance you can select collections and create collections at any time. I'll look at adding the ability to select collection via the URL protocol scheme as well.
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

thks Conor,
I'll look at adding the ability to select collection via the URL protocol scheme as well.
Do you think you can add the feature for next release ? it would be great to be able to jump from a record to a collection, particularly for comics !
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: plugin menuCommandFor issue

Post by Conor »

It's done in the beta for testing.

Code: Select all

pedia://bruji.com/findCollection=Library
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

Hi Conor,

how is it possible to retrieve plugins objects ?
I would like to call a plugin from an other.

Thks
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: plugin menuCommandFor issue

Post by Conor »

It's not possible, are you trying to integrate another search?
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

At this time i have to duplicate code and class in some plugins :x
Furthermore, i would like to add a small HUD panel in order to access very quickly functions of iBédé, that are distribute in different plugin.
Could you add or expose a method that can retrieve a NSArray of Plugins loaded by name ?
User avatar
Nora
Site Admin
Posts: 2155
Joined: Sun Jul 04, 2004 5:03 am
Contact:

Re: plugin menuCommandFor issue

Post by Nora »

What would be better is to try to rework the way menu commands are added, so that you can have a single plug-in that can add several menu commands to Bookpedia and has access to the same code and to the other menu commands. I'll take a look at the problem in the next few days and let you know the details.
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

Great
thanks
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

hi,

i tested the new function for selecting a collection with last beta, but it doesn't work for me.
i added the following line to the template:

Code: Select all

<a href="pedia://bruji.com/findCollection=Library">Library</a>
but nothing happened when i click on it, i also try with other collection name.

Edit :

i have an other problem with pedia://... Call doesn't work when there is a special char in the name, like : space, é and so one, even if the percent encoding is applied. For example "pedia://bruji.com/menuPlugin=test" works but "pedia://bruji.com/menuPlugin=test again" doesn't and "pedia://bruji.com/menuPlugin=test%20again" neither.

Could you help me ?
thks
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

hi Conor, any news about pedia://bruji.com/findCollection=Library and multiple menuCommand ?
What would be better is to try to rework the way menu commands are added, so that you can have a single plug-in that can add several menu commands to Bookpedia and has access to the same code and to the other menu commands.
thks
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: plugin menuCommandFor issue

Post by Conor »

Still working on the multiple menu command, should have it ready in a day or two.
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: plugin menuCommandFor issue

Post by Conor »

Beta version 3 will now be able to use the link "pedia://bruji.com/findCollection=Library" as well as the ability to add several menu items to the plugin menu by adding the following declarations to MyControllerForPlugins:

Code: Select all

@interface MyPluginManager : NSManagedObject 
- (void)addMenuItem:(NSMenuItem *)aMenuItem;
@end

@interface MyControllerForPlugins : NSObject
- (MyPluginManager *)pluginManager;
@end

An example would be to add the following code to the init method of the plug-in:

Code: Select all

- (id)init {
	if (self = [super init]) {

		NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease];
		[aMenuItem setTitle:@"A Test Menu"];
		[aMenuItem setTarget:self];
		[aMenuItem setAction:@selector(doTest:)];
		
		NSMenuItem *secondMenuItem = [[[NSMenuItem alloc] init] autorelease];
		[secondMenuItem setTitle:@"A Second Menu"];
		[secondMenuItem setTarget:self];
		[secondMenuItem setAction:@selector(doSecondTest:)];
		
		 MyPluginManager *pluginManager = [[NSApp delegate] pluginManager];
		[pluginManager addMenuItem:aMenuItem];
		[pluginManager addMenuItem:secondMenuItem];
	}
	return self;
}

- (IBAction)doTest:(id)sender {
	NSLog(@"Doing a Test");
}
- (IBAction)doSecondTest:(id)sender {
	NSLog(@"Doing another Test");
}
User avatar
sjk
Addicted to Bruji
Addicted to Bruji
Posts: 529
Joined: Sat Feb 21, 2009 9:01 pm
Location: Eugene

Re: plugin menuCommandFor issue

Post by sjk »

Conor wrote:Beta version 3
Wow, first sign of beta version numbering… thanks, Conor!

Ideally filenames would be <pediatype>-beta-<v#>.zip but I won't push my luck. :)
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: plugin menuCommandFor issue

Post by bobino »

that's great , i did a few tests for both functions, it works very well.
Some comments :
  • it seem's that menuCommandFor method and pluginName in info.plist are always mandatory for the plugin, exact ?
    Menu items are alphabetically sorted, it would be interresting to keep the creation order in the menu.
    It would also be interresting to be able to add menu separator.
Thks again for this great evolution.
Post Reply