예제 #1
0
    def showOptionsDialog(self,
                          layerList,
                          animationFrameLength,
                          playBackwards=False,
                          loopAnimation=False):
        """show the optionsDialog and populate it with settings from timeLayerManager"""

        # check if the dialog is already showing
        if self.optionsDialog is not None:
            self.optionsDialog.raise_()
            self.optionsDialog.activateWindow()
            return

        # load the form
        self.optionsDialog = uic.loadUi(
            os.path.join(self.path, OPTIONS_WIDGET_FILE))

        # restore settings from layerList:
        for layer in layerList:
            settings = ls.getSettingsFromLayer(layer)
            ls.addSettingsToRow(settings, self.optionsDialog.tableWidget)

        # restore animation options
        self.optionsDialog.spinBoxFrameLength.setValue(animationFrameLength)
        self.optionsDialog.checkBoxBackwards.setChecked(playBackwards)
        self.optionsDialog.checkBoxLabel.setChecked(self.showLabel)
        self.optionsDialog.checkBoxDontExportEmpty.setChecked(
            not self.exportEmpty)
        self.optionsDialog.checkBoxLoop.setChecked(loopAnimation)
        self.optionsDialog.show_label_options_button.clicked.connect(
            self.showLabelOptions)
        self.optionsDialog.checkBoxLabel.stateChanged.connect(
            self.showOrHideLabelOptions)

        # show dialog
        self.showOrHideLabelOptions()
        self.optionsDialog.show()

        # create raster and vector dialogs
        self.vectorDialog = VectorLayerDialog(
            self.iface, os.path.join(self.path, ADD_VECTOR_LAYER_WIDGET_FILE),
            self.optionsDialog.tableWidget)
        self.rasterDialog = RasterLayerDialog(
            self.iface, os.path.join(self.path, ADD_RASTER_LAYER_WIDGET_FILE),
            self.optionsDialog.tableWidget)
        # establish connections
        self.optionsDialog.pushButtonAddVector.clicked.connect(
            self.vectorDialog.show)
        self.optionsDialog.pushButtonAddRaster.clicked.connect(
            self.rasterDialog.show)
        self.optionsDialog.pushButtonRemove.clicked.connect(self.removeLayer)
        self.optionsDialog.buttonBox.accepted.connect(self.saveOptions)
        self.optionsDialog.buttonBox.accepted.connect(
            self.setOptionsDialogToNone)
        self.optionsDialog.buttonBox.rejected.connect(
            self.setOptionsDialogToNone)
        self.optionsDialog.rejected.connect(self.setOptionsDialogToNone)
        self.optionsDialog.buttonBox.helpRequested.connect(self.showHelp)
예제 #2
0
    def showOptionsDialog(self, layerList, animationFrameLength, playBackwards=False,
                          loopAnimation=False):
        """show the optionsDialog and populate it with settings from timeLayerManager"""

        # check if the dialog is already showing
        if self.optionsDialog is not None:
            self.optionsDialog.raise_()
            self.optionsDialog.activateWindow()
            return

        # load the form
        self.optionsDialog = uic.loadUi(os.path.join(self.path, OPTIONS_WIDGET_FILE))

        # restore settings from layerList:
        for layer in layerList:
            settings = ls.getSettingsFromLayer(layer)
            ls.addSettingsToRow(settings, self.optionsDialog.tableWidget)

        # restore animation options
        self.optionsDialog.spinBoxFrameLength.setValue(animationFrameLength)
        self.optionsDialog.checkBoxBackwards.setChecked(playBackwards)
        self.optionsDialog.checkBoxLabel.setChecked(self.showLabel)
        self.optionsDialog.checkBoxDontExportEmpty.setChecked(not self.exportEmpty)
        self.optionsDialog.checkBoxLoop.setChecked(loopAnimation)
        self.optionsDialog.show_label_options_button.clicked.connect(self.showLabelOptions)
        self.optionsDialog.checkBoxLabel.stateChanged.connect(self.showOrHideLabelOptions)

        # show dialog
        self.showOrHideLabelOptions()
        self.optionsDialog.show()

        # create raster and vector dialogs
        self.vectorDialog = VectorLayerDialog(self.iface, os.path.join(self.path,
                                                                       ADD_VECTOR_LAYER_WIDGET_FILE),
                                              self.optionsDialog.tableWidget)
        self.rasterDialog = RasterLayerDialog(self.iface, os.path.join(self.path,
                                                                       ADD_RASTER_LAYER_WIDGET_FILE),
                                              self.optionsDialog.tableWidget)
        # establish connections
        self.optionsDialog.pushButtonAddVector.clicked.connect(self.vectorDialog.show)
        self.optionsDialog.pushButtonAddRaster.clicked.connect(self.rasterDialog.show)
        self.optionsDialog.pushButtonRemove.clicked.connect(self.removeLayer)
        self.optionsDialog.buttonBox.accepted.connect(self.saveOptions)
        self.optionsDialog.buttonBox.accepted.connect(self.setOptionsDialogToNone)
        self.optionsDialog.buttonBox.rejected.connect(self.setOptionsDialogToNone)
        self.optionsDialog.rejected.connect(self.setOptionsDialogToNone)
        self.optionsDialog.buttonBox.helpRequested.connect(self.showHelp)
예제 #3
0
    def showOptionsDialog(self, layerList, animationFrameLength, playBackwards=False, loopAnimation=False):
        """Show the optionsDialog and populate it with settings from timeLayerManager"""

        # load the form
        self.optionsDialog = uic.loadUi(os.path.join(self.path, OPTIONS_WIDGET_FILE))

        # restore settings from layerList:
        for layer in layerList:
            settings = layer_settings.getSettingsFromLayer(layer)
            layer_settings.addSettingsToRow(settings, self.optionsDialog.tableWidget)

        # restore animation options
        self.optionsDialog.spinBoxFrameLength.setValue(animationFrameLength)
        self.optionsDialog.checkBoxBackwards.setChecked(playBackwards)
        self.optionsDialog.checkBoxLabel.setChecked(self.showLabel)
        self.optionsDialog.checkBoxDontExportEmpty.setChecked(not self.exportEmpty)
        self.optionsDialog.checkBoxLoop.setChecked(loopAnimation)
        self.optionsDialog.show_label_options_button.clicked.connect(self.showLabelOptions)
        self.optionsDialog.checkBoxLabel.stateChanged.connect(self.showOrHideLabelOptions)
        
        # show help
        helpPath = QUrl(
            'file:///' + replace(os.path.join(self.path, "help.htm"), '\\', '/'))  # windows
        # hack: Qt expects / instead of \
        self.optionsDialog.textBrowser.setSource(helpPath)

        # show dialog
        self.showOrHideLabelOptions()
        self.optionsDialog.show()

        # create raster and vector dialogs
        self.vectorDialog = VectorLayerDialog(self.iface, os.path.join(self.path,
                                                                       ADD_VECTOR_LAYER_WIDGET_FILE),
                                              self.optionsDialog.tableWidget)
        self.rasterDialog = RasterLayerDialog(self.iface, os.path.join(self.path,
                                                                       ADD_RASTER_LAYER_WIDGET_FILE),
                                              self.optionsDialog.tableWidget)
        # establish connections
        self.optionsDialog.pushButtonAddVector.clicked.connect(self.vectorDialog.show)
        self.optionsDialog.pushButtonAddRaster.clicked.connect(self.rasterDialog.show)
        self.optionsDialog.pushButtonRemove.clicked.connect(self.removeLayer)
        self.optionsDialog.buttonBox.accepted.connect(self.saveOptions)
예제 #4
0
 def addLayerToTable(self):
     """Add selected layer attributes to table"""
     settings = self.extractSettings()
     layer_settings.addSettingsToRow(settings, self.out_table)
예제 #5
0
 def add_layer_to_table(self):
     """Add selected layer attributes to table"""
     settings = self.extract_settings()
     ls.addSettingsToRow(settings, self.out_table)
예제 #6
0
 def add_layer_to_table(self):
     """Add selected layer attributes to table"""
     settings = self.extract_settings()
     ls.addSettingsToRow(settings, self.out_table)
예제 #7
0
        allVectorIds = set(qgs.getAllLayerIds(lambda x: not qgs.isRaster(x)))
        try:
            self.populate(allVectorIds - idsToIgnore)
        except Exception, e:
            warn(e)
            return
        self.add_interpolation_modes(self.dialog.comboBoxInterpolation)

        if self.layer_count() == 0:
            msg = 'There are no unmanaged layers of requested type in the project!'
            QMessageBox.information(self.dialog, 'Error', msg)
            raise Exception(msg)

        for index in range(self.layer_count()):
            settings = self.getItemFromIndex(index)
            ls.addSettingsToRow(settings, self.out_table)

    def getItemFromIndex(self, index):
        result = LayerSettings()
        result.layerName = self.dialog.comboBoxLayers.itemText(index)
        result.startTimeAttribute = self.dialog.comboBoxStart.itemText(
            self.dialog.comboBoxStart.count() - 1)
        result.endTimeAttribute = result.startTimeAttribute
        result.accumulate = False
        result.isEnabled = True
        result.layerId = self.tempLayerIndexToId[index]
        result.timeFormat = time_util.PENDING
        result.offset = 0
        result.interpolationMode = self.dialog.comboBoxInterpolation.itemText(
            0)
        result.interpolationEnabled = conf.INTERPOLATION_MODES[