[QGIS Commit] r12353 - docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Dec 7 12:27:51 EST 2009


Author: jrm
Date: 2009-12-07 12:27:50 -0500 (Mon, 07 Dec 2009)
New Revision: 12353

Added:
   docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_cpp_applications.diff
   docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_pyqgis_applications.diff
   docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_cpp.diff
   docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_python.diff
Log:
diff files for real, the return II

Added: docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_cpp_applications.diff
===================================================================
--- docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_cpp_applications.diff	                        (rev 0)
+++ docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_cpp_applications.diff	2009-12-07 17:27:50 UTC (rev 12353)
@@ -0,0 +1,167 @@
+--- user guide EN 1.0/creating_cpp_applications.tex	2009-11-30 19:25:27.240714291 +0100
++++ coding-compilation_guide/creating_cpp_applications.tex	2009-11-30 22:26:55.769714713 +0100
+@@ -3,22 +3,19 @@
+ Not everyone wants a full blown GIS desktop application. Sometimes you want
+ to just have a widget inside your application that displays a map while the
+ main goal of the application lies elsewhere. Perhaps a database frontend with
+-a map display? This Section provides two simple code examples by Tim Sutton. 
+-They are available in the qgis subversion repository together with more
+-interesting tutorials. Check out the whole repository from: 
+-\filename{https://svn.osgeo.org/qgis/trunk/code\_examples/}
++a map display? This Section provides two simple code examples by Tim Sutton, 
++based on earlier work by Francis Bolduc. They are available in the qgis 
++subversion repository together with more interesting tutorials. Check out 
++the whole repository from: \filename{https://svn.osgeo.org/qgis/trunk/code\_examples/}
+ 
+ \subsection{Creating a simple mapping widget}\label{subsec:simple_widget}
+ 
+-With this first tutorial we take a little walk through creating a simple mapping
+-widget. It won't do anything much - just load a shape file and display it in
+-a random colour. 
+-But it should give you an idea of the potential for using QGIS as an embedded
+-mapping component. Before we carry on, many thanks to Francis Bolduc who wrote
+-the beginnings of this demo. He kindly agreed to make his work generally
+-available.
++With this tutorial we will create a simple mapping widget. It won't do 
++anything much - just load a shape file and display it in a random colour. 
++This should give you an idea of the potential for using QGIS as an embedded
++mapping component.
+ 
+-We start with typical adding the neccessary includes for our app:
++We start by adding the neccessary includes for our app:
+ 
+ \begin{verbatim}
+ //
+@@ -38,9 +35,8 @@
+ #include <QWidget>
+ \end{verbatim}
+ 
+-We use QgsApplication instead of Qt's QApplication, and get some added
+-benifits of various static methods that can be used to locate library paths
+-and so on.
++We use QgsApplication instead of Qt's QApplication, to take advantage of 
++various static methods that can be used to locate library paths and so on.
+ 
+ The provider registry is a singleton that keeps track of vector data provider
+ plugins. It does all the work for you of loading the plugins and so on. The
+@@ -53,8 +49,8 @@
+ vector layer class inherits from maplayer and extends it to include
+ specialist functionality for vector data.
+ 
+-Finally the mapcanvas is really the nub of the matter. Its the drawable
+-widget that our map will be drawn onto.
++Finally, the mapcanvas is our main map area. Its the drawable
++widget that our map will be dispalyed on.
+ 
+ Now we can move on to initialising our application....
+ 
+@@ -71,15 +67,15 @@
+ 
+ \end{verbatim}
+ 
+-So now we have a qgsapplication and we have defined some variables. Since I
+-tested this on the Ubuntu 8.10, I just specified the location of the vector
+-provider plugins as being inside the my development install directory. It
+-would probaby make more sense in general to keep the QGIS libs in one of the
++We now have a qgsapplication and we have defined several variables. Since this 
++tutorial was initially tested on Ubuntu Linux 8.10, we have specified the 
++location of the vector provider plugins as being inside our development install 
++directory. It would probaby make more sense in general to keep the QGIS libs in one of the
+ standard library search paths on your system (e.g. /usr/lib) but this way
+ will do for now.
+ 
+-The next two variables defined here just point to the shapefile I am going to
+-be using (and you should substitute your own data here).
++The next two variables defined here point to the shapefile that is going to
++be used (though you will likely want to substitute your own data here).
+ 
+ The provider name is important - it tells qgis which data provider to use to
+ load the file. Typically you will use 'ogr' or 'postgres'.
+@@ -122,15 +118,12 @@
+ \end{verbatim}
+ 
+ The code is fairly self explanatory here. We create a layer using the
+-variables
+-we defined earlier. Then we assign the layer a renderer. When we create a
+-renderer, we need to specify the geometry type, which do do by asking the
+-vector layer for its geometry type. Next we add the layer to a layerset
+-(which
+-is used by the QgsMapCanvas to keep track of which layers to render and in
+-what
+-order) and to the maplayer registry. Finally we make sure the layer will be
+-visible.
++variables we defined earlier. Then we assign the layer a renderer. 
++When we create a renderer, we need to specify the geometry type, which 
++we do by asking the vector layer for its geometry type. Next we add 
++the layer to a layerset (which is used by the QgsMapCanvas to keep 
++track of which layers to render and in what order) and to the maplayer 
++registry. Finally we make sure the layer will be visible.
+ 
+ Now we create a map canvas on to which we can draw the layer.
+ 
+@@ -160,7 +153,7 @@
+ 
+ \end{verbatim}
+ 
+-In the last step we simply start the Qt event loop and we are all done. You
++In the last step we simply start the Qt event loop and we are done. You
+ can check out, compile and run this example using cmake like this:
+ 
+ \begin{verbatim}
+@@ -189,17 +182,15 @@
+ 
+ \subsection{Working with QgsMapCanvas}
+ 
+-In Section~\ref{subsec:simple_widget} we showed you the usage of the
+-QgsMapCanvas api to create a simple application that loads a shapefile and
++In the previous Section (Section~\ref{subsec:simple_widget}) we showed you how to use 
++the QgsMapCanvas API to create a simple application that loads a shapefile and
+ displays the points in it. But what good is a map that you can't interact
+ with? 
+ 
+-In this second tutorial I will extend the last tutorial by making it a
++In this second tutorial we will extend the previous tutorial by making it a
+ QMainWindow application with a menu, toolbar and canvas area. We show you how
+-to use QgsMapTool - the base class for all tools that need to interact with
+-the map canvas.
+-The purpose is to provide a demonstrator project, so I wont promise to write the most
+-elegant or robust C++ code. The project will provide 4 toolbar icons for
++to use QgsMapTool - the base class for all tools that are used to interact with
++the map canvas. The project will provide 4 toolbar icons for
+ 
+ \begin{itemize}
+  \item loading a map layer (layer name is hard coded in the application
+@@ -215,12 +206,12 @@
+ \textbf{Note:} You will need to edit the .pro file in the above svn directory to
+ match your system.
+ 
+-Since much of the code is the same as the previous tutorial, I will focus on
++Since much of the code is the same as the previous tutorial, we will focus on
+ the MapTool specifics - the rest of the implementation details can be
+ investigated by checking out the project form SVN. A QgsMapTool is a class that
+ interacts with the MapCanvas using the mouse pointer. QGIS has a number of
+ QgsMapTools implemented, and you can subclass QgsMapTool to create your own. In
+-mainwindow.cpp you will see I include the headers for the QgsMapTools near the
++mainwindow.cpp you will see we have included the headers for the QgsMapTools near the
+ start of the file:
+ 
+ \begin{verbatim}
+@@ -264,8 +255,7 @@
+      mpMapToolBar->addAction(mpActionPan);
+ \end{verbatim}
+ 
+-Thats really pretty straightforward Qt stuff too. Now we create our three map
+-tools:
++Now we create our three map tools:
+ 
+ \begin{verbatim}
+      //create the maptools
+@@ -293,7 +283,7 @@
+    \begin{center}
+    \caption{QMainWindow application with a menu, toolbar and canvas area
+ \osxcaption}\label{fig:cpp2_application}\smallskip
+-   \includegraphics[clip=true, width=\textwidth]{cpp2_application}
++   \includegraphics[clip=true, width=12cm]{cpp2_application}
+ \end{center}
+ \end{figure}
+ 

Added: docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_pyqgis_applications.diff
===================================================================
--- docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_pyqgis_applications.diff	                        (rev 0)
+++ docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/creating_pyqgis_applications.diff	2009-12-07 17:27:50 UTC (rev 12353)
@@ -0,0 +1,108 @@
+--- user guide EN 1.0/creating_pyqgis_applications.tex	2009-11-30 19:25:27.243714597 +0100
++++ coding-compilation_guide/creating_pyqgis_applications.tex	2009-11-30 22:26:55.768715334 +0100
+@@ -11,11 +11,11 @@
+ realized with the refactoring of libraries that took place after the release
+ of 0.8. Since the release of 0.9, development of standalone applications using
+ either C++ or Python is possible. We recommend you use QGIS 1.0.0 or greater
+-as the basis for your pythong applications because since this version we now
++as the basis for your python applications because since this version we now
+ provide a stable consistent API.
+ 
+-In this chapter we'll take a brief look at the process for creating a
+-standalone Python application. The QGIS blog has several examples of creating
++In this chapter we'll take a brief look at the process of creating a
++standalone Python application. The QGIS blog has several examples for creating
+ PyQGIS\footnote{An application created using Python and the QGIS bindings}
+ applications. We'll use one of them as a starting point to get a look at how
+ to create an application.
+@@ -133,21 +133,29 @@
+ 44 
+ 45     # Create the actions for our tools and connect each to the appropriate
+ 46     # method
+-47     self.actionAddLayer = QAction(QIcon("(qgis_prefix + "/share/qgis/themes/classic/mActionAddLayer.png"),
+-48     \
++47     self.actionAddLayer = QAction(QIcon("(qgis_prefix + \
++       "/share/qgis/themes/classic/mActionAddLayer.png"),
++48
+ 49         "Add Layer", self.frame)
+ 50     self.connect(self.actionAddLayer, SIGNAL("activated()"), self.addLayer)
+-51     self.actionZoomIn = QAction(QIcon("(qgis_prefix + "/share/qgis/themes/classic/mActionZoomIn.png"), \
+-52         "Zoom In", self.frame)
++51     self.actionZoomIn = QAction(QIcon("(qgis_prefix + \
++       "/share/qgis/themes/classic/mActionZoomIn.png"), \
++       "Zoom In", self.frame)
++52     
+ 53     self.connect(self.actionZoomIn, SIGNAL("activated()"), self.zoomIn)
+-54     self.actionZoomOut = QAction(QIcon("(qgis_prefix + "/share/qgis/themes/classic/mActionZoomOut.png"), \
++54     self.actionZoomOut = QAction(QIcon("(qgis_prefix + \
++       "/share/qgis/themes/classic/mActionZoomOut.png"), \
+ 55         "Zoom Out", self.frame)
+ 56     self.connect(self.actionZoomOut, SIGNAL("activated()"), self.zoomOut)
+-57     self.actionPan = QAction(QIcon("(qgis_prefix + "/share/qgis/themes/classic/mActionPan.png"), \
+-58         "Pan", self.frame)
++57     self.actionPan = QAction(QIcon("(qgis_prefix + \
++       "/share/qgis/themes/classic/mActionPan.png"), \
++       "Pan", self.frame)
++58
+ 59     self.connect(self.actionPan, SIGNAL("activated()"), self.pan)
+-60     self.actionZoomFull = QAction(QIcon("(qgis_prefix + "/share/qgis/themes/classic/mActionZoomFullExtent.png"), \
+-61         "Zoom Full Extent", self.frame)
++60     self.actionZoomFull = QAction(QIcon("(qgis_prefix + \
++       "/share/qgis/themes/classic/mActionZoomFullExtent.png"), \
++       "Zoom Full Extent", self.frame)
++61
+ 62     self.connect(self.actionZoomFull, SIGNAL("activated()"),
+ 63     self.zoomFull)
+ 64 
+@@ -354,24 +362,17 @@
+ 
+ When the application starts up, it looks like this:
+ 
+-%\begin{figure}[ht]
+-%\begin{center}
+-%  \caption{Starting the new demo application}\label{fig:demo_app_startup}%\smallskip
+-%  \includegraphics[scale=0.8]{getdsn}
+-%\end{center}
+-%\end{figure}
++\begin{figure}[ht]
++\begin{center}
++  \caption{Starting the new demo application \nixcaption} \label{fig:demo_app_startup}
++  \includegraphics[clip=true, width=12cm]{python1_application}
++\end{center}
++\end{figure}
+ 
+ To add the \filename{world\_borders} layer, click on the 
+ \usertext{Add Layer} tool and navigate to the data directory.
+ Select the shapefile and click \button{Open} to add it to the map. 
+-Our custom fill color is applied and the result is:
+-
+-%\begin{figure}[ht]
+-%\begin{center}
+-%  \caption{Adding a layer the demo application}\label{fig:demo_app_done}%\smallskip
+-%  \includegraphics[scale=0.8]{getdsn}
+-%\end{center}
+-%\end{figure}
++Our custom fill color is applied and the result is shown in Figure \ref{fig:demo_app_done}.
+ 
+ Creating a PyQGIS application is really pretty simple.  In less than 150 lines
+ of code we have an application that can load a shapefile and navigate the map.
+@@ -383,12 +384,10 @@
+ the works. This is pretty impressive, considering that this development has 
+ taken place even before the official release of QGIS 1.0.
+ 
+-\begin{Tip}\caption{\textsc{Documentation For PyQGIS}}
+-\qgistip{Whether you are writing a plugin or a PyQGIS application, you are
+-going to need to refer to both the QGIS API documentation
+-(\url{http://doc.qgis.org}) and the PyQt Python Bindings Reference Guide
+-(\url{http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html}). These
+-documents provide information about the classes and methods you'll use to
+-bring your Python creation to life.
+-}
+-\end{Tip} 
++\begin{figure}[ht]
++\begin{center}
++  \caption{Adding a layer the demo application \nixcaption} \label{fig:demo_app_done}
++  \includegraphics[clip=true, width=12cm]{python2_application}
++\end{center}
++\end{figure}
++

Added: docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_cpp.diff
===================================================================
--- docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_cpp.diff	                        (rev 0)
+++ docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_cpp.diff	2009-12-07 17:27:50 UTC (rev 12353)
@@ -0,0 +1,130 @@
+--- user guide EN 1.0/plugins_writing_in_cpp.tex	2009-11-30 19:25:27.248714015 +0100
++++ coding-compilation_guide/plugins_writing_in_cpp.tex	2009-11-30 22:26:55.772715014 +0100
+@@ -1,4 +1,6 @@
+ % vim: set textwidth=78 autoindent:
++\pagenumbering{arabic}
++\setcounter{page}{1}
+ 
+ \section{Writing a QGIS Plugin in C++}\label{cpp_plugin}
+ 
+@@ -10,13 +12,13 @@
+ C++ plugin. It is based on a workshop held by Dr. Marco Hugentobler. 
+ 
+ QGIS C++ plugins are dynamically linked libraries (.so or .dll). They are
+-linked to QGIS at runtime when requested in the plugin manager and extend the
+-functionality of QGIS. They have access to the QGIS GUI and can be devided
++linked to QGIS at runtime when requested in the Plugin Manager, and extend the
++functionality of QGIS via access to the QGIS GUI. In general, they can be devided
+ into core and external plugins.
+ 
+-Technically the QGIS plugin manager looks in the lib/qgis directory for all
++Technically the QGIS Plugin Manager looks in the lib/qgis directory for all
+ .so files and loads them when it is started. When it is closed they are
+-unloaded again, except the ones with a checked box. For newly loaded plugins,
++unloaded again, except the ones enabled by the user (See User Manual). For newly loaded plugins,
+ the \method{classFactory} method creates an instance of the plugin class and
+ the \method{initGui} method of the plugin is called to show the GUI elements
+ in the plugin menu and toolbar. The \method{unload()} function of the plugin
+@@ -27,37 +29,47 @@
+ 
+ \subsection{Why C++ and what about licensing}
+ 
+-QGIS itself is written in C++, so it also makes sense to write plugins in C++
+-as well. It is an object-oriented programming (OOP) language that is viewed
+-by many developers as a prefered language for creating large-scale
+-applications.
++QGIS itself is written in C++, so it makes sense to write plugins in C++
++as well. It is an object-oriented programming (OOP) language that is prefered 
++by many developers for creating large-scale applications.
+ 
+-QGIS C++ plugins use functionalities of libqgis*.so libraries. As they are
+-licensed under GNU GPL, QGIS C++ plugins must be licenced under the GPL, too.
+-This means you may use your plugins for any purpose and you are not forced to
++QGIS C++ plugins take advantage of the functionalities provided by the libqgis*.so libraries. 
++As these libraries licensed under the GNU GPL, QGIS C++ plugins must also be licenced under 
++the GPL. This means that you may use your plugins for any purpose and you are not required to
+ publish them. If you do publish them however, they must be published under
+ the conditions of the GPL license. 
+ 
+ \subsection{Programming a QGIS C++ Plugin in four steps}
+ 
+-The example plugin is a point converter plugin and intentionally kept simple. 
+-The plugin searches the active vector layer in QGIS, converts all vertices of
+-the layer features to point features keeping the attributes and finally
+-writes the point features into a delimited text file. The new layer can then
+-be loaded into QGIS using the delimited text plugin (see Section
+-\ref{label_dltext}).
++The C++ plugin example covered in this manual is a point converter plugin and intentionally kept simple. 
++The plugin searches the active vector layer in QGIS, converts all vertices of 
++the layer's features to point features (keeping the attributes), and finally
++writes the point features to a delimited text file. The new layer can then
++be loaded into QGIS using the delimited text plugin (see User Manual).
+ 
+ \minisec{Step 1: Make the plugin manager recognise the plugin}
+ 
+ As a first step we create the \filename{QgsPointConverter.h} and
+-\filename{QgsPointConverter.cpp} files. Then we add virtual methods inherited
+-from QgisPlugin (but leave them empty for now), create necessary external 'C'
+-methods and a .pro file, which is a Qt mechanism to easily create Makefiles.
+-Then we compile the sources, move the compiled library into the plugin folder
+-and load it in the QGIS plugin manager.
++\filename{QgsPointConverter.cpp} files. We then add virtual methods inherited
++from QgisPlugin (but leave them empty for now), create the necessary external 'C'
++methods, and a .pro file (which is a Qt mechanism to easily create Makefiles).
++Then we compile the sources, move the compiled library into the plugin folder,
++and load it in the QGIS Plugin Manager.
+ 
+ \textbf{a) Create new pointconverter.pro file and add}:
+ 
++
++% 
++%
++% Note: the use of qmake / pro files for building plugins 
++% is outdated and the reader should be made aware that this 
++% chapter is not longer current. Tim will update this 
++% chapter in the near future, but in the meantime this
++% note serves as a reminder.
++%
++%
++
++
+ \begin{verbatim}
+ #base directory of the qgis installation
+ QGIS_DIR = /home/marco/src/qgis
+@@ -162,7 +174,7 @@
+ 
+ This step includes adding a pointer to the QgisInterface object in the plugin
+ class. Then we create a QAction and a callback function (slot), add it to the
+-QGIS GUI using QgisIface::addToolBarIcon() and QgisIface::addPluginToMenu()
++QGIS GUI using QgisInterface::addToolBarIcon() and QgisInterface::addPluginToMenu()
+ and finally remove the QAction in the \method{unload()} method.
+ 
+ \textbf{d) Open qgspointconverterplugin.h again and extend existing content to}:
+@@ -510,10 +522,10 @@
+ 
+ \minisec{Step 4: Copy the feature attributes to the text file}
+ 
+-At the end we extract the attributes from the active layer using
+-QgsVectorDataProvider::fieldNameMap(). For each feature we extract the field
+-values using QgsFeature::attributeMap() and add the contents comma separated
+-behind the x- and y-coordinates for each new point feature. For this step
++At the end we extract the attributes from the active layer using 
++QgsVectorDataProvider::fieldNameMap(). For each feature we extract the field 
++values using QgsFeature::attributeMap() and add the contents (comma separated) 
++behind the x- and y-coordinates for each new point feature. For this step 
+ there is no need for any furter change in \filename{qgspointconverterplugin.h} 
+ 
+ \textbf{h) Open qgspointconverterplugin.cpp again and extend existing content
+@@ -818,9 +830,9 @@
+ 
+ \subsection{Further information}
+ 
+-As you can see, you need information from different sources to write QGIS C++
+-plugins. Plugin writers need to know C++, the QGIS plugin interface as
+-well as Qt4 classes and tools. At the beginning it is best to learn from
++As you can see, you need information from many different sources to write QGIS C++ 
++plugins. Plugin writers need to know C++, the QGIS plugin interface as 
++well as Qt4 classes and tools. At the beginning it is best to learn from 
+ examples and copy the mechanism of existing plugins. 
+ 
+ There is a a collection of online documentation that may be usefull for

Added: docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_python.diff
===================================================================
--- docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_python.diff	                        (rev 0)
+++ docs/branches/1.3.0/french/coding-compilation_guide/diff_1.0_to_1.3/plugins_writing_in_python.diff	2009-12-07 17:27:50 UTC (rev 12353)
@@ -0,0 +1,192 @@
+--- user guide EN 1.0/plugins_writing_in_python.tex	2009-11-30 19:25:27.241714440 +0100
++++ coding-compilation_guide/plugins_writing_in_python.tex	2009-11-30 22:26:55.772715014 +0100
+@@ -6,53 +6,50 @@
+ % comment out the following line:
+ % \updatedisclaimer
+ 
+-In this section you find a beginner's tutorial for writing a QGIS Python
+-plugins. It is based on the workshop "Extending the Functionality of QGIS
++In this section we provide a beginner's tutorial for writing a simple QGIS Python
++plugin. It is based on the workshop "Extending the Functionality of QGIS
+ with Python Plugins" held at FOSS4G 2008 by Dr. Marco Hugentobler, Dr. Horst
+ D\"uster and Tim Sutton. 
+ 
+ Apart from writing a QGIS Python plugin, it is also possible to use PyQGIS
+-from a python command line console which is mainly interesting for debugging
+-or to write standalone applications in Python with their own user interfaces
+-using the functionality of the QGIS core library.
++from a python command line console which is useful for debugging or writing 
++standalone applications in Python, with their own user interfaces
++based on the functionality of the QGIS core library.
+ 
+ \subsection{Why Python and what about licensing}
+ 
+-Python is a scripting language which was designed with the goal of being easy
+-to program. It has a mechanism that automatically releases memory that is no
++Python is a scripting language that was designed with the goal of being easy
++to program. It has a mechanism for automatically releasing memory that is no
+ longer used (garbagge collector). A further advantage is that many programs
+ that are written in C++ or Java offer the possibility to write extensions in
+ Python, e.g. OpenOffice or Gimp. Therefore it is a good investment of time to
+ learn the Python language.
+ 
+-PyQGIS plugins use functionality of libqgis\_core.so and libqgis\_gui.so. As
+-both are licensed under GNU GPL, QGIS Python plugins must be licenced under the
+-GPL, too. This means you may use your plugins for any purpose and you are not
+-forced to publish them. If you do publish them however, they must be
+-published under the conditions of the GPL license. 
++PyQGIS plugins take advantage of the functionality of libqgis\_core.so and libqgis\_gui.so. 
++As both libqgis\_core.so and libqgis\_gui.so are licensed under GNU GPL, QGIS Python 
++plugins must also be licenced under the GPL. This means you may use your plugins 
++for any purpose, and you are not forced to publish them. If you do publish them however, 
++they must be published under the conditions of the GPL license. 
+ 
+ \subsection{What needs to be installed to get started}
+ 
+-On the lab computers, everything for the workshop is already installed. If
+-you program Python plugins at home, you will need the following libraries and
+-programs:
++You will need the following libraries and programs to create QGIS python plugins yourself:
+ 
+ \begin{itemize}
+ \item QGIS
+-\item Python
++\item Python >= 2.5
+ \item Qt
+ \item PyQT
+ \item PyQt development tools
+ \end{itemize}
+ 
+ If you use Linux, there are binary packages for all major distributions. For
+-Windows, the PyQt installer already contains Qt, PyQt and the PyQt
+-development tools.
++Windows, the PyQt installer contains Qt, PyQt and the PyQt development tools.
+ 
+ \subsection{Programming a simple PyQGIS Plugin in four steps}\label{subsec:pyfoursteps}
+ 
+-The example plugin is intentionally kept simple. It adds a button to the menu
+-bar of QGIS. If the button is clicked, a file dialog appears where the user
++The example plugin demonstrated here is intentionally kept simple. It adds a button to the menu
++bar of QGIS. When the button is clicked, a file dialog appears where the user
+ may load a shape file.
+ 
+ For each python plugin, a dedicated folder that contains the plugin files
+@@ -78,15 +75,9 @@
+ 
+ \end{itemize}
+ 
+-Once that's done, the plugin will show up in the
++Once that is done, the plugin will show up in the
+ \dropmenuopttwo{mActionShowPluginManager}{Plugin Manager...}
+ 
+-\begin{Tip}\caption{\textsc{Two QGIS Python Plugin folders}}
+-\qgistip{There are two directories containing the python plugins. \$QGIS\_DIR/share/qgis/python/plugins
+-is designed mainly for the core plugins while \$HOME/.qgis/python/plugins for easy installation of the external plugins. Plugins in the home location are only visible for one user but also mask the core plugins with the same name, what can be used to provide main plugin updates
+-}
+-\end{Tip}
+-
+ To provide the neccessary information for QGIS, the plugin needs to implement
+ the methods \method{name()}, \method{description()}, \method{version()},
+ \method{qgisMinimumVersion()} and \method{authorName()} which return descriptive strings.
+@@ -96,7 +87,7 @@
+ plugin to access functions of the QGIS instance. We are going to work with
+ this object in step 2.  
+ 
+-Note that, in contrast to other programing languages, indention is very
++Note that in contrast to other programing languages, indention is very
+ important. The Python interpreter throws an error if it is not correct.
+ 
+ For our plugin we create the plugin folder 'foss4g\_plugin' in
+@@ -150,7 +141,7 @@
+   return FOSS4GPlugin(iface)
+ \end{verbatim}
+ 
+-At this point the plugin already the neccessary infrastructure to appear in
++At this point the plugin already has the neccessary infrastructure to appear in
+ the QGIS \dropmenuopttwo{mActionShowPluginManager}{Plugin Manager...} to be
+ loaded or unloaded. 
+ 
+@@ -158,16 +149,16 @@
+ 
+ To make the icon graphic available for our program, we need a so-called
+ resource file. In the resource file, the graphic is contained in hexadecimal
+-notation. Fortunately, we don't need to care about its representation because
++notation. Fortunately, we don't need to worry about its representation because
+ we use the pyrcc compiler, a tool that reads the file
+ \filename{resources.qrc} and creates a resource file. 
+ 
+ The file \filename{foss4g.png} and the \filename{resources.qrc} we use in
+-this little workshop can be downloaded from
+-\url{http://karlinapp.ethz.ch/python\_foss4g}. Move these 2 files into the
+-directory of the example plugin
+-\filename{\$HOME/.qgis/python/plugins/foss4g\_plugin} and enter there: pyrcc4 -o
+-resources.py resources.qrc.
++this workshop can be downloaded from \url{http://karlinapp.ethz.ch/python\_foss4g}, you 
++can also use your own icon if you prefer, you just need to make sure it is named 
++\filename{foss4g.png}. Move these 2 files into the directory of the example plugin 
++\filename{\$HOME/.qgis/python/plugins/foss4g\_plugin} and enter: \filename{pyrcc4 -o
++resources.py resources.qrc}.
+ 
+ \minisec{Step 3: Add a button and a menu}
+ 
+@@ -218,35 +209,46 @@
+       vlayer = self.iface.addVectorLayer(fileName, "myLayer", "ogr")
+ \end{verbatim}
+ 
++\minisec{Signal 'activated ()' in python plugins is deprecated}
+ 
+-\subsection{Committing the plugin to repository}
++When writing your python plugin, remember that the \texttt{activated ()}
++signal of the 'QAction class', used to signal the plugin it has been
++activated, is deprecated. This signal has disappeared from Qt4 and if Qt4 is
++not compiled with the Qt3 backward compatibility, it is simply non existent,
++so no plugin can be called at all.
++
++Please replace \texttt{activated ()} with \texttt{triggered ()}.
++
++\subsection{Uploading the plugin to the repository}
+ 
+ If you have written a plugin you consider to be useful and you want to share with
+-other users you're welcome to upload it to the QGIS User-Contributed Repository.
++other users you are welcome to upload it to the QGIS User-Contributed Repository.
+ \begin{itemize}
+-\item Prepare a plugin directory containing only necessary files (ensure that there
++\item Prepare a plugin directory containing only the necessary files (ensure that there
+ is no compiled .pyc files, Subversion .svn directories etc).
+ \item Make a zip archive of it, including the directory. Be sure the zip file
+-name is exactly the same as the directory inside (except the .zip extension of course).
+-In other case the Plugin Installer won't be able to relate the available plugin with its
++name is exactly the same as the directory inside (except the .zip extension of course), if not 
++the Plugin Installer will be unable to relate the available plugin with its 
+ locally installed instance.
+ \item Upload it to the repository: \url{http://pyqgis.org/admin/contributed} (you
+ will need to register at first time). Please pay attention when filling the form.
+-Especially the Version Number field is often filled wrongly what confuses the Plugin
+-Installer and causes false notifications of available updates.
++The Version Number field is especially important, and if filled out incorrectly it may confuse the Plugin Installer and cause false notifications of available updates.
+ \end{itemize}
+ 
+ \subsection{Further information}
+ 
+-As you can see, you need information from different sources to write PyQGIS
+-plugins. Plugin writers need to know Python and the QGIS plugin interface as
+-well as the Qt4 classes and tools. At the beginning it is best to learn from
++As you can see, you need information from many different sources to a write PyQGIS
++plugin. Plugin authors need to know Python, the QGIS plugin interface, as well 
++as the Qt4 classes and tools. In the beginning, it is best to learn from
+ examples and copy the mechanism of existing plugins. Using the QGIS plugin
+-installer, which itself is a Python plugin, it is possible to download a lot
+-of existing Python plugins and to study their behaviour.
++installer, which itself is a Python plugin, it is possible to download many 
++existing Python plugins and to study their behaviour. It is also possible to use 
++the on-line Python plugin generator to create a base plugin to work off of. This on-line 
++tool will help you to build a minimal plugin that you can use as a starting point in your 
++development. The result is a ready to install QGIS 1.0 plugin that implements an 
++empty dialog with Ok and Close buttons. It is available here: \url{http://www.pyqgis.org/builder/plugin_builder.py}
+ 
+-There is a a collection of online documentation that may be usefull for
+-PyQGIS programers:
++There is a a collection of on-line documentation that may be useful for PyQGIS programmers:
+  
+ \begin{itemize}
+ \item QGIS wiki: \url{http://wiki.qgis.org/qgiswiki/PythonBindings}



More information about the QGIS-commit mailing list