[QGIS Commit] r9045 - in docs/trunk/english_us/user_guide: .
plugins_spit_images
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Aug 10 22:12:11 EDT 2008
Author: taraathan
Date: 2008-08-10 22:12:11 -0400 (Sun, 10 Aug 2008)
New Revision: 9045
Added:
docs/trunk/english_us/user_guide/plugins_spit_images/spiticon.png
Modified:
docs/trunk/english_us/user_guide/plugins.tex
docs/trunk/english_us/user_guide/plugins_georeferencer.tex
docs/trunk/english_us/user_guide/plugins_gps.tex
docs/trunk/english_us/user_guide/plugins_python.tex
docs/trunk/english_us/user_guide/plugins_spit_images/Makefile
Log:
added instances of \usertext, \filename, \classname, \method and \object macros to the plugin chapter
added the spiticon.png image to the proper folder, included it in the makefile and called it in the plugin listing
Modified: docs/trunk/english_us/user_guide/plugins.tex
===================================================================
--- docs/trunk/english_us/user_guide/plugins.tex 2008-08-10 19:44:20 UTC (rev 9044)
+++ docs/trunk/english_us/user_guide/plugins.tex 2008-08-11 02:12:11 UTC (rev 9045)
@@ -48,7 +48,7 @@
You can stop all plugins from loading by editing your stored settings file (see \ref{subsec:gui_options} for location).
Locate the plugins settings and change all the plugin values to false to prevent them from loading.
\nix {For example, to prevent the Delimited text plugin from loading, the entry in \$HOME/.config/QuantumGIS/qgis.conf on Linux
-should look like this:\ttfamily{Add Delimited Text Layer=false}.}
+should look like this:\usertext{Add Delimited Text Layer=false}.}
\normalfont
Do this for each plugin in the [Plugins] section.
You can then start QGIS and add the plugins one at a time from the Plugin Manger to determine which is causing the problem.
@@ -105,7 +105,7 @@
\includegraphics[width=0.7cm]{quick_print}
& Quick Print \index{plugins!quickprint}& Quickly print a map \\
\hline
-\includegraphics[width=0.7cm]{spit}
+\includegraphics[width=0.7cm]{spiticon}
& SPIT \index{plugins!spit}& Shapefile to PostGIS Import Tool - import shapefiles into PostgreSQL\\
\hline
\includegraphics[width=0.7cm]{scale_bar}
@@ -142,7 +142,7 @@
svn co https://svn.osgeo.org/qgis/trunk/external_plugins external_qgis_plugins
\end{verbatim}
-This will create a folder \texttt{external\_qgis\_plugins} in your current folder.
+This will create a folder \usertext{external\_qgis\_plugins} in your current folder.
Each subdirectory has its own compile and install instructions.
Read them carefully in order to build the plugin.
@@ -152,7 +152,7 @@
\subsubsection{Plugin templates}\label{sec:plugin_template}\index{plugins!template}
If you like to develop your own QGIS-plugin the main sources include a nice script which guides you through the process of creating your own template-directory-structure within the QGIS-source-tree.
-The script lives in \texttt{QGIS/src/plugins/plugin\_builder.pl}.
+The script lives in \usertext{QGIS/src/plugins/plugin\_builder.pl}.
The only thing to do is coding your functions into the plugin (and of course contribute your plugin to the QGIS-development-team).
Modified: docs/trunk/english_us/user_guide/plugins_georeferencer.tex
===================================================================
--- docs/trunk/english_us/user_guide/plugins_georeferencer.tex 2008-08-10 19:44:20 UTC (rev 9044)
+++ docs/trunk/english_us/user_guide/plugins_georeferencer.tex 2008-08-11 02:12:11 UTC (rev 9045)
@@ -16,7 +16,7 @@
cd spearfish_toposheet
\end{verbatim}
-The next step is to start QGIS, load the georeferencer plugin and select the file spearfish\_topo24.tif.
+The next step is to start QGIS, load the georeferencer plugin and select the file \filename{spearfish\_topo24.tif}.
%\begin{figure}[ht]
%\begin{center}
@@ -50,14 +50,18 @@
%\end{center}
%\end{figure}
-For this example we use the second option and enter the coordinates for the selected points with the help of the \textsl{roads} map provided with the \textsl{spearfish60} location from: \url{http://grass.osgeo.org/sampledata/spearfish\_grass60data-0.3.tar.gz}
+For this example we use the second option and enter the coordinates for the selected points with the help of the \filename{roads} map provided with the \filename{spearfish60} location from: \url{http://grass.osgeo.org/sampledata/spearfish\_grass60data-0.3.tar.gz}
-If you don't know how to integrate the spearfish60 location with the GRASS plugin, information are provided in Section \ref{sec:grass}.
+If you don't know how to integrate the \filename{spearfish60} location with the GRASS plugin, information are provided in Section \ref{sec:grass}.
As you can see in Figure \ref{fig:choose_points}, the georeferencer provides buttons to zoom, pan, add and delete points in the image.
After you added enough points to the image you need to select the transformation type for the georeferencing process and save the resulting world file together with the Tiff.
-In our example we choose linear transformation although a Helmert transformation might be sufficient as well.
+In our example we choose
+\selectstring{Transform type}{linear transformation}
+although a
+\selectstring{Transform type}{Helmert transformation}
+might be sufficient as well.
\begin{Tip}\caption{\textsc{Choosing the transformation type}}
@@ -66,9 +70,9 @@
If your image is contorted you will need to use software that provides 2nd or 3rd order polynomial transformation, e.g. GRASS GIS.}
\end{Tip}
-The points we added to the map will be stored in a \textsl{spearfish\_topo24.tif.points} file together with the raster image.
+The points we added to the map will be stored in a \filename{spearfish\_topo24.tif.points} file together with the raster image.
This allows us to reopen the georeferencer plugin and to add new points or delete existing ones to optimize the result.
-The \textsl{spearfish\_topo24.tif.points} file of this example shows the points:
+The \filename{spearfish\_topo24.tif.points} file of this example shows the points:
\begin{verbatim}
mapX mapY pixelX pixelY
@@ -81,7 +85,7 @@
We used 5 coordinate points to georeference the raster image.
To get correct results it is important to disperse the points regulary in the image.
-Finally we check the result and load the new georeferenced map \textsl{spearfish\_topo24.tif} and overlay it with the map \textsl{roads} of the spearfish60 location.
+Finally we check the result and load the new georeferenced map \filename{spearfish\_topo24.tif} and overlay it with the map \filename{roads} of the \filename{spearfish60} location.
%\begin{figure}[ht]
%\begin{center}
Modified: docs/trunk/english_us/user_guide/plugins_gps.tex
===================================================================
--- docs/trunk/english_us/user_guide/plugins_gps.tex 2008-08-10 19:44:20 UTC (rev 9044)
+++ docs/trunk/english_us/user_guide/plugins_gps.tex 2008-08-11 02:12:11 UTC (rev 9045)
@@ -99,16 +99,16 @@
The name will be listed in the device menus in the upload and download windows, and can be any string.
The download command is the command that is used to download data from the device to a GPX file.
This will probably be a GPSBabel command, but you can use any other command line program that can create a GPX file.
-QGIS will replace the keywords \emph{\%type}, \emph{\%in}, and \emph{\%out} when it runs the command.
+QGIS will replace the keywords \usertext{\%type}, \usertext{\%in}, and \usertext{\%out} when it runs the command.
-\emph{\%type} will be replaced by {}``-w'' if you are downloading waypoints, {}``-r'' if you are downloading routes and {}``-t'' if you are downloading tracks.
+\usertext{\%type} will be replaced by {}``\usertext{-w}'' if you are downloading waypoints, {}``\usertext{-r}'' if you are downloading routes and {}``\usertext{-t}'' if you are downloading tracks.
These are command line options that tell GPSBabel which feature type to download.
-\emph{\%in} will be replaced by the port name that you choose in the download window and \emph{\%out} will be replaced by the name you choose for the GPX file that the downloaded data should be stored in.
-So if you create a device type with the download command {}``gpsbabel \%type -i garmin -o gpx \%in \%out'' (this is actually the download command for the predefined device type {}``Garmin serial'') and then use it to download waypoints from port {}``/dev/ttyS0'' to the file {}``output.gpx'', QGIS will replace the keywords and run the command {}``gpsbabel -w -i garmin -o gpx /dev/ttyS0 output.gpx''.
+\usertext{\%in} will be replaced by the port name that you choose in the download window and \usertext{\%out} will be replaced by the name you choose for the GPX file that the downloaded data should be stored in.
+So if you create a device type with the download command {}``\usertext{gpsbabel \%type -i garmin -o gpx \%in \%out}'' (this is actually the download command for the predefined device type \selectstring{GPS device:}{Garmin serial})and then use it to download waypoints from port {}``\usertext{/dev/ttyS0}'' to the file {}``\usertext{output.gpx}'', QGIS will replace the keywords and run the command {}``\usertext{gpsbabel -w -i garmin -o gpx /dev/ttyS0 output.gpx}''.
The upload command is the command that is used to upload data to the device.
-The same keywords are used, but \emph{\%in} is now replaced by the name of the GPX file for the layer that is being uploaded, and \emph{\%out} is replaced by the port name.
+The same keywords are used, but \usertext{\%in} is now replaced by the name of the GPX file for the layer that is being uploaded, and \usertext{\%out} is replaced by the port name.
You can learn more about GPSBabel and it's available command line options at \url{http://www.gpsbabel.org}
Modified: docs/trunk/english_us/user_guide/plugins_python.tex
===================================================================
--- docs/trunk/english_us/user_guide/plugins_python.tex 2008-08-10 19:44:20 UTC (rev 9044)
+++ docs/trunk/english_us/user_guide/plugins_python.tex 2008-08-11 02:12:11 UTC (rev 9045)
@@ -16,7 +16,7 @@
\end{itemize}
Each Python plugin is contained in its own directory.
-When QGIS starts up it will scan each subdirectory in \textsl{share/qgis/python/plugins} and initialize any plugins it finds.
+When QGIS starts up it will scan each subdirectory in \filename{share/qgis/python/plugins} and initialize any plugins it finds.
Once that's done, the plugin will show up in the \dropmenuopttwo{mActionShowPluginManager}{Plugin Manager...}
Let's create a plugin to fill a gap in the QGIS interface.
@@ -26,14 +26,14 @@
\subsubsection{Setting up the Structure}
The first thing we need to do is set up the structure for our plugin.
In this example we'll be developing our plugin on \nix{Linux} but the method is the same, just adapt some of the file system commands as appropriate for your platform.
-QGIS is installed in a directory named \textsl{qgis} in our home directory.
+QGIS is installed in a directory named \filename{qgis} in our home directory.
Let's create the directory for the plugin.
\begin{verbatim}
mkdir ~/qgis/share/qgis/python/plugins/new_layer
\end{verbatim}
-To get started, we need to create the following files in the \textsl{new\_layer} directory (we'll need some additional files in a bit):
+To get started, we need to create the following files in the \filename{new\_layer} directory (we'll need some additional files in a bit):
\begin{verbatim}
__init__.py
@@ -44,8 +44,8 @@
\subsubsection{Making the Plugin Recognizable}
-Initializing the plugin is done in the \textsl{\_\_init\_\_.py} script.
-For our \textsl{NewLayer} plugin the script contains:
+Initializing the plugin is done in the \filename{\_\_init\_\_.py} script.
+For our \filename{NewLayer} plugin the script contains:
\begin{verbatim}
1 # load NewLayer class from file newlayer.py
@@ -62,12 +62,12 @@
The mandatory things a plugin must return are a name, description, and version, all of which are implemented in our script above.
Each method simply returns a string with the appropriate information.
-The other requirement is the \textsl{classFactory} method that must return a reference to the plugin itself (line 10), after receiving the \textbf{iface} object as an argument.
+The other requirement is the \method{classFactory} method that must return a reference to the plugin itself (line 10), after receiving the \object{iface} object as an argument.
With this simple code, QGIS will recognize our script as a plugin.
\subsubsection{Resources}
-In order to have a nice icon for our plugin, we need a resources file which we'll name \textsl{resources.qrc}.
+In order to have a nice icon for our plugin, we need a resources file which we'll name \filename{resources.qrc}.
This is just a simple XML file that defines the icon resource:
\begin{verbatim}
@@ -79,7 +79,7 @@
\end{verbatim}
The resource file uses a prefix to prevent naming clashes with other plugins - using the name of the plugin is usually sufficient.
-The \textsl{icon.png} file is is just a PNG image that will be used in the toolbar when the plugin is activated.
+The \filename{icon.png} file is is just a PNG image that will be used in the toolbar when the plugin is activated.
You can use any image, as long as it's 22x22 pixels (so it fits on the toolbar).
To turn the resource file into something the plugin can use, it must be compiled using the PyQt resource compiler:
@@ -88,7 +88,7 @@
pyrcc4 -o resources.py resources.qrc
\end{verbatim}
-The \textsl{-o} switch is used to specify the output file.
+The \filename{-o} switch is used to specify the output file.
Now that we have resources, we need a way to collect the information needed for creating a new layer.
\subsubsection{Creating the GUI}
@@ -100,7 +100,7 @@
However, since our time is limited, we'll use another means to collect the information we need to create the table.
This will illustrate the concepts and then you can venture further using the tutorials on the QGIS blog.
-To collect the user input, we'll use the \textsl{QInputDialog} class from the Qt library.
+To collect the user input, we'll use the \classname{QInputDialog} class from the Qt library.
This prompts the user for a single line of input.
While it will make our plugin a little crude, it serves to illustrate the concepts.
@@ -109,7 +109,7 @@
\subsubsection{Creating the Plugin}
Now that we have the preliminaries out of the way, we can get down to writing the code that does the actual work.
-Let's start by looking at the things we need to import and the initialization of the plugin in \textsl{newlayer.py}.
+Let's start by looking at the things we need to import and the initialization of the plugin in \filename{newlayer.py}.
\begin{verbatim}
1 # Import the PyQt and QGIS libraries
@@ -147,27 +147,27 @@
This includes the PyQt libraries, the QGIS core library, and the Python PostgreSQL library psycopg.
Every Python script that uses the QGIS libraries and PyQt needs to import the QtCore and QtGui libraries, as well as the QGIS core library.
This gives us access to the PyQt wrappers for our Qt objects (like our input dialog) and the QGIS core libraries.
-We also need to import the \textsl{resources.py} file we created with the icon definition.
+We also need to import the \filename{resources.py} file we created with the icon definition.
-In line 10 we declare the class \textbf{NewLayer}.
-In the \textsl{\_\_init\_\_} method (lines 12 through 14) our class is initialized and passed the \textbf{iface} object from QGIS via the \textsl{classFactory} method in line 10 of \_\_init\_\_.py.
-We store \textbf{iface} as a member variable so we can use it later.
+In line 10 we declare the class \classname{NewLayer}.
+In the \method{\_\_init\_\_} method (lines 12 through 14) our class is initialized and passed the \object{iface} object from QGIS via the \method{classFactory} method in line 10 of \filename{\_\_init\_\_.py}.
+We store \object{iface} as a member variable so we can use it later.
In lines 16 through 24 we initialize the GUI elements for the plugin.
-In Qt, a \textbf{QAction} is used to create a user interface action that can be used to create both a menu and toolbar item.
+In Qt, a \classname{QAction} is used to create a user interface action that can be used to create both a menu and toolbar item.
In our plugin, we use it for both.
-In line 18 we create the action using our icon resource (note the prefix we specified in \textsl{resources.qrc}).
+In line 18 we create the action using our icon resource (note the prefix we specified in \filename{resources.qrc}).
We also provide some text that will appear when it is used in a menu or during a mouseover, and lastly we need to specify the ``parent''.
In a plugin, the parent is the main window of QGIS.
-The \textbf{iface} object that we stored during initialization allows us to get the reference to the main window in line 19.
+The \object{iface} object that we stored during initialization allows us to get the reference to the main window in line 19.
-Once the action is created, we can add it to both the toolbar and the \textsl{Plugins} menu (lines 23 and 24).
+Once the action is created, we can add it to both the toolbar and the \mainmenuopt{Plugins} menu (lines 23 and 24).
That takes care of initializing the GUI for the plugin.
The other thing we need to do is clean up after ourself when the plugin is unloaded.
-The \textsl{unload} method takes care of this by removing the menu item and the tool from the toolbar (lines 28 and 29).
+The \method{unload} method takes care of this by removing the menu item and the tool from the toolbar (lines 28 and 29).
This takes care of the initialization stuff and getting our plugin to load and unload nicely.
Now let's look at the code that does the actual work.
-It's all contained in the \textsl{run} method.
+It's all contained in the \method{run} method.
\begin{verbatim}
30 def run(self):
@@ -204,7 +204,7 @@
61 con.commit()
\end{verbatim}
-The first thing we need to do is use the \textbf{QInputDialog} to get the name of the table to create.
+The first thing we need to do is use the \classname{QInputDialog} to get the name of the table to create.
This is done in line 32 where we prompt for it.
%\begin{figure}[ht]
@@ -248,7 +248,7 @@
\textsl{dbname=gis\_data user=gsherman}
\end{center}
-To get the DSN, we prompt the user with a \textbf{QInputDialog} in line 47.
+To get the DSN, we prompt the user with a \classname{QInputDialog} in line 47.
%\begin{figure}[ht]
%\begin{center}
@@ -320,7 +320,7 @@
Writing a QGIS plugin in Python is pretty easy.
Some plugins won't require a GUI at all.
For example, you might write a plugin that returns the map coordinates for the point you click on the map.
-Such a plugin wouldn't require any user input and could use a standard Qt \textbf{QMessageBox} to display the result.
+Such a plugin wouldn't require any user input and could use a standard Qt \classname{QMessageBox} to display the result.
You can also write plugins for QGIS in C++, but that's another story.
You can find tutorials on writing QGIS plugins in both C++ and Python on the QGIS blog at:
Modified: docs/trunk/english_us/user_guide/plugins_spit_images/Makefile
===================================================================
--- docs/trunk/english_us/user_guide/plugins_spit_images/Makefile 2008-08-10 19:44:20 UTC (rev 9044)
+++ docs/trunk/english_us/user_guide/plugins_spit_images/Makefile 2008-08-11 02:12:11 UTC (rev 9045)
@@ -11,7 +11,7 @@
# JPG=qgis_icon_new_verylarge.eps\
# nextfile.eps
-PNG=spit.eps\
+PNG=spiticon.eps\
##### TARGETS #####
Added: docs/trunk/english_us/user_guide/plugins_spit_images/spiticon.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/english_us/user_guide/plugins_spit_images/spiticon.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
More information about the QGIS-commit
mailing list