* Re-Ordering Plugins on the Tools Menu
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re-Ordering Plugins on the Tools Menu
I hope I am missing something obvious here. I have currently 18 plugins on the tools menu and I like to organise them into blocks according to what they do. As far as I can find out the only way, for example, to put a plugin in at number 6 in my list is to remove all the plugins after 6 from the list put in the one I want and then replace the ones I have just removed in the new correct order. This is a pain and when I have done it I usually make some mistake.
I discovered from a post on this forum that the tools menu list is kept in a text file 'Plugins.fhdata' and editing this file using a text editor (and some care) is quicker and easier than the first method but even then it is messy and I assume that if a mistake is made then the tools menu will get messed up. I note also that such a change seems to have no immediate effect and some method is necessary to make FH reload it.
What would be nice is a simple direct method for reordering the tools menu, drag and drop would be nice. Is there a plugin to do this?
David
I discovered from a post on this forum that the tools menu list is kept in a text file 'Plugins.fhdata' and editing this file using a text editor (and some care) is quicker and easier than the first method but even then it is messy and I assume that if a mistake is made then the tools menu will get messed up. I note also that such a change seems to have no immediate effect and some method is necessary to make FH reload it.
What would be nice is a simple direct method for reordering the tools menu, drag and drop would be nice. Is there a plugin to do this?
David
- tatewise
- Megastar
- Posts: 27089
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Re-Ordering Plugins on the Tools Menu
No you are not missing anything.
It would certainly be useful to arrange the Tools menu Plugin order.
There is no Plugin to do that at present, but it would be a relatively simple task.
Even if the Plugins.fhdata file is corrupted, FH does not seem to mind.
It lists what it recognises and disregards the rest, often making corrections.
It would certainly be useful to arrange the Tools menu Plugin order.
There is no Plugin to do that at present, but it would be a relatively simple task.
Even if the Plugins.fhdata file is corrupted, FH does not seem to mind.
It lists what it recognises and disregards the rest, often making corrections.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
Thanks Mike. '
However, I have made a start! on the easy bit. So far I have been able to extract the names of the existing plugins on the tools menu, in the order that they are now in, into an indexed table and I am fairly sure, although I haven't tried it yet, that I can reverse the process and plant a table of plugin names into the Tools menu. The sticking point is how to present them in a way which makes it easy to rearrange them, (rearranging the index numbers perhaps) into a new table. Any ideas anyone.
David
I take it that means relative to your knowledgeThere is no Plugin to do that at present, but it would be a relatively simple task.
However, I have made a start! on the easy bit. So far I have been able to extract the names of the existing plugins on the tools menu, in the order that they are now in, into an indexed table and I am fairly sure, although I haven't tried it yet, that I can reverse the process and plant a table of plugin names into the Tools menu. The sticking point is how to present them in a way which makes it easy to rearrange them, (rearranging the index numbers perhaps) into a new table. Any ideas anyone.
David
-
carlineric
- Silver
- Posts: 7
- Joined: 21 Dec 2013 21:40
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
I managed to do it the brute force way by editing the Plugins.fhdata file. You need to alter the number 'N' at the end of the [PluginN] line to bring the list of plugins into order.
Eric
Eric
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
Eric
Brute force is how I have now learned to do it. In fact if you are not changing the number of plugins you only need to move the "Name=.." lines around and not get involved with any renumbering. Nevertheless it would be nice to have a simple drag'n'drop method.
David
Brute force is how I have now learned to do it. In fact if you are not changing the number of plugins you only need to move the "Name=.." lines around and not get involved with any renumbering. Nevertheless it would be nice to have a simple drag'n'drop method.
David
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
OK here is my first go at a plugin to do drag and drop reordering. For safety I both create a backup of the existing Plugins.fhdata and until fully tested I am writing the new list into Plugins.fhdata.new.
I have essentially no experience with IupLua so any comments are welcome. I ended up using a tree structure because I could not get drag and drop to work on a List structure.
A question: when i get it fully working how do I get FH to read the new data into the Tools menu?
David
I have essentially no experience with IupLua so any comments are welcome. I ended up using a tree structure because I could not get drag and drop to work on a List structure.
A question: when i get it fully working how do I get FH to read the new data into the Tools menu?
David
- Attachments
-
Rearrange Tools menu Plugins.fh_lua- (1.66 KiB) Downloaded 196 times
- Jane
- Site Admin
- Posts: 8442
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Re-Ordering Plugins on the Tools Menu
A quick look at your plugin shows you have "hard coded" the file.
Rather than doing that I recommend using
sPluginListFile = fhGetContextInfo('CI_APP_DATA_FOLDER')..[[\General\Plugins.fhdata]]
To get the file at the start of the program, check if it exists and then use the variable each time you need to access the file.
I would also be tempted to rename the file before writing the new one, rather than copying the file in Lua.
Other than that it looks very good.
Rather than doing that I recommend using
sPluginListFile = fhGetContextInfo('CI_APP_DATA_FOLDER')..[[\General\Plugins.fhdata]]
To get the file at the start of the program, check if it exists and then use the variable each time you need to access the file.
I would also be tempted to rename the file before writing the new one, rather than copying the file in Lua.
Other than that it looks very good.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
Thanks for the comments Jane. I have made some changes as you suggested and am attaching a new version.
David
David
- Attachments
-
Rearrange Tools Menu Plugins v0.2.fh_lua- (1.48 KiB) Downloaded 157 times
- tatewise
- Megastar
- Posts: 27089
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Re-Ordering Plugins on the Tools Menu
Regarding you last question David, I think you just have to close and re-open FH.
In plugins:index#developer_guide|> Family Historian Plugins ~ Developer Guide there are lots of tips and advice including plugins:iup_hints_and_tips|> IUP GUI Builder Hints And Tips.
You may not have noticed, but when editing your Plugin the Help has direct links to the Lua/IUP Online Reference Manuals.
In plugins:index#developer_guide|> Family Historian Plugins ~ Developer Guide there are lots of tips and advice including plugins:iup_hints_and_tips|> IUP GUI Builder Hints And Tips.
You may not have noticed, but when editing your Plugin the Help has direct links to the Lua/IUP Online Reference Manuals.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
Thanks Mike, I was slowly coming to the realisation that FH needed tp be restarted to allow the loading of the new menu. I can stop looking for another way.
I have seen the references to online manuals for both Lua and IUP but to be frank, for a beginner. the notes in the Knowledge base are more useful (although less extensive) and explain very clearly what is happening
David
I have seen the references to online manuals for both Lua and IUP but to be frank, for a beginner. the notes in the Knowledge base are more useful (although less extensive) and explain very clearly what is happening
David
- tatewise
- Megastar
- Posts: 27089
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Re-Ordering Plugins on the Tools Menu
One minor simplification you cold make is to use:
for line in io.lines(sPluginListFile) do
...
end
instead of:
file=io.open(sPluginListFile,'r')
for line in file:lines() do
...
end
file:close()
It just saves the open and close, but for writing there is no way of avoiding them.
for line in io.lines(sPluginListFile) do
...
end
instead of:
file=io.open(sPluginListFile,'r')
for line in file:lines() do
...
end
file:close()
It just saves the open and close, but for writing there is no way of avoiding them.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- DavidNewton
- Superstar
- Posts: 462
- Joined: 25 Mar 2014 11:46
- Family Historian: V7
Re: Re-Ordering Plugins on the Tools Menu
Thanks Mike
Always useful to learn about these shortcuts. I have made that change in v0.3
David
Always useful to learn about these shortcuts. I have made that change in v0.3
David
- Attachments
-
Rearrange Tools Menu Plugins v0.3.fh_lua- (1.48 KiB) Downloaded 160 times