Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[FEATHRE] attribute action improvements
- add python bindings for attribute actions - support actions as context menu in feature form (ui) - add action types: * generic: commands that should work on all platforms * windows, mac, unix: commands that should work and are only shown on one platform respectively (eg. vim on unix, notepad on windows and textmate on Mac) * python: python strings to be executed instead of a command (eg. qgis.utils.plugins['apluginname'].amethod('[%someattribute%]')) [BUGFIXES] - ogr support for relative filenames fixed - relative filename support also for feature form uis git-svn-id: http://svn.osgeo.org/qgis/trunk@12113 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
Showing
with
407 additions
and 254 deletions.
- +1 −0 python/core/core.sip
- +77 −0 python/core/qgsattributeaction.sip
- +1 −1 python/core/qgsvectorlayer.sip
- +8 −0 src/app/qgisapp.cpp
- +3 −0 src/app/qgisapp.h
- +25 −21 src/app/qgsattributeactiondialog.cpp
- +3 −2 src/app/qgsattributeactiondialog.h
- +2 −0 src/app/qgsattributedialog.h
- +124 −131 src/app/qgsidentifyresults.cpp
- +31 −6 src/app/qgsidentifyresults.h
- +34 −38 src/core/qgsattributeaction.cpp
- +38 −40 src/core/qgsattributeaction.h
- +1 −1 src/core/qgsmaplayer.cpp
- +7 −6 src/core/qgsvectorlayer.cpp
- +52 −8 src/ui/qgsattributeactiondialogbase.ui
@@ -0,0 +1,77 @@ | ||
class QgsAction | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsattributeaction.h" | ||
%End | ||
|
||
public: | ||
enum ActionType | ||
{ | ||
Generic, | ||
GenericPython, | ||
Mac, | ||
Windows, | ||
Unix, | ||
}; | ||
|
||
QgsAction( ActionType type, QString name, QString action, bool capture ); | ||
|
||
//! The name of the action | ||
QString name() const; | ||
|
||
//! The action | ||
QString action() const; | ||
|
||
//! The action type | ||
ActionType type() const; | ||
|
||
//! Whether to capture output for display when this action is run | ||
bool capture() const; | ||
|
||
bool runable() const; | ||
}; | ||
|
||
class QgsAttributeAction | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsattributeaction.h" | ||
%End | ||
public: | ||
QgsAttributeAction(); | ||
|
||
//! Destructor | ||
virtual ~QgsAttributeAction(); | ||
|
||
//! Add an action with the given name and action details. | ||
// Will happily have duplicate names and actions. If | ||
// capture is true, when running the action using doAction(), | ||
// any stdout from the process will be captured and displayed in a | ||
// dialog box. | ||
void addAction( QgsAction::ActionType type, QString name, QString action, bool capture = false ); | ||
|
||
/* | ||
//! Does the action using the given values. defaultValueIndex is an | ||
// index into values which indicates which value in the values vector | ||
// is to be used if the action has a default placeholder. | ||
void doAction( int index, const QList< QPair<QString, QString> > &values, | ||
int defaultValueIndex = 0, void *executePython = 0 ); | ||
*/ | ||
|
||
//! Removes all actions | ||
void clearActions(); | ||
|
||
//! Expands the given action, replacing all %'s with the value as | ||
// given. | ||
static QString expandAction( QString action, const QList< QPair<QString, QString> > &values, | ||
uint defaultValueIndex ); | ||
|
||
//! Writes the actions out in XML format | ||
bool writeXML( QDomNode& layer_node, QDomDocument& doc ) const; | ||
|
||
//! Reads the actions in in XML format | ||
bool readXML( const QDomNode& layer_node ); | ||
|
||
//! interface to inherited methods from QList<QgsAction> | ||
const QgsAction &at( int idx ); | ||
const int size(); | ||
}; |
Oops, something went wrong.