Plugin initialization¶
Create QGIS project¶
Use Add vector layer or Ctrl+Shift+V. Add multiple layers to your new QGIS project.
, iconActivate plugin¶
In
search and activate the Save Views plugin.See a new icon in the toolbar . Plugin can be open.
The code¶
The key file is save_views.py
and the run()
method:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | def run(self):
"""Run method that loads and starts the plugin"""
if not self.pluginIsActive:
self.pluginIsActive = True
#print "** STARTING SaveViews"
# dockwidget may not exist if:
# first run of plugin
# removed on close (see self.onClosePlugin method)
if self.dockwidget == None:
# Create the dockwidget (after translation) and keep reference
self.dockwidget = SaveViewsDockWidget()
# connect to provide cleanup on closing of dockwidget
self.dockwidget.closingPlugin.connect(self.onClosePlugin)
# show the dockwidget
# TODO: fix to allow choice of dock location
self.iface.addDockWidget(Qt.LeftDockWidgetArea, self.dockwidget)
self.dockwidget.show()
|
Note
The code can be downloaded from our Github.