Scribus Forums

Scribus => Scripts and Plugins => Topic started by: Gibbz on August 14, 2019, 06:51:05 am

Title: Creating a dock(palette) plugin
Post by: Gibbz on August 14, 2019, 06:51:05 am
Ive been playing around with the scribus c++ plugins. I'm wanting to create a simple dock similar to the outline dock.
A few things im getting stuck on....
I have my plugin registering and running, but I cant get the dock to become visible.
Can I have it also link in with the app so it reloads at startup?
- ScribusMainWindow has a function for initPalettes(), is there a way to register my custom dock here?

Ive put my current code here if it helps:
https://github.com/Gibbz/scribus-dock-plugin
Title: Re: Creating a dock(palette) plugin
Post by: a.l.e on August 14, 2019, 08:13:30 pm
i had a look at your code and i don't see any sign that you would be displaying a dialog...

if i understand your goals correctly you want to display some sort of palette with buttons that start a script when you click them.

on the one side, i'm not aware of any plugin that shows a palette, that is a dialog that stays open for a longer time. i have not tried it myself and i don't if it's easy / safe to do so.

on the other side, if it's for your own use, i believe that adding the list of your scripts in the script dialog (see the patch i've referenced) and using the action search is a better way to run the scripts.

if it's for other people and you think that they need big buttons... then i see why you want to do that. but i would still refrain from adding even more visual elements that one does not use very often (and if they're used often, it's worth to learn a keyboard shortcut : - )

at the end, without having dived too much into your code, i think that you're missing the line where the dialog gets shown.
something like this:
https://github.com/aoloe/scribus-plugin-actionSearch/blob/master/src/plugin.cpp#L88
Title: Re: Creating a dock(palette) plugin
Post by: none on August 21, 2019, 11:44:46 pm
Hi Gibbz
Is your plugin running Gibbz?
I like the idea to add a palette / toolbar /window to load (sub)scripts.
Exactly "other people" are in my mind, they are used to use macros in word ;)
I thought, it isn't possible t map ahortkeys to scripts (except actionsearch)
I wrote a script with tkinter, which ist modal (scribus 1.5 - but just on windows), so it could stay open while working on a document in scribus. A toolbar or a palette will be much nicer.

Title: Re: Creating a dock(palette) plugin
Post by: a.l.e on August 22, 2019, 09:59:17 am
for that usage i would suggest using a toolbar...

a palette might also be ok.

it would be nice if you could discuss the feature in details, so that we can come up with a good spec.
this is a tool that many people have wished in the past.

topics that could be discussed:

- how easy should it be to add new buttons? (preferences? a button in the toolbar / palette itself?)
- should the button have images? (one can link / upload the images? or should they be in a manifest in the script's directory?)

finally, from the feedback i got from the team, it's probably not such a good idea to create this as a plugin.

finally (2), remember that there is a patch for user scripts hanging ( https://bugs.scribus.net/view.php?id=15579 ): it might be nice if the two work well together (as an example, we could choose to show all the scripts from given directories in the toolbar / palette, rather than being able to define single scripts to be added)
Title: Re: Creating a dock(palette) plugin
Post by: none on August 25, 2019, 11:19:13 pm
Hi a.l.e,
thank you, sorry for the late responce, I was very busy.
Your idea sounds nice and useful.
I think in your idea there could be many scripts in the menu. Too many for a toolbar. One have too choose which scripts will get to the toolbar.
Pictures/Icons will be great. I think a button in the toolbar for adding scripts is irritating. Maybe an editable configfile or better something in the preferences of scribus or a menu if toolbar is rightclickt.



Title: Re: Creating a dock(palette) plugin
Post by: Gibbz on January 22, 2020, 06:14:53 am
I haven't looked into this any further, things got busy again at work!
But today I did just notice that there is documentation on scripter extensions (which looks out of date when I tried them).
It would be great to be able to write your own palletes/docks completely using python and scripter. And if they register on startup with scribus they would show up under Windows>'custom dock name' which the user could toggle on and off.
These docks would be the same as the existing ones such as properties, or layers.

Example uses:
- Having a color picker like krita would be great!
- A custom 'pdf export' dock with my commonly changed settings.
- Custom buttons with my custom shapes and effects which i regularly use.