mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Merge pull request #3624 from ghtmtt/master
[processing] porting some small fixes to master
This commit is contained in:
commit
f0f70a5d9a
@ -35,7 +35,7 @@ import subprocess
|
|||||||
from qgis.PyQt.QtCore import QSettings, QCoreApplication
|
from qgis.PyQt.QtCore import QSettings, QCoreApplication
|
||||||
from processing.core.ProcessingConfig import ProcessingConfig
|
from processing.core.ProcessingConfig import ProcessingConfig
|
||||||
from processing.core.ProcessingLog import ProcessingLog
|
from processing.core.ProcessingLog import ProcessingLog
|
||||||
from processing.tools.system import userFolder, isWindows, mkdir
|
from processing.tools.system import userFolder, isWindows, mkdir, getTempFilenameInTempFolder
|
||||||
|
|
||||||
|
|
||||||
class RUtils(object):
|
class RUtils(object):
|
||||||
|
@ -150,7 +150,7 @@ class ListMultiSelectWidget(QGroupBox):
|
|||||||
|
|
||||||
def _setupUI(self):
|
def _setupUI(self):
|
||||||
self.setSizePolicy(
|
self.setSizePolicy(
|
||||||
QSizePolicy.Preferred, QSizePolicy.Ignored)
|
QSizePolicy.Preferred, QSizePolicy.Preferred)
|
||||||
|
|
||||||
self.setMinimumHeight(180)
|
self.setMinimumHeight(180)
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
"""
|
"""
|
||||||
from builtins import str
|
|
||||||
|
|
||||||
__author__ = 'Alexander Bruy'
|
__author__ = 'Alexander Bruy'
|
||||||
__date__ = 'December 2012'
|
__date__ = 'December 2012'
|
||||||
@ -98,8 +97,8 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
self.btnPaste.clicked.connect(self.editor.paste)
|
self.btnPaste.clicked.connect(self.editor.paste)
|
||||||
self.btnUndo.clicked.connect(self.editor.undo)
|
self.btnUndo.clicked.connect(self.editor.undo)
|
||||||
self.btnRedo.clicked.connect(self.editor.redo)
|
self.btnRedo.clicked.connect(self.editor.redo)
|
||||||
self.btnIncreaseFont.clicked.connect(self.increaseFontSize)
|
self.btnIncreaseFont.clicked.connect(self.editor.zoomIn)
|
||||||
self.btnDecreaseFont.clicked.connect(self.decreaseFontSize)
|
self.btnDecreaseFont.clicked.connect(self.editor.zoomOut)
|
||||||
self.editor.textChanged.connect(lambda: self.setHasChanged(True))
|
self.editor.textChanged.connect(lambda: self.setHasChanged(True))
|
||||||
|
|
||||||
self.alg = alg
|
self.alg = alg
|
||||||
@ -139,15 +138,6 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
|
|
||||||
self.editor.setLexerType(self.algType)
|
self.editor.setLexerType(self.algType)
|
||||||
|
|
||||||
def increaseFontSize(self):
|
|
||||||
font = self.editor.defaultFont
|
|
||||||
self.editor.setFonts(font.pointSize() + 1)
|
|
||||||
self.editor.initLexer()
|
|
||||||
|
|
||||||
def decreaseFontSize(self):
|
|
||||||
font = self.editor.defaultFont
|
|
||||||
self.editor.setFonts(font.pointSize() - 1)
|
|
||||||
self.editor.initLexer()
|
|
||||||
|
|
||||||
def showSnippets(self, evt):
|
def showSnippets(self, evt):
|
||||||
popupmenu = QMenu()
|
popupmenu = QMenu()
|
||||||
@ -173,9 +163,9 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
def editHelp(self):
|
def editHelp(self):
|
||||||
if self.alg is None:
|
if self.alg is None:
|
||||||
if self.algType == self.SCRIPT_PYTHON:
|
if self.algType == self.SCRIPT_PYTHON:
|
||||||
alg = ScriptAlgorithm(None, str(self.editor.text()))
|
alg = ScriptAlgorithm(None, self.editor.text())
|
||||||
elif self.algType == self.SCRIPT_R:
|
elif self.algType == self.SCRIPT_R:
|
||||||
alg = RAlgorithm(None, str(self.editor.text()))
|
alg = RAlgorithm(None, self.editor.text())
|
||||||
else:
|
else:
|
||||||
alg = self.alg
|
alg = self.alg
|
||||||
|
|
||||||
@ -200,7 +190,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
scriptDir = RUtils.RScriptsFolders()[0]
|
scriptDir = RUtils.RScriptsFolders()[0]
|
||||||
filterName = self.tr('Processing R script (*.rsx)')
|
filterName = self.tr('Processing R script (*.rsx)')
|
||||||
|
|
||||||
self.filename, selected_filter = QFileDialog.getOpenFileName(
|
self.filename = QFileDialog.getOpenFileName(
|
||||||
self, self.tr('Open script'), scriptDir, filterName)
|
self, self.tr('Open script'), scriptDir, filterName)
|
||||||
|
|
||||||
if self.filename == '':
|
if self.filename == '':
|
||||||
@ -231,9 +221,9 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
scriptDir = RUtils.RScriptsFolders()[0]
|
scriptDir = RUtils.RScriptsFolders()[0]
|
||||||
filterName = self.tr('Processing R script (*.rsx)')
|
filterName = self.tr('Processing R script (*.rsx)')
|
||||||
|
|
||||||
self.filename, filter = QFileDialog.getSaveFileName(self,
|
self.filename = str(QFileDialog.getSaveFileName(self,
|
||||||
self.tr('Save script'), scriptDir,
|
self.tr('Save script'), scriptDir,
|
||||||
filterName)
|
filterName))
|
||||||
|
|
||||||
if self.filename:
|
if self.filename:
|
||||||
if self.algType == self.SCRIPT_PYTHON and \
|
if self.algType == self.SCRIPT_PYTHON and \
|
||||||
@ -243,7 +233,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
not self.filename.lower().endswith('.rsx'):
|
not self.filename.lower().endswith('.rsx'):
|
||||||
self.filename += '.rsx'
|
self.filename += '.rsx'
|
||||||
|
|
||||||
text = str(self.editor.text())
|
text = self.editor.text()
|
||||||
if self.alg is not None:
|
if self.alg is not None:
|
||||||
self.alg.script = text
|
self.alg.script = text
|
||||||
try:
|
try:
|
||||||
@ -273,10 +263,10 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
|
|
||||||
def runAlgorithm(self):
|
def runAlgorithm(self):
|
||||||
if self.algType == self.SCRIPT_PYTHON:
|
if self.algType == self.SCRIPT_PYTHON:
|
||||||
alg = ScriptAlgorithm(None, str(self.editor.text()))
|
alg = ScriptAlgorithm(None, self.editor.text())
|
||||||
alg.provider = algList.getProviderFromName('script')
|
alg.provider = algList.getProviderFromName('script')
|
||||||
if self.algType == self.SCRIPT_R:
|
if self.algType == self.SCRIPT_R:
|
||||||
alg = RAlgorithm(None, str(self.editor.text()))
|
alg = RAlgorithm(None, self.editor.text())
|
||||||
alg.provider = algList.getProviderFromName('r')
|
alg.provider = algList.getProviderFromName('r')
|
||||||
|
|
||||||
dlg = alg.getCustomParametersDialog()
|
dlg = alg.getCustomParametersDialog()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user