11 | Your QGIS plugin directory is located at:
12 | ${UserPluginDir}
13 |
14 |
35 | For information on writing PyQGIS code, see http://loc8.cc/pyqgis_resources for a list of resources. 36 |
37 |39 | ©2011-2017 GeoApt LLC - geoapt.com 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /pb_tool/templates/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g-sherman/plugin_build_tool/b3a6fef19d64d37b4d8040fe2bb4d8bf55c57d2d/pb_tool/templates/icon.png -------------------------------------------------------------------------------- /pb_tool/templates/pb_tool.tmpl: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # ${TemplateClass} 3 | # 4 | # Configuration file for plugin builder tool (pb_tool) 5 | # ------------------- 6 | # begin : $TemplateBuildDate 7 | # copyright : (C) $TemplateYear by $TemplateAuthor 8 | # email : $TemplateEmail 9 | # ***************************************************************************/ 10 | # 11 | #/*************************************************************************** 12 | # * * 13 | # * This program is free software; you can redistribute it and/or modify * 14 | # * it under the terms of the GNU General Public License as published by * 15 | # * the Free Software Foundation; either version 2 of the License, or * 16 | # * (at your option) any later version. * 17 | # * * 18 | # ***************************************************************************/ 19 | # 20 | # 21 | # You can install pb_tool using: 22 | # pip install http://geoapt.net/files/pb_tool.zip 23 | # 24 | # Consider doing your development (and install of pb_tool) in a virtualenv. 25 | # 26 | # For details on setting up and using pb_tool, see: 27 | # http://g-sherman.github.io/plugin_build_tool/ 28 | # 29 | # Issues and pull requests here: 30 | # https://github.com/g-sherman/plugin_build_tool: 31 | # 32 | # Sane defaults for your plugin generated by the Plugin Builder are 33 | # already set below. 34 | # 35 | # As you add Python source files and UI files to your plugin, add 36 | # them to the appropriate [files] section below. 37 | 38 | [plugin] 39 | # Name of the plugin. This is the name of the directory that will 40 | # be created in .qgis2/python/plugins 41 | name: ${TemplateModuleName} 42 | 43 | [files] 44 | # Python files that should be deployed with the plugin 45 | python_files: __init__.py ${TemplateModuleName}.py ${TemplatePyFiles} 46 | 47 | # The main dialog file that is loaded (not compiled) 48 | main_dialog: ${TemplateUiFiles} 49 | 50 | # Other ui files for dialogs you create (these will be compiled) 51 | compiled_ui_files: 52 | 53 | # Resource file(s) that will be compiled 54 | resource_files: ${TemplateQrcFiles} 55 | 56 | # Other files required for the plugin 57 | extras: metadata.txt ${TemplateExtraFiles} 58 | 59 | # Other directories to be deployed with the plugin. 60 | # These must be subdirectories under the plugin directory 61 | extra_dirs: 62 | 63 | # ISO code(s) for any locales (translations), separated by spaces. 64 | # Corresponding .ts files must exist in the i18n directory 65 | locales: 66 | 67 | [help] 68 | # the built help directory that should be deployed with the plugin 69 | dir: help/build/html 70 | # the name of the directory to target in the deployed plugin 71 | target: help 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | /*************************************************************************** 3 | setup.py for pb_tool 4 | A tool for building and deploying QGIS plugins 5 | ------------------- 6 | begin : 2014-09-24 7 | copyright : (C) 2014 by GeoApt LLC 8 | email : gsherman@geoapt.com 9 | ***************************************************************************/ 10 | 11 | /*************************************************************************** 12 | * * 13 | * This program is free software; you can redistribute it and/or modify * 14 | * it under the terms of the GNU General Public License as published by * 15 | * the Free Software Foundation; either version 2 of the License, or * 16 | * (at your option) any later version. * 17 | * * 18 | ***************************************************************************/ 19 | """ 20 | 21 | from setuptools import * 22 | 23 | setup( 24 | name='pb_tool', 25 | version='2.0.2', 26 | description='A tool to aid in QGIS Python plugin development', 27 | long_description='pb_tool provides commands to deploy and publish a QGIS Python plugin.', 28 | url='http://g-sherman.github.io/plugin_build_tool', 29 | author='Gary Sherman', 30 | author_email='gsherman@geoapt.com', 31 | maintainer='Gary Sherman', 32 | maintainer_email='gsherman@geoapt.com', 33 | license='GPL2', 34 | classifiers=[ 35 | 'Development Status :: 5 - Production/Stable', 36 | 'Operating System :: OS Independent', 37 | 'Intended Audience :: Developers', 38 | 'Topic :: Software Development :: Build Tools', 39 | 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 40 | 'Topic :: Scientific/Engineering :: GIS'], 41 | keywords='QGIS PyQGIS', 42 | platforms=['Linux', 'Windows', 'OS X'], 43 | packages=find_packages(), 44 | package_data={'pb_tool': ['templates/*.tmpl']}, 45 | include_package_data=True, 46 | py_modules=['pb_tool'], 47 | install_requires=[ 48 | 'Click', 49 | 'Sphinx', 50 | 'colorama' 51 | ], 52 | entry_points=''' 53 | [console_scripts] 54 | pb_tool=pb_tool.pb_tool:cli 55 | pbt=pb_tool.pb_tool:cli 56 | ''', 57 | ) 58 | -------------------------------------------------------------------------------- /test_pb_tool.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import click 4 | from click.testing import CliRunner 5 | from pb_tool import pb_tool 6 | 7 | runner = CliRunner() 8 | 9 | 10 | def test_validate(): 11 | result = runner.invoke(pb_tool.cli, ['validate']) 12 | assert result.exit_code == 0 13 | 14 | 15 | 16 | def test_clean(): 17 | result = runner.invoke(pb_tool.cli, ['clean']) 18 | assert result.exit_code == 0 19 | 20 | 21 | def test_cleandocs(): 22 | result = runner.invoke(pb_tool.cli, ['clean_docs']) 23 | assert result.exit_code == 0 24 | 25 | 26 | def test_config(): 27 | result = runner.invoke(pb_tool.cli, 28 | ['config', '--name', 'test_from_pytest.cfg', 29 | '--package', 'testname'], input='y\n') 30 | assert result.exit_code == 0 31 | assert os.path.exists('test_from_pytest.cfg') == 1 32 | 33 | 34 | def test_create(): 35 | result = runner.invoke(pb_tool.cli, ['create']) 36 | assert result.exit_code == 0 37 | 38 | 39 | def test_doc(): 40 | result = runner.invoke(pb_tool.cli, ['doc']) 41 | assert result.exit_code == 0 42 | 43 | 44 | def test_deploy(): 45 | result = runner.invoke(pb_tool.cli, ['deploy'], input='y\n') 46 | assert result.exit_code == 0 47 | 48 | def test_zip(): 49 | result = runner.invoke(pb_tool.cli, ['zip'], input='y\n') 50 | assert result.exit_code == 0 51 | #assert os.path.exists(os.path.join(os.getcwd(), 'whereami.zip')) 52 | 53 | 54 | def test_dclean(): 55 | result = runner.invoke(pb_tool.cli, ['dclean'], input='y\n') 56 | assert result.exit_code == 0 57 | 58 | 59 | # def test_help(): 60 | # result = runner.invoke(pb_tool.cli, ['help']) 61 | # assert result.exit_code == 0 62 | 63 | 64 | def test_list(): 65 | result = runner.invoke(pb_tool.cli, ['list']) 66 | assert result.exit_code == 0 67 | 68 | 69 | def test_validate(): 70 | result = runner.invoke(pb_tool.cli, ['validate']) 71 | assert result.exit_code == 0 72 | 73 | def test_update(): 74 | result = runner.invoke(pb_tool.cli, ['update']) 75 | assert result.exit_code == 0 76 | 77 | def test_version(): 78 | result = runner.invoke(pb_tool.cli, ['version']) 79 | assert result.exit_code == 0 80 | 81 | def test_compile(): 82 | result = runner.invoke(pb_tool.cli, ['compile']) 83 | assert result.exit_code == 0 84 | 85 | # results.append("Command validate failed: {}".format(result.output)) 86 | #print("testing validate: {}".format(result)) 87 | #result = runner.invoke(pb_tool.cli, ['zip', '-q']) 88 | #print("testing zip: {}".format(result)) 89 | #print results 90 | -------------------------------------------------------------------------------- /test_plugin/Makefile: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # TestPlugin 3 | # 4 | # Test Plugin 5 | # ------------------- 6 | # begin : 2014-10-06 7 | # git sha : $Format:%H$ 8 | # copyright : (C) 2014 by GeoApt LLC 9 | # email : gsherman@geoapt.com 10 | # ***************************************************************************/ 11 | # 12 | #/*************************************************************************** 13 | # * * 14 | # * This program is free software; you can redistribute it and/or modify * 15 | # * it under the terms of the GNU General Public License as published by * 16 | # * the Free Software Foundation; either version 2 of the License, or * 17 | # * (at your option) any later version. * 18 | # * * 19 | # ***************************************************************************/ 20 | 21 | ################################################# 22 | # Edit the following to match your sources lists 23 | ################################################# 24 | 25 | 26 | #Add iso code for any locales you want to support here (space separated) 27 | # default is no locales 28 | # LOCALES = af 29 | LOCALES = 30 | 31 | # If locales are enabled, set the name of the lrelease binary on your system. If 32 | # you have trouble compiling the translations, you may have to specify the full path to 33 | # lrelease 34 | #LRELEASE = lrelease 35 | #LRELEASE = lrelease-qt4 36 | 37 | 38 | # translation 39 | SOURCES = \ 40 | __init__.py \ 41 | test_plugin.py \ 42 | test_plugin_dialog.py 43 | 44 | PLUGINNAME = TestPlugin 45 | 46 | PY_FILES = \ 47 | test_plugin.py \ 48 | test_plugin_dialog.py \ 49 | __init__.py 50 | 51 | UI_FILES = test_plugin_dialog_base.ui 52 | 53 | EXTRAS = icon.png metadata.txt 54 | 55 | COMPILED_RESOURCE_FILES = resources_rc.py 56 | 57 | PEP8EXCLUDE=pydev,resources_rc.py,conf.py,third_party,ui 58 | 59 | 60 | ################################################# 61 | # Normally you would not need to edit below here 62 | ################################################# 63 | 64 | HELP = help/build/html 65 | 66 | PLUGIN_UPLOAD = $(c)/plugin_upload.py 67 | 68 | RESOURCE_SRC=$(shell grep '^ *
11 | Your QGIS plugin directory is located at:
12 | /Users/gsherman/.qgis2/python/plugins
13 |
14 |
30 | For more information, see the PyQGIS Developer Cookbook at: 31 | http://www.qgis.org/pyqgis-cookbook/index.html. 32 |
33 |