Skip to content

UBA Menu Plugins

Eliran Wong edited this page Mar 9, 2021 · 3 revisions

UBA Menu Plugins

UBA plugins are plugins accessible through UBA menu.

A valid plugin file should be written in python with file extension ".py".

Read https://github.com/eliranwong/UniqueBible/wiki/UBA-Plugins for other types of UBA plugins.

File Location

All UBA menu plugins are placed in folder "plugins/menu/" inside UniqueBible home directory.

Enable Plugins

You need to have "enablePlugins" checked on "Set Config Flags" window to use UBA plugins.

config.mainWindow

config.mainWindow points to the mainWindow of UBA. This gives developer an access point of UBA built-in functions.

An example

A context plugin could be as simple as below, to display a message in a dialog window.

import config

config.mainWindow.displayMessage("Testing a plugin!")

Hide supporting files from menu

You may have multiple files for a plugin and some of which are shared library files, which you do not want to display on menu.

You can do this by placing them into a sub-folder. Python files placed inside a sub-folder within the directory "plugins/menu/" are not displayed on menu.

A real example - Backup / Restore Notes with Google Drive

Description: https://github.com/eliranwong/UniqueBible/wiki/Notes-Backup-with-Google-Drive

Source codes: https://github.com/eliranwong/UniqueBible/tree/master/plugins/menu

Automating menu plugins on UBA startup / shutdown

You can simply COPY plugin files from "plugins/menu/" to "plugins/startup/" or "plugins/shutdown/" to automate a plugin on UBA startup / shutdown.

For example, https://github.com/eliranwong/UniqueBible/wiki/Notes-Backup-with-Google-Drive#automate-restoration-on-startup

Clone this wiki locally