Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into delimited_text_bug_fixes_2
  • Loading branch information
ccrook committed May 1, 2013
2 parents 1fb1c9c + 3c68312 commit 78f5110
Show file tree
Hide file tree
Showing 82 changed files with 5,150 additions and 3,585 deletions.
1 change: 1 addition & 0 deletions doc/AUTHORS
Expand Up @@ -53,3 +53,4 @@ Dave DeHaan <dave.dehaan@sap.com>
Matthias Kuhn <matthias.kuhn at gmx.ch>
Salvatore Larosa <lrssvtml at gmail.com>
Nyall Dawson <nyall.dawson at gmail.com>
Vinayan Parameswaran <vinayan123 at gmail dot com>
64 changes: 32 additions & 32 deletions doc/TRANSLATORS

Large diffs are not rendered by default.

7,100 changes: 4,040 additions & 3,060 deletions i18n/qgis_sv.ts

Large diffs are not rendered by default.

61 changes: 28 additions & 33 deletions python/console/console_editor.py
Expand Up @@ -82,9 +82,6 @@ def __init__(self, parent=None):
# Enable non-ascii chars for editor
self.setUtf8(True)

#self.insertInitText()
self.setLexers()

# Set the default font
font = QFont()
font.setFamily('Courier')
Expand All @@ -102,7 +99,7 @@ def __init__(self, parent=None):
self.setMarginsBackgroundColor(QColor("#f9f9f9"))
self.setCaretLineVisible(True)
self.setCaretLineBackgroundColor(QColor("#fcf3ed"))

# Clickable margin 1 for showing markers
# self.setMarginSensitivity(1, True)
# self.connect(self,
Expand Down Expand Up @@ -172,6 +169,7 @@ def __init__(self, parent=None):
self.uncommentScut.activated.connect(self.parent.pc.uncommentCode)

def settingsEditor(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThresholdEditor", 2).toInt()[0]
radioButtonSource = self.settings.value("pythonConsole/autoCompleteSourceEditor", 'fromAPI').toString()
Expand Down Expand Up @@ -209,6 +207,9 @@ def setLexers(self):
from qgis.core import QgsApplication

self.lexer = QsciLexerPython()
self.lexer.setIndentationWarning(QsciLexerPython.Inconsistent)
self.lexer.setFoldComments(True)
self.lexer.setFoldQuotes(True)

loadFont = self.settings.value("pythonConsole/fontfamilytextEditor", "Monospace").toString()
fontSize = self.settings.value("pythonConsole/fontsizeEditor", 10).toInt()[0]
Expand Down Expand Up @@ -257,6 +258,7 @@ def get_end_pos(self):
def contextMenuEvent(self, e):
menu = QMenu(self)
iconRun = QgsApplication.getThemeIcon("console/iconRunConsole.png")
iconRunScript = QgsApplication.getThemeIcon("console/iconRunScriptConsole.png")
iconCodePad = QgsApplication.getThemeIcon("console/iconCodepadConsole.png")
iconNewEditor = QgsApplication.getThemeIcon("console/iconTabEditorConsole.png")
iconCommentEditor = QgsApplication.getThemeIcon("console/iconCommentEditorConsole.png")
Expand All @@ -274,7 +276,7 @@ def contextMenuEvent(self, e):
runSelected = menu.addAction(iconRun,
"Enter selected",
self.runSelectedCode, 'Ctrl+E')
runScript = menu.addAction(iconRun,
runScript = menu.addAction(iconRunScript,
"Run Script",
self.runScriptCode, 'Shift+Ctrl+E')
menu.addSeparator()
Expand Down Expand Up @@ -343,18 +345,13 @@ def objectListEditor(self):
else:
listObj.show()
self.parent.pc.objectListButton.setChecked(True)

def codepad(self):
import urllib2, urllib
listText = self.selectedText().split('\n')
getCmd = []
for strLine in listText:
if strLine != "":
#if s[0:3] in (">>>", "..."):
# filter for special command (_save,_clear) and comment
if strLine[4] != "_" and strLine[:2] != "##":
strLine.replace(">>> ", "").replace("... ", "")
getCmd.append(unicode(strLine))
getCmd.append(unicode(strLine))
pasteText= u"\n".join(getCmd)
url = 'http://codepad.org'
values = {'lang' : 'Python',
Expand Down Expand Up @@ -387,32 +384,24 @@ def commentEditorCode(self, commentCheck):
if self.hasSelectedText():
startLine, _, endLine, _ = self.getSelection()
for line in range(startLine, endLine + 1):
selCmd = self.text(line)
self.setSelection(line, 0, line, selCmd.length())
self.removeSelectedText()
if commentCheck:
self.insert('#' + selCmd)
self.setCursorPosition(endLine, selCmd.length())
self.insertAt('#', line, 0)
else:
if selCmd.startsWith('#'):
self.insert(selCmd[1:])
else:
self.insert(selCmd)
self.setCursorPosition(endLine, self.text(line).length() - 1)
if not self.text(line).trimmed().startsWith('#'):
continue
self.setSelection(line, self.indentation(line),
line, self.indentation(line) + 1)
self.removeSelectedText()
else:
line, pos = self.getCursorPosition()
selCmd = self.text(line)
self.setSelection(line, 0, line, selCmd.length())
self.removeSelectedText()
if commentCheck:
self.insert('#' + selCmd)
self.setCursorPosition(line, selCmd.length())
self.insertAt('#', line, 0)
else:
if selCmd.startsWith('#'):
self.insert(selCmd[1:])
else:
self.insert(selCmd)
self.setCursorPosition(line, self.text(line).length() - 1)
if not self.text(line).trimmed().startsWith('#'):
return
self.setSelection(line, self.indentation(line),
line, self.indentation(line) + 1)
self.removeSelectedText()
self.endUndoAction()

def createTempFile(self):
Expand All @@ -430,7 +419,13 @@ def _runSubProcess(self, filename, tmp=False):
if dir not in sys.path:
sys.path.append(dir)
try:
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
## set creationflags for runnning command without shell window
if sys.platform.startswith('win'):
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE,
stderr=subprocess.PIPE, stdout=subprocess.PIPE, creationflags=0x08000000)
else:
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE,
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out, _traceback = p.communicate()

## Fix interrupted system call on OSX
Expand Down
4 changes: 1 addition & 3 deletions python/console/console_sci.py
Expand Up @@ -73,9 +73,6 @@ def __init__(self, parent=None):
# Current line visible with special background color
self.setCaretWidth(2)

# Set Python lexer
self.setLexers()

self.settingsShell()

# Don't want to see the horizontal scrollbar at all
Expand Down Expand Up @@ -110,6 +107,7 @@ def __init__(self, parent=None):
self.completion_list_selected)

def settingsShell(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThreshold", 2).toInt()[0]
self.setAutoCompletionThreshold(threshold)
Expand Down
10 changes: 10 additions & 0 deletions python/core/composer/qgscomposeritem.sip
Expand Up @@ -305,6 +305,16 @@ class QgsComposerItem: QObject, QGraphicsRectItem
@note there is not setter since one can't manually set the id*/
QString uuid() const;

/** Gets the background color for this item
* @note introduced in 2.0
*/
const QColor backgroundColor() const;

/** Sets the background color for this item
* @note introduced in 2.0
*/
void setBackgroundColor( const QColor& backgroundColor );

/* Returns the current blending mode for the composer item
@note added in version 1.9*/
const QPainter::CompositionMode blendMode() const;
Expand Down
12 changes: 12 additions & 0 deletions python/core/composer/qgscomposermap.sip
Expand Up @@ -278,6 +278,18 @@ class QgsComposerMap : QgsComposerItem
void setOverviewFrameMapSymbol( QgsFillSymbolV2* symbol /Transfer/ );
QgsFillSymbolV2* overviewFrameMapSymbol();

/* Returns the blending mode for the overview frame
@note added in version 1.9*/
const QPainter::CompositionMode overviewBlendMode() const;
/* Sets the blending mode for the overview frame
@note added in version 1.9*/
void setOverviewBlendMode( const QPainter::CompositionMode blendMode );

/**Sets flag if overview frame should be inverted
@note this function was added in version 1.9*/
void setOverviewInverted( bool inverted );
bool overviewInverted() const;

/**Sets mId to a number not yet used in the composition. mId is kept if it is not in use.
Usually, this function is called before adding the composer map to the composition*/
void assignFreeId();
Expand Down
35 changes: 30 additions & 5 deletions python/core/qgsmaprenderer.sip
Expand Up @@ -152,19 +152,44 @@ class QgsMapRenderer : QObject
QSize outputSize();
QSizeF outputSizeF();

//! transform extent in layer's CRS to extent in output CRS
/**
* @brief transform bounding box from layer's CRS to output CRS
* @see layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle rect ) if you want to transform a rectangle
* @return a bounding box (aligned rectangle) containing the transformed extent
*/
QgsRectangle layerExtentToOutputExtent( QgsMapLayer* theLayer, QgsRectangle extent );

//! transform extent in output CRS to extent in layer's CRS
/**
* @brief transform bounding box from output CRS to layer's CRS
* @see mapToLayerCoordinates( QgsMapLayer* theLayer,QgsRectangle rect ) if you want to transform a rectangle
* @return a bounding box (aligned rectangle) containing the transformed extent
*/
QgsRectangle outputExtentToLayerExtent( QgsMapLayer* theLayer, QgsRectangle extent );

//! transform coordinates from layer's CRS to output CRS
/**
* @brief transform point coordinates from layer's CRS to output CRS
* @return the transformed point
*/
QgsPoint layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint point );

//! transform coordinates from output CRS to layer's CRS
/**
* @brief transform rectangle from layer's CRS to output CRS
* @see layerExtentToOutputExtent() if you want to transform a bounding box
* @return the transformed rectangle
*/
QgsRectangle layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle rect );

/**
* @brief transform point coordinates from output CRS to layer's CRS
* @return the transformed point
*/
QgsPoint mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint point );

//! transform rect's coordinates from output CRS to layer's CRS
/**
* @brief transform rectangle from output CRS to layer's CRS
* @see outputExtentToLayerExtent() if you want to transform a bounding box
* @return the transformed rectangle
*/
QgsRectangle mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRectangle rect );

//! sets whether to use projections for this layer set
Expand Down
3 changes: 0 additions & 3 deletions python/core/raster/qgsrasterbandstats.sip
Expand Up @@ -27,9 +27,6 @@ class QgsRasterBandStats
/*! Compares region, size etc. not collected statistics */
bool contains( const QgsRasterBandStats &s ) const;

/** \brief The name of the band that these stats belong to. */
QString bandName;

/** \brief The gdal band number (starts at 1)*/
int bandNumber;

Expand Down
5 changes: 1 addition & 4 deletions python/core/raster/qgsrasterdataprovider.sip
Expand Up @@ -82,7 +82,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
virtual void setUserNoDataValue( int bandNo, QgsRasterRangeList noData );

/** Get list of user no data value ranges */
virtual QgsRasterRangeList userNoDataValue( int bandNo ) const;
virtual QgsRasterRangeList userNoDataValues( int bandNo ) const;

virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo ) const;

Expand Down Expand Up @@ -181,9 +181,6 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
*/
virtual bool setNoDataValue( int bandNo, double noDataValue );

/**Returns the formats supported by create()*/
virtual QStringList createFormats() const;

/** Remove dataset*/
virtual bool remove();

Expand Down
10 changes: 0 additions & 10 deletions python/core/raster/qgsrasteriterator.sip
Expand Up @@ -4,16 +4,6 @@ class QgsRasterIterator
#include <qgsrasteriterator.h>
%End
public:
//Stores information about reading of a raster band. Columns and rows are in unsampled coordinates
struct RasterPartInfo
{
int currentCol;
int currentRow;
int nCols;
int nRows;
QgsRasterBlock *block;
QgsRasterProjector* prj; //raster projector (or 0 if no reprojection is done)
};

QgsRasterIterator( QgsRasterInterface* input );
~QgsRasterIterator();
Expand Down
5 changes: 3 additions & 2 deletions python/core/raster/qgsrasterlayer.sip
Expand Up @@ -190,7 +190,8 @@ class QgsRasterLayer : QgsMapLayer
QString providerType() const;

/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
double rasterUnitsPerPixel();
double rasterUnitsPerPixelX();
double rasterUnitsPerPixelY();

/** \brief Mutator for contrast enhancement algorithm
* @param theAlgorithm Contrast enhancement algorithm
Expand All @@ -200,7 +201,7 @@ class QgsRasterLayer : QgsMapLayer
* @param theGenerateLookupTableFlag Generate llokup table. */


void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
void setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
QgsRaster::ContrastEnhancementLimits theLimits = QgsRaster::ContrastEnhancementMinMax,
QgsRectangle theExtent = QgsRectangle(),
int theSampleSize = QgsRasterLayer::SAMPLE_SIZE,
Expand Down
6 changes: 3 additions & 3 deletions python/core/raster/qgsrasternuller.sip
Expand Up @@ -21,10 +21,10 @@ class QgsRasterNuller : QgsRasterInterface

QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height ) / Factory /;

void setNoData( QList<QgsRasterNuller::NoData> noData );
void setNoData( int bandNo, QgsRasterRangeList noData );

QList<QgsRasterNuller::NoData> noData() const;
QgsRasterRangeList noData( int bandNo ) const;

/** \brief Set output no data value. */
void setOutputNoData( double noData );
void setOutputNoDataValue( int bandNo, double noData );
};
15 changes: 0 additions & 15 deletions python/core/raster/qgsrasterprojector.sip
Expand Up @@ -50,21 +50,6 @@ class QgsRasterProjector : QgsRasterInterface
/** \brief set maximum source resolution */
void setMaxSrcRes( double theMaxSrcXRes, double theMaxSrcYRes );

/** get source extent */
QgsRectangle srcExtent();

/** get/set source width/height */
int srcRows();
int srcCols();
void setSrcRows( int theRows );
void setSrcCols( int theCols );

/** \brief Get source row and column indexes for current source extent and resolution */
void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol );

int dstRows() const;
int dstCols() const;

QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height ) / Factory /;
};

33 changes: 16 additions & 17 deletions python/core/raster/qgsrasterviewport.sip
Expand Up @@ -4,28 +4,27 @@ struct QgsRasterViewPort
%TypeHeaderCode
#include <qgsrasterviewport.h>
%End
/** \brief Coordinate (in output device coordinate system) of top left corner
* of the part of the raster that is to be rendered.*/
QgsPoint mTopLeftPoint;
/** \brief Coordinate (in output device coordinate system) of bottom right corner
* of the part of the raster that is to be rendered.*/
QgsPoint mBottomRightPoint;

// NOT IN MAP SPACE BUT DEVICE SPACE
/** \brief Coordinate (in geographic coordinate system) of top left corner of the part of the raster that
* is to be rendered.*/
QgsPoint topLeftPoint;
/** \brief Coordinate (in geographic coordinate system) of bottom right corner of the part of the raster that
* is to be rendered.*/
QgsPoint bottomRightPoint;
/** \brief Distance in map units from left edge to right edge for the part of the raster that
* is to be rendered.*/
/** \brief Width, number of columns to be rendered */
int mWidth;
/** \brief Distance in map units from bottom edge to top edge for the part of
* the raster that is to be rendered.*/
/** \brief Height, number of rows to be rendered */
int mHeight;

int drawableAreaXDim;
/** \brief Distance in map units from bottom edge to top edge for the part of the raster that
* is to be rendered.*/
int drawableAreaYDim;

// intersection of current map extent and layer extent
/** \brief Intersection of current map extent and layer extent */
QgsRectangle mDrawnExtent;

// Source coordinate system
/** \brief Source coordinate system */
QgsCoordinateReferenceSystem mSrcCRS;

// Target coordinate system
/** \brief Target coordinate system */
QgsCoordinateReferenceSystem mDestCRS;

};
2 changes: 1 addition & 1 deletion python/gui/qgsrasterlayersaveasdialog.sip
Expand Up @@ -46,7 +46,7 @@ class QgsRasterLayerSaveAsDialog : QDialog
QgsCoordinateReferenceSystem outputCrs();
QStringList createOptions() const;
QgsRectangle outputRectangle() const;
QList<QgsRasterNuller::NoData> noData() const;
QgsRasterRangeList noData() const;

QList< int > pyramidsList() const;
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
Expand Down

0 comments on commit 78f5110

Please sign in to comment.