Note that this only works for
geanyup to version1.31.
See this issue for more details. For now, I'm holding back my RPM install to version 1.31 (and not really suffering), however if I see that (for instance) peasy becomes viable, I'll update here.
OTOH, since this issue isn't very promising (after such a quiet period for
peasy), I'm looking at building an extension for VScode that does the same job (and is backwards compatible with existing.projectand.sesssionfiles).
As another alternative, I'm having a dig around doing this directly in C++, since
geanyas an editor is super-familiar, small, and 'works-for-me'...
This plugin gives Geany sidebar a 'project-tree' view of your files.
The project-tree view can be different from how they're laid out on disk : Personally, I prefer to keep a 'thematic' structure to a project - at the very least, it can be handy to keep files in an order not dictated by their sequence alphabetically.
The plugin is also designed to keep separate state for different repository folders, with the state being stored locally, so that one can put it into version control, for instance.
I had previously contributed to a separate sidebar widget/app for SciTE, called SciTEpm (which is why this plugin contains a loader for the xml files that SciTEpm saves).
For each actual project that you have (as distinct from what Geany calls projects), typically one would launch Geany from its root directory (where the .git directory is stored, for instance).
The project-tree plugin's files are stored in a '.geany' directory (it will confirm before writing anything to disk) :
- .geany
- project-tree-layout.ini
- session.ini
- [OPTIONAL: project-tree-layout_devel.ini]
- [OPTIONAL: session_default.ini ]
- ... the rest of your files ...
Of these files:
- 'project-tree-layout.ini' will be relatively static (once the project is in mainenance mode), so could well be put into version control
- 'session.ini' is just a dump of open files, so is probably not sensible to put into version control
- 'project-tree-layout_devel.ini' is read-only, for testing
- 'session_default.ini' is used if session.ini doesn't exist - so could be used as a starter set of relevant files for newcomers
The project-tree sidebar can be right-clicked, to get to :
- 'Add this file', which adds the currently open document to the project-tree
- 'Add group', which adds a new group heading
- and other functions that should be obvious
It also allows drag-and-drop internally, so you can organize files & groups to your heart's content.
At the top of the sidebar is a quick menu, allowing you to Load/Save the Project-Tree layout, and current open files.
When loaded for the first time in a directory, it's immediately ready to use : It will ask whether to create the '.geany' folder if you need to save the tree or the session.
The .ini files are standard form, while enabling the storing of the full tree structure.
This works within the Project-Tree sidepanel. And it was really painful to do - particularly since (for instance) some drops should be disallowed :
- anything onto a file
- anything onto itself, or a descendent, etc
Hopefully, someone that gets caught with the same problems can avoid days of Googling, and have a look at the code here.
The module contains code to 'instantly' create menus (and menubars) based upon annotated function names. This looks rather kludgy, I know, but makes it very quick to add new features, etc.
For example, the following creates a File dropdown (ordering can be changed numerically) with a 'Load Project Tree' entry that's auto-linked to the function that requires it:
def _menubar_0_File_0_Load_Project_Tree(self, data):
"""
Loads the project tree specified by the user in the message box
"""
print "_menubar_0_File_0_Load_Project_Tree"
project_tree_layout_ini = self._prompt_for_ini_file("*tree*.ini")
if project_tree_layout_ini:
self._change_base_directory(os.path.dirname(os.path.dirname(project_tree_layout_ini))) # strip off .geany/XYZ.ini
self._load_project_tree(self.treeview.get_model(), project_tree_layout_ini)
return TrueAnnotation style for menubar callbacks :
- _menubar _{order#} _{heading-label} _{submenu-order#} _{submenu-label}
Similarly, for the right-click menu popup :
def _popup_0_SEPARATOR(self, data): pass
def _popup_1_Add_Group(self, data):
print "_popup_1_Add_Group"
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, "Add Group :")
return TrueAnnotation style for menu callbacks (normally for popups) :
- _popup _{order#} _{heading-label}
This plugin depends on GeanyPy. See GeanyPy's documentation/website for information on installation.
On Fedora, for instance, installing GeanyPy is as simple as :
# yum install geany-plugins-geanypy python-devel
First you need to know where GeanyPy stores its plugin directory - and that the path has been set up.
As a local user on Fedora, this is done simply by running geany, and making sure that the geanypy plugin is installed.
Then (for versions < 1.27, which is Fedora<=22):
cd {base directory inside this repository}
ln -s `pwd`/project-tree ~/.config/geany/plugins/geanypy/plugins/Or (for versions >= 1.27, which is Fedora>=23) - because GeanyPy is now a 'unified' plugin:
cd {base directory inside this repository}
ln -s `pwd`/project-tree/project_tree.py ~/.config/geany/plugins/Geany will need to be restarted for GeanyPy to pick up the new plugin available. If it doesn't work, you can also try to add it to the main geany installation instead :
cd {base directory inside this repository}
sudo ln -s `pwd`/project-tree/project_tree.py /usr/lib64/geany/