def __init__(self, tree, parent, repo, layer, branch, branchCommitId):
        QTreeWidgetItem.__init__(self, parent)
        self.repo = repo
        self.tree = tree
        self.layer = layer
        self.branch = branch
        self.currentCommitId = None
        self.branchCommitId = branchCommitId
        self.setIcon(0, layerIcon)
        self.setText(0, self.layer)

        self.status = self.NOT_EXPORTED
        trackedlayer = getTrackingInfoForGeogigLayer(self.repo.url, layer)
        if trackedlayer:
            if os.path.exists(trackedlayer.geopkg):
                try:
                    con = sqlite3.connect(trackedlayer.geopkg)
                    cursor = con.cursor()
                    cursor.execute("SELECT commit_id FROM geogig_audited_tables WHERE table_name='%s';" % layer)
                    self.currentCommitId = cursor.fetchone()[0]
                    cursor.close()
                    con.close()
                    if branchCommitId == self.currentCommitId:
                        self.status = self.IN_SYNC
                    else:
                        self.status = self.NOT_IN_SYNC
                except:
                    pass
 def __init__(self, filename, name, icon):
     QTreeWidgetItem.__init__(self)
     self.name = name
     self.filename = filename
     self.setText(0, name)
     self.setIcon(0, icon)
     self.setCheckState(0, Qt.Unchecked)
Exemple #3
0
 def __init__(self, provider, tree, toolbox):
     QTreeWidgetItem.__init__(self, tree)
     self.tree = tree
     self.toolbox = toolbox
     self.provider = provider
     self.setIcon(0, self.provider.icon())
     self.populate()
Exemple #4
0
 def __init__(self, provider_id, tree, toolbox):
     QTreeWidgetItem.__init__(self, tree)
     self.tree = tree
     self.toolbox = toolbox
     self.provider_id = provider_id
     self.provider = QgsApplication.processingRegistry().providerById(provider_id)
     self.setIcon(0, self.provider.icon())
     self.populate()
 def __init__(self, tree, repo, branch):
     QTreeWidgetItem.__init__(self)
     self.repo = repo
     self.tree = tree
     self.branch = branch
     self.setText(0, branch)
     self.setIcon(0, branchIcon)
     self.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
Exemple #6
0
 def __init__(self, providerName, tree, toolbox):
     QTreeWidgetItem.__init__(self, tree)
     self.tree = tree
     self.toolbox = toolbox
     self.providerName = providerName
     self.provider = Processing.getProviderFromName(providerName)
     self.setIcon(0, self.provider.getIcon())
     self.populate()
Exemple #7
0
 def __init__(self, alg):
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     name = AlgorithmClassification.getDisplayName(alg)
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Exemple #8
0
 def __init__(self, alg):
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     name = alg.displayName()
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Exemple #9
0
    def __init__(self, connection):
        self.connIcon = QIcon(os.path.dirname(__file__) + '/../images/postgis.png')
        self.schemaIcon = QIcon(os.path.dirname(__file__) + '/../images/namespace.png')

        QTreeWidgetItem.__init__(self)
        self.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
        self.connection = connection
        self.setText(0, connection)
        self.setIcon(0, self.connIcon)
Exemple #10
0
 def __init__(self, provider, tree, toolbox):
     QTreeWidgetItem.__init__(self, None)
     self.tree = tree
     self.toolbox = toolbox
     self.provider = provider
     self.setIcon(0, self.provider.icon())
     self.setData(0, ProcessingToolbox.TYPE_ROLE, ProcessingToolbox.PROVIDER_ITEM)
     self.setToolTip(0, self.provider.longName())
     self.populate()
 def __init__(self, navigator, tree, repo):
     QTreeWidgetItem.__init__(self)
     self.navigator = navigator
     self.repo = repo
     self.tree = tree
     self.setSizeHint(0, QSize(self.sizeHint(0).width(), 25))
     self.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
     self.setText(0, self.repo.title)
     self.setIcon(0, repoIcon)
 def __init__(self, conflict):
     QTreeWidgetItem.__init__(self)
     self.setText(0, conflict.path)
     self.setIcon(0, featureIcon)
     self.setSizeHint(0, QSize(self.sizeHint(0).width(), 25))
     self.conflict = conflict
     self._local = None
     self._remote = None
     self._origin = None
Exemple #13
0
 def __init__(self, alg):
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     nameEn, name = alg.displayNames()
     name = name if name != '' else nameEn
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
     self.setData(0, Qt.UserRole, nameEn)
 def __init__(self, branch, repo, path):
     QTreeWidgetItem.__init__(self)
     self.branch = branch
     self.ref = branch
     self.repo = repo
     self.path = path
     self.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
     self.setText(0, branch)
     self.setIcon(0, branchIcon)
     self._commit = None
Exemple #15
0
 def __init__(self, alg):
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.icon()
     nameEn = alg.name()
     name = alg.displayName()
     name = name if name != '' else nameEn
     self.setIcon(0, icon)
     self.setToolTip(0, self.formatAlgorithmTooltip(alg))
     self.setText(0, name)
     self.setData(0, ProcessingToolbox.NAME_ROLE, nameEn)
     self.setData(0, ProcessingToolbox.TAG_ROLE, alg.tags())
     self.setData(0, ProcessingToolbox.TYPE_ROLE, ProcessingToolbox.ALG_ITEM)
 def __init__(self, parent, tree, providerName, param):
     QTreeWidgetItem.__init__(self, parent)
     self.providereName = providerName
     self.param = param
     self.tree = tree
     self.setText(0, param.description)
     self.paramName = settingName(providerName, param.name)
     if isinstance(param.defaultValue, bool):
         self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue, type=bool)
         if self.value:
             self.setCheckState(1, Qt.Checked)
         else:
             self.setCheckState(1, Qt.Unchecked)
     elif isinstance(param.defaultValue, list):
         self.combo = QComboBox()
         for element in param.defaultValue:
             self.combo.addItem(element)
         self.tree.setItemWidget(self, 1, self.combo)
         self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue[0])
         idx = self.combo.findText(self.value)
         self.combo.setCurrentIndex(idx)
     elif param.description == "Password":
         self.passwordField = QLineEdit()
         self.passwordField.setEchoMode(QLineEdit.Password);
         #self.passwordField.setStyleSheet("QLineEdit { border: none }");
         self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue)
         self.passwordField.setText(str(self.value))
         self.tree.setItemWidget(self, 1, self.passwordField)
     elif param.action is not None:
         layout = QHBoxLayout()
         layout.setMargin(0)
         layout.setSpacing(0)
         self.textbox = QLineEdit()
         self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue)
         self.textbox.setText(str(self.value))
         layout.addWidget(self.textbox)
         self.button = QToolButton()
         self.button.setText(param.actionText)
         self.button.clicked.connect(param.action)
         layout.addWidget(self.button)
         self.widget = QWidget()
         self.widget.setLayout(layout)
         self.tree.setItemWidget(self, 1, self.widget)
     else:
         self.textbox = QLineEdit()
         #self.textbox.setStyleSheet("QLineEdit { border: none }");
         self.tree.setItemWidget(self, 1, self.textbox)
         self.value = QSettings().value(self.paramName, defaultValue=param.defaultValue)
         self.textbox.setText(str(self.value))
Exemple #17
0
 def __init__(self, name):
     QTreeWidgetItem.__init__(self)
     self.setToolTip(0, name)
     self.setText(0, name)
     self.setData(0, ProcessingToolbox.NAME_ROLE, name)
     self.setData(0, ProcessingToolbox.TYPE_ROLE, ProcessingToolbox.GROUP_ITEM)
Exemple #18
0
 def __init__(self, result):
     QTreeWidgetItem.__init__(self)
     self.setIcon(0, result.icon)
     self.setText(0, '{0} [{1}]'.format(result.name, time.strftime('%I:%M:%S%p', result.timestamp)))
     self.algorithm = result.name
     self.filename = result.filename
 def __init__(self, name, value):
     QTreeWidgetItem.__init__(self)
     self.value = value
     self.setText(0, name + ': ' + str(value))
Exemple #20
0
    def __init__(self, tree, parent, repo, layer, branch, branchCommitId):
        QTreeWidgetItem.__init__(self, parent)
        self.repo = repo
        self.tree = tree
        self.layer = layer
        self.branch = branch
        self.currentCommitId = None
        self.setIcon(0, layerIcon)

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.label = QLabel()
        self.label.setText(layer)
        self.labelLinks = QLabel()
        self.labelLinks.setText("<a href='#'>Add to QGIS</a>")
        self.label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        layout.addWidget(self.label)
        layout.addWidget(self.labelLinks)
        layout.addStretch()

        def add():
            if self.status == self.NOT_IN_SYNC:
                msgBox = QMessageBox()
                msgBox.setText(
                    "This layer was exported already at a different version.\nWhich version would you like to add to your QGIS project?"
                )
                msgBox.addButton(QPushButton('Use exported version'),
                                 QMessageBox.YesRole)
                msgBox.addButton(QPushButton('Use version from this branch'),
                                 QMessageBox.NoRole)
                msgBox.addButton(QPushButton('Cancel'), QMessageBox.RejectRole)
                QApplication.restoreOverrideCursor()
                ret = msgBox.exec_()
                if ret == 0:
                    checkoutLayer(self.repo, self.layer, None,
                                  self.currentCommitId)
                elif ret == 1:
                    try:
                        layer = checkoutLayer(self.repo, self.layer, None,
                                              branchCommitId)
                        repoWatcher.layerUpdated.emit(layer)
                    except HasLocalChangesError:
                        QMessageBox.warning(
                            config.iface.mainWindow(), 'Cannot change version',
                            "There are local changes that would be overwritten.\n"
                            "Revert them before changing version.",
                            QMessageBox.Ok)
            else:
                checkoutLayer(self.repo, self.layer, None, branchCommitId)

        self.labelLinks.linkActivated.connect(add)
        w = QWidget()
        w.setLayout(layout)
        self.tree.setItemWidget(self, 0, w)

        self.status = self.NOT_EXPORTED
        trackedlayer = getTrackingInfoForGeogigLayer(self.repo.url, layer)
        if trackedlayer:
            try:
                con = sqlite3.connect(trackedlayer.geopkg)
                cursor = con.cursor()
                cursor.execute(
                    "SELECT commit_id FROM geogig_audited_tables WHERE table_name='%s';"
                    % layer)
                self.currentCommitId = cursor.fetchone()[0]
                cursor.close()
                con.close()
                if branchCommitId == self.currentCommitId:
                    self.status = self.IN_SYNC
                else:
                    self.status = self.NOT_IN_SYNC
                    self.label.setText("<font color='orange'>%s</font>" %
                                       layer)
            except:
                pass
Exemple #21
0
 def __init__(self, description, name):
     QTreeWidgetItem.__init__(self)
     self.name = name
     self.description = description
     self.setText(0, description)
 def __init__(self, layer):
     QTreeWidgetItem.__init__(self)
     self.layer = layer
     self.setText(0, layer.title())
     self.setIcon(0, layerIcon)
Exemple #23
0
 def __init__(self, description, name):
     QTreeWidgetItem.__init__(self)
     self.name = name
     self.description = description
     self.setText(0, description)
Exemple #24
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.name)
     self.setIcon(0, action.getIcon())
     self.setData(0, ModelerDialog.NAME_ROLE, action.name)
Exemple #25
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.i18n_name)
     self.setIcon(0, action.getIcon())
     self.setData(0, ProcessingToolbox.NAME_ROLE, action.name)
 def __init__(self, fid, old, new):
     QTreeWidgetItem.__init__(self)
     self.setIcon(0, featureIcon)
     self.setText(0, fid)
     self.old = old
     self.new = new
Exemple #27
0
 def __init__(self, result):
     QTreeWidgetItem.__init__(self)
     self.setIcon(0, result.icon)
     self.setText(0, '{0} [{1}]'.format(result.name, time.strftime('%I:%M:%S%p', result.timestamp)))
     self.algorithm = result.name
     self.filename = result.filename
Exemple #28
0
 def __init__(self, iface, layer, tree, dlg):
     QTreeWidgetItem.__init__(self)
     self.iface = iface
     self.layer = layer
     self.setText(0, layer.name())
     self.setIcon(0, self.layerIcon)
     project = QgsProject.instance()
     if project.layerTreeRoot().findLayer(layer.id()).isVisible():
         self.setCheckState(0, Qt.Checked)
     else:
         self.setCheckState(0, Qt.Unchecked)
     self.visibleItem = QTreeWidgetItem(self)
     self.visibleCheck = QCheckBox()
     vis = layer.customProperty("qgis2web/Visible", True)
     if vis == 0 or str(vis).lower() == "false":
         self.visibleCheck.setChecked(False)
     else:
         self.visibleCheck.setChecked(True)
     self.visibleItem.setText(0, "Visible")
     self.addChild(self.visibleItem)
     tree.setItemWidget(self.visibleItem, 1, self.visibleCheck)
     if layer.type() == layer.VectorLayer:
         if layer.providerType() == 'WFS':
             self.jsonItem = QTreeWidgetItem(self)
             self.jsonCheck = QCheckBox()
             if layer.customProperty("qgis2web/Encode to JSON") == 2:
                 self.jsonCheck.setChecked(True)
             self.jsonItem.setText(0, "Encode to JSON")
             self.jsonCheck.stateChanged.connect(self.changeJSON)
             self.addChild(self.jsonItem)
             tree.setItemWidget(self.jsonItem, 1, self.jsonCheck)
         if layer.geometryType() == QgsWkbTypes.PointGeometry:
             self.clusterItem = QTreeWidgetItem(self)
             self.clusterCheck = QCheckBox()
             if layer.customProperty("qgis2web/Cluster") == 2:
                 self.clusterCheck.setChecked(True)
             self.clusterItem.setText(0, "Cluster")
             self.clusterCheck.stateChanged.connect(self.changeCluster)
             self.addChild(self.clusterItem)
             tree.setItemWidget(self.clusterItem, 1, self.clusterCheck)
         self.popupItem = QTreeWidgetItem(self)
         self.popupItem.setText(0, "Popup fields")
         options = []
         fields = self.layer.fields()
         for f in fields:
             fieldIndex = fields.indexFromName(f.name())
             editorWidget = layer.editorWidgetSetup(fieldIndex).type()
             if editorWidget == 'Hidden':
                 continue
             options.append(f.name())
         for option in options:
             self.attr = QTreeWidgetItem(self)
             self.attrWidget = QComboBox()
             self.attrWidget.addItem("no label")
             self.attrWidget.addItem("inline label")
             self.attrWidget.addItem("header label")
             custProp = layer.customProperty("qgis2web/popup/" + option)
             if (custProp != "" and custProp is not None):
                 self.attrWidget.setCurrentIndex(
                     self.attrWidget.findText(
                         layer.customProperty("qgis2web/popup/" + option)))
             self.attr.setText(1, option)
             self.popupItem.addChild(self.attr)
             tree.setItemWidget(self.attr, 2, self.attrWidget)
         self.addChild(self.popupItem)
     else:
         if layer.providerType() == 'wms':
             self.getFeatureInfoItem = QTreeWidgetItem(self)
             self.getFeatureInfoCheck = QCheckBox()
             if layer.customProperty("qgis2web/GetFeatureInfo") == 2:
                 self.getFeatureInfoCheck.setChecked(True)
             self.getFeatureInfoItem.setText(0, "Enable GetFeatureInfo?")
             self.getFeatureInfoCheck.stateChanged.connect(
                 self.changeGetFeatureInfo)
             self.addChild(self.getFeatureInfoItem)
             tree.setItemWidget(self.getFeatureInfoItem, 1,
                                self.getFeatureInfoCheck)
 def __init__(self, name, value):
     QTreeWidgetItem.__init__(self)
     self.value = value
     self.setText(0, name + ': ' + unicode(value))
Exemple #30
0
 def __init__(self, entry, isAlg):
     QTreeWidgetItem.__init__(self)
     self.entry = entry
     self.isAlg = isAlg
     self.setText(0, "[" + entry.date + "] " + entry.text.split("|")[0])
Exemple #31
0
 def __init__(self):
     QTreeWidgetItem.__init__(self)
Exemple #32
0
 def __init__(self, layername, featureid):
     QTreeWidgetItem.__init__(self)
     self.setIcon(0, featureIcon)
     self.layername = layername
     self.featureid = featureid
     self.setText(0, featureid)
Exemple #33
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.i18n_name)
     self.setIcon(0, action.getIcon())
     self.setData(0, Qt.UserRole, action.name)
Exemple #34
0
 def __init__(self, name):
     QTreeWidgetItem.__init__(self)
     self.setToolTip(0, name)
     self.setText(0, name)
     self.setData(0, ModelerDialog.NAME_ROLE, name)
     self.setData(0, ModelerDialog.TYPE_ROLE, ModelerDialog.GROUP_ITEM)
Exemple #35
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.name)
     self.setIcon(0, action.getIcon())
     self.setData(0, ModelerDialog.NAME_ROLE, action.name)
 def __init__(self, layername, featureid):
     QTreeWidgetItem.__init__(self)
     self.setIcon(0, featureIcon)
     self.layername = layername
     self.featureid = featureid
     self.setText(0, featureid)
Exemple #37
0
 def __init__(self, name):
     QTreeWidgetItem.__init__(self)
     self.setToolTip(0, name)
     self.setText(0, name)
     self.setData(0, ModelerDialog.NAME_ROLE, name)
     self.setData(0, ModelerDialog.TYPE_ROLE, ModelerDialog.GROUP_ITEM)
Exemple #38
0
 def __init__(self, layer, widget):
     QTreeWidgetItem.__init__(self)
     self.layer = layer
     self.widget = widget
     self.setCheckState(0, Qt.Unchecked);
     self.setText(0, layer.time())
Exemple #39
0
 def __init__(self, result):
     QTreeWidgetItem.__init__(self)
     self.filename = result.filename
     self.setText(0, result.name)
Exemple #40
0
 def __init__(self, result):
     QTreeWidgetItem.__init__(self)
     self.setIcon(0, result.icon)
     self.setText(0, result.name)
     self.filename = result.filename
Exemple #41
0
 def __init__(self, name):
     QTreeWidgetItem.__init__(self)
     self.setToolTip(0, name)
     self.setText(0, name)
     self.setData(0, ProcessingToolbox.NAME_ROLE, name)
     self.setData(0, ProcessingToolbox.TYPE_ROLE, ProcessingToolbox.GROUP_ITEM)
Exemple #42
0
 def __init__(self, entry, isAlg):
     QTreeWidgetItem.__init__(self)
     self.entry = entry
     self.isAlg = isAlg
     self.setText(0, '[' + entry.date + '] ' + entry.text.split('|')[0])
Exemple #43
0
 def __init__(self, entry, isAlg):
     QTreeWidgetItem.__init__(self)
     self.entry = entry
     self.isAlg = isAlg
     self.setText(0, '[' + entry.date + '] ' + entry.text.split('|')[0])
Exemple #44
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.i18n_name)
     self.setIcon(0, action.getIcon())
     self.setData(0, ProcessingToolbox.NAME_ROLE, action.name)
Exemple #45
0
 def __init__(self, action):
     QTreeWidgetItem.__init__(self)
     self.action = action
     self.setText(0, action.i18n_name)
     self.setIcon(0, action.getIcon())
     self.setData(0, Qt.UserRole, action.name)
Exemple #46
0
 def __init__(self):
     QTreeWidgetItem.__init__(self)
     self.setText(0, "Repositories")
Exemple #47
0
 def __init__(self, parent, tree, setting, namespace, value):
     QTreeWidgetItem.__init__(self, parent)
     self.parent = parent
     self.namespace = namespace
     self.tree = tree
     self._value = value
     self.setting = setting
     self.name = setting["name"]
     self.labelText = setting["label"]
     self.settingType = setting["type"]
     self.setText(0, self.labelText)
     if self.settingType == CRS:
         def edit():
             selector = QgsProjectionSelectionDialog()
             selector.setCrs(value);
             if selector.exec_():
                 crs = selector.crs()
                 if crs.upper().startswith("EPSG:"):
                     self.lineEdit.setText(crs)
         self._addTextBoxWithLink("Edit", edit, False)
     elif self.settingType == FILES:
         def edit():
             f = QFileDialog.getOpenFileNames(parent.treeWidget(), "Select file", "", "*.*")
             if f:
                 self.lineEdit.setText(",".join(f))
         self._addTextBoxWithLink("Browse", edit, True)
     elif self.settingType == FILE:
         def edit():
             f = QFileDialog.getOpenFileName(parent.treeWidget(), "Select file", "", "*.*")
             if f:
                 self.lineEdit.setText(f)
         self._addTextBoxWithLink("Browse", edit, True)
     elif self.settingType == FOLDER:
         def edit():
             f = QFileDialog.getExistingDirectory(parent.treeWidget(), "Select folder", "")
             if f:
                 self.lineEdit.setText(f)
         self._addTextBoxWithLink("Browse", edit, True)
     elif self.settingType == BOOL:
         if value:
             self.setCheckState(1, Qt.Checked)
         else:
             self.setCheckState(1, Qt.Unchecked)
     elif self.settingType == CHOICE:
         self.combo = QComboBox()
         self.combo.setStyleSheet(self.comboStyle)
         for option in setting["options"]:
             self.combo.addItem(option)
         self.tree.setItemWidget(self, 1, self.combo)
         idx = self.combo.findText(str(value))
         self.combo.setCurrentIndex(idx)
     elif self.settingType == TEXT:
         self._addTextEdit()
     elif self.settingType == STRING:
         self._addTextBoxWithLink(None, None)
     elif self.settingType == AUTHCFG:
         def edit():
             currentAuthCfg = self.value()
             dlg = AuthConfigSelectDialog(parent.treeWidget(), authcfg=currentAuthCfg)
             ret = dlg.exec_()
             if ret:
                 self.lineEdit.setText(dlg.authcfg)
         self._addTextBoxWithLink("Select", edit, True)
     else:
         self.setFlags(self.flags() | Qt.ItemIsEditable)
         self.setText(1, unicode(value))
 def __init__(self, tree, stringlist):
     QTreeWidgetItem.__init__(self, tree, stringlist)