All the packaging moved to QGIS-Plugin-CI.
The scope of the repository has decreased. All the packaging, translations steps are easier when using QGIS-Plugin-CI. https://github.com/opengisch/qgis-plugin-ci
A docker image is available https://github.com/3liz/docker-qgis-plugin-ci
As it's a submodule, you can configure your GIT to auto update the submodule commit by running:
git config --global submodule.recurse true
The module is helping you with:
- setting up some logging (QgsMessageLog, file log, remote logs...)
- fetching resources in
resources
folder - fetching compiled UI file in
resources/ui
folder - fetching compiled translation file in
resources/i18n
folder - removing QRC resources file easily
- translate using the
i18n.tr()
function. - launching tests on Travis
- providing some common widgets/code for plugins
To use the logging system:
import logging
from .qgis_plugin_tools.tools.resources import plugin_name
# Top of the file
LOGGER = logging.getLogger(plugin_name())
# Later in the code
LOGGER.debug('Log some debug messages')
LOGGER.info('Log some info here')
LOGGER.warning('Log a warning here')
LOGGER.error('Log an error here')
LOGGER.critical('Log a critical error here')
- Go to the root folder of your plugin code source
git submodule add https://github.com/3liz/qgis_plugin_tools.git
For setting up the logging:
from .qgis_plugin_tools.tools.resources import plugin_name
from .qgis_plugin_tools.tools.custom_logging import setup_logger
setup_logger(plugin_name())
For setting up the translation file:
from qgis.PyQt.QtCore import QCoreApplication, QTranslator
from .qgis_plugin_tools.tools.i18n import setup_translation
locale, file_path = setup_translation()
if file_path:
self.translator = QTranslator()
self.translator.load(file_path)
QCoreApplication.installTranslator(self.translator)
- Using the plugin upload function, check the
--help
of theplugin_upload.py
file. For instance, you can setup environment variable in your bash for your credentials.
Plugin Foo
root folder:
.docker
plugin_name
qgis_plugins_tools/
submoduleresources/
i18n/
fr.ts
fr.qm
ui/
main_dialog.ui
icons/
my_icon.svg
test/
__init__.py
foo.py
metadata.txt
- `.gitattributes
.gitmodules
.gitignore
Makefile