• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python QtWidgets.QLabel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qgis.PyQt.QtWidgets.QLabel的典型用法代码示例。如果您正苦于以下问题:Python QLabel类的具体用法?Python QLabel怎么用?Python QLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了QLabel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: populate

    def populate(self):
        groups = {}
        count = 0
        provider = algList.algs[self.providerName]
        algs = list(provider.values())

        name = "ACTIVATE_" + self.providerName.upper().replace(" ", "_")
        active = ProcessingConfig.getSetting(name)

        # Add algorithms
        for alg in algs:
            if not alg.showInToolbox:
                continue
            if alg.group in groups:
                groupItem = groups[alg.group]
            else:
                groupItem = QTreeWidgetItem()
                name = alg.i18n_group or alg.group
                if not active:
                    groupItem.setForeground(0, Qt.darkGray)
                groupItem.setText(0, name)
                groupItem.setToolTip(0, name)
                groups[alg.group] = groupItem
            algItem = TreeAlgorithmItem(alg)
            if not active:
                algItem.setForeground(0, Qt.darkGray)
            groupItem.addChild(algItem)
            count += 1

        actions = Processing.actions[self.providerName]
        for action in actions:
            if action.group in groups:
                groupItem = groups[action.group]
            else:
                groupItem = QTreeWidgetItem()
                groupItem.setText(0, action.group)
                groups[action.group] = groupItem
            algItem = TreeActionItem(action)
            groupItem.addChild(algItem)

        text = self.provider.getDescription()

        if not active:

            def activateProvider():
                self.toolbox.activateProvider(self.providerName)

            label = QLabel(text + "&nbsp;&nbsp;&nbsp;&nbsp;<a href='%s'>Activate</a>")
            label.setStyleSheet("QLabel {background-color: white; color: grey;}")
            label.linkActivated.connect(activateProvider)
            self.tree.setItemWidget(self, 0, label)

        else:
            text += QCoreApplication.translate("TreeProviderItem", " [{0} geoalgorithms]").format(count)
        self.setText(0, text)
        self.setToolTip(0, self.text(0))
        for groupItem in list(groups.values()):
            self.addChild(groupItem)

        self.setHidden(self.childCount() == 0)
开发者ID:mbernasocchi,项目名称:QGIS,代码行数:60,代码来源:ProcessingToolbox.py


示例2: __init__

    def __init__(self, param):
        super().__init__(param)

        self.label = QLabel('')

        self.units_combo = QComboBox()
        self.base_units = QgsUnitTypes.DistanceUnknownUnit
        for u in (QgsUnitTypes.DistanceMeters,
                  QgsUnitTypes.DistanceKilometers,
                  QgsUnitTypes.DistanceFeet,
                  QgsUnitTypes.DistanceMiles,
                  QgsUnitTypes.DistanceYards):
            self.units_combo.addItem(QgsUnitTypes.toString(u), u)

        label_margin = self.fontMetrics().width('X')
        self.layout().insertSpacing(1, label_margin / 2)
        self.layout().insertWidget(2, self.label)
        self.layout().insertWidget(3, self.units_combo)
        self.layout().insertSpacing(4, label_margin / 2)
        self.warning_label = QLabel()
        icon = QgsApplication.getThemeIcon('mIconWarning.svg')
        size = max(24, self.spnValue.height() * 0.5)
        self.warning_label.setPixmap(icon.pixmap(icon.actualSize(QSize(size, size))))
        self.warning_label.setToolTip(self.tr('Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results.'))
        self.layout().insertWidget(4, self.warning_label)
        self.layout().insertSpacing(5, label_margin)

        self.setUnits(QgsUnitTypes.DistanceUnknownUnit)
开发者ID:borysiasty,项目名称:QGIS,代码行数:28,代码来源:NumberInputPanel.py


示例3: ProgressBarLogger

class ProgressBarLogger(QDialog):
    """A simple dialog with a progress bar and a label"""
    def __init__(self, title = None):
        QDialog.__init__(self, None)
        if title is not None:
            self.setWindowTitle(title)
        self.__label = QLabel(self)
        self.__layout = QVBoxLayout()
        self.__layout.addWidget(self.__label)
        self.__progress = QProgressBar(self)
        self.__layout.addWidget(self.__progress)
        self.setLayout(self.__layout)
        self.resize(600, 70)
        self.setFixedSize(600, 70)
        self.__progress.hide()
        self.show()

    def set_text(self, t):
        """Gets called when a text is to be logged"""
        if isinstance(t, tuple):
            lvl, msg = t
        else:
            msg = t
        self.__label.setText(msg)
        QCoreApplication.processEvents()

    def set_progress(self, i, n):
        """Gets called when there is a progression"""
        self.__progress.show()
        self.__progress.setMinimum(0)
        self.__progress.setMaximum(n)
        self.__progress.setValue(i)
        QCoreApplication.processEvents()
开发者ID:Oslandia,项目名称:gml_application_schema_toolbox,代码行数:33,代码来源:progress_bar.py


示例4: XYDialog

class XYDialog(QDialog):
    crs = None

    def __init__(self):
        QDialog.__init__(self)

        self.setWindowTitle(tr('XY Point drawing tool'))

        self.X = QLineEdit()
        self.Y = QLineEdit()

        X_val = QDoubleValidator()
        Y_val = QDoubleValidator()

        self.X.setValidator(X_val)
        self.Y.setValidator(Y_val)

        self.crsButton = QPushButton("Projection")
        self.crsButton.clicked.connect(self.changeCRS)
        self.crsLabel = QLabel("")

        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        grid = QGridLayout()
        grid.addWidget(QLabel("X"), 0, 0)
        grid.addWidget(QLabel("Y"), 0, 1)
        grid.addWidget(self.X, 1, 0)
        grid.addWidget(self.Y, 1, 1)
        grid.addWidget(self.crsButton, 2, 0)
        grid.addWidget(self.crsLabel, 2, 1)
        grid.addWidget(buttons, 3, 0, 1, 2)

        self.setLayout(grid)

    def changeCRS(self):
        projSelector = QgsProjectionSelectionDialog()
        projSelector.exec_()
        self.crs = projSelector.crs()
        self.crsLabel.setText(self.crs.authid())

    def getPoint(self, crs):
        # fix_print_with_import
        print(crs)
        dialog = XYDialog()
        dialog.crs = crs
        dialog.crsLabel.setText(crs.authid())
        result = dialog.exec_()

        X = 0
        Y = 0
        if dialog.X.text().strip() and dialog.Y.text().strip():
            X = float(dialog.X.text())
            Y = float(dialog.Y.text())
        return ([QgsPointXY(X, Y), dialog.crs], result == QDialog.Accepted)
开发者ID:jeremyk6,项目名称:qdraw,代码行数:57,代码来源:drawtools.py


示例5: treeItemClicked

 def treeItemClicked(self, item):
     if item.childCount():
         return
     color = {"MODIFIED": QColor(255, 170, 0), "ADDED":Qt.green,
              "REMOVED":Qt.red , "NO_CHANGE":Qt.white}
     changeTypeName = ["", "ADDED", "MODIFIED", "REMOVED"]
     path = item.text(0)
     if path not in self.changes:
         return
     oldfeature = self.changes[path].oldfeature
     newfeature = self.changes[path].newfeature
     changetype = self.changes[path].changetype
     self.attributesTable.clear()
     self.attributesTable.verticalHeader().show()
     self.attributesTable.horizontalHeader().show()
     self.attributesTable.setRowCount(len(newfeature))
     self.attributesTable.setVerticalHeaderLabels([a for a in newfeature])
     self.attributesTable.setHorizontalHeaderLabels(["Old value", "New value", "Change type"])
     for i, attrib in enumerate(newfeature):
         self.attributesTable.setItem(i, 0, DiffItem(oldfeature.get(attrib, None)))
         self.attributesTable.setItem(i, 1, DiffItem(newfeature.get(attrib, None)))
         attribChangeType = changeTypeName[changetype]
         isChangedGeom = False
         if changetype == LOCAL_FEATURE_MODIFIED:
             oldvalue = oldfeature.get(attrib, None)
             newvalue = newfeature.get(attrib, None)
             try:# to avoid false change detection due to different precisions
                 oldvalue = QgsGeometry.fromWkt(oldvalue).exportToWkt(7)
                 newvalue = QgsGeometry.fromWkt(newvalue).exportToWkt(7)
                 if oldvalue != newvalue and None not in [oldvalue, newvalue]:
                     widget = QWidget()
                     btn = QPushButton()
                     btn.setText("View detail")
                     g1 = QgsGeometry.fromWkt(oldvalue)
                     g2 = QgsGeometry.fromWkt(newvalue)
                     btn.clicked.connect(lambda: self.viewGeometryChanges(g1, g2))
                     label = QLabel()
                     label.setText(attribChangeType)
                     layout = QHBoxLayout(widget)
                     layout.addWidget(label);
                     layout.addWidget(btn);
                     layout.setContentsMargins(0, 0, 0, 0)
                     widget.setLayout(layout)
                     self.attributesTable.setItem(i, 2, QTableWidgetItem(""))
                     self.attributesTable.setCellWidget(i, 2, widget)
                     isChangedGeom = True
             except:
                 pass
             if oldvalue == newvalue:
                 attribChangeType = "NO_CHANGE"
         if not isChangedGeom:
             self.attributesTable.setItem(i, 2, QTableWidgetItem(attribChangeType))
         for col in range(3):
             self.attributesTable.item(i, col).setBackgroundColor(color[attribChangeType]);
     self.attributesTable.resizeColumnsToContents()
     self.attributesTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:56,代码来源:localdiffviewerdialog.py


示例6: populate

    def populate(self):
        groups = {}
        count = 0
        algs = self.provider.algorithms()
        active = self.provider.isActive()

        # Add algorithms
        for alg in algs:
            if alg.flags() & QgsProcessingAlgorithm.FlagHideFromToolbox:
                continue
            if alg.group() in groups:
                groupItem = groups[alg.group()]
            else:
                groupItem = QTreeWidgetItem()
                name = alg.group()
                if not active:
                    groupItem.setForeground(0, Qt.darkGray)
                groupItem.setText(0, name)
                groupItem.setToolTip(0, name)
                groups[alg.group()] = groupItem
            algItem = TreeAlgorithmItem(alg)
            if not active:
                algItem.setForeground(0, Qt.darkGray)
            groupItem.addChild(algItem)
            count += 1

        if self.provider.id() in ProviderActions.actions:
            actions = ProviderActions.actions[self.provider.id()]
            for action in actions:
                if action.group in groups:
                    groupItem = groups[action.group]
                else:
                    groupItem = QTreeWidgetItem()
                    groupItem.setText(0, action.group)
                    groups[action.group] = groupItem
                algItem = TreeActionItem(action)
                groupItem.addChild(algItem)

        text = self.provider.name()

        if not active:
            def activateProvider():
                self.toolbox.activateProvider(self.provider.id())
            label = QLabel(text + "&nbsp;&nbsp;&nbsp;&nbsp;<a href='%s'>Activate</a>")
            label.setStyleSheet("QLabel {background-color: white; color: grey;}")
            label.linkActivated.connect(activateProvider)
            self.tree.setItemWidget(self, 0, label)

        else:
            text += QCoreApplication.translate("TreeProviderItem", " [{0} geoalgorithms]").format(count)
        self.setText(0, text)
        self.setToolTip(0, self.text(0))
        for groupItem in list(groups.values()):
            self.addChild(groupItem)

        self.setHidden(self.childCount() == 0)
开发者ID:rskelly,项目名称:QGIS,代码行数:56,代码来源:ProcessingToolbox.py


示例7: addAlgorithmsFromProvider

    def addAlgorithmsFromProvider(self, provider, parent):
        groups = {}
        count = 0
        algs = provider.algorithms()
        active = provider.isActive()

        # Add algorithms
        for alg in algs:
            if alg.flags() & QgsProcessingAlgorithm.FlagHideFromToolbox:
                continue
            groupItem = None
            if alg.group() in groups:
                groupItem = groups[alg.group()]
            else:
                # check if group already exists
                for i in range(parent.childCount()):
                    if parent.child(i).text(0) == alg.group():
                        groupItem = parent.child(i)
                        groups[alg.group()] = groupItem
                        break

                if not groupItem:
                    groupItem = TreeGroupItem(alg.group())
                    if not active:
                        groupItem.setInactive()
                    if provider.id() in ('qgis', 'native', '3d'):
                        groupItem.setIcon(0, provider.icon())
                    groups[alg.group()] = groupItem
            algItem = TreeAlgorithmItem(alg)
            if not active:
                algItem.setForeground(0, Qt.darkGray)
            groupItem.addChild(algItem)
            count += 1

        text = provider.name()

        if not provider.id() in ('qgis', 'native', '3d'):
            if not active:
                def activateProvider():
                    self.activateProvider(provider.id())

                label = QLabel(text + "&nbsp;&nbsp;&nbsp;&nbsp;<a href='%s'>Activate</a>")
                label.setStyleSheet("QLabel {background-color: white; color: grey;}")
                label.linkActivated.connect(activateProvider)
                self.algorithmTree.setItemWidget(parent, 0, label)
            else:
                parent.setText(0, text)

        for group, groupItem in sorted(groups.items(), key=operator.itemgetter(1)):
            parent.addChild(groupItem)

        if not provider.id() in ('qgis', 'native', '3d'):
            parent.setHidden(parent.childCount() == 0)
开发者ID:nyalldawson,项目名称:QGIS,代码行数:53,代码来源:ProcessingToolbox.py


示例8: addLayer

 def addLayer(self):
     table = self.currentTable()
     if table is not None:
         layer = table.toMapLayer()
         layers = QgsMapLayerRegistry.instance().addMapLayers([layer])
         if len(layers) != 1:
             QgsMessageLog.logMessage(
                 self.tr("%1 is an invalid layer - not loaded").replace("%1", layer.publicSource()))
             msgLabel = QLabel(self.tr(
                 "%1 is an invalid layer and cannot be loaded. Please check the <a href=\"#messageLog\">message log</a> for further info.").replace(
                 "%1", layer.publicSource()), self.mainWindow.infoBar)
             msgLabel.setWordWrap(True)
             msgLabel.linkActivated.connect(self.mainWindow.iface.mainWindow().findChild(QWidget, "MessageLog").show)
             msgLabel.linkActivated.connect(self.mainWindow.iface.mainWindow().raise_)
             self.mainWindow.infoBar.pushItem(QgsMessageBarItem(msgLabel, QgsMessageBar.WARNING))
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:15,代码来源:db_tree.py


示例9: __init__

    def __init__(self):
        QWidget.__init__(self)

        self.setWindowTitle(self.tr('Qdraw - Settings'))
        self.setFixedSize(320, 100)
        self.center()

        # default color
        self.color = QColor(60, 151, 255, 255)

        self.sld_opacity = QSlider(Qt.Horizontal, self)
        self.sld_opacity.setRange(0, 255)
        self.sld_opacity.setValue(255)
        self.sld_opacity.tracking = True
        self.sld_opacity.valueChanged.connect(self.handler_opacitySliderValue)
        self.lbl_opacity = QLabel(self.tr('Opacity') + ': 100%', self)

        self.dlg_color = QColorDialog(self)
        btn_chColor = QPushButton(self.tr('Change the drawing color'), self)
        btn_chColor.clicked.connect(self.handler_chColor)

        vbox = QVBoxLayout()
        vbox.addWidget(self.lbl_opacity)
        vbox.addWidget(self.sld_opacity)
        vbox.addWidget(btn_chColor)
        self.setLayout(vbox)
开发者ID:jeremyk6,项目名称:qdraw,代码行数:26,代码来源:qdrawsettings.py


示例10: __init__

    def __init__(self):
        QDialog.__init__(self)

        self.setWindowTitle(tr('XY Point drawing tool'))

        self.X = QLineEdit()
        self.Y = QLineEdit()

        X_val = QDoubleValidator()
        Y_val = QDoubleValidator()

        self.X.setValidator(X_val)
        self.Y.setValidator(Y_val)

        self.crsButton = QPushButton("Projection")
        self.crsButton.clicked.connect(self.changeCRS)
        self.crsLabel = QLabel("")

        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        grid = QGridLayout()
        grid.addWidget(QLabel("X"), 0, 0)
        grid.addWidget(QLabel("Y"), 0, 1)
        grid.addWidget(self.X, 1, 0)
        grid.addWidget(self.Y, 1, 1)
        grid.addWidget(self.crsButton, 2, 0)
        grid.addWidget(self.crsLabel, 2, 1)
        grid.addWidget(buttons, 3, 0, 1, 2)

        self.setLayout(grid)
开发者ID:jeremyk6,项目名称:qdraw,代码行数:33,代码来源:drawtools.py


示例11: __init__

    def __init__(self, parent, alg):
        ParametersPanel.__init__(self, parent, alg)

        w = QWidget()
        layout = QVBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(6)
        label = QLabel()
        label.setText(self.tr("GDAL/OGR console call"))
        layout.addWidget(label)
        self.text = QPlainTextEdit()
        self.text.setReadOnly(True)
        layout.addWidget(self.text)
        w.setLayout(layout)
        self.layoutMain.addWidget(w)

        self.connectParameterSignals()
        self.parametersHaveChanged()
开发者ID:telwertowski,项目名称:Quantum-GIS,代码行数:18,代码来源:GdalAlgorithmDialog.py


示例12: show_error

 def show_error(self, error_text):
     self.lstSearchResult.clear()
     new_widget = QLabel()
     new_widget.setTextFormat(Qt.RichText)
     new_widget.setOpenExternalLinks(True)
     new_widget.setWordWrap(True)
     new_widget.setText(
         u"<div align='center'> <strong>{}</strong> </div><div align='center' style='margin-top: 3px'> {} </div>".format(
             self.tr('Error'),
             error_text
         )
     )
     new_item = QListWidgetItem(self.lstSearchResult)
     new_item.setSizeHint(new_widget.sizeHint())
     self.lstSearchResult.addItem(new_item)
     self.lstSearchResult.setItemWidget(
         new_item,
         new_widget
     )
开发者ID:nextgis,项目名称:quickmapservices,代码行数:19,代码来源:qms_service_toolbox.py


示例13: set_unit

 def set_unit(self):
     """Set the units label. (Include the frequency.)"""
     label = ''
     if self._parameter.frequency:
         label = self._parameter.frequency
     if self._parameter.unit.plural:
         label = '%s %s' % (self._parameter.unit.plural, label)
     elif self._parameter.unit.name:
         label = '%s %s' % (self._parameter.unit.name, label)
     self._unit_widget = QLabel(label)
     if self._parameter.unit.help_text:
         self._unit_widget.setToolTip(self._parameter.unit.help_text)
开发者ID:inasafe,项目名称:inasafe,代码行数:12,代码来源:resource_parameter_widget.py


示例14: search_finished_progress

 def search_finished_progress(self):
     self.lstSearchResult.takeItem(0)
     if self.lstSearchResult.count() == 0:
         new_widget = QLabel()
         new_widget.setTextFormat(Qt.RichText)
         new_widget.setOpenExternalLinks(True)
         new_widget.setWordWrap(True)
         new_widget.setText(
             u"<div align='center'> <strong>{}</strong> </div><div align='center' style='margin-top: 3px'> {} </div>".format(
                 self.tr(u"No results."),
                 self.tr(u"You can add a service to become searchable. Start <a href='{}'>here</a>.").format(
                     u"https://qms.nextgis.com/create"
                 ),
             )
         )
         new_item = QListWidgetItem(self.lstSearchResult)
         new_item.setSizeHint(new_widget.sizeHint())
         self.lstSearchResult.addItem(new_item)
         self.lstSearchResult.setItemWidget(
             new_item,
             new_widget
         )
开发者ID:nextgis,项目名称:quickmapservices,代码行数:22,代码来源:qms_service_toolbox.py


示例15: initGui

    def initGui(self):
        self.setWindowTitle('New connection')
        layout = QVBoxLayout()
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)

        horizontalLayout = QHBoxLayout()
        horizontalLayout.setSpacing(30)
        horizontalLayout.setMargin(0)
        nameLabel = QLabel('Name')
        nameLabel.setMinimumWidth(120)
        nameLabel.setMaximumWidth(120)
        self.nameBox = QLineEdit()
        if self.name is not None:
            self.nameBox.setText(self.name)
        horizontalLayout.addWidget(nameLabel)
        horizontalLayout.addWidget(self.nameBox)
        layout.addLayout(horizontalLayout)

        horizontalLayout = QHBoxLayout()
        horizontalLayout.setSpacing(30)
        horizontalLayout.setMargin(0)
        urlLabel = QLabel('URL')
        urlLabel.setMinimumWidth(120)
        urlLabel.setMaximumWidth(120)
        self.urlBox = QLineEdit()
        if self.url is not None:
            self.urlBox.setText(self.url)
        horizontalLayout.addWidget(urlLabel)
        horizontalLayout.addWidget(self.urlBox)
        layout.addLayout(horizontalLayout)


        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.okPressed)
        buttonBox.rejected.connect(self.cancelPressed)

        self.resize(400, 200)
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:39,代码来源:remotesdialog.py


示例16: ResourceParameterWidget

class ResourceParameterWidget(FloatParameterWidget):

    """Widget class for Resource parameter."""

    # pylint: disable=super-on-old-class
    def __init__(self, parameter, parent=None):
        """Constructor

        .. versionadded:: 2.3

        :param parameter: A ResourceParameter object.
        :type parameter: ResourceParameter, FloatParameter
        """
        # pylint: disable=E1002
        super(ResourceParameterWidget, self).__init__(parameter, parent)
        # pylint: enable=E1002
        self.set_unit()

    def get_parameter(self):
        """Obtain the parameter object from the current widget state.

        :returns: A BooleanParameter from the current state of widget
        """
        self._parameter.value = self._input.value()
        return self._parameter

    def set_unit(self):
        """Set the units label. (Include the frequency.)"""
        label = ''
        if self._parameter.frequency:
            label = self._parameter.frequency
        if self._parameter.unit.plural:
            label = '%s %s' % (self._parameter.unit.plural, label)
        elif self._parameter.unit.name:
            label = '%s %s' % (self._parameter.unit.name, label)
        self._unit_widget = QLabel(label)
        if self._parameter.unit.help_text:
            self._unit_widget.setToolTip(self._parameter.unit.help_text)
开发者ID:inasafe,项目名称:inasafe,代码行数:38,代码来源:resource_parameter_widget.py


示例17: __init__

 def __init__(self, title = None):
     QDialog.__init__(self, None)
     if title is not None:
         self.setWindowTitle(title)
     self.__label = QLabel(self)
     self.__layout = QVBoxLayout()
     self.__layout.addWidget(self.__label)
     self.__progress = QProgressBar(self)
     self.__layout.addWidget(self.__progress)
     self.setLayout(self.__layout)
     self.resize(600, 70)
     self.setFixedSize(600, 70)
     self.__progress.hide()
     self.show()
开发者ID:Oslandia,项目名称:gml_application_schema_toolbox,代码行数:14,代码来源:progress_bar.py


示例18: __init__

    def __init__(self):
        """ Initialize data objects, starts fetching if appropriate, and warn about/removes obsolete plugins """

        QObject.__init__(self)  # initialize QObject in order to to use self.tr()
        repositories.load()
        plugins.getAllInstalled()

        if repositories.checkingOnStart() and repositories.timeForChecking() and repositories.allEnabled():
            # start fetching repositories
            self.statusLabel = QLabel(self.tr("Looking for new plugins...") + " ", iface.mainWindow().statusBar())
            iface.mainWindow().statusBar().insertPermanentWidget(0, self.statusLabel)
            self.statusLabel.linkActivated.connect(self.showPluginManagerWhenReady)
            repositories.checkingDone.connect(self.checkingDone)
            for key in repositories.allEnabled():
                repositories.requestFetching(key)
        else:
            # no fetching at start, so mark all enabled repositories as requesting to be fetched.
            for key in repositories.allEnabled():
                repositories.setRepositoryData(key, "state", 3)

        # look for obsolete plugins (the user-installed one is newer than core one)
        for key in plugins.obsoletePlugins:
            plugin = plugins.localCache[key]
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Warning)
            msg.setWindowTitle(self.tr("QGIS Python Plugin Installer"))
            msg.addButton(self.tr("Uninstall (recommended)"), QMessageBox.AcceptRole)
            msg.addButton(self.tr("I will uninstall it later"), QMessageBox.RejectRole)
            msg.setText(
                "%s <b>%s</b><br/><br/>%s"
                % (
                    self.tr("Obsolete plugin:"),
                    plugin["name"],
                    self.tr(
                        "QGIS has detected an obsolete plugin that masks its more recent version shipped with this copy of QGIS. This is likely due to files associated with a previous installation of QGIS. Do you want to remove the old plugin right now and unmask the more recent version?"
                    ),
                )
            )
            msg.exec_()
            if not msg.result():
                # uninstall, update utils and reload if enabled
                self.uninstallPlugin(key, quiet=True)
                updateAvailablePlugins()
                settings = QSettings()
                if settings.value("/PythonPlugins/" + key, False, type=bool):
                    settings.setValue("/PythonPlugins/watchDog/" + key, True)
                    loadPlugin(key)
                    startPlugin(key)
                    settings.remove("/PythonPlugins/watchDog/" + key)
开发者ID:Zakui,项目名称:QGIS,代码行数:49,代码来源:installer.py


示例19: __init__

 def __init__(self, iface):
     QDialog.__init__(self, iface.mainWindow())
     
     self.workerThread = None
     self.state = False
     self.outputLoc = None
     self.resultStatus = None
     self.reRun = False
     self.savedProj = None
     
     # Build GUI Elements
     self.setWindowTitle("SEILAPLAN wird ausgeführt")
     self.resize(500, 100)
     self.container = QVBoxLayout()
     self.progressBar = QProgressBar(self)
     self.progressBar.setMinimumWidth(500)
     self.statusLabel = QLabel(self)
     self.hbox = QHBoxLayout()
     self.cancelButton = QDialogButtonBox()
     self.closeButton = QDialogButtonBox()
     self.resultLabel = ClickLabel(self)
     self.resultLabel.setMaximumWidth(500)
     self.resultLabel.setSizePolicy(
         QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding))
     self.resultLabel.setWordWrap(True)
     self.rerunButton = QPushButton("Berechnungen wiederholen")
     self.rerunButton.setVisible(False)
     spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                          QSizePolicy.Minimum)
     self.cancelButton.setStandardButtons(QDialogButtonBox.Cancel)
     self.cancelButton.clicked.connect(self.onAbort)
     self.closeButton.setStandardButtons(QDialogButtonBox.Close)
     self.closeButton.clicked.connect(self.onClose)
     self.hbox.addWidget(self.rerunButton)
     self.hbox.addItem(spacer)
     self.hbox.addWidget(self.cancelButton)
     self.hbox.setAlignment(self.cancelButton, Qt.AlignHCenter)
     self.hbox.addWidget(self.closeButton)
     self.hbox.setAlignment(self.closeButton, Qt.AlignHCenter)
     self.closeButton.hide()
     
     self.container.addWidget(self.progressBar)
     self.container.addWidget(self.statusLabel)
     self.container.addWidget(self.resultLabel)
     self.container.addLayout(self.hbox)
     self.container.setSizeConstraint(QLayout.SetFixedSize)
     self.setLayout(self.container)
开发者ID:piMoll,项目名称:SEILAPLAN,代码行数:47,代码来源:progressDialog.py


示例20: do_post_offline_convert_action

    def do_post_offline_convert_action(self):
        """
        Show an information label that the project has been copied
        with a nice link to open the result folder.
        """
        export_folder = self.get_export_folder_from_dialog()

        result_label = QLabel(self.tr(u'Finished creating the project at {result_folder}. Please copy this folder to '
                                      u'your QField device.').format(
            result_folder=u'<a href="{folder}">{folder}</a>'.format(folder=export_folder)))
        result_label.setTextFormat(Qt.RichText)
        result_label.setTextInteractionFlags(Qt.TextBrowserInteraction)
        result_label.linkActivated.connect(lambda: open_folder(export_folder))
        result_label.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)

        self.iface.messageBar().pushWidget(result_label, Qgis.Info, 0)
开发者ID:opengisch,项目名称:QFieldSync,代码行数:16,代码来源:package_dialog.py



注:本文中的qgis.PyQt.QtWidgets.QLabel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python QtWidgets.QLineEdit类代码示例发布时间:2022-05-26
下一篇:
Python QtWidgets.QInputDialog类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap