Skip to content
Permalink
Browse files

Merge branch 'master' into delimited_text_bug_fixes_2

  • Loading branch information
ccrook committed Apr 29, 2013
2 parents 2232c3d + 1959182 commit 18786ad7d5aea3dfbd0ed7ddea34f00bb844c135
Showing with 12,940 additions and 8,950 deletions.
  1. +23 −23 doc/TRANSLATORS
  2. +3,916 −2,958 i18n/qgis_da_DK.ts
  3. +317 −271 i18n/qgis_de.ts
  4. +3,944 −3,117 i18n/qgis_fr.ts
  5. +3,053 −2,123 i18n/qgis_gl_ES.ts
  6. +2 −2 ms-windows/osgeo4w/browser.bat.tmpl
  7. +4 −4 ms-windows/osgeo4w/package-nightly.cmd
  8. +4 −4 ms-windows/osgeo4w/package.cmd
  9. +1 −1 ms-windows/osgeo4w/qgis.bat.tmpl
  10. +2 −2 python/console/console.py
  11. +120 −69 python/console/console_editor.py
  12. +13 −7 python/console/console_output.py
  13. +38 −15 python/console/console_sci.py
  14. +96 −30 python/console/console_settings.py
  15. +460 −202 python/console/console_settings.ui
  16. +51 −0 python/gui/qgisinterface.sip
  17. +15 −6 python/plugins/GdalTools/tools/doRasterize.py
  18. +155 −13 python/plugins/GdalTools/tools/widgetRasterize.ui
  19. +4 −4 python/plugins/plugin_installer/installer_data.py
  20. +3 −3 python/plugins/plugin_installer/metadata.txt
  21. +11 −7 python/plugins/sextante/SextantePlugin.py
  22. +31 −21 python/plugins/sextante/commander/CommanderWindow.py
  23. +1 −1 python/plugins/sextante/gui/HistoryDialog.py
  24. +81 −4 python/plugins/sextante/gui/help/algclasssification.txt
  25. +1 −1 python/plugins/sextante/otb/OTBAlgorithm.py
  26. +0 −21 python/plugins/sextante/otb/description/RadiometricVegetationIndices.txt
  27. +0 −20 python/plugins/sextante/otb/description/RadiometricWaterIndices.txt
  28. +17 −0 resources/function_help/color_cmyk-en_US
  29. +18 −0 resources/function_help/color_cmyka-en_US
  30. +16 −0 resources/function_help/color_hsl-en_US
  31. +17 −0 resources/function_help/color_hsla-en_US
  32. +16 −0 resources/function_help/color_hsv-en_US
  33. +17 −0 resources/function_help/color_hsva-en_US
  34. +14 −0 resources/function_help/regexp_match-en_US
  35. +4 −4 resources/function_help/regexp_replace-en_US
  36. +25 −0 src/app/qgisapp.cpp
  37. +45 −0 src/app/qgisapp.h
  38. +25 −0 src/app/qgisappinterface.cpp
  39. +45 −0 src/app/qgisappinterface.h
  40. +149 −1 src/core/qgsexpression.cpp
  41. +51 −0 src/gui/qgisinterface.h
  42. +0 −2 src/gui/qgsrubberband.cpp
  43. +10 −0 tests/src/core/testqgsexpression.cpp
  44. +19 −14 tests/src/core/testziplayer.cpp
  45. +1 −0 tests/src/gui/CMakeLists.txt
  46. +105 −0 tests/src/gui/testqgsrubberband.cpp
  47. BIN tests/testdata/zip/testtar.tgz
  48. BIN tests/testdata/zip/testzip.zip

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1,7 +1,7 @@
@echo off
call "~dp0\o4w_env.bat
call "%~dp0\o4w_env.bat"
call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/@package@
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\bin\@package@-browser.exe %*
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\bin\@package@-browser-bin.exe %*
@@ -174,14 +174,14 @@ REM del %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py

touch exclude

move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
apps/%PACKAGENAME% ^
bin/%PACKAGENAME%.exe ^
bin/%PACKAGENAME%-browser.exe ^
bin/%PACKAGENAME%-bin.exe ^
bin/%PACKAGENAME%-browser-bin.exe ^
bin/%PACKAGENAME%.bat.tmpl ^
bin/%PACKAGENAME%-browser.bat.tmpl ^
apps/qt4/plugins/sqldrivers/qsqlocispatial.dll ^
@@ -224,13 +224,13 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
>>%LOG% 2>&1
if errorlevel 1 goto error

move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"bin/%PACKAGENAME%-browser.exe" ^
"bin/%PACKAGENAME%.exe" ^
"bin/%PACKAGENAME%-browser-bin.exe" ^
"bin/%PACKAGENAME%-bin.exe" ^
"apps/%PACKAGENAME%/bin/qgis.reg.tmpl" ^
"apps/%PACKAGENAME%/i18n/" ^
"apps/%PACKAGENAME%/icons/" ^
@@ -4,4 +4,4 @@ call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/@package@
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\bin\@package@.exe %*
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\bin\@package@-bin.exe %*
@@ -606,9 +606,9 @@ def openSettings(self):
self.options.exec_()

def prefChanged(self):
self.shell.refreshLexerProperties()
self.shell.settingsShell()
self.shellOut.refreshLexerProperties()
self.tabEditorWidget.changeFont()
self.tabEditorWidget.refreshSettingsEditor()

def callWidgetMessageBar(self, text):
self.shellOut.widgetMessageBar(iface, text)
@@ -77,6 +77,8 @@ def __init__(self, parent=None):
super(Editor,self).__init__(parent)
self.parent = parent

self.settings = QSettings()

# Enable non-ascii chars for editor
self.setUtf8(True)

@@ -113,9 +115,6 @@ def __init__(self, parent=None):

self.setMinimumHeight(120)
#self.setMinimumWidth(300)

self.setAutoCompletionThreshold(2)
self.setAutoCompletionSource(self.AcsAPIs)

# Folding
self.setFolding(QsciScintilla.PlainFoldStyle)
@@ -131,6 +130,8 @@ def __init__(self, parent=None):
self.setWhitespaceVisibility(QsciScintilla.WsVisibleAfterIndent)
#self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)

self.settingsEditor()

# Annotations
#self.setAnnotationDisplay(QsciScintilla.ANNOTATION_BOXED)

@@ -155,7 +156,7 @@ def __init__(self, parent=None):
## New QShortcut = ctrl+space/ctrl+alt+space for Autocomplete
self.newShortcutCS = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Space), self)
self.newShortcutCS.setContext(Qt.WidgetShortcut)
self.newShortcutCS.activated.connect(self.autoComplete)
self.newShortcutCS.activated.connect(self.autoCompleteKeyBinding)
self.runScut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_E), self)
self.runScut.setContext(Qt.WidgetShortcut)
self.runScut.activated.connect(self.runSelectedCode)
@@ -169,9 +170,33 @@ def __init__(self, parent=None):
self.uncommentScut = QShortcut(QKeySequence(Qt.SHIFT + Qt.CTRL + Qt.Key_3), self)
self.uncommentScut.setContext(Qt.WidgetShortcut)
self.uncommentScut.activated.connect(self.parent.pc.uncommentCode)

def autoComplete(self):
self.autoCompleteFromAll()

def settingsEditor(self):
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThresholdEditor", 2).toInt()[0]
radioButtonSource = self.settings.value("pythonConsole/autoCompleteSourceEditor", 'fromAPI').toString()
autoCompEnabled = self.settings.value("pythonConsole/autoCompleteEnabledEditor", True).toBool()
self.setAutoCompletionThreshold(threshold)
if autoCompEnabled:
if radioButtonSource == 'fromDoc':
self.setAutoCompletionSource(self.AcsDocument)
elif radioButtonSource == 'fromAPI':
self.setAutoCompletionSource(self.AcsAPIs)
elif radioButtonSource == 'fromDocAPI':
self.setAutoCompletionSource(self.AcsAll)
else:
self.setAutoCompletionSource(self.AcsNone)

def autoCompleteKeyBinding(self):
radioButtonSource = self.settings.value("pythonConsole/autoCompleteSourceEditor").toString()
autoCompEnabled = self.settings.value("pythonConsole/autoCompleteEnabledEditor").toBool()
if autoCompEnabled:
if radioButtonSource == 'fromDoc':
self.autoCompleteFromDocument()
elif radioButtonSource == 'fromAPI':
self.autoCompleteFromAPIs()
elif radioButtonSource == 'fromDocAPI':
self.autoCompleteFromAll()

def on_margin_clicked(self, nmargin, nline, modifiers):
# Toggle marker for the line the margin was clicked on
@@ -180,16 +205,13 @@ def on_margin_clicked(self, nmargin, nline, modifiers):
else:
self.markerAdd(nline, self.ARROW_MARKER_NUM)

def refreshLexerProperties(self):
self.setLexers()

def setLexers(self):
from qgis.core import QgsApplication

self.lexer = QsciLexerPython()
settings = QSettings()
loadFont = settings.value("pythonConsole/fontfamilytext", "Monospace").toString()
fontSize = settings.value("pythonConsole/fontsize", 10).toInt()[0]

loadFont = self.settings.value("pythonConsole/fontfamilytextEditor", "Monospace").toString()
fontSize = self.settings.value("pythonConsole/fontsizeEditor", 10).toInt()[0]

font = QFont(loadFont)
font.setFixedPitch(True)
@@ -208,11 +230,11 @@ def setLexers(self):
self.lexer.setFont(font, 4)

self.api = QsciAPIs(self.lexer)
chekBoxAPI = settings.value("pythonConsole/preloadAPI", True).toBool()
chekBoxAPI = self.settings.value("pythonConsole/preloadAPI", True).toBool()
if chekBoxAPI:
self.api.loadPrepared( QgsApplication.pkgDataPath() + "/python/qsci_apis/pyqgis_master.pap" )
else:
apiPath = settings.value("pythonConsole/userAPI").toStringList()
apiPath = self.settings.value("pythonConsole/userAPI").toStringList()
for i in range(0, len(apiPath)):
self.api.load(QString(unicode(apiPath[i])))
self.api.prepare()
@@ -239,6 +261,7 @@ def contextMenuEvent(self, e):
iconNewEditor = QgsApplication.getThemeIcon("console/iconTabEditorConsole.png")
iconCommentEditor = QgsApplication.getThemeIcon("console/iconCommentEditorConsole.png")
iconUncommentEditor = QgsApplication.getThemeIcon("console/iconUncommentEditorConsole.png")
iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png")
hideEditorAction = menu.addAction("Hide Editor",
self.hideEditor)
menu.addSeparator()
@@ -282,6 +305,10 @@ def contextMenuEvent(self, e):
selectAllAction = menu.addAction("Select All",
self.selectAll,
QKeySequence.SelectAll)
menu.addSeparator()
settingsDialog = menu.addAction(iconSettings,
"Settings",
self.parent.pc.openSettings)
pasteAction.setEnabled(False)
codePadAction.setEnabled(False)
cutAction.setEnabled(False)
@@ -352,15 +379,13 @@ def codepad(self):
self.parent.pc.callWidgetMessageBarEditor(msgText + str(e.args))

def hideEditor(self):
self.parent.pc.widgetEditor.hide()
self.parent.pc.listClassMethod.hide()
self.parent.pc.splitterObj.hide()
self.parent.pc.showEditorButton.setChecked(False)

def commentEditorCode(self, commentCheck):
self.beginUndoAction()
if self.hasSelectedText():
startLine, _, endLine, _ = self.getSelection()
self.beginUndoAction()
for line in range(startLine, endLine + 1):
selCmd = self.text(line)
self.setSelection(line, 0, line, selCmd.length())
@@ -370,12 +395,12 @@ def commentEditorCode(self, commentCheck):
self.setCursorPosition(endLine, selCmd.length())
else:
if selCmd.startsWith('#'):
self.insert(selCmd[1:])
self.insert(selCmd[1:])
else:
self.insert(selCmd)
self.setCursorPosition(endLine, self.text(line).length() - 1)
else:
line, pos = self.getCursorPosition()
self.beginUndoAction()
selCmd = self.text(line)
self.setSelection(line, 0, line, selCmd.length())
self.removeSelectedText()
@@ -384,61 +409,88 @@ def commentEditorCode(self, commentCheck):
self.setCursorPosition(line, selCmd.length())
else:
if selCmd.startsWith('#'):
self.insert(selCmd[1:])
self.insert(selCmd[1:])
else:
self.insert(selCmd)
self.setCursorPosition(line, self.text(line).length() - 1)
self.endUndoAction()

def createTempFile(self):
import tempfile
fd, path = tempfile.mkstemp()
tmpFileName = path + '.py'
with open(path, "w") as f:
f.write(self.text())
os.close(fd)
os.rename(path, tmpFileName)
return tmpFileName

def runScriptCode(self):
tabWidget = self.parent.mw.currentWidget()
filename = tabWidget.path
def _runSubProcess(self, filename, tmp=False):
dir, name = os.path.split(unicode(filename))
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)
out, _traceback = p.communicate()

## Fix interrupted system call on OSX
if sys.platform == 'darwin':
status = None
while status is None:
try:
status = p.wait()
except OSError, e:
if e.errno == 4:
pass
else:
raise e
if tmp:
name = name + ' [Temporary file saved in ' + dir + ']'
if _traceback:
print "## %s" % datetime.datetime.now()
print "## Script error: %s" % name
sys.stderr.write(_traceback)
p.stderr.close()
else:
print "## %s" % datetime.datetime.now()
print "## Script executed successfully: %s" % name
sys.stdout.write(out)
p.stdout.close()
del p
if tmp:
os.remove(filename)
except IOError, error:
print 'Cannot execute file %s. Error: %s' % (filename, error.strerror)
except:
s = traceback.format_exc()
print '## Error: '
sys.stderr.write(s)

def runScriptCode(self):
autoSave = self.settings.value("pythonConsole/autoSaveScript").toBool()

tabWidget = self.parent.mw.currentWidget()
filename = tabWidget.path

msgEditorBlank = QCoreApplication.translate('PythonConsole',
'Hey, type something for running !')
msgEditorUnsaved = QCoreApplication.translate('PythonConsole',
'You have to save the file before running.')
if filename is None:
if not self.isModified():
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank)
else:
'You have to save the file before running.')
if not autoSave:
if filename is None:
if not self.isModified():
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank)
else:
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved)
return
if self.isModified():
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved)
return
if self.isModified():
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved)
return
return
else:
self._runSubProcess(filename)
else:
try:
p = subprocess.Popen(['python', filename], shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out, traceback = p.communicate()

## Fix interrupted system call on OSX
if sys.platform == 'darwin':
status = None
while status is None:
try:
status = p.wait()
except OSError, e:
if e.errno == 4:
pass
else:
raise e

if traceback:
print "## %s" % datetime.datetime.now()
print "## Script error: %s" % name
sys.stderr.write(traceback)
p.stderr.close()
else:
print "## %s" % datetime.datetime.now()
print "## Script executed successfully: %s" % name
sys.stdout.write(out)
p.stdout.close()
del p
#execfile(unicode(filename))
except IOError, error:
print 'Cannot execute file %s. Error: %s' % (filename, error.strerror)
tmpFile = self.createTempFile()
self._runSubProcess(tmpFile, True)

def runSelectedCode(self):
cmd = self.selectedText()
@@ -827,18 +879,17 @@ def listObject(self, tab):
s = traceback.format_exc()
print '## Error: '
sys.stderr.write(s)

def changeFont(self):
def refreshSettingsEditor(self):
countTab = self.count()
for i in range(countTab):
self.widget(i).newEditor.refreshLexerProperties()
self.widget(i).newEditor.settingsEditor()

def changeLastDirPath(self, tab):
tabWidget = self.widget(tab)
settings = QSettings()
settings.setValue("pythonConsole/lastDirPath", QVariant(tabWidget.path))
self.settings.setValue("pythonConsole/lastDirPath", QVariant(tabWidget.path))

def widgetMessageBar(self, iface, text):
timeout = iface.messageTimeout()
currWidget = self.currentWidget()
currWidget.infoBar.pushMessage('Editor', text, QgsMessageBar.INFO, timeout)
currWidget.infoBar.pushMessage(text, QgsMessageBar.INFO, timeout)

0 comments on commit 18786ad

Please sign in to comment.
You can’t perform that action at this time.