Exemple #1
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_merge.py")

        self.inSelector.setType(self.inSelector.FILE)
        self.outSelector.setType(self.outSelector.FILE)
        self.recurseCheck.hide()
        # use this for approx. previous UI
        #self.creationOptionsWidget.setType(QgsRasterFormatSaveOptionsWidget.Table)

        self.outputFormat = Utils.fillRasterOutputFormat()
        self.extent = None

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.noDataSpin, "valueChanged", self.noDataCheck),
            (self.inputDirCheck, "stateChanged"),
            (self.recurseCheck, "stateChanged", self.inputDirCheck),
            (self.separateCheck, "stateChanged"),
            (self.pctCheck, "stateChanged"),
            (self.intersectCheck, "stateChanged"),
            (self.creationOptionsWidget, "optionsChanged"),
            (self.creationOptionsGroupBox, "toggled")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFilesEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.intersectCheck.toggled.connect(self.refreshExtent)
        self.inputDirCheck.stateChanged.connect(self.switchToolMode)
        self.inSelector.filenameChanged.connect(self.refreshExtent)
Exemple #2
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.resolutions = ("highest", "average", "lowest")

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdalbuildvrt")

        self.inSelector.setType(self.inSelector.FILE)
        self.outSelector.setType(self.outSelector.FILE)
        self.recurseCheck.hide()
        self.visibleRasterLayers = []

        self.setParamsStatus(
            [
                (self.inSelector, "filenameChanged"),
                (self.outSelector, "filenameChanged"),
                (self.resolutionComboBox, "currentIndexChanged", self.resolutionCheck),
                (self.noDataEdit, "textChanged", self.srcNoDataCheck, 1700),
                (self.inputDirCheck, "stateChanged"),
                (self.separateCheck, "stateChanged", None, 1700),
                (self.targetSRSEdit, "textChanged", self.targetSRSCheck),
                (self.allowProjDiffCheck, "stateChanged", None, 1700),
                (self.recurseCheck, "stateChanged", self.inputDirCheck),
                (self.inputSelLayersCheck, "stateChanged")
            ]
        )

        self.inSelector.selectClicked.connect(self.fillInputFilesEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.inputDirCheck.stateChanged.connect(self.switchToolMode)
        self.inputSelLayersCheck.stateChanged.connect(self.switchLayerMode)
        self.iface.mapCanvas().layersChanged.connect(self.switchLayerMode)
        self.selectTargetSRSButton.clicked.connect(self.fillTargetSRSEdit)
Exemple #3
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "rgb2pct.py")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.colorsSpin.setValue(2)
        self.progressBar.setValue(0)

        self.progressBar.hide()
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.colorsSpin, "valueChanged", self.colorsCheck),
            (self.bandSpin, "valueChanged", self.bandCheck, "-1"
             )  # hide this option
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
Exemple #4
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "rgb2pct.py")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.colorsSpin.setValue(2)
        self.progressBar.setValue(0)

        self.progressBar.hide()
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.colorsSpin, "valueChanged", self.colorsCheck),
            (self.bandSpin, "valueChanged", self.bandCheck, "-1")   # hide this option
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
Exemple #5
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdalinfo")

        # we don't need load to canvas functionality
        self.base.loadCheckBox.hide()
        # make window large
        self.base.resize(400, 360)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.suppressGCPCheck, "stateChanged"),
            (self.suppressMDCheck, "stateChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)

        # helper actions for copying info output
        self.copyLine = QAction(self.tr("Copy"), self)
        self.copyLine.triggered.connect(self.doCopyLine)
        self.copyAll = QAction(self.tr("Copy all"), self)
        self.copyAll.triggered.connect(self.doCopyAll)
Exemple #6
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdal_fillnodata.py")

        self.inSelector.setType(self.inSelector.FILE_LAYER)
        self.outSelector.setType(self.outSelector.FILE)
        self.maskSelector.setType(self.maskSelector.FILE)

        self.progressBar.setValue(0)
        self.progressBar.hide()
        self.formatLabel.hide()
        self.formatCombo.hide()

        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.maskSelector, "filenameChanged", self.maskCheck),
            (self.distanceSpin, "valueChanged", self.distanceCheck),
            (self.smoothSpin, "valueChanged", self.smoothCheck),
            (self.bandSpin, "valueChanged", self.bandCheck),
            (self.nomaskCheck, "stateChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFile)
        self.maskSelector.selectClicked.connect(self.fillMaskFile)
        self.batchCheck.stateChanged.connect(self.switchToolMode)

        # add raster filters to combo
        self.formatCombo.addItems(Utils.FileFilter.allRastersFilter().split(";;"))
Exemple #7
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "pct2rgb.py")

        # we use one widget for two tools
        self.base.setWindowTitle(self.tr("Convert paletted image to RGB"))

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.bandSpin.setValue(1)
        self.progressBar.setValue(0)

        self.progressBar.hide()
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.colorsSpin, "valueChanged", self.colorsCheck, "-1"),   # hide this option
            (self.bandSpin, "valueChanged", self.bandCheck)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
Exemple #8
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_merge.py")

        self.inSelector.setType(self.inSelector.FILE)
        self.outSelector.setType(self.outSelector.FILE)
        self.recurseCheck.hide()
        # use this for approx. previous UI
        #self.creationOptionsWidget.setType(QgsRasterFormatSaveOptionsWidget.Table)

        self.outputFormat = Utils.fillRasterOutputFormat()
        self.extent = None

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.noDataSpin, "valueChanged", self.noDataCheck),
            (self.inputDirCheck, "stateChanged"),
            (self.recurseCheck, "stateChanged", self.inputDirCheck),
            (self.separateCheck, "stateChanged"),
            (self.pctCheck, "stateChanged"),
            (self.intersectCheck, "stateChanged"),
            (self.creationOptionsWidget, "optionsChanged"),
            (self.creationOptionsGroupBox, "toggled")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFilesEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.intersectCheck.toggled.connect(self.refreshExtent)
        self.inputDirCheck.stateChanged.connect(self.switchToolMode)
        self.inSelector.filenameChanged.connect(self.refreshExtent)
Exemple #9
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "pct2rgb.py")

        # we use one widget for two tools
        self.base.setWindowTitle(self.tr("Convert paletted image to RGB"))

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.bandSpin.setValue(1)
        self.progressBar.setValue(0)

        self.progressBar.hide()
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.colorsSpin, "valueChanged", self.colorsCheck,
             "-1"),  # hide this option
            (self.bandSpin, "valueChanged", self.bandCheck)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
Exemple #10
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.resampling_method = ('nearest', 'average', 'gauss', 'cubic',
                                  'average_mp', 'average_magphase', 'mode')

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdaladdo")

        # set the default QSpinBoxes and QProgressBar value
        self.progressBar.setValue(0)

        self.progressBar.hide()
        # we don't need load to canvas functionality
        self.base.loadCheckBox.hide()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.cleanCheck, "stateChanged", None, 1700),
            (self.mPyramidOptionsWidget, "overviewListChanged"),
            (self.mPyramidOptionsWidget, "someValueChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.batchCheck.stateChanged.connect(self.switchToolMode)

        self.init = False  # workaround bug that pyramid options widgets are not initialized at first
Exemple #11
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_contour")

        gdalVersion = Utils.GdalConfig.versionNum()
        self.useDirAsOutput = gdalVersion < 1700
        if self.useDirAsOutput:
            self.label_2.setText(QApplication.translate("GdalToolsWidget", "&Output directory for contour lines (shapefile)"))

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes value
        self.intervalDSpinBox.setValue(10.0)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.intervalDSpinBox, "valueChanged"),
            (self.attributeEdit, "textChanged", self.attributeCheck)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #12
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_rasterize")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.widthSpin.setValue(3000)
        self.heightSpin.setValue(3000)
        self.horizresSpin.setValue(1)
        self.vertresSpin.setValue(1)

        self.lastEncoding = Utils.getLastUsedEncoding()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.attributeComboBox, "currentIndexChanged"),
            ([self.widthSpin, self.heightSpin], "valueChanged"),
            ([self.horizresSpin, self.vertresSpin], "valueChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.inSelector.layerChanged.connect(self.fillFieldsCombo)
        self.radioSetSize.toggled.connect(self.someValueChanged)
        self.radioSetResolution.toggled.connect(self.someValueChanged)
Exemple #13
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_contour")

        gdalVersion = Utils.GdalConfig.versionNum()
        self.useDirAsOutput = gdalVersion < 1700
        if self.useDirAsOutput:
            self.label_2.setText(
                QApplication.translate(
                    "GdalToolsWidget",
                    "&Output directory for contour lines (shapefile)"))

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes value
        self.intervalDSpinBox.setValue(10.0)

        self.setParamsStatus([(self.inSelector, "filenameChanged"),
                              (self.outSelector, "filenameChanged"),
                              (self.intervalDSpinBox, "valueChanged"),
                              (self.attributeEdit, "textChanged",
                               self.attributeCheck)])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #14
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.canvas = self.iface.mapCanvas()
        self.algorithm = ('invdist', 'average', 'nearest', 'datametrics')
        self.datametrics = ('minimum', 'maximum', 'range')

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_grid")

        self.outSelector.setType(self.outSelector.FILE)
        self.extentSelector.setCanvas(self.canvas)
        #self.extentSelector.stop()

        # set the default QSpinBoxes and QProgressBar value
        self.widthSpin.setValue(3000)
        self.heightSpin.setValue(3000)
        self.invdistPowerSpin.setValue(2.0)

        self.outputFormat = Utils.fillRasterOutputFormat()
        self.lastEncoding = Utils.getLastUsedEncoding()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.zfieldCombo, "currentIndexChanged", self.zfieldCheck),
            (self.algorithmCombo, "currentIndexChanged", self.algorithmCheck),
            (self.stackedWidget, None, self.algorithmCheck),
            ([
                self.invdistPowerSpin, self.invdistSmothingSpin,
                self.invdistRadius1Spin, self.invdistRadius2Spin,
                self.invdistAngleSpin, self.invdistNoDataSpin
            ], "valueChanged"),
            ([self.invdistMaxPointsSpin,
              self.invdistMinPointsSpin], "valueChanged"),
            ([
                self.averageRadius1Spin, self.averageRadius2Spin,
                self.averageAngleSpin, self.averageNoDataSpin
            ], "valueChanged"), (self.averageMinPointsSpin, "valueChanged"),
            ([
                self.nearestRadius1Spin, self.nearestRadius2Spin,
                self.nearestAngleSpin, self.nearestNoDataSpin
            ], "valueChanged"), (self.datametricsCombo, "currentIndexChanged"),
            ([
                self.datametricsRadius1Spin, self.datametricsRadius2Spin,
                self.datametricsAngleSpin, self.datametricsNoDataSpin
            ], "valueChanged"),
            (self.datametricsMinPointsSpin, "valueChanged"),
            (self.extentSelector, ["selectionStarted",
                                   "newExtentDefined"], self.extentGroup),
            ([self.widthSpin,
              self.heightSpin], "valueChanged", self.resizeGroupBox)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.inSelector.layerChanged.connect(self.fillFieldsCombo)
        self.extentGroup.toggled.connect(self.onExtentCheckedChanged)
Exemple #15
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.modes = ("hillshade", "slope", "aspect", "color-relief", "TRI",
                      "TPI", "roughness")

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdaldem")

        self.outSelector.setType(self.outSelector.FILE)
        self.configSelector.setType(self.configSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.bandSpin.setValue(1)

        self.hillshadeZFactorSpin.setValue(1)
        self.hillshadeScaleSpin.setValue(1)
        self.hillshadeAltitudeSpin.setValue(45.0)
        self.hillshadeAzimuthSpin.setValue(315.0)
        self.slopeScaleSpin.setValue(1)

        # set the default color configuration file to terrain
        import os.path
        colorConfigFile = os.path.join(os.path.dirname(__file__),
                                       "terrain.txt")
        self.configSelector.setFilename(colorConfigFile)

        self.outputFormat = Utils.fillRasterOutputFormat()
        self.creationOptionsWidget.setFormat(self.outputFormat)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.computeEdgesCheck, "stateChanged", None, 1800),
            (self.bandSpin, "valueChanged", self.bandCheck),
            (self.algorithmCheck, "stateChanged", None, 1800),
            (self.creationOptionsWidget, "optionsChanged"),
            (self.creationOptionsGroupBox, "toggled"),
            (self.modeCombo, "currentIndexChanged"),
            ([
                self.hillshadeZFactorSpin, self.hillshadeScaleSpin,
                self.hillshadeAltitudeSpin, self.hillshadeAzimuthSpin
            ], "valueChanged"), (self.slopeScaleSpin, "valueChanged"),
            (self.slopePercentCheck, "stateChanged"),
            ([self.aspectTrigonometricCheck,
              self.aspectZeroForFlatCheck], "stateChanged"),
            (self.configSelector, "filenameChanged"),
            ([self.colorExactRadio,
              self.colorNearestRadio], "toggled", self.colorMatchGroupBox),
            (self.colorAlphaCheck, "stateChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.configSelector.selectClicked.connect(self.fillColorConfigFileEdit)
        self.modeCombo.currentIndexChanged.connect(self.showModeParams)
Exemple #16
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.setupUi(self)

        self.table.cellChanged.connect(self.cellValueChanged)

        self.table.itemSelectionChanged.connect(self.enableDeleteButton)
        self.btnAdd.clicked.connect(self.addNewRow)
        self.btnDel.clicked.connect(self.deleteRow)

        self.btnDel.setEnabled(False)
Exemple #17
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.canvas = None
        self.tool = None
        self.previousMapTool = None
        self.isStarted = False

        self.setupUi(self)

        self.x1CoordEdit.textChanged.connect(self.coordsChanged)
        self.x2CoordEdit.textChanged.connect(self.coordsChanged)
        self.y1CoordEdit.textChanged.connect(self.coordsChanged)
        self.y2CoordEdit.textChanged.connect(self.coordsChanged)
        self.btnEnable.clicked.connect(self.start)
Exemple #18
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.canvas = None
        self.tool = None
        self.previousMapTool = None
        self.isStarted = False

        self.setupUi(self)

        self.x1CoordEdit.textChanged.connect(self.coordsChanged)
        self.x2CoordEdit.textChanged.connect(self.coordsChanged)
        self.y1CoordEdit.textChanged.connect(self.coordsChanged)
        self.y2CoordEdit.textChanged.connect(self.coordsChanged)
        self.btnEnable.clicked.connect(self.start)
Exemple #19
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.modes = ("hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "roughness")

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdaldem")

        self.outSelector.setType(self.outSelector.FILE)
        self.configSelector.setType(self.configSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.bandSpin.setValue(1)

        self.hillshadeZFactorSpin.setValue(1)
        self.hillshadeScaleSpin.setValue(1)
        self.hillshadeAltitudeSpin.setValue(45.0)
        self.hillshadeAzimuthSpin.setValue(315.0)
        self.slopeScaleSpin.setValue(1)

        # set the default color configuration file to terrain
        import os.path
        colorConfigFile = os.path.join(os.path.dirname(__file__), "terrain.txt")
        self.configSelector.setFilename(colorConfigFile)

        self.outputFormat = Utils.fillRasterOutputFormat()
        self.creationOptionsWidget.setFormat(self.outputFormat)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.computeEdgesCheck, "stateChanged", None, 1800),
            (self.bandSpin, "valueChanged", self.bandCheck),
            (self.algorithmCheck, "stateChanged", None, 1800),
            (self.creationOptionsWidget, "optionsChanged"),
            (self.creationOptionsGroupBox, "toggled"),
            (self.modeCombo, "currentIndexChanged"),
            ([self.hillshadeZFactorSpin, self.hillshadeScaleSpin, self.hillshadeAltitudeSpin, self.hillshadeAzimuthSpin], "valueChanged"),
            (self.slopeScaleSpin, "valueChanged"),
            (self.slopePercentCheck, "stateChanged"),
            ([self.aspectTrigonometricCheck, self.aspectZeroForFlatCheck], "stateChanged"),
            (self.configSelector, "filenameChanged"),
            ([self.colorExactRadio, self.colorNearestRadio], "toggled", self.colorMatchGroupBox),
            (self.colorAlphaCheck, "stateChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.configSelector.selectClicked.connect(self.fillColorConfigFileEdit)
        self.modeCombo.currentIndexChanged.connect(self.showModeParams)
Exemple #20
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.canvas = self.iface.mapCanvas()
        self.expand_method = ('gray', 'rgb', 'rgba')

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdal_translate")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.outsizeSpin.setValue(25)
        self.progressBar.setValue(0)

        self.progressBar.hide()
        self.formatLabel.hide()
        self.formatCombo.hide()

        if Utils.GdalConfig.versionNum() < 1700:
            index = self.expandCombo.findText('gray', Qt.MatchFixedString)
            if index >= 0:
                self.expandCombo.removeItem(index)

        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.targetSRSEdit, "textChanged", self.targetSRSCheck),
            (self.selectTargetSRSButton, None, self.targetSRSCheck),
            (self.creationOptionsWidget, "optionsChanged"),
            (self.outsizeSpin, "valueChanged", self.outsizeCheck),
            (self.nodataSpin, "valueChanged", self.nodataCheck),
            (self.expandCombo, "currentIndexChanged", self.expandCheck, 1600),
            (self.sdsCheck, "stateChanged"),
            (self.srcwinEdit, "textChanged", self.srcwinCheck),
            (self.prjwinEdit, "textChanged", self.prjwinCheck)
        ])

        #self.canvas.layersChanged.connect(self.fillInputLayerCombo)
        self.inSelector.layerChanged.connect(self.fillTargetSRSEditDefault)
        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.selectTargetSRSButton.clicked.connect(self.fillTargetSRSEdit)
        self.batchCheck.stateChanged.connect(self.switchToolMode)

        # add raster filters to combo
        self.formatCombo.addItems(Utils.FileFilter.allRastersFilter().split(";;"))
Exemple #21
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.resampling_method = ('near', 'bilinear', 'cubic', 'cubicspline',
                                  'lanczos')

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdalwarp")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.widthSpin.setValue(3000)
        self.heightSpin.setValue(3000)
        self.progressBar.setValue(0)

        self.progressBar.hide()

        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.sourceSRSEdit, "textChanged", self.sourceSRSCheck),
            (self.selectSourceSRSButton, None, self.sourceSRSCheck),
            (self.targetSRSEdit, "textChanged", self.targetSRSCheck),
            (self.selectTargetSRSButton, None, self.targetSRSCheck),
            (self.resamplingCombo, "currentIndexChanged",
             self.resamplingCheck),
            (self.cacheSpin, "valueChanged", self.cacheCheck),
            ([self.widthSpin,
              self.heightSpin], "valueChanged", self.resizeGroupBox),
            (self.multithreadCheck, "stateChanged"),
            (self.noDataEdit, "textChanged", self.noDataCheck),
            (self.maskSelector, "filenameChanged", self.maskCheck, 1600),
        ])

        self.inSelector.layerChanged.connect(self.fillSourceSRSEditDefault)
        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.selectSourceSRSButton.clicked.connect(self.fillSourceSRSEdit)
        self.selectTargetSRSButton.clicked.connect(self.fillTargetSRSEdit)
        self.maskSelector.selectClicked.connect(self.fillMaskFile)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
Exemple #22
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.canvas = self.iface.mapCanvas()
        self.algorithm = ('invdist', 'average', 'nearest', 'datametrics')
        self.datametrics = ('minimum', 'maximum', 'range')

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_grid")

        self.outSelector.setType(self.outSelector.FILE)
        self.extentSelector.setCanvas(self.canvas)
        #self.extentSelector.stop()

        # set the default QSpinBoxes and QProgressBar value
        self.widthSpin.setValue(3000)
        self.heightSpin.setValue(3000)
        self.invdistPowerSpin.setValue(2.0)

        self.outputFormat = Utils.fillRasterOutputFormat()
        self.lastEncoding = Utils.getLastUsedEncoding()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.zfieldCombo, "currentIndexChanged", self.zfieldCheck),
            (self.algorithmCombo, "currentIndexChanged", self.algorithmCheck),
            (self.stackedWidget, None, self.algorithmCheck),
            ([self.invdistPowerSpin, self.invdistSmothingSpin, self.invdistRadius1Spin, self.invdistRadius2Spin, self.invdistAngleSpin, self.invdistNoDataSpin], "valueChanged"),
            ([self.invdistMaxPointsSpin, self.invdistMinPointsSpin], "valueChanged"),
            ([self.averageRadius1Spin, self.averageRadius2Spin, self.averageAngleSpin, self.averageNoDataSpin], "valueChanged"),
            (self.averageMinPointsSpin, "valueChanged"),
            ([self.nearestRadius1Spin, self.nearestRadius2Spin, self.nearestAngleSpin, self.nearestNoDataSpin], "valueChanged"),
            (self.datametricsCombo, "currentIndexChanged"),
            ([self.datametricsRadius1Spin, self.datametricsRadius2Spin, self.datametricsAngleSpin, self.datametricsNoDataSpin], "valueChanged"),
            (self.datametricsMinPointsSpin, "valueChanged"),
            (self.extentSelector, ["selectionStarted", "newExtentDefined"], self.extentGroup),
            ([self.widthSpin, self.heightSpin], "valueChanged", self.resizeGroupBox)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.inSelector.layerChanged.connect(self.fillFieldsCombo)
        self.extentGroup.toggled.connect(self.onExtentCheckedChanged)
Exemple #23
0
    def __init__(self, parent=None, type=None):
        QWidget.__init__(self, parent)

        self.setupUi(self)
        self.setFocusPolicy(Qt.StrongFocus)
        self.combo.setInsertPolicy(QComboBox.NoInsert)

        self.clear()

        self.typ = None
        if type is None:
            self.resetType()
        else:
            self.setType(type)

        self.selectBtn.clicked.connect(self.selectClicked)
        self.fileEdit.textChanged.connect(self.textChanged)
        self.combo.editTextChanged.connect(self.textChanged)
        self.combo.currentIndexChanged.connect(self.indexChanged)
Exemple #24
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_sieve.py")

        self.outSelector.setType(self.outSelector.FILE)
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([(self.inSelector, "filenameChanged"),
                              (self.outSelector, "filenameChanged"),
                              (self.thresholdSpin, "valueChanged",
                               self.thresholdCheck),
                              (self.connectionsCombo, "currentIndexChanged",
                               self.connectionsCheck)])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #25
0
    def __init__(self, parent=None, type=None):
        QWidget.__init__(self, parent)

        self.setupUi(self)
        self.setFocusPolicy(Qt.StrongFocus)
        self.combo.setInsertPolicy(QComboBox.NoInsert)

        self.clear()

        self.typ = None
        if type is None:
            self.resetType()
        else:
            self.setType(type)

        self.selectBtn.clicked.connect(self.selectClicked)
        self.fileEdit.textChanged.connect(self.textChanged)
        self.combo.editTextChanged.connect(self.textChanged)
        self.combo.currentIndexChanged.connect(self.indexChanged)
Exemple #26
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdaltindex")

        self.inSelector.setType(self.inSelector.FILE)
        self.outSelector.setType(self.outSelector.FILE)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            #( self.recurseCheck, "stateChanged" ),
            (self.outSelector, "filenameChanged"),
            (self.indexFieldEdit, "textChanged", self.indexFieldCheck),
            (self.skipDifferentProjCheck, "stateChanged", None, 1500)
        ])

        self.inSelector.selectClicked.connect(self.fillInputDirEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #27
0
    def __init__(self, parent=None, selectFile=False):
        QWidget.__init__(self, parent)

        # create gui
        self.btnSelect = QToolButton()
        self.btnSelect.setText(self.tr('...'))
        self.lineEdit = QLineEdit()
        self.hbl = QHBoxLayout()
        self.hbl.setMargin(0)
        self.hbl.setSpacing(0)
        self.hbl.addWidget(self.lineEdit)
        self.hbl.addWidget(self.btnSelect)

        self.setLayout(self.hbl)

        self.canFocusOut = False
        self.selectFile = selectFile

        self.setFocusPolicy(Qt.StrongFocus)
        self.btnSelect.clicked.connect(self.select)
Exemple #28
0
    def __init__(self, parent=None, selectFile=False):
        QWidget.__init__(self, parent)

        # create gui
        self.btnSelect = QToolButton()
        self.btnSelect.setText(self.tr('...'))
        self.lineEdit = QLineEdit()
        self.hbl = QHBoxLayout()
        self.hbl.setMargin(0)
        self.hbl.setSpacing(0)
        self.hbl.addWidget(self.lineEdit)
        self.hbl.addWidget(self.btnSelect)

        self.setLayout(self.hbl)

        self.canFocusOut = False
        self.selectFile = selectFile

        self.setFocusPolicy(Qt.StrongFocus)
        self.btnSelect.clicked.connect(self.select)
Exemple #29
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.resampling_method = ('near', 'bilinear', 'cubic', 'cubicspline', 'lanczos')

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdalwarp")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.widthSpin.setValue(3000)
        self.heightSpin.setValue(3000)
        self.progressBar.setValue(0)

        self.progressBar.hide()

        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.sourceSRSEdit, "textChanged", self.sourceSRSCheck),
            (self.selectSourceSRSButton, None, self.sourceSRSCheck),
            (self.targetSRSEdit, "textChanged", self.targetSRSCheck),
            (self.selectTargetSRSButton, None, self.targetSRSCheck),
            (self.resamplingCombo, "currentIndexChanged", self.resamplingCheck),
            (self.cacheSpin, "valueChanged", self.cacheCheck),
            ([self.widthSpin, self.heightSpin], "valueChanged", self.resizeGroupBox),
            (self.multithreadCheck, "stateChanged"),
            (self.noDataEdit, "textChanged", self.noDataCheck),
            (self.maskSelector, "filenameChanged", self.maskCheck, 1600),
        ])

        self.inSelector.layerChanged.connect(self.fillSourceSRSEditDefault)
        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.selectSourceSRSButton.clicked.connect(self.fillSourceSRSEdit)
        self.selectTargetSRSButton.clicked.connect(self.fillTargetSRSEdit)
        self.maskSelector.selectClicked.connect(self.fillMaskFile)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
Exemple #30
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.resolutions = ("highest", "average", "lowest")

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_polygonize.py")

        self.outSelector.setType(self.outSelector.FILE)
        self.outputFormat = Utils.fillVectorOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.maskSelector, "filenameChanged", self.maskCheck),
            (self.fieldEdit, "textChanged", self.fieldCheck)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.maskSelector.selectClicked.connect(self.fillMaskFileEdit)
Exemple #31
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_sieve.py")

        self.outSelector.setType(self.outSelector.FILE)
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus(
            [
                (self.inSelector, "filenameChanged"),
                (self.outSelector, "filenameChanged"),
                (self.thresholdSpin, "valueChanged", self.thresholdCheck),
                (self.connectionsCombo, "currentIndexChanged", self.connectionsCheck),
            ]
        )

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #32
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "nearblack")

        self.outSelector.setType(self.outSelector.FILE)

        # set the default QSpinBoxes value
        self.nearSpin.setValue(15)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.nearSpin, "valueChanged", self.nearCheck),
            (self.whiteCheckBox, "stateChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #33
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_proximity.py")

        self.outSelector.setType(self.outSelector.FILE)
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.valuesEdit, "textChanged", self.valuesCheck),
            (self.distUnitsCombo, "currentIndexChanged", self.distUnitsCheck),
            (self.maxDistSpin, "valueChanged", self.maxDistCheck),
            (self.noDataSpin, "valueChanged", self.noDataCheck),
            (self.fixedBufValSpin, "valueChanged", self.fixedBufValCheck)
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #34
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_proximity.py")

        self.outSelector.setType(self.outSelector.FILE)
        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus(
            [
                (self.inSelector, "filenameChanged"),
                (self.outSelector, "filenameChanged"),
                (self.valuesEdit, "textChanged", self.valuesCheck),
                (self.distUnitsCombo, "currentIndexChanged", self.distUnitsCheck),
                (self.maxDistSpin, "valueChanged", self.maxDistCheck),
                (self.noDataSpin, "valueChanged", self.noDataCheck),
                (self.fixedBufValSpin, "valueChanged", self.fixedBufValCheck),
            ]
        )

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
Exemple #35
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdalwarp")

        self.inSelector.setType(self.inSelector.FILE)

        # set the default QSpinBoxes and QProgressBar value
        self.progressBar.setValue(0)

        self.progressBar.hide()
        self.recurseCheck.hide()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.desiredSRSEdit, "textChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.selectDesiredSRSButton.clicked.connect(self.fillDesiredSRSEdit)
        self.batchCheck.stateChanged.connect(self.switchToolMode)
        self.recurseCheck.stateChanged.connect(self.enableRecurse)
Exemple #36
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface

        self.setupUi(self)
        BaseBatchWidget.__init__(self, self.iface, "gdal_fillnodata.py")

        self.inSelector.setType(self.inSelector.FILE_LAYER)
        self.outSelector.setType(self.outSelector.FILE)
        self.maskSelector.setType(self.maskSelector.FILE)

        self.progressBar.setValue(0)
        self.progressBar.hide()
        self.formatLabel.hide()
        self.formatCombo.hide()

        self.outputFormat = Utils.fillRasterOutputFormat()

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.maskSelector, "filenameChanged", self.maskCheck),
            (self.distanceSpin, "valueChanged", self.distanceCheck),
            (self.smoothSpin, "valueChanged", self.smoothCheck),
            (self.bandSpin, "valueChanged", self.bandCheck),
            (self.nomaskCheck, "stateChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFile)
        self.outSelector.selectClicked.connect(self.fillOutputFile)
        self.maskSelector.selectClicked.connect(self.fillMaskFile)
        self.batchCheck.stateChanged.connect(self.switchToolMode)

        # add raster filters to combo
        self.formatCombo.addItems(
            Utils.FileFilter.allRastersFilter().split(";;"))
Exemple #37
0
    def __init__(self, iface):
        QWidget.__init__(self)
        self.iface = iface
        self.canvas = self.iface.mapCanvas()

        self.setupUi(self)
        BasePluginWidget.__init__(self, self.iface, "gdal_translate")

        self.outSelector.setType(self.outSelector.FILE)
        self.extentSelector.setCanvas(self.canvas)
        self.outputFormat = Utils.fillRasterOutputFormat()

        # set the default QDoubleSpinBoxes
        self.xRes.setValue(12.5)
        self.yRes.setValue(12.5)

        self.setParamsStatus([
            (self.inSelector, "filenameChanged"),
            (self.outSelector, "filenameChanged"),
            (self.noDataSpin, "valueChanged", self.noDataCheck, 1700),
            (self.maskSelector, "filenameChanged", self.maskModeRadio, 1600),
            (self.alphaBandCheck, "stateChanged"),
            (self.cropToCutlineCheck, "stateChanged"),
            ([self.xRes, self.yRes], "valueChanged", self.setResolutionRadio),
            (self.extentSelector, ["selectionStarted", "newExtentDefined"], self.extentModeRadio),
            (self.modeStackedWidget, "currentChanged")
        ])

        self.inSelector.selectClicked.connect(self.fillInputFileEdit)
        self.outSelector.selectClicked.connect(self.fillOutputFileEdit)
        self.maskSelector.selectClicked.connect(self.fillMaskFileEdit)
        self.extentSelector.newExtentDefined.connect(self.extentChanged)
        self.extentSelector.selectionStarted.connect(self.checkRun)

        self.extentModeRadio.toggled.connect(self.switchClippingMode)
        self.keepResolutionRadio.toggled.connect(self.switchResolutionMode)
Exemple #38
0
    def __init__(self, iface, db, parent=None):
        QWidget.__init__(self, parent)
        self.iface = iface
        self.db = db
        self.filter = ""
        self.allowMultiColumnPk = isinstance(
            db, PGDatabase
        )  # at the moment only PostgreSQL allows a primary key to span multiple columns, spatialite doesn't
        self.aliasSubQuery = isinstance(
            db,
            PGDatabase)  # only PostgreSQL requires subqueries to be aliases
        self.setupUi(self)
        self.setWindowTitle(
            u"%s - %s [%s]" %
            (self.windowTitle(), db.connection().connectionName(),
             db.connection().typeNameString()))

        self.defaultLayerName = 'QueryLayer'

        if self.allowMultiColumnPk:
            self.uniqueColumnCheck.setText(
                self.trUtf8("Column(s) with unique values"))
        else:
            self.uniqueColumnCheck.setText(
                self.trUtf8("Column with unique values"))

        self.editSql.setFocus()
        self.editSql.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.initCompleter()

        # allow copying results
        copyAction = QAction("copy", self)
        self.viewResult.addAction(copyAction)
        copyAction.setShortcuts(QKeySequence.Copy)

        copyAction.triggered.connect(self.copySelectedResults)

        self.btnExecute.clicked.connect(self.executeSql)
        self.btnSetFilter.clicked.connect(self.setFilter)
        self.btnClear.clicked.connect(self.clearSql)

        self.presetStore.clicked.connect(self.storePreset)
        self.presetDelete.clicked.connect(self.deletePreset)
        self.presetCombo.activated[str].connect(self.loadPreset)
        self.presetCombo.activated[str].connect(self.presetName.setText)

        self.updatePresetsCombobox()

        self.geomCombo.setEditable(True)
        self.geomCombo.lineEdit().setReadOnly(True)

        self.uniqueCombo.setEditable(True)
        self.uniqueCombo.lineEdit().setReadOnly(True)
        self.uniqueModel = QStandardItemModel(self.uniqueCombo)
        self.uniqueCombo.setModel(self.uniqueModel)
        if self.allowMultiColumnPk:
            self.uniqueCombo.setItemDelegate(QStyledItemDelegate())
            self.uniqueModel.itemChanged.connect(
                self.uniqueChanged)  # react to the (un)checking of an item
            self.uniqueCombo.lineEdit().textChanged.connect(
                self.uniqueTextChanged
            )  # there are other events that change the displayed text and some of them can not be caught directly

        # hide the load query as layer if feature is not supported
        self._loadAsLayerAvailable = self.db.connector.hasCustomQuerySupport()
        self.loadAsLayerGroup.setVisible(self._loadAsLayerAvailable)
        if self._loadAsLayerAvailable:
            self.layerTypeWidget.hide()  # show if load as raster is supported
            self.loadLayerBtn.clicked.connect(self.loadSqlLayer)
            self.getColumnsBtn.clicked.connect(self.fillColumnCombos)
            self.loadAsLayerGroup.toggled.connect(self.loadAsLayerToggled)
            self.loadAsLayerToggled(False)

        self._createViewAvailable = self.db.connector.hasCreateSpatialViewSupport(
        )
        self.btnCreateView.setVisible(self._createViewAvailable)
        if self._createViewAvailable:
            self.btnCreateView.clicked.connect(self.createView)

        self.queryBuilderFirst = True
        self.queryBuilderBtn.setIcon(QIcon(":/db_manager/icons/sql.gif"))
        self.queryBuilderBtn.clicked.connect(self.displayQueryBuilder)

        self.presetName.textChanged.connect(self.nameChanged)
Exemple #39
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console"))

        self.settings = QSettings()

        self.shell = ShellScintilla(self)
        self.setFocusProxy(self.shell)
        self.shellOut = ShellOutputScintilla(self)
        self.tabEditorWidget = EditorTabWidget(self)

        ##------------ UI -------------------------------

        self.splitterEditor = QSplitter(self)
        self.splitterEditor.setOrientation(Qt.Horizontal)
        self.splitterEditor.setHandleWidth(6)
        self.splitterEditor.setChildrenCollapsible(True)

        self.shellOutWidget = QWidget(self)
        self.shellOutWidget.setLayout(QVBoxLayout())
        self.shellOutWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.shellOutWidget.layout().addWidget(self.shellOut)

        self.splitter = QSplitter(self.splitterEditor)
        self.splitter.setOrientation(Qt.Vertical)
        self.splitter.setHandleWidth(3)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.addWidget(self.shellOutWidget)
        self.splitter.addWidget(self.shell)

        #self.splitterEditor.addWidget(self.tabEditorWidget)

        self.splitterObj = QSplitter(self.splitterEditor)
        self.splitterObj.setHandleWidth(3)
        self.splitterObj.setOrientation(Qt.Horizontal)
        #self.splitterObj.setSizes([0, 0])
        #self.splitterObj.setStretchFactor(0, 1)

        self.widgetEditor = QWidget(self.splitterObj)
        self.widgetFind = QWidget(self)

        self.listClassMethod = QTreeWidget(self.splitterObj)
        self.listClassMethod.setColumnCount(2)
        objInspLabel = QCoreApplication.translate("PythonConsole", "Object Inspector")
        self.listClassMethod.setHeaderLabels([objInspLabel, ''])
        self.listClassMethod.setColumnHidden(1, True)
        self.listClassMethod.setAlternatingRowColors(True)

        #self.splitterEditor.addWidget(self.widgetEditor)
        #self.splitterObj.addWidget(self.listClassMethod)
        #self.splitterObj.addWidget(self.widgetEditor)

        # Hide side editor on start up
        self.splitterObj.hide()
        self.listClassMethod.hide()
        # Hide search widget on start up
        self.widgetFind.hide()

        sizes = self.splitter.sizes()
        self.splitter.setSizes(sizes)

        ##----------------Restore Settings------------------------------------

        self.restoreSettingsConsole()

        ##------------------Toolbar Editor-------------------------------------

        ## Action for Open File
        openFileBt = QCoreApplication.translate("PythonConsole", "Open Script...")
        self.openFileButton = QAction(self)
        self.openFileButton.setCheckable(False)
        self.openFileButton.setEnabled(True)
        self.openFileButton.setIcon(QgsApplication.getThemeIcon("console/iconOpenConsole.png"))
        self.openFileButton.setMenuRole(QAction.PreferencesRole)
        self.openFileButton.setIconVisibleInMenu(True)
        self.openFileButton.setToolTip(openFileBt)
        self.openFileButton.setText(openFileBt)

        openExtEditorBt = QCoreApplication.translate("PythonConsole", "Open in External Editor")
        self.openInEditorButton = QAction(self)
        self.openInEditorButton.setCheckable(False)
        self.openInEditorButton.setEnabled(True)
        self.openInEditorButton.setIcon(QgsApplication.getThemeIcon("console/iconShowEditorConsole.png"))
        self.openInEditorButton.setMenuRole(QAction.PreferencesRole)
        self.openInEditorButton.setIconVisibleInMenu(True)
        self.openInEditorButton.setToolTip(openExtEditorBt)
        self.openInEditorButton.setText(openExtEditorBt)
        ## Action for Save File
        saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
        self.saveFileButton = QAction(self)
        self.saveFileButton.setCheckable(False)
        self.saveFileButton.setEnabled(False)
        self.saveFileButton.setIcon(QgsApplication.getThemeIcon("console/iconSaveConsole.png"))
        self.saveFileButton.setMenuRole(QAction.PreferencesRole)
        self.saveFileButton.setIconVisibleInMenu(True)
        self.saveFileButton.setToolTip(saveFileBt)
        self.saveFileButton.setText(saveFileBt)
        ## Action for Save File As
        saveAsFileBt = QCoreApplication.translate("PythonConsole", "Save As...")
        self.saveAsFileButton = QAction(self)
        self.saveAsFileButton.setCheckable(False)
        self.saveAsFileButton.setEnabled(True)
        self.saveAsFileButton.setIcon(QgsApplication.getThemeIcon("console/iconSaveAsConsole.png"))
        self.saveAsFileButton.setMenuRole(QAction.PreferencesRole)
        self.saveAsFileButton.setIconVisibleInMenu(True)
        self.saveAsFileButton.setToolTip(saveAsFileBt)
        self.saveAsFileButton.setText(saveAsFileBt)
        ## Action Cut
        cutEditorBt = QCoreApplication.translate("PythonConsole", "Cut")
        self.cutEditorButton = QAction(self)
        self.cutEditorButton.setCheckable(False)
        self.cutEditorButton.setEnabled(True)
        self.cutEditorButton.setIcon(QgsApplication.getThemeIcon("mActionEditCut.png"))
        self.cutEditorButton.setMenuRole(QAction.PreferencesRole)
        self.cutEditorButton.setIconVisibleInMenu(True)
        self.cutEditorButton.setToolTip(cutEditorBt)
        self.cutEditorButton.setText(cutEditorBt)
        ## Action Copy
        copyEditorBt = QCoreApplication.translate("PythonConsole", "Copy")
        self.copyEditorButton = QAction(self)
        self.copyEditorButton.setCheckable(False)
        self.copyEditorButton.setEnabled(True)
        self.copyEditorButton.setIcon(QgsApplication.getThemeIcon("mActionEditCopy.png"))
        self.copyEditorButton.setMenuRole(QAction.PreferencesRole)
        self.copyEditorButton.setIconVisibleInMenu(True)
        self.copyEditorButton.setToolTip(copyEditorBt)
        self.copyEditorButton.setText(copyEditorBt)
        ## Action Paste
        pasteEditorBt = QCoreApplication.translate("PythonConsole", "Paste")
        self.pasteEditorButton = QAction(self)
        self.pasteEditorButton.setCheckable(False)
        self.pasteEditorButton.setEnabled(True)
        self.pasteEditorButton.setIcon(QgsApplication.getThemeIcon("mActionEditPaste.png"))
        self.pasteEditorButton.setMenuRole(QAction.PreferencesRole)
        self.pasteEditorButton.setIconVisibleInMenu(True)
        self.pasteEditorButton.setToolTip(pasteEditorBt)
        self.pasteEditorButton.setText(pasteEditorBt)
        ## Action Run Script (subprocess)
        runScriptEditorBt = QCoreApplication.translate("PythonConsole", "Run script")
        self.runScriptEditorButton = QAction(self)
        self.runScriptEditorButton.setCheckable(False)
        self.runScriptEditorButton.setEnabled(True)
        self.runScriptEditorButton.setIcon(QgsApplication.getThemeIcon("console/iconRunScriptConsole.png"))
        self.runScriptEditorButton.setMenuRole(QAction.PreferencesRole)
        self.runScriptEditorButton.setIconVisibleInMenu(True)
        self.runScriptEditorButton.setToolTip(runScriptEditorBt)
        self.runScriptEditorButton.setText(runScriptEditorBt)
        ## Action Run Script (subprocess)
        commentEditorBt = QCoreApplication.translate("PythonConsole", "Comment")
        self.commentEditorButton = QAction(self)
        self.commentEditorButton.setCheckable(False)
        self.commentEditorButton.setEnabled(True)
        self.commentEditorButton.setIcon(QgsApplication.getThemeIcon("console/iconCommentEditorConsole.png"))
        self.commentEditorButton.setMenuRole(QAction.PreferencesRole)
        self.commentEditorButton.setIconVisibleInMenu(True)
        self.commentEditorButton.setToolTip(commentEditorBt)
        self.commentEditorButton.setText(commentEditorBt)
        ## Action Run Script (subprocess)
        uncommentEditorBt = QCoreApplication.translate("PythonConsole", "Uncomment")
        self.uncommentEditorButton = QAction(self)
        self.uncommentEditorButton.setCheckable(False)
        self.uncommentEditorButton.setEnabled(True)
        self.uncommentEditorButton.setIcon(QgsApplication.getThemeIcon("console/iconUncommentEditorConsole.png"))
        self.uncommentEditorButton.setMenuRole(QAction.PreferencesRole)
        self.uncommentEditorButton.setIconVisibleInMenu(True)
        self.uncommentEditorButton.setToolTip(uncommentEditorBt)
        self.uncommentEditorButton.setText(uncommentEditorBt)
        ## Action for Object browser
        objList = QCoreApplication.translate("PythonConsole", "Object Inspector...")
        self.objectListButton = QAction(self)
        self.objectListButton.setCheckable(True)
        self.objectListButton.setEnabled(self.settings.value("pythonConsole/enableObjectInsp",
                                                             False, type=bool))
        self.objectListButton.setIcon(QgsApplication.getThemeIcon("console/iconClassBrowserConsole.png"))
        self.objectListButton.setMenuRole(QAction.PreferencesRole)
        self.objectListButton.setIconVisibleInMenu(True)
        self.objectListButton.setToolTip(objList)
        self.objectListButton.setText(objList)
        ## Action for Find text
        findText = QCoreApplication.translate("PythonConsole", "Find Text")
        self.findTextButton = QAction(self)
        self.findTextButton.setCheckable(True)
        self.findTextButton.setEnabled(True)
        self.findTextButton.setIcon(QgsApplication.getThemeIcon("console/iconSearchEditorConsole.png"))
        self.findTextButton.setMenuRole(QAction.PreferencesRole)
        self.findTextButton.setIconVisibleInMenu(True)
        self.findTextButton.setToolTip(findText)
        self.findTextButton.setText(findText)

        ##----------------Toolbar Console-------------------------------------

        ## Action Show Editor
        showEditor = QCoreApplication.translate("PythonConsole", "Show Editor")
        self.showEditorButton = QAction(self)
        self.showEditorButton.setEnabled(True)
        self.showEditorButton.setCheckable(True)
        self.showEditorButton.setIcon(QgsApplication.getThemeIcon("console/iconShowEditorConsole.png"))
        self.showEditorButton.setMenuRole(QAction.PreferencesRole)
        self.showEditorButton.setIconVisibleInMenu(True)
        self.showEditorButton.setToolTip(showEditor)
        self.showEditorButton.setText(showEditor)
        ## Action for Clear button
        clearBt = QCoreApplication.translate("PythonConsole", "Clear Console")
        self.clearButton = QAction(self)
        self.clearButton.setCheckable(False)
        self.clearButton.setEnabled(True)
        self.clearButton.setIcon(QgsApplication.getThemeIcon("console/iconClearConsole.png"))
        self.clearButton.setMenuRole(QAction.PreferencesRole)
        self.clearButton.setIconVisibleInMenu(True)
        self.clearButton.setToolTip(clearBt)
        self.clearButton.setText(clearBt)
        ## Action for settings
        optionsBt = QCoreApplication.translate("PythonConsole", "Options...")
        self.optionsButton = QAction(self)
        self.optionsButton.setCheckable(False)
        self.optionsButton.setEnabled(True)
        self.optionsButton.setIcon(QgsApplication.getThemeIcon("console/iconSettingsConsole.png"))
        self.optionsButton.setMenuRole(QAction.PreferencesRole)
        self.optionsButton.setIconVisibleInMenu(True)
        self.optionsButton.setToolTip(optionsBt)
        self.optionsButton.setText(optionsBt)
        ## Action menu for class
        actionClassBt = QCoreApplication.translate("PythonConsole", "Import Class")
        self.actionClass = QAction(self)
        self.actionClass.setCheckable(False)
        self.actionClass.setEnabled(True)
        self.actionClass.setIcon(QgsApplication.getThemeIcon("console/iconClassConsole.png"))
        self.actionClass.setMenuRole(QAction.PreferencesRole)
        self.actionClass.setIconVisibleInMenu(True)
        self.actionClass.setToolTip(actionClassBt)
        self.actionClass.setText(actionClassBt)
        ## Import Processing class
        loadProcessingBt = QCoreApplication.translate("PythonConsole", "Import Processing Class")
        self.loadProcessingButton = QAction(self)
        self.loadProcessingButton.setCheckable(False)
        self.loadProcessingButton.setEnabled(True)
        self.loadProcessingButton.setIcon(QgsApplication.getThemeIcon("console/iconProcessingConsole.png"))
        self.loadProcessingButton.setMenuRole(QAction.PreferencesRole)
        self.loadProcessingButton.setIconVisibleInMenu(True)
        self.loadProcessingButton.setToolTip(loadProcessingBt)
        self.loadProcessingButton.setText(loadProcessingBt)
        ## Import QtCore class
        loadQtCoreBt = QCoreApplication.translate("PythonConsole", "Import PyQt.QtCore Class")
        self.loadQtCoreButton = QAction(self)
        self.loadQtCoreButton.setCheckable(False)
        self.loadQtCoreButton.setEnabled(True)
        self.loadQtCoreButton.setIcon(QgsApplication.getThemeIcon("console/iconQtCoreConsole.png"))
        self.loadQtCoreButton.setMenuRole(QAction.PreferencesRole)
        self.loadQtCoreButton.setIconVisibleInMenu(True)
        self.loadQtCoreButton.setToolTip(loadQtCoreBt)
        self.loadQtCoreButton.setText(loadQtCoreBt)
        ## Import QtGui class
        loadQtGuiBt = QCoreApplication.translate("PythonConsole", "Import PyQt.QtGui Class")
        self.loadQtGuiButton = QAction(self)
        self.loadQtGuiButton.setCheckable(False)
        self.loadQtGuiButton.setEnabled(True)
        self.loadQtGuiButton.setIcon(QgsApplication.getThemeIcon("console/iconQtGuiConsole.png"))
        self.loadQtGuiButton.setMenuRole(QAction.PreferencesRole)
        self.loadQtGuiButton.setIconVisibleInMenu(True)
        self.loadQtGuiButton.setToolTip(loadQtGuiBt)
        self.loadQtGuiButton.setText(loadQtGuiBt)
        ## Action for Run script
        runBt = QCoreApplication.translate("PythonConsole", "Run Command")
        self.runButton = QAction(self)
        self.runButton.setCheckable(False)
        self.runButton.setEnabled(True)
        self.runButton.setIcon(QgsApplication.getThemeIcon("console/iconRunConsole.png"))
        self.runButton.setMenuRole(QAction.PreferencesRole)
        self.runButton.setIconVisibleInMenu(True)
        self.runButton.setToolTip(runBt)
        self.runButton.setText(runBt)
        ## Help action
        helpBt = QCoreApplication.translate("PythonConsole", "Help...")
        self.helpButton = QAction(self)
        self.helpButton.setCheckable(False)
        self.helpButton.setEnabled(True)
        self.helpButton.setIcon(QgsApplication.getThemeIcon("console/iconHelpConsole.png"))
        self.helpButton.setMenuRole(QAction.PreferencesRole)
        self.helpButton.setIconVisibleInMenu(True)
        self.helpButton.setToolTip(helpBt)
        self.helpButton.setText(helpBt)

        self.toolBar = QToolBar()
        self.toolBar.setEnabled(True)
        self.toolBar.setFocusPolicy(Qt.NoFocus)
        self.toolBar.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.toolBar.setLayoutDirection(Qt.LeftToRight)
        self.toolBar.setIconSize(QSize(16, 16))
        self.toolBar.setMovable(False)
        self.toolBar.setFloatable(False)
        self.toolBar.addAction(self.clearButton)
        self.toolBar.addAction(self.actionClass)
        self.toolBar.addAction(self.runButton)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.showEditorButton)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.optionsButton)
        self.toolBar.addAction(self.helpButton)

        self.toolBarEditor = QToolBar()
        self.toolBarEditor.setEnabled(False)
        self.toolBarEditor.setFocusPolicy(Qt.NoFocus)
        self.toolBarEditor.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.toolBarEditor.setLayoutDirection(Qt.LeftToRight)
        self.toolBarEditor.setIconSize(QSize(16, 16))
        self.toolBarEditor.setMovable(False)
        self.toolBarEditor.setFloatable(False)
        self.toolBarEditor.addAction(self.openFileButton)
        self.toolBarEditor.addAction(self.openInEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.saveFileButton)
        self.toolBarEditor.addAction(self.saveAsFileButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.runScriptEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.findTextButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.cutEditorButton)
        self.toolBarEditor.addAction(self.copyEditorButton)
        self.toolBarEditor.addAction(self.pasteEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.commentEditorButton)
        self.toolBarEditor.addAction(self.uncommentEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.objectListButton)

        ## Menu Import Class
        self.classMenu = QMenu()
        self.classMenu.addAction(self.loadProcessingButton)
        self.classMenu.addAction(self.loadQtCoreButton)
        self.classMenu.addAction(self.loadQtGuiButton)
        cM = self.toolBar.widgetForAction(self.actionClass)
        cM.setMenu(self.classMenu)
        cM.setPopupMode(QToolButton.InstantPopup)

        self.widgetButton = QWidget()
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.widgetButton.sizePolicy().hasHeightForWidth())
        self.widgetButton.setSizePolicy(sizePolicy)

        self.widgetButtonEditor = QWidget(self.widgetEditor)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.widgetButtonEditor.sizePolicy().hasHeightForWidth())
        self.widgetButtonEditor.setSizePolicy(sizePolicy)

        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.shellOut.sizePolicy().hasHeightForWidth())
        self.shellOut.setSizePolicy(sizePolicy)

        self.shellOut.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.shell.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)

        ##------------ Layout -------------------------------

        self.mainLayout = QGridLayout(self)
        self.mainLayout.setMargin(0)
        self.mainLayout.setSpacing(0)
        self.mainLayout.addWidget(self.widgetButton, 0, 0, 1, 1)
        self.mainLayout.addWidget(self.splitterEditor, 0, 1, 1, 1)

        self.shellOutWidget.layout().insertWidget(0, self.toolBar)

        self.layoutEditor = QGridLayout(self.widgetEditor)
        self.layoutEditor.setMargin(0)
        self.layoutEditor.setSpacing(0)
        self.layoutEditor.addWidget(self.toolBarEditor, 0, 1, 1, 1)
        self.layoutEditor.addWidget(self.widgetButtonEditor, 1, 0, 2, 1)
        self.layoutEditor.addWidget(self.tabEditorWidget, 1, 1, 1, 1)
        self.layoutEditor.addWidget(self.widgetFind, 2, 1, 1, 1)

        ## Layout for the find widget
        self.layoutFind = QGridLayout(self.widgetFind)
        self.layoutFind.setContentsMargins(0, 0, 0, 0)
        self.lineEditFind = QgsFilterLineEdit()
        placeHolderTxt = QCoreApplication.translate("PythonConsole", "Enter text to find...")

        self.lineEditFind.setPlaceholderText(placeHolderTxt)
        self.findNextButton = QToolButton()
        self.findNextButton.setEnabled(False)
        toolTipfindNext = QCoreApplication.translate("PythonConsole", "Find Next")
        self.findNextButton.setToolTip(toolTipfindNext)
        self.findNextButton.setIcon(QgsApplication.getThemeIcon("console/iconSearchNextEditorConsole.png"))
        self.findNextButton.setIconSize(QSize(24, 24))
        self.findNextButton.setAutoRaise(True)
        self.findPrevButton = QToolButton()
        self.findPrevButton.setEnabled(False)
        toolTipfindPrev = QCoreApplication.translate("PythonConsole", "Find Previous")
        self.findPrevButton.setToolTip(toolTipfindPrev)
        self.findPrevButton.setIcon(QgsApplication.getThemeIcon("console/iconSearchPrevEditorConsole.png"))
        self.findPrevButton.setIconSize(QSize(24, 24))
        self.findPrevButton.setAutoRaise(True)
        self.caseSensitive = QCheckBox()
        caseSensTr = QCoreApplication.translate("PythonConsole", "Case Sensitive")
        self.caseSensitive.setText(caseSensTr)
        self.wholeWord = QCheckBox()
        wholeWordTr = QCoreApplication.translate("PythonConsole", "Whole Word")
        self.wholeWord.setText(wholeWordTr)
        self.wrapAround = QCheckBox()
        self.wrapAround.setChecked(True)
        wrapAroundTr = QCoreApplication.translate("PythonConsole", "Wrap Around")
        self.wrapAround.setText(wrapAroundTr)
        self.layoutFind.addWidget(self.lineEditFind, 0, 1, 1, 1)
        self.layoutFind.addWidget(self.findPrevButton, 0, 2, 1, 1)
        self.layoutFind.addWidget(self.findNextButton, 0, 3, 1, 1)
        self.layoutFind.addWidget(self.caseSensitive, 0, 4, 1, 1)
        self.layoutFind.addWidget(self.wholeWord, 0, 5, 1, 1)
        self.layoutFind.addWidget(self.wrapAround, 0, 6, 1, 1)

        ##------------ Add first Tab in Editor -------------------------------

        #self.tabEditorWidget.newTabEditor(tabName='first', filename=None)

        ##------------ Signal -------------------------------

        self.findTextButton.toggled.connect(self.findTextEditor)
        self.objectListButton.toggled.connect(self.toggleObjectListWidget)
        self.commentEditorButton.triggered.connect(self.commentCode)
        self.uncommentEditorButton.triggered.connect(self.uncommentCode)
        self.runScriptEditorButton.triggered.connect(self.runScriptEditor)
        self.cutEditorButton.triggered.connect(self.cutEditor)
        self.copyEditorButton.triggered.connect(self.copyEditor)
        self.pasteEditorButton.triggered.connect(self.pasteEditor)
        self.showEditorButton.toggled.connect(self.toggleEditor)
        self.clearButton.triggered.connect(self.shellOut.clearConsole)
        self.optionsButton.triggered.connect(self.openSettings)
        self.loadProcessingButton.triggered.connect(self.processing)
        self.loadQtCoreButton.triggered.connect(self.qtCore)
        self.loadQtGuiButton.triggered.connect(self.qtGui)
        self.runButton.triggered.connect(self.shell.entered)
        self.openFileButton.triggered.connect(self.openScriptFile)
        self.openInEditorButton.triggered.connect(self.openScriptFileExtEditor)
        self.saveFileButton.triggered.connect(self.saveScriptFile)
        self.saveAsFileButton.triggered.connect(self.saveAsScriptFile)
        self.helpButton.triggered.connect(self.openHelp)
        self.listClassMethod.itemClicked.connect(self.onClickGoToLine)
        self.lineEditFind.returnPressed.connect(self._findText)
        self.findNextButton.clicked.connect(self._findNext)
        self.findPrevButton.clicked.connect(self._findPrev)
        self.lineEditFind.textChanged.connect(self._textFindChanged)
Exemple #40
0
    def __init__(self, iface, db, parent=None):
        QWidget.__init__(self, parent)
        self.iface = iface
        self.db = db
        self.filter = ""
        self.allowMultiColumnPk = isinstance(db, PGDatabase)  # at the moment only PostgreSQL allows a primary key to span multiple columns, spatialite doesn't
        self.aliasSubQuery = isinstance(db, PGDatabase)       # only PostgreSQL requires subqueries to be aliases
        self.setupUi(self)
        self.setWindowTitle(
            u"%s - %s [%s]" % (self.windowTitle(), db.connection().connectionName(), db.connection().typeNameString()))

        self.defaultLayerName = 'QueryLayer'

        if self.allowMultiColumnPk:
            self.uniqueColumnCheck.setText(self.trUtf8("Column(s) with unique values"))
        else:
            self.uniqueColumnCheck.setText(self.trUtf8("Column with unique values"))

        self.editSql.setFocus()
        self.editSql.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.initCompleter()

        # allow copying results
        copyAction = QAction("copy", self)
        self.viewResult.addAction(copyAction)
        copyAction.setShortcuts(QKeySequence.Copy)

        copyAction.triggered.connect(self.copySelectedResults)

        self.btnExecute.clicked.connect(self.executeSql)
        self.btnSetFilter.clicked.connect(self.setFilter)
        self.btnClear.clicked.connect(self.clearSql)

        self.presetStore.clicked.connect(self.storePreset)
        self.presetDelete.clicked.connect(self.deletePreset)
        self.presetCombo.activated[str].connect(self.loadPreset)
        self.presetCombo.activated[str].connect(self.presetName.setText)

        self.updatePresetsCombobox()

        self.geomCombo.setEditable(True)
        self.geomCombo.lineEdit().setReadOnly(True)

        self.uniqueCombo.setEditable(True)
        self.uniqueCombo.lineEdit().setReadOnly(True)
        self.uniqueModel = QStandardItemModel(self.uniqueCombo)
        self.uniqueCombo.setModel(self.uniqueModel)
        if self.allowMultiColumnPk:
            self.uniqueCombo.setItemDelegate(QStyledItemDelegate())
            self.uniqueModel.itemChanged.connect(self.uniqueChanged)                 # react to the (un)checking of an item
            self.uniqueCombo.lineEdit().textChanged.connect(self.uniqueTextChanged)  # there are other events that change the displayed text and some of them can not be caught directly

        # hide the load query as layer if feature is not supported
        self._loadAsLayerAvailable = self.db.connector.hasCustomQuerySupport()
        self.loadAsLayerGroup.setVisible(self._loadAsLayerAvailable)
        if self._loadAsLayerAvailable:
            self.layerTypeWidget.hide()  # show if load as raster is supported
            self.loadLayerBtn.clicked.connect(self.loadSqlLayer)
            self.getColumnsBtn.clicked.connect(self.fillColumnCombos)
            self.loadAsLayerGroup.toggled.connect(self.loadAsLayerToggled)
            self.loadAsLayerToggled(False)

        self._createViewAvailable = self.db.connector.hasCreateSpatialViewSupport()
        self.btnCreateView.setVisible(self._createViewAvailable)
        if self._createViewAvailable:
            self.btnCreateView.clicked.connect(self.createView)

        self.queryBuilderFirst = True
        self.queryBuilderBtn.setIcon(QIcon(":/db_manager/icons/sql.gif"))
        self.queryBuilderBtn.clicked.connect(self.displayQueryBuilder)

        self.presetName.textChanged.connect(self.nameChanged)
Exemple #41
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setWindowTitle(
            QCoreApplication.translate("PythonConsole", "Python Console"))

        self.settings = QSettings()

        self.shell = ShellScintilla(self)
        self.setFocusProxy(self.shell)
        self.shellOut = ShellOutputScintilla(self)
        self.tabEditorWidget = EditorTabWidget(self)

        ##------------ UI -------------------------------

        self.splitterEditor = QSplitter(self)
        self.splitterEditor.setOrientation(Qt.Horizontal)
        self.splitterEditor.setHandleWidth(6)
        self.splitterEditor.setChildrenCollapsible(True)

        self.shellOutWidget = QWidget(self)
        self.shellOutWidget.setLayout(QVBoxLayout())
        self.shellOutWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.shellOutWidget.layout().addWidget(self.shellOut)

        self.splitter = QSplitter(self.splitterEditor)
        self.splitter.setOrientation(Qt.Vertical)
        self.splitter.setHandleWidth(3)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.addWidget(self.shellOutWidget)
        self.splitter.addWidget(self.shell)

        #self.splitterEditor.addWidget(self.tabEditorWidget)

        self.splitterObj = QSplitter(self.splitterEditor)
        self.splitterObj.setHandleWidth(3)
        self.splitterObj.setOrientation(Qt.Horizontal)
        #self.splitterObj.setSizes([0, 0])
        #self.splitterObj.setStretchFactor(0, 1)

        self.widgetEditor = QWidget(self.splitterObj)
        self.widgetFind = QWidget(self)

        self.listClassMethod = QTreeWidget(self.splitterObj)
        self.listClassMethod.setColumnCount(2)
        objInspLabel = QCoreApplication.translate("PythonConsole",
                                                  "Object Inspector")
        self.listClassMethod.setHeaderLabels([objInspLabel, ''])
        self.listClassMethod.setColumnHidden(1, True)
        self.listClassMethod.setAlternatingRowColors(True)

        #self.splitterEditor.addWidget(self.widgetEditor)
        #self.splitterObj.addWidget(self.listClassMethod)
        #self.splitterObj.addWidget(self.widgetEditor)

        # Hide side editor on start up
        self.splitterObj.hide()
        self.listClassMethod.hide()
        # Hide search widget on start up
        self.widgetFind.hide()

        sizes = self.splitter.sizes()
        self.splitter.setSizes(sizes)

        ##----------------Restore Settings------------------------------------

        self.restoreSettingsConsole()

        ##------------------Toolbar Editor-------------------------------------

        ## Action for Open File
        openFileBt = QCoreApplication.translate("PythonConsole",
                                                "Open Script...")
        self.openFileButton = QAction(self)
        self.openFileButton.setCheckable(False)
        self.openFileButton.setEnabled(True)
        self.openFileButton.setIcon(
            QgsApplication.getThemeIcon("console/iconOpenConsole.png"))
        self.openFileButton.setMenuRole(QAction.PreferencesRole)
        self.openFileButton.setIconVisibleInMenu(True)
        self.openFileButton.setToolTip(openFileBt)
        self.openFileButton.setText(openFileBt)

        openExtEditorBt = QCoreApplication.translate(
            "PythonConsole", "Open in External Editor")
        self.openInEditorButton = QAction(self)
        self.openInEditorButton.setCheckable(False)
        self.openInEditorButton.setEnabled(True)
        self.openInEditorButton.setIcon(
            QgsApplication.getThemeIcon("console/iconShowEditorConsole.png"))
        self.openInEditorButton.setMenuRole(QAction.PreferencesRole)
        self.openInEditorButton.setIconVisibleInMenu(True)
        self.openInEditorButton.setToolTip(openExtEditorBt)
        self.openInEditorButton.setText(openExtEditorBt)
        ## Action for Save File
        saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
        self.saveFileButton = QAction(self)
        self.saveFileButton.setCheckable(False)
        self.saveFileButton.setEnabled(False)
        self.saveFileButton.setIcon(
            QgsApplication.getThemeIcon("console/iconSaveConsole.png"))
        self.saveFileButton.setMenuRole(QAction.PreferencesRole)
        self.saveFileButton.setIconVisibleInMenu(True)
        self.saveFileButton.setToolTip(saveFileBt)
        self.saveFileButton.setText(saveFileBt)
        ## Action for Save File As
        saveAsFileBt = QCoreApplication.translate("PythonConsole",
                                                  "Save As...")
        self.saveAsFileButton = QAction(self)
        self.saveAsFileButton.setCheckable(False)
        self.saveAsFileButton.setEnabled(True)
        self.saveAsFileButton.setIcon(
            QgsApplication.getThemeIcon("console/iconSaveAsConsole.png"))
        self.saveAsFileButton.setMenuRole(QAction.PreferencesRole)
        self.saveAsFileButton.setIconVisibleInMenu(True)
        self.saveAsFileButton.setToolTip(saveAsFileBt)
        self.saveAsFileButton.setText(saveAsFileBt)
        ## Action Cut
        cutEditorBt = QCoreApplication.translate("PythonConsole", "Cut")
        self.cutEditorButton = QAction(self)
        self.cutEditorButton.setCheckable(False)
        self.cutEditorButton.setEnabled(True)
        self.cutEditorButton.setIcon(
            QgsApplication.getThemeIcon("mActionEditCut.png"))
        self.cutEditorButton.setMenuRole(QAction.PreferencesRole)
        self.cutEditorButton.setIconVisibleInMenu(True)
        self.cutEditorButton.setToolTip(cutEditorBt)
        self.cutEditorButton.setText(cutEditorBt)
        ## Action Copy
        copyEditorBt = QCoreApplication.translate("PythonConsole", "Copy")
        self.copyEditorButton = QAction(self)
        self.copyEditorButton.setCheckable(False)
        self.copyEditorButton.setEnabled(True)
        self.copyEditorButton.setIcon(
            QgsApplication.getThemeIcon("mActionEditCopy.png"))
        self.copyEditorButton.setMenuRole(QAction.PreferencesRole)
        self.copyEditorButton.setIconVisibleInMenu(True)
        self.copyEditorButton.setToolTip(copyEditorBt)
        self.copyEditorButton.setText(copyEditorBt)
        ## Action Paste
        pasteEditorBt = QCoreApplication.translate("PythonConsole", "Paste")
        self.pasteEditorButton = QAction(self)
        self.pasteEditorButton.setCheckable(False)
        self.pasteEditorButton.setEnabled(True)
        self.pasteEditorButton.setIcon(
            QgsApplication.getThemeIcon("mActionEditPaste.png"))
        self.pasteEditorButton.setMenuRole(QAction.PreferencesRole)
        self.pasteEditorButton.setIconVisibleInMenu(True)
        self.pasteEditorButton.setToolTip(pasteEditorBt)
        self.pasteEditorButton.setText(pasteEditorBt)
        ## Action Run Script (subprocess)
        runScriptEditorBt = QCoreApplication.translate("PythonConsole",
                                                       "Run script")
        self.runScriptEditorButton = QAction(self)
        self.runScriptEditorButton.setCheckable(False)
        self.runScriptEditorButton.setEnabled(True)
        self.runScriptEditorButton.setIcon(
            QgsApplication.getThemeIcon("console/iconRunScriptConsole.png"))
        self.runScriptEditorButton.setMenuRole(QAction.PreferencesRole)
        self.runScriptEditorButton.setIconVisibleInMenu(True)
        self.runScriptEditorButton.setToolTip(runScriptEditorBt)
        self.runScriptEditorButton.setText(runScriptEditorBt)
        ## Action Run Script (subprocess)
        commentEditorBt = QCoreApplication.translate("PythonConsole",
                                                     "Comment")
        self.commentEditorButton = QAction(self)
        self.commentEditorButton.setCheckable(False)
        self.commentEditorButton.setEnabled(True)
        self.commentEditorButton.setIcon(
            QgsApplication.getThemeIcon(
                "console/iconCommentEditorConsole.png"))
        self.commentEditorButton.setMenuRole(QAction.PreferencesRole)
        self.commentEditorButton.setIconVisibleInMenu(True)
        self.commentEditorButton.setToolTip(commentEditorBt)
        self.commentEditorButton.setText(commentEditorBt)
        ## Action Run Script (subprocess)
        uncommentEditorBt = QCoreApplication.translate("PythonConsole",
                                                       "Uncomment")
        self.uncommentEditorButton = QAction(self)
        self.uncommentEditorButton.setCheckable(False)
        self.uncommentEditorButton.setEnabled(True)
        self.uncommentEditorButton.setIcon(
            QgsApplication.getThemeIcon(
                "console/iconUncommentEditorConsole.png"))
        self.uncommentEditorButton.setMenuRole(QAction.PreferencesRole)
        self.uncommentEditorButton.setIconVisibleInMenu(True)
        self.uncommentEditorButton.setToolTip(uncommentEditorBt)
        self.uncommentEditorButton.setText(uncommentEditorBt)
        ## Action for Object browser
        objList = QCoreApplication.translate("PythonConsole",
                                             "Object Inspector...")
        self.objectListButton = QAction(self)
        self.objectListButton.setCheckable(True)
        self.objectListButton.setEnabled(
            self.settings.value("pythonConsole/enableObjectInsp",
                                False,
                                type=bool))
        self.objectListButton.setIcon(
            QgsApplication.getThemeIcon("console/iconClassBrowserConsole.png"))
        self.objectListButton.setMenuRole(QAction.PreferencesRole)
        self.objectListButton.setIconVisibleInMenu(True)
        self.objectListButton.setToolTip(objList)
        self.objectListButton.setText(objList)
        ## Action for Find text
        findText = QCoreApplication.translate("PythonConsole", "Find Text")
        self.findTextButton = QAction(self)
        self.findTextButton.setCheckable(True)
        self.findTextButton.setEnabled(True)
        self.findTextButton.setIcon(
            QgsApplication.getThemeIcon("console/iconSearchEditorConsole.png"))
        self.findTextButton.setMenuRole(QAction.PreferencesRole)
        self.findTextButton.setIconVisibleInMenu(True)
        self.findTextButton.setToolTip(findText)
        self.findTextButton.setText(findText)

        ##----------------Toolbar Console-------------------------------------

        ## Action Show Editor
        showEditor = QCoreApplication.translate("PythonConsole", "Show Editor")
        self.showEditorButton = QAction(self)
        self.showEditorButton.setEnabled(True)
        self.showEditorButton.setCheckable(True)
        self.showEditorButton.setIcon(
            QgsApplication.getThemeIcon("console/iconShowEditorConsole.png"))
        self.showEditorButton.setMenuRole(QAction.PreferencesRole)
        self.showEditorButton.setIconVisibleInMenu(True)
        self.showEditorButton.setToolTip(showEditor)
        self.showEditorButton.setText(showEditor)
        ## Action for Clear button
        clearBt = QCoreApplication.translate("PythonConsole", "Clear Console")
        self.clearButton = QAction(self)
        self.clearButton.setCheckable(False)
        self.clearButton.setEnabled(True)
        self.clearButton.setIcon(
            QgsApplication.getThemeIcon("console/iconClearConsole.png"))
        self.clearButton.setMenuRole(QAction.PreferencesRole)
        self.clearButton.setIconVisibleInMenu(True)
        self.clearButton.setToolTip(clearBt)
        self.clearButton.setText(clearBt)
        ## Action for settings
        optionsBt = QCoreApplication.translate("PythonConsole", "Options...")
        self.optionsButton = QAction(self)
        self.optionsButton.setCheckable(False)
        self.optionsButton.setEnabled(True)
        self.optionsButton.setIcon(
            QgsApplication.getThemeIcon("console/iconSettingsConsole.png"))
        self.optionsButton.setMenuRole(QAction.PreferencesRole)
        self.optionsButton.setIconVisibleInMenu(True)
        self.optionsButton.setToolTip(optionsBt)
        self.optionsButton.setText(optionsBt)
        ## Action menu for class
        actionClassBt = QCoreApplication.translate("PythonConsole",
                                                   "Import Class")
        self.actionClass = QAction(self)
        self.actionClass.setCheckable(False)
        self.actionClass.setEnabled(True)
        self.actionClass.setIcon(
            QgsApplication.getThemeIcon("console/iconClassConsole.png"))
        self.actionClass.setMenuRole(QAction.PreferencesRole)
        self.actionClass.setIconVisibleInMenu(True)
        self.actionClass.setToolTip(actionClassBt)
        self.actionClass.setText(actionClassBt)
        ## Action for Run script
        runBt = QCoreApplication.translate("PythonConsole", "Run Command")
        self.runButton = QAction(self)
        self.runButton.setCheckable(False)
        self.runButton.setEnabled(True)
        self.runButton.setIcon(
            QgsApplication.getThemeIcon("console/iconRunConsole.png"))
        self.runButton.setMenuRole(QAction.PreferencesRole)
        self.runButton.setIconVisibleInMenu(True)
        self.runButton.setToolTip(runBt)
        self.runButton.setText(runBt)
        ## Help action
        helpBt = QCoreApplication.translate("PythonConsole", "Help...")
        self.helpButton = QAction(self)
        self.helpButton.setCheckable(False)
        self.helpButton.setEnabled(True)
        self.helpButton.setIcon(
            QgsApplication.getThemeIcon("console/iconHelpConsole.png"))
        self.helpButton.setMenuRole(QAction.PreferencesRole)
        self.helpButton.setIconVisibleInMenu(True)
        self.helpButton.setToolTip(helpBt)
        self.helpButton.setText(helpBt)

        self.toolBar = QToolBar()
        self.toolBar.setEnabled(True)
        self.toolBar.setFocusPolicy(Qt.NoFocus)
        self.toolBar.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.toolBar.setLayoutDirection(Qt.LeftToRight)
        self.toolBar.setIconSize(QSize(16, 16))
        self.toolBar.setMovable(False)
        self.toolBar.setFloatable(False)
        self.toolBar.addAction(self.clearButton)
        self.toolBar.addAction(self.actionClass)
        self.toolBar.addAction(self.runButton)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.showEditorButton)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.optionsButton)
        self.toolBar.addAction(self.helpButton)

        self.toolBarEditor = QToolBar()
        self.toolBarEditor.setEnabled(False)
        self.toolBarEditor.setFocusPolicy(Qt.NoFocus)
        self.toolBarEditor.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.toolBarEditor.setLayoutDirection(Qt.LeftToRight)
        self.toolBarEditor.setIconSize(QSize(16, 16))
        self.toolBarEditor.setMovable(False)
        self.toolBarEditor.setFloatable(False)
        self.toolBarEditor.addAction(self.openFileButton)
        self.toolBarEditor.addAction(self.openInEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.saveFileButton)
        self.toolBarEditor.addAction(self.saveAsFileButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.runScriptEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.findTextButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.cutEditorButton)
        self.toolBarEditor.addAction(self.copyEditorButton)
        self.toolBarEditor.addAction(self.pasteEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.commentEditorButton)
        self.toolBarEditor.addAction(self.uncommentEditorButton)
        self.toolBarEditor.addSeparator()
        self.toolBarEditor.addAction(self.objectListButton)

        ## Menu Import Class
        default_command = {
            (QCoreApplication.translate("PythonConsole", "Import Processing Class"),
             QgsApplication.getThemeIcon("console/iconProcessingConsole.png")):
            ["import processing"],
            (QCoreApplication.translate("PythonConsole", "Import PyQt.QtCore Class"),
             QgsApplication.getThemeIcon("console/iconQtCoreConsole.png")):
            ["from PyQt.QtCore import *"],
            (QCoreApplication.translate("PythonConsole", "Import PyQt.QtGui Class"),
             QgsApplication.getThemeIcon("console/iconQtGuiConsole.png")):
            ["from PyQt.QtGui import *", "from PyQt.QtWidgets import *"]
        }

        self.classMenu = QMenu()
        for (title, icon), commands in default_command.iteritems():
            action = self.classMenu.addAction(icon, title)
            action.triggered[()].connect(
                lambda commands=commands: self.shell.commandConsole(commands))

        cM = self.toolBar.widgetForAction(self.actionClass)
        cM.setMenu(self.classMenu)
        cM.setPopupMode(QToolButton.InstantPopup)

        self.widgetButton = QWidget()
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.widgetButton.sizePolicy().hasHeightForWidth())
        self.widgetButton.setSizePolicy(sizePolicy)

        self.widgetButtonEditor = QWidget(self.widgetEditor)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.widgetButtonEditor.sizePolicy().hasHeightForWidth())
        self.widgetButtonEditor.setSizePolicy(sizePolicy)

        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.shellOut.sizePolicy().hasHeightForWidth())
        self.shellOut.setSizePolicy(sizePolicy)

        self.shellOut.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.shell.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)

        ##------------ Layout -------------------------------

        self.mainLayout = QGridLayout(self)
        self.mainLayout.setMargin(0)
        self.mainLayout.setSpacing(0)
        self.mainLayout.addWidget(self.widgetButton, 0, 0, 1, 1)
        self.mainLayout.addWidget(self.splitterEditor, 0, 1, 1, 1)

        self.shellOutWidget.layout().insertWidget(0, self.toolBar)

        self.layoutEditor = QGridLayout(self.widgetEditor)
        self.layoutEditor.setMargin(0)
        self.layoutEditor.setSpacing(0)
        self.layoutEditor.addWidget(self.toolBarEditor, 0, 1, 1, 1)
        self.layoutEditor.addWidget(self.widgetButtonEditor, 1, 0, 2, 1)
        self.layoutEditor.addWidget(self.tabEditorWidget, 1, 1, 1, 1)
        self.layoutEditor.addWidget(self.widgetFind, 2, 1, 1, 1)

        ## Layout for the find widget
        self.layoutFind = QGridLayout(self.widgetFind)
        self.layoutFind.setContentsMargins(0, 0, 0, 0)
        self.lineEditFind = QgsFilterLineEdit()
        placeHolderTxt = QCoreApplication.translate("PythonConsole",
                                                    "Enter text to find...")

        self.lineEditFind.setPlaceholderText(placeHolderTxt)
        self.findNextButton = QToolButton()
        self.findNextButton.setEnabled(False)
        toolTipfindNext = QCoreApplication.translate("PythonConsole",
                                                     "Find Next")
        self.findNextButton.setToolTip(toolTipfindNext)
        self.findNextButton.setIcon(
            QgsApplication.getThemeIcon(
                "console/iconSearchNextEditorConsole.png"))
        self.findNextButton.setIconSize(QSize(24, 24))
        self.findNextButton.setAutoRaise(True)
        self.findPrevButton = QToolButton()
        self.findPrevButton.setEnabled(False)
        toolTipfindPrev = QCoreApplication.translate("PythonConsole",
                                                     "Find Previous")
        self.findPrevButton.setToolTip(toolTipfindPrev)
        self.findPrevButton.setIcon(
            QgsApplication.getThemeIcon(
                "console/iconSearchPrevEditorConsole.png"))
        self.findPrevButton.setIconSize(QSize(24, 24))
        self.findPrevButton.setAutoRaise(True)
        self.caseSensitive = QCheckBox()
        caseSensTr = QCoreApplication.translate("PythonConsole",
                                                "Case Sensitive")
        self.caseSensitive.setText(caseSensTr)
        self.wholeWord = QCheckBox()
        wholeWordTr = QCoreApplication.translate("PythonConsole", "Whole Word")
        self.wholeWord.setText(wholeWordTr)
        self.wrapAround = QCheckBox()
        self.wrapAround.setChecked(True)
        wrapAroundTr = QCoreApplication.translate("PythonConsole",
                                                  "Wrap Around")
        self.wrapAround.setText(wrapAroundTr)
        self.layoutFind.addWidget(self.lineEditFind, 0, 1, 1, 1)
        self.layoutFind.addWidget(self.findPrevButton, 0, 2, 1, 1)
        self.layoutFind.addWidget(self.findNextButton, 0, 3, 1, 1)
        self.layoutFind.addWidget(self.caseSensitive, 0, 4, 1, 1)
        self.layoutFind.addWidget(self.wholeWord, 0, 5, 1, 1)
        self.layoutFind.addWidget(self.wrapAround, 0, 6, 1, 1)

        ##------------ Add first Tab in Editor -------------------------------

        #self.tabEditorWidget.newTabEditor(tabName='first', filename=None)

        ##------------ Signal -------------------------------

        self.findTextButton.toggled.connect(self.findTextEditor)
        self.objectListButton.toggled.connect(self.toggleObjectListWidget)
        self.commentEditorButton.triggered.connect(self.commentCode)
        self.uncommentEditorButton.triggered.connect(self.uncommentCode)
        self.runScriptEditorButton.triggered.connect(self.runScriptEditor)
        self.cutEditorButton.triggered.connect(self.cutEditor)
        self.copyEditorButton.triggered.connect(self.copyEditor)
        self.pasteEditorButton.triggered.connect(self.pasteEditor)
        self.showEditorButton.toggled.connect(self.toggleEditor)
        self.clearButton.triggered.connect(self.shellOut.clearConsole)
        self.optionsButton.triggered.connect(self.openSettings)
        self.runButton.triggered.connect(self.shell.entered)
        self.openFileButton.triggered.connect(self.openScriptFile)
        self.openInEditorButton.triggered.connect(self.openScriptFileExtEditor)
        self.saveFileButton.triggered.connect(self.saveScriptFile)
        self.saveAsFileButton.triggered.connect(self.saveAsScriptFile)
        self.helpButton.triggered.connect(self.openHelp)
        self.listClassMethod.itemClicked.connect(self.onClickGoToLine)
        self.lineEditFind.returnPressed.connect(self._findText)
        self.findNextButton.clicked.connect(self._findNext)
        self.findPrevButton.clicked.connect(self._findPrev)
        self.lineEditFind.textChanged.connect(self._textFindChanged)