Difference between revisions of "Creating a GenGIS plugin"

From The GenGIS wiki
Jump to: navigation, search
(Required Files)
(Required Files)
Line 5: Line 5:
 
Begin by creating the directory ''HelloWorld'' within the GenGIS ''plugins' directory. Within this directory create a file called ''__init__.py''. This file contains general information about your plugin which is used by GenGIS to load the plugin. For our Hello World plugin, enter the following into ''__init__.py'':
 
Begin by creating the directory ''HelloWorld'' within the GenGIS ''plugins' directory. Within this directory create a file called ''__init__.py''. This file contains general information about your plugin which is used by GenGIS to load the plugin. For our Hello World plugin, enter the following into ''__init__.py'':
  
 +
<code>
 
   def name():
 
   def name():
     return "Hello World"
+
     return "Hello World"
 +
 
   def version():
 
   def version():
 
     return "Version 1.0"
 
     return "Version 1.0"
 +
 
   def description():
 
   def description():
     return "Prints Hello World to the Viewport."
+
     return "Prints Hello World to the Viewport."
 +
 
   def authors():
 
   def authors():
 
     return "Donovan Parks"
 
     return "Donovan Parks"
 +
 
   def publicationDate():
 
   def publicationDate():
     return "March 1, 2012"
+
     return "March 1, 2012"
 +
 
   def minimumVersionOfGenGIS():  
 
   def minimumVersionOfGenGIS():  
 
     return "2.0"
 
     return "2.0"
 +
 
   def requireR():
 
   def requireR():
 
     return False
 
     return False
 +
</code>

Revision as of 00:05, 4 March 2012

The functionality of GenGIS can be extended by writing a Python plugin. Python plugins reside in the plugins folder within your GenGIS directory. In this tutorial we will create a simple "Hello World" plugin which writes a simple greeting to the GenGIS viewport.

Required Files

Begin by creating the directory HelloWorld within the GenGIS plugins' directory. Within this directory create a file called __init__.py. This file contains general information about your plugin which is used by GenGIS to load the plugin. For our Hello World plugin, enter the following into __init__.py:

 def name():
   return "Hello World"
 def version():
   return "Version 1.0"
 def description():
   return "Prints Hello World to the Viewport."
 def authors():
   return "Donovan Parks"
 def publicationDate():
   return "March 1, 2012"
 def minimumVersionOfGenGIS(): 
   return "2.0"
 def requireR():
   return False