Esempio n. 1
0
 def __init__(self, project, parent=None):
     QDialog.__init__(self, parent)
     uic.loadUi(
         os.path.join(os.path.dirname(__file__),
                      'export_raster_formation.ui'), self)
     self.__project = project
     self.populateFormation()
Esempio n. 2
0
 def __init__(self, iface: QgisInterface = None, canvas: QgsMapCanvas = None,
              position: int = Qt.RightDockWidgetArea):
     '''
     Parameters
     ----------
     iface : QgisInterface, optional
         instance of QGIS interface, defaults to the interface of the QGIS
         instance in use
     canvas : QgsMapCanvas, optional
         the map canvas, defaults to the canvas of the interface
     position : int, optional
         dock widget area to add the dock widget to, defaults to attach the
         widget in the right section of QGIS (Qt.RightDockWidgetArea)
     '''
     super().__init__()
     self.iface = iface or utils.iface
     self.canvas = canvas or self.iface.mapCanvas()
     self.initial_position = position
     self.ui = QtWidgets.QDockWidget()
     # look for file ui folder if not found
     ui_file = self.ui_file if os.path.exists(self.ui_file) \
         else os.path.join(settings.UI_PATH, self.ui_file)
     uic.loadUi(ui_file, self.ui)
     #self.ui.setAllowedAreas(
         #Qt.RightDockWidgetArea | Qt.LeftDockWidgetArea |
         #Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea
     #)
     self.ui.closeEvent = self.closeEvent
     self.is_active = False
     self.setupUi()
Esempio n. 3
0
 def __init__(self, conn_info, parent=None):
     super(BoreHoleWindow, self).__init__(parent)
     uic.loadUi(os.path.join(os.path.dirname(__file__), 'log_strati.ui'),
                self)
     self.scene = BoreHoleScene(conn_info, self)
     self.graphicsView.setScene(self.scene)
     self.graphicsView.installEventFilter(self.scene.scroll_filter())
Esempio n. 4
0
    def __init__(self, item, backgrounds, parent=None):
        super(ProjectWidget, self).__init__(parent)
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), "project_dialog.ui"), self)
        self.__item = item
        self.scaleLineEdit.setText(str([int(s) for s in item['scales']])[1:-1])

        defaultBackgroundIdx = None
        self.backgroundComboBox.addItem("")
        for i, layer in enumerate(backgrounds):
            self.backgroundComboBox.addItem(layer['name'])
            checkBox = QCheckBox(layer['name'])
            self.backgroundLayout.addWidget(checkBox)
            for l in item['backgroundLayers']:
                if (l['name'] == layer['name']) == 1:
                    checkBox.setChecked(True)
                    if l['visibility']:
                        defaultBackgroundIdx = i + 1

        if defaultBackgroundIdx is not None:
            self.backgroundComboBox.setCurrentIndex(defaultBackgroundIdx)

        if 'coordinates' in item['searchProviders']:
            self.coordinatesCheckBox.setChecked(True)
        if 'nominatim' in item['searchProviders']:
            self.nominatimCheckBox.setChecked(True)
    def __init__(self, main):
        super().__init__(self._icon, self._name)
        self.setCheckable(True)

        self.main = main

        # Build the widget
        self.widget = QWidget()
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), "ui", self._widget_ui),
            self.widget)
        self.widget.dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        self.widgetAction = QWidgetAction(self)
        self.widgetAction.setDefaultWidget(self.widget)

        self.menu = QMenu()
        self.menu.addAction(self.widgetAction)
        self.setMenu(self.menu)

        # Build the tool
        self.tool = QgsMapToolEmitPoint(self.main.iface.mapCanvas())
        self.tool.activated.connect(lambda: self.setChecked(True))
        self.tool.deactivated.connect(lambda: self.setChecked(False))
        self.tool.canvasClicked.connect(self.tool_clicked)

        # Connect the action
        self.triggered.connect(self.start_tool)
Esempio n. 6
0
    def __init__(self,
                 ui_file: str = None,
                 modal: bool = True,
                 parent: QWidget = None,
                 title: str = None):
        '''
        Parameters
        ----------
        ui_file : str, optional
            path to QT-Designer xml file to load UI of dialog from,
            if only filename is given, the file is looked for in the standard
            folder (UI_PATH), defaults to not using ui file
        modal : bool, optional
            set dialog to modal if True, not modal if False, defaults to modal
        parent: QWidget, optional
            parent widget, defaults to None
        title: str, optional
            replaces title of dialog if given, defaults to preset title
        '''

        super().__init__(parent=parent)
        if ui_file:
            # look for file ui folder if not found
            ui_file = ui_file if os.path.exists(ui_file) \
                else os.path.join(UI_PATH, ui_file)
            uic.loadUi(ui_file, self)
        if title:
            self.setWindowTitle(title)

        self.setModal(modal)
        self.setupUi()
Esempio n. 7
0
    def __init__(self, iface, plugin_dir, yleiskaavaSettings,
                 yleiskaavaDatabase, yleiskaavaUtils):

        self.iface = iface

        self.yleiskaavaSettings = yleiskaavaSettings
        self.yleiskaavaDatabase = yleiskaavaDatabase
        self.yleiskaavaUtils = yleiskaavaUtils

        self.plugin_dir = plugin_dir

        self.dialogChangeFieldValuesOfGroup = uic.loadUi(
            os.path.join(self.plugin_dir, 'ui',
                         'yleiskaava_dialog_change_field_values_of_group.ui'))

        self.dialogChooseAndUpdateFieldValuesForFeatureType = uic.loadUi(
            os.path.join(
                self.plugin_dir, 'ui',
                'yleiskaava_dialog_choose_and_update_field_values_for_feature_type.ui'
            ))

        self.hasUserSelectedPolygonFeaturesForUpdate = False
        self.hasUserSelectedSuplementaryPolygonFeaturesForUpdate = False
        self.hasUserSelectedLineFeaturesForUpdate = False
        self.hasUserSelectedPointFeaturesForUpdate = False

        self.shownFieldNamesAndTypes = []

        self.currentFeatureType = None
    def __init__(self, model, iface=None):

        QDialog.__init__(self)
        # Set up the user interface from Designer.
        ui_path = os.path.join(os.path.dirname(__file__),
                               'Ui_AddColumnDialog.ui')
        uic.loadUi(ui_path, self)

        self.mError.setStyleSheet('* { color: red; }')

        try:
            self.restoreGeometry(QgsSettings().value("RATAddColumn/geometry",
                                                     None, QByteArray,
                                                     QgsSettings.Plugins))
        except:
            pass

        self.mName.textChanged.connect(self.updateDialog)
        self.mStandardColumn.toggled.connect(self.updateDialog)
        self.mUsage.currentIndexChanged.connect(self.updateDialog)
        self.mColor.toggled.connect(self.updateDialog)

        self.mDataType.addItem(data_type_name(gdal.GFT_String),
                               gdal.GFT_String)
        self.mDataType.addItem(data_type_name(gdal.GFT_Integer),
                               gdal.GFT_Integer)
        self.mDataType.addItem(data_type_name(gdal.GFT_Real), gdal.GFT_Real)

        self.upper_headers = [h.upper() for h in model.headers]
        self.model = model
        self.column_info = rat_column_info()
        self.mUsage.setCurrentIndex(self.mUsage.findData(gdal.GFU_Generic))
        self.updateDialog()
Esempio n. 9
0
    def __init__(self, currentQgisProjectFile, parent=None):
        super(ConfigDialog, self).__init__(parent)
        uic.loadUi(os.path.join(os.path.dirname(__file__), "config_dialog.ui"),
                   self)

        assert (currentQgisProjectFile
                and os.path.isfile(currentQgisProjectFile))
        if currentQgisProjectFile is not None and not currentQgisProjectFile.endswith(
                ".qgs"):
            self.warningLabel.setText("the project extension is not .qgs")

        s = QgsSettings()

        self.urlLineEdit.setText(s.value("qwc2configurator/server/url", ""))
        self.usernameLineEdit.setText(
            s.value("qwc2configurator/server/username", ""))
        self.passwordLineEdit.setText(
            s.value("qwc2configurator/server/password", ""))

        self.__config = None
        self.__projectIdxInConfig = None
        self.__projectConfig = None
        self.__currentQgisProjectFile = os.path.abspath(currentQgisProjectFile)

        self.projectsComboBox.currentIndexChanged[str].connect(
            self.__projectChanged)
        self.getConfigButton.clicked.connect(self.__getConfig)
Esempio n. 10
0
 def __init__(self):
     QDialog.__init__(self)
     # Set up the user interface from Designer.
     ui_path = os.path.join(os.path.dirname(__file__), 'Ui_QuickWKT.ui')
     uic.loadUi(ui_path, self)
     self.exampleComboBox.addItems(list(EXAMPLES.keys()))
     self.exampleComboBox.currentIndexChanged.connect(self.on_exampleComboBox_currentIndexChanged)
Esempio n. 11
0
    def __init__(self, iface, parent=None, flags=Qt.WindowFlags()):
        QDialog.__init__(self, parent, flags)
        #load the ui
        uic.loadUi(UI_PATH, self)

        self.iface = iface
        self.HelpButton.clicked.connect(self.Help)
Esempio n. 12
0
    def __init__(self):
        super().__init__()
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), "ui", "ExpressRouteWidget.ui"), self
        )

        self.dateTimeEdit.setDateTime(QDateTime.currentDateTime())
Esempio n. 13
0
    def __init__(self, iface, parent=None, flags=Qt.WindowFlags()):
        QDialog.__init__(self, parent, flags)
        uic.loadUi(UI_PATH, self)

        self.iface = iface
        self.input_layer = None
        self.raster_layer = None

        self.raster_layer_box.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.raster_layer_box.layerChanged.connect(self.setRasterLayer)

        self.raster_band_box.setEnabled(False)

        self.method_box.addItem('nearest neighbor (downscaling/upscaling)')
        self.method_box.addItem('bi-linear (downscaling)')
        self.method_box.addItem('bi-cubic (downscaling)')

        #connect by signal and slot
        self.browse_button.clicked.connect(self.onBrowseButtonClicked)
        self.interpolation_group.clicked.connect(self.change_interpolation)
        self.HelpButton.clicked.connect(self.Help)

        self.iface.currentLayerChanged.connect(self.setInputLayer)

        self.setInputLayer(self.iface.activeLayer())
        self.setRasterLayer(self.raster_layer_box.currentLayer())
Esempio n. 14
0
    def __init__(self, iface):
        QDialog.__init__(self)
        self.iface = iface
        loadUi(os.path.join(os.path.dirname(__file__), "dialogo.ui"), self)

        self.mi_boton.clicked.connect(self.accion)
        self.accepted.connect(self.aceptado)
        self.rejected.connect(self.rechazado)
Esempio n. 15
0
 def __init__(self, iface, parent=None, flags=Qt.WindowFlags()):
     QDialog.__init__(self, parent, flags)
     uic.loadUi(UI_PATH, self)
     self.iface = iface
     self.input_layer = None
     self.browse_button.clicked.connect(self.onBrowseButtonClicked)
     self.iface.currentLayerChanged.connect(self.setInputLayer)
     self.setInputLayer(self.iface.activeLayer())
    def __init__(self, main):
        super().__init__(main.iface.mainWindow())
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), "ui", "SplashScreen.ui"),
            self)

        # self.setWindowFlag(Qt.WindowStaysOnTopHint)

        self.buttonBox.accepted.connect(self.accept)
Esempio n. 17
0
    def __init__(self):
        super().__init__()
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), 'ui', 'ConfigDialog.ui'),
            self)

        self.getKeyButton.pressed.connect(self.get_key)
        self.countResetButton.pressed.connect(self.reset_count)
        self.buttonBox.accepted.connect(self.accept)
Esempio n. 18
0
 def __init__(self, uifile, presenter, manager, parent=None):
     super().__init__(parent=parent, flags=Qt.Window)
     uipath = "ui"
     ui = path.join(path.dirname(__file__), f"{uipath}/{uifile}")
     uic.loadUi(ui, self)
     self.manager = manager
     self.presenter = presenter(self)
     self.messageBar = self.manager.iface.messageBar()
     self.messageTitle = "Gardener plugin"
Esempio n. 19
0
    def __init__(self, main, html, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), 'ui', 'HelpContent.ui'),
            self)

        self.main = main
        self.htmlWidget.anchorClicked.connect(self.open_link)
        self.htmlWidget.setText(html)
        self.htmlWidget.setSearchPaths([HELP_DIR])
Esempio n. 20
0
    def __init__(self, iface, parent=None, flags=Qt.WindowFlags()):
        QDialog.__init__(self, parent=parent, flags=flags)
        uic.loadUi(UI_PATH, self)
        self.iface = iface

        self.db_host.editingFinished.connect(self.onConnectionSettingsEdited)
        self.db_name.editingFinished.connect(self.onConnectionSettingsEdited)
        self.db_user.editingFinished.connect(self.onConnectionSettingsEdited)
        self.db_pass.editingFinished.connect(self.onConnectionSettingsEdited)
        self.browse_button.clicked.connect(self.onBrowseButtonClicked)
        self.connect_button.clicked.connect(self.onConnectClicked)
    def __init__(self, iface=None):

        QDialog.__init__(self)
        # Set up the user interface from Designer.
        ui_path = os.path.join(os.path.dirname(
            __file__), 'Ui_AboutDialog.ui')
        uic.loadUi(ui_path, self)

        try:
            self.restoreGeometry(QgsSettings().value(
                "RATAbout/geometry", None, QByteArray, QgsSettings.Plugins))
        except:
            pass
Esempio n. 22
0
    def __init__(self, parent):
        super().__init__(parent)
        loadUi(os.path.join(os.path.dirname(__file__), "gui_import.ui"), self)

        self.accepted.connect(self.commit_session)
        self.rejected.connect(self.rollback_session)

        header = self.treeWidget.header()
        header.setSectionResizeMode(QHeaderView.ResizeToContents)
        header.setSectionResizeMode(0, QHeaderView.Stretch)

        # No required here, but this way we load before opening the dialog
        get_qgep_model()
Esempio n. 23
0
    def __init__(self, iface, parent=None, flags=Qt.WindowFlags()):
        QDialog.__init__(self, parent, flags)
        uic.loadUi(UI_PATH, self)
        self.iface = iface

        self.ecnLayerBox.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.popLayerBox.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.AreaLayerBox.setFilters(QgsMapLayerProxyModel.PolygonLayer)

        # The module consists of two input options ecn/ pop. The lines below set the default that none of them are chosen in the beginning.
        # The user has to choose one of them. The two bottom functions will make sure that only one of the options can be chosen.

        self.mGroupBox_ecn.clicked.connect(self.check_mGroupBox_ecn)
        self.mGroupBox_pop.clicked.connect(self.check_mGroupBox_pop)
        self.mGroupBox_ecn.setChecked(True)

        self.picker = QgsMapToolEmitPoint(self.iface.mapCanvas())

        self.addButton.setEnabled(False)
        self.zoomButton.setEnabled(False)
        self.removeButton.setEnabled(False)
        self.ExportButton.setEnabled(False)
        self.groupBox.setEnabled(False)
        self.ImportButton.setEnabled(False)
        self.AreaLayerBox.setLayer(None)
        self.ecnLayerBox.setLayer(None)
        self.popLayerBox.setLayer(None)

        self.removeButton.clicked.connect(self.removeRasterItems)
        self.removeButton.setAutoDefault(False)
        self.listWidget.currentRowChanged.connect(
            self.updateRasterPropertiesGroup)
        self.ecnLayerBox.layerChanged.connect(self.updateECNBox)
        self.popLayerBox.layerChanged.connect(self.updatePOPBox)
        self.AreaLayerBox.layerChanged.connect(self.UpdateImportButtons)
        self.pickButton.clicked.connect(self.enableMapPicker)
        self.pickButton.setAutoDefault(False)
        self.browseButton.clicked.connect(self.onBrowseButtonClicked)
        self.browseButton.setAutoDefault(False)

        self.mGroupBox_ecn.setChecked(True)
        self.popNaNBox.setEnabled(False)
        self.popTypeBox.setEnabled(False)
        self.popUnitTransBox.setEnabled(False)
        self.popLayerBox.setEnabled(False)
        self.label_20.setEnabled(False)
        self.label.setEnabled(False)
        self.label_12.setEnabled(False)
        self.label_21.setEnabled(False)
        self.HelpButton.clicked.connect(self.Help)
Esempio n. 24
0
    def widget(self):
        """
        The editor's widget (created on the fly if needed)
        """
        if not hasattr(self, "_widget"):

            class BaseWidget(QWidget):
                pass

            self._widget = BaseWidget()
            loadUi(os.path.join(os.path.dirname(__file__), self.widget_name),
                   self._widget)
            self.init_widget()
        return self._widget
Esempio n. 25
0
    def __init__(self, parent: QWidget = None):
        super(MainWidget, self).__init__(parent)
        # currently selected output layer
        self.output = None
        # stores which layers are marked as output layers
        self.output_layer_ids = []

        self.input = None
        self.valid_bkg_key = False
        self.label_field_name = None
        # cache all results for a layer, (layer-id, feature-id) as keys,
        # geojson features as values
        self.result_cache = {}
        # cache field-map settings for layers, layer-ids as keys,
        # FieldMaps as values
        self.field_map_cache = {}
        # cache label fields, layer-ids as keys, field name as values
        self.label_cache = {}
        self.field_map = None

        add_fields = [
            ResField('n_results',
                     'int2',
                     alias='Anzahl der Ergebnisse',
                     prefix='gc'),
            ResField('i', 'int2', alias='Ergebnisindex', prefix='gc'),
            ResField('manuell_bearbeitet', 'bool', alias='Manuell bearbeitet')
        ]
        add_fields += BKG_RESULT_FIELDS

        # additional fields for storing results,
        # non-optional fields are active by default, others will be set by
        # user input
        self.result_fields = {
            f.name: (f, True if not f.optional else False)
            for f in add_fields
        }

        self.inspect_dialog = None
        self.reverse_dialog = None
        self.geocoding = None

        self.iface = utils.iface
        self.canvas = self.iface.mapCanvas()
        ui_file = self.ui_file if os.path.exists(self.ui_file) \
            else os.path.join(UI_PATH, self.ui_file)
        uic.loadUi(ui_file, self)
        self.setAllowedAreas(Qt.RightDockWidgetArea | Qt.LeftDockWidgetArea)
        self.setupUi()
        self.setup_config()
Esempio n. 26
0
 def __init__(self, iface):
     QDialog.__init__(self)
     ui_path = os.path.join(os.path.dirname(__file__),
                            'BBoxPreviewWindow.ui')
     uic.loadUi(ui_path, self)
     self.canvas = iface.mapCanvas()
     self.destinationLayer.setCurrentIndex(0)
     self.destinationLayer.setFilters(
         qgis.core.QgsMapLayerProxyModel.PolygonLayer)
     self.showButton.clicked.connect(self.showBbox)
     self.formatManager = biz.FormatManager()
     for format in self.formatManager.formatClasses:
         self.formatsComboBox.addItem(
             self.formatManager.formatClasses[format].displayName(), format)
    def __init__(self, iface):
        self.iface = iface
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = uic.loadUi(ui_file, self)

        self.configFilePath = os.path.join(os.path.dirname(__file__), 'config.cfg')
        self.defFlags = Qt.NoItemFlags | Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable
        
        # Populate the PostGIS connection combo with the available connections
        
        # Determine our current preference
        s = QSettings()
        selectedConnection = str(s.value("constraintchecker/postgisConnection", ''))
        
        s.beginGroup('PostgreSQL/connections')
        i = 0
        for connectionName in s.childGroups():
            self.postgisConnectionComboBox.addItem(connectionName)
            if connectionName == selectedConnection:
                # Select this preference in the combo if exists
                self.postgisConnectionComboBox.setCurrentIndex(i)
            i += 1
        s.endGroup()
        
        # Now read the configuration file (if it exists) into the table widget
        try:
            self.readConfiguration()
        except:
            pass
 def __init__(self, model):
     QDialog.__init__(self)
     # Set up the user interface from Designer.
     self.ui = uic.loadUi(ui_file, self)
     self.resultModel = model
     self.constraintTableView.setModel(self.resultModel)
     self.constraintTableView.resizeColumnsToContents()
Esempio n. 29
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        tdir = os.path.dirname(os.path.realpath(__file__))
        uif = os.path.join(tdir, "ui", "ui_rasCreateRasLayers.ui")
        self.ui = uic.loadUi(uif, self)
        self.rgis = parent
        self.rdb = parent.rdb

        self.ui.buttonBox.accepted.connect(self.acceptDialog)
        self.ui.buttonBox.rejected.connect(self.reject)
        self.ui.helpButton.clicked.connect(self.displayHelp)
        self.ui.allChbox.toggled.connect(self.allChboxToggled)

        self.tables = [
            (self.ui.bankLinesChbox, heco.BankLines),
            (self.ui.blockedChbox, heco.BlockedObs),
            (self.ui.breaklines2DChbox, heco.BreakLines2d),
            (self.ui.breakpoints2DChbox, heco.BreakPoints2d),
            (self.ui.bridgesChbox, heco.Bridges),
            (self.ui.flowPathChbox, heco.Flowpaths),
            (self.ui.flowAreas2DChbox, heco.FlowAreas2d),
            (self.ui.flowAreas2DChbox, heco.MeshPoints2d),
            (self.ui.ineffectiveChbox, heco.IneffAreas),
            (self.ui.inlineStructChbox, heco.InlineStructures),
            (self.ui.streamChbox, heco.StreamCenterlines),
            (self.ui.landuseChbox, heco.LanduseAreas),
            (self.ui.lateralStructChbox, heco.LateralStructures),
            (self.ui.leveeChbox, heco.LeveeAlignment),
            (self.ui.leveeChbox, heco.LeveePoints),
            (self.ui.storageAreasChbox, heco.StorageAreas),
            (self.ui.saConnectionsChbox, heco.SAConnections),
            (self.ui.xsCutLinesChbox, heco.XSCutLines)]

        self.tables.sort(key=lambda x: x[1]().order)
Esempio n. 30
0
    def __init__(self, current_row, iface=None):

        QDialog.__init__(self)
        # Set up the user interface from Designer.
        ui_path = os.path.join(os.path.dirname(__file__), 'Ui_AddRowDialog.ui')
        uic.loadUi(ui_path, self)

        try:
            self.restoreGeometry(QgsSettings().value("RATAddRow/geometry",
                                                     None, QByteArray,
                                                     QgsSettings.Plugins))
        except:
            pass

        self.mBefore.setText(self.mBefore.text() + str(current_row + 1))
        self.mAfter.setText(self.mAfter.text() + str(current_row + 1))
    def __init__(self, main, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi(
            os.path.join(os.path.dirname(__file__), "ui", "HelpDialog.ui"),
            self)

        self.closeButton.pressed.connect(self.close)
        self.openBrowserButton.pressed.connect(self.open_in_browser)
        self.homeButton.pressed.connect(self.reset_url)

        self.main = main

        self.webview = QWebView()
        self.reset_url()

        self.contentWidget.layout().addWidget(self.webview)
    def __init__(self, iface, plugin_dir, yleiskaavaSettings,
                 yleiskaavaDatabase, yleiskaavaUtils):

        self.iface = iface

        self.yleiskaavaSettings = yleiskaavaSettings
        self.yleiskaavaDatabase = yleiskaavaDatabase
        self.yleiskaavaUtils = yleiskaavaUtils

        self.plugin_dir = plugin_dir

        self.dialogUpdateThemeOfGroup = uic.loadUi(
            os.path.join(self.plugin_dir, 'ui',
                         'yleiskaava_dialog_update_themes_of_group.ui'))

        self.themes = None
        self.themeNames = None

        self.currentTheme = None

        self.hasUserSelectedPolygonFeaturesForUpdate = False
        self.hasUserSelectedSuplementaryPolygonFeaturesForUpdate = False
        self.hasUserSelectedLineFeaturesForUpdate = False
        self.hasUserSelectedPointFeaturesForUpdate = False

        self.hasUserCanceledCopy = False
        self.progressDialog = None
        self.shouldHide = False
    def __init__(self, iface):

        self.supportedPaperSizes = ['A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8']  # ISO A series
        self.paperSizesPresent = []
        self.presetScales = ['200', '500', '1 000', '1 250', '2 500', '5 000', '10 000', '25 000', '50 000', '100 000']

        self.iface = iface
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = uic.loadUi(ui_file, self)

        # Set up the list of templates
        s = QtCore.QSettings()
        self.identifiable_only = s.value("SelectorTools/ProjectSelector/identifiableOnly", True, type=bool)
        self.templateFileRoot = s.value("SelectorTools/TemplateSelector/templateRoot", '', type=str)
        if len(self.templateFileRoot) == 0 or not os.path.isdir(self.templateFileRoot):
            raise TemplateSelectorException('\'%s\' is not a valid template file root folder.' % self.templateFileRoot)
        self.populateTemplateTypes()
        self.populatePoiLayers()
        self.onPoiLayerChanged()

        self.onTemplateTypeChanged()
        self.plugin_dir = os.path.dirname(__file__)

        # Replacement map
        self.ui.suitableForComboBox.addItem('<custom>')
        self.user = os.environ.get('username', '[user]')
        self.replaceMap = {
            'author': "Compiled by {} on [%concat(day($now ),'/',month($now),'/',year($now))%]".format(self.user)
        }
        self.ui.autofit_btn.clicked.connect(self.autofit_map)
        self.ui.suitableForComboBox.currentIndexChanged.connect(self.specify_dpi)
        self.ui.suitableForComboBox.editTextChanged.connect(self.text_changed)
        self.ui.poiLayerComboBox.currentIndexChanged.connect(self.onPoiLayerChanged)
Esempio n. 34
0
    def __init__(self,
                 zipfile: str,
                 output_dir: str,
                 no_shapes=False,
                 ignore_no_route_stops=False):
        """Constructor."""
        super().__init__()
        self.ui = uic.loadUi(
            os.path.join(os.path.dirname(__file__), 'gtfs_go_loader_base.ui'),
            self)

        self.zipfile = zipfile
        self.output_dir = output_dir
        self.no_shapes = no_shapes
        self.ignore_no_route_stops = ignore_no_route_stops

        # vars to store Classes working in other threads.
        self.downloader = None
        self.extractor = None

        self.ui.progressBar.setMaximum(MAX_PROGRESS_COUNT)

        if os.path.exists(TEMPDIR):
            shutil.rmtree(TEMPDIR)
        os.makedirs(TEMPDIR, exist_ok=True)

        self.start()

        self.ui.pushButton.clicked.connect(self.canceled)
 def update_template(self):
     if self.template_subframe is not None:
         self.template_subframe.setParent(None)
     subframe = QFrame(self.template_frame)
     self.frame_layout.addWidget(subframe, 1, 0, 1, 2)
     self.template_subframe = uic.loadUi(os.path.join(
         self.template().subdir(), 'wizard_form_base.ui'),
         subframe)
    def showAnimationOptions(self):
        self.animationDialog = uic.loadUi(os.path.join(self.path, ANIMATION_WIDGET_FILE))

        def selectFile():
            self.animationDialog.lineEdit.setText(QFileDialog.getOpenFileName())

        self.animationDialog.pushButton.clicked.connect(self.selectAnimationFolder)
        self.animationDialog.buttonBox.accepted.connect(self.sendAnimationOptions)
        self.animationDialog.show()
    def __init__(self, iface, model):
        """Initialize the GUI control"""
        QObject.__init__(self)
        self.iface = iface
        self.model = model
        self.optionsDialog = None
        self.path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ui')

        # load the form
        self.dock = uic.loadUi(os.path.join(self.path, DOCK_WIDGET_FILE))
        self.iface.addDockWidget(Qt.BottomDockWidgetArea, self.dock)

        self.dock.pushButtonExportVideo.setEnabled(False)  # only enabled if there are managed layers
        self.dock.pushButtonOptions.clicked.connect(self.optionsClicked)
        self.dock.pushButtonExportVideo.clicked.connect(self.exportVideoClicked)
        self.dock.pushButtonToggleTime.clicked.connect(self.toggleTimeClicked)
        self.dock.pushButtonArchaeology.clicked.connect(self.archaeologyClicked)
        self.dock.pushButtonBack.clicked.connect(self.backClicked)
        self.dock.pushButtonForward.clicked.connect(self.forwardClicked)
        self.dock.pushButtonPlay.clicked.connect(self.playClicked)
        self.dock.dateTimeEditCurrentTime.dateTimeChanged.connect(self.currentTimeChangedDateText)
        # self.dock.horizontalTimeSlider.valueChanged.connect(self.currentTimeChangedSlider)

        self.sliderTimer = QTimer(self)
        self.sliderTimer.setInterval(250)
        self.sliderTimer.setSingleShot(True)
        self.sliderTimer.timeout.connect(self.currentTimeChangedSlider)
        self.dock.horizontalTimeSlider.valueChanged.connect(self.startTimer)

        self.dock.comboBoxTimeExtent.currentIndexChanged[str].connect(self.currentTimeFrameTypeChanged)
        self.dock.spinBoxTimeExtent.valueChanged.connect(self.currentTimeFrameSizeChanged)

        # this signal is responsible for rendering the label
        self.iface.mapCanvas().renderComplete.connect(self.renderLabel)

        # create shortcuts
        self.focusSC = QShortcut(QKeySequence("Ctrl+Space"), self.dock)
        self.focusSC.activated.connect(self.dock.horizontalTimeSlider.setFocus)

        # put default values
        self.dock.horizontalTimeSlider.setMinimum(conf.MIN_TIMESLIDER_DEFAULT)
        self.dock.horizontalTimeSlider.setMaximum(conf.MAX_TIMESLIDER_DEFAULT)
        self.dock.dateTimeEditCurrentTime.setMinimumDate(MIN_QDATE)
        self.showLabel = conf.DEFAULT_SHOW_LABEL
        self.exportEmpty = conf.DEFAULT_EXPORT_EMPTY
        self.labelOptions = TimestampLabelConfig(self.model)

        # placeholders for widgets that are added dynamically
        self.bcdateSpinBox = None

        # add to plugins toolbar
        try:
            self.action = QAction(QCoreApplication.translate("TimeManagerGuiControl", "Toggle visibility"), self.iface.mainWindow())
            self.action.triggered.connect(self.toggleDock)
            self.iface.addPluginToMenu(QCoreApplication.translate("TimeManagerGuiControl", "&TimeManager"), self.action)
        except Exception as e:
            pass  # OK for testing
Esempio n. 38
0
 def initGui(self):
     proj = QgsProject.instance()
     proj.readProject.connect(self.loadData)
     proj.writeProject.connect(self.saveData)
     self.iface.newProjectCreated .connect(self.clearEdit)
     
     pluginPath = path.dirname(path.abspath(__file__))
     self.dock = uic.loadUi(path.join(pluginPath, "ui_qnote.ui"))
     self.iface.addDockWidget(Qt.BottomDockWidgetArea, self.dock)
     self.loadData()
Esempio n. 39
0
 def xml(self):
     self.doc = QDomDocument()
     element = self.doc.createElement("qgiswidgets")
     self.doc.appendChild(element)
     for p in glob.glob(self.ui_dir):
         self.printMsg("Loading " + p)
         # qgsrasterlayerpropertiesbase.ui is giving: No module named qwt_plot
         try:
             widget = loadUi(p)
             #print dir ( ui )
             self.widgetXml(element, widget)
         except Exception, e:
             #except IOError, e:
             self.printMsg(str(e))
    def __init__(self):
        
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = uic.loadUi(ui_file, self)

        self.settings = QtCore.QSettings()

        # Populate the values
        with open(DEFAULTS) as paths:
            projects = paths.readline().strip().split(':', 1)[-1]
            templates = paths.readline().strip().split(':', 1)[-1]
            self.ui.projectsFolderLineEdit.setText(projects)
            self.ui.templateRootLineEdit.setText(templates)
        project_selector_enabled = self.settings.value("SelectorTools/ProjectSelector/isEnabled", True, type=bool)
        identifiable_only = self.settings.value("SelectorTools/ProjectSelector/identifiableOnly", True, type=bool)
        self.ui.projectSelectorEnabledCheckBox.setChecked(project_selector_enabled)
        self.ui.identifiableOnly.setChecked(identifiable_only)
    def __init__(self, iface):
        
        self.iface = iface

        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = uic.loadUi(ui_file, self)
        self.plugin_dir = os.path.dirname(__file__)
        
        # import pydevd; pydevd.settrace()
        
        # Disable OK button until we are sure we have at least one project
        self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        # Set up the list of templates
        self.settings = QtCore.QSettings()
        self.projectFileRoot = self.settings.value('SelectorTools/ProjectSelector/projectRoot', '', type=str)
        if len(self.projectFileRoot) == 0 or not os.path.isdir(self.projectFileRoot):
            raise ProjectSelectorException('\'%s\' is not a valid project file root folder.' % self.projectFileRoot)

        # Populate the list of project types
        self.ui.projectGroupComboBox.blockSignals(True)
        for entry in os.listdir(self.projectFileRoot):
            entryPath = os.path.join(self.projectFileRoot, entry)
            if not os.path.isdir(entryPath):
                continue
            # Check there's a .qgs file in this path
            for subEntry in os.listdir(entryPath):
                if subEntry.lower().endswith('.qgs') and os.path.isfile(os.path.join(entryPath, subEntry)):
                    # The folder contains at least one project, add it
                    self.ui.projectGroupComboBox.addItem(entry)
                    break
        self.ui.projectGroupComboBox.blockSignals(False)
        defaultGroup = self.settings.value('SelectorTools/ProjectSelector/defaultProjectGroup', '', type=str)
        if len(defaultGroup) > 0:
            self.ui.projectGroupComboBox.setCurrentIndex( self.ui.projectGroupComboBox.findText(defaultGroup) )
        if self.ui.projectGroupComboBox.count() == 1:
            self.ui.projectGroupComboBox.setCurrentIndex(0)
            self.ui.projectGroupComboBox.setEnabled(False)
        self.onProjectGroupChanged()
 def __init__(self, iface, parent=None):
     super(PostNAS_CreateFulltextindex, self).__init__(parent)
     self.dialog = uic.loadUi(os.path.join(os.path.dirname(__file__), 'PostNAS_FulltextindexInProgress.ui'))
 def showArchOptions(self):
     self.archMenu = uic.loadUi(os.path.join(self.path, ARCH_WIDGET_FILE))
     self.archMenu.buttonBox.accepted.connect(self.saveArchOptions)
     self.archMenu.buttonBox.rejected.connect(self.cancelArch)
     self.archMenu.show()
    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)
        self.optionsDialog.tableWidget.resizeColumnsToContents()

        # 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)

        self.optionsDialog.textBrowser.setHtml(QCoreApplication.translate('TimeManager', """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
    <meta name="qrichtext" content="1"/>

    <style>
    li.mono {
    font-family: Consolas, Courier New, Courier, monospace;
}
    </style>
</head>
<body>

<h1>Time Manager</h1>

<p>Time Manager filters your layers and displays only layers and features that match the specified time frame. Time Manager supports vector layers and raster layers (including WMS-T).</p>

<p>Timestamps have to be in one of the following formats:</p>

<ul>
<li class="mono">%Y-%m-%d %H:%M:%S.%f</li>
<li class="mono">%Y-%m-%d %H:%M:%S</li>
<li class="mono">%Y-%m-%d %H:%M</li>
<li class="mono">%Y-%m-%dT%H:%M:%S</li>
<li class="mono">%Y-%m-%dT%H:%M:%SZ</li>
<li class="mono">%Y-%m-%dT%H:%M</li>
<li class="mono">%Y-%m-%dT%H:%MZ</li>
<li class="mono">%Y-%m-%d</li>
<li class="mono">%Y/%m/%d %H:%M:%S.%f</li>
<li class="mono">%Y/%m/%d %H:%M:%S</li>
<li class="mono">%Y/%m/%d %H:%M</li>
<li class="mono">%Y/%m/%d</li>
<li class="mono">%H:%M:%S</li>
<li class="mono">%H:%M:%S.%f</li>
<li class="mono">%Y.%m.%d %H:%M:%S.%f</li>
<li class="mono">%Y.%m.%d %H:%M:%S</li>
<li class="mono">%Y.%m.%d %H:%M</li>
<li class="mono">%Y.%m.%d</li>
<li class="mono">%Y%m%d%H%M%SED</li>
<li>Integer timestamp in seconds after or before the epoch (1970-1-1)</li>
</ul>


<p>The layer list contains all layers managed by Time Manager.
To add a vector layer, press [Add layer].
To add a raster layer, press [Add raster].
If you want to remove a layer from the list, select it and press [Remove layer].</p>


<p>Below the layer list, you'll find the following <b>animation options</b>:</p>

<p><b>Show frame for x milliseconds</b>...
allows you to adjust for how long a frame will be visible during the animation</p>

<p><b>Play animation backwards</b>...
if checked, the animation will run in reverse direction</p>

<p><b>Display frame start time on map</b>...
if checked, displays the start time of the visible frame in the lower right corner of the map</p>

<h2>Add Layer dialog</h2>

<p>Here, you are asked to select the layer that should be added and specify the columns containing
start and (optionally) end time.</p>

<p>The <b>offset</b> option allows you to further time the appearance of features. If you specify
an offset of -1, the features will appear one second later than they would by default.</p>

<h2>Dock widget</h2>

<p>The dock was designed to attach to the bottom of the QGIS main window. It offers the following tools:</p>

<ul>
<li><img src="images/power_on.png" alt="power"/> ... On/Off switch, allows you to turn Time Manager's functionality on/off with the click of only one button</li>
<li><span class="hidden">[Settings]</span><input type="button" value="Settings"/> ... opens the Settings dialog where you can manage your spatio-temporal layers</li>
<li><span class="hidden">[Export Video]</span><input type="button" value="Export Video"/> ... exports an image series based on current settings (This button is only enabled if there are layers registered in Time Manager "Settings")</li>
<li><b>Time frame start: <span class="hidden">[2000-01-01 00:00:00]</span></b><input type="text" value="2000-01-01 00:00:00"/> ... shows the start time of the currently active frame. Allows you to precisely specify your desired analysis time.</li>
<li><b>Time frame size: </b><input type="text" value="1"/><span class="hidden">[x]</span><select><option value="days">days</option></select> ... allow you to choose the size of the time frame</li>
<li><img src="images/back.png" alt="back"/> ... go to the previous time frame</li>
<li><img src="images/forward.png" alt="forward"/> ... go to the next time frame</li>
<li><b>Slider</b> ... shows the position of current frame relative to the whole dataset and allows you to seamlessly scroll through the dataset</li>
<li><img src="images/play.png" alt="play"/> ... start an automatic animation based on your current settings</li>
</ul>

</body>
</html>"""))

        # 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)
Esempio n. 45
0
 def __init__(self, iface, ui_path, out_table):
     self.iface = iface
     self.tempLayerIndexToId = {}
     self.dialog = uic.loadUi(ui_path)
     self.out_table = out_table
     self.addConnections()
 def __init__(self):
     QDialog.__init__(self)
     # Set up the user interface from Designer.
     self.ui = uic.loadUi(ui_file, self)