當前位置: 首頁>>代碼示例>>Python>>正文


Python QtWidgets.QProgressBar方法代碼示例

本文整理匯總了Python中qgis.PyQt.QtWidgets.QProgressBar方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QProgressBar方法的具體用法?Python QtWidgets.QProgressBar怎麽用?Python QtWidgets.QProgressBar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qgis.PyQt.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QProgressBar方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from qgis.PyQt import QtWidgets [as 別名]
# 或者: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
def __init__(self, min, max, message, parent=None, timeout = 1.5):
        """
        Constructs a progress widget
        """
        super(self.__class__, self).__init__(parent)
        self.min = min
        self.max = max
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        if parent:
            self.setMinimumSize(parent.width(),40)
        else:
            self.setMinimumSize(766,40)
        self.setSizePolicy(sizePolicy)
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(min)
        self.progressBar.setMaximum(max)
        self.parent = parent
        self.msgBarItem = QgsMessageBarItem(self.tr("INFO: "), message, self.progressBar, level=Qgis.Info, duration=timeout, parent = self.parent)
        self.pushItem(self.msgBarItem)
        self.parent.repaint() 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:22,代碼來源:progressWidget.py

示例2: prepareProcess

# 需要導入模塊: from qgis.PyQt import QtWidgets [as 別名]
# 或者: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
def prepareProcess(self, process, message):
        """
        Prepares the process to be executed.
        Creates a message bar.
        Connects the destroyed progress bar signal to the process cancel method
        """
        # Setting the progress bar
        progressMessageBar = self.iface.messageBar().createMessage(message)
        progressBar = QProgressBar()
        progressBar.setAlignment(Qt.AlignLeft|Qt.AlignVCenter)
        progressMessageBar.layout().addWidget(progressBar)
        self.iface.messageBar().pushWidget(progressMessageBar, self.iface.messageBar().INFO)

        #connecting the destroyed signal
        progressMessageBar.destroyed.connect(process.messenger.progressCanceled)

        #storing the process and its related progressBar
        self.processDict[process] = progressBar

        #initiating processing
        QThreadPool.globalInstance().start(process) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:23,代碼來源:processManager.py

示例3: messageShow

# 需要導入模塊: from qgis.PyQt import QtWidgets [as 別名]
# 或者: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
def messageShow(self, progress, count, max):
        if not progress:
            progressMessageBar = iface.messageBar().createMessage(
                "Looping through " + str(max) + " records ...")
            progress = QProgressBar()
            progress.setMaximum(max)
            progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
            progressMessageBar.layout().addWidget(progress)
            iface.messageBar().pushWidget(progressMessageBar, level=1)
            iface.mainWindow().repaint()
        #    return progress
        if progress:
            progress.setValue(count)
        return(progress) 
開發者ID:riccardoklinger,項目名稱:Hqgis,代碼行數:16,代碼來源:hqgis.py

示例4: __init__

# 需要導入模塊: from qgis.PyQt import QtWidgets [as 別名]
# 或者: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
def __init__(self, parent, title = ''):
        '''
        progressBar class instatiation method. It creates a QgsMessageBar with provided msg and a working QProgressBar
        :param parent:
        :param msg: string
        '''
        self.iface = parent.iface
        self.title = title 
開發者ID:enricofer,項目名稱:go2mapillary,代碼行數:10,代碼來源:mapillary_coverage.py

示例5: start

# 需要導入模塊: from qgis.PyQt import QtWidgets [as 別名]
# 或者: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
def start(self,max=0, msg = ''):
        self.widget = self.iface.messageBar().createMessage(self.title,msg)
        self.progressBar = QProgressBar()
        self.progressBar.setRange(0,max)
        self.progressBar.setValue(0)
        self.progressBar.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.widget.layout().addWidget(self.progressBar)
        QApplication.processEvents()
        self.iface.messageBar().pushWidget(self.widget, Qgis.Info, 50)
        QApplication.processEvents() 
開發者ID:enricofer,項目名稱:go2mapillary,代碼行數:12,代碼來源:mapillary_coverage.py

示例6: __import_data

# 需要導入模塊: from qgis.PyQt import QtWidgets [as 別名]
# 或者: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
def __import_data(self):
        assert(self.project)
        dir_ = QFileDialog.getExistingDirectory(
            None,
            u"Data directory",
            QgsProject.instance().readEntry("albion", "last_dir", "")[0],
            QFileDialog.ShowDirsOnly | QFileDialog.DontUseNativeDialog
        )
        if not dir_:
            return
        QgsProject.instance().writeEntry("albion", "last_dir", dir_),

        progressMessageBar = self.__iface.messageBar().createMessage(
            "Loading {}...".format(dir_)
        )
        progress = QProgressBar()
        progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        progressMessageBar.layout().addWidget(progress)
        self.__iface.messageBar().pushWidget(progressMessageBar)

        self.project.import_data(dir_, ProgressBar(progress))
        #self.project.triangulate()
        self.project.create_section_view_0_90(4)

        self.__iface.messageBar().clearWidgets()

        collar = QgsProject.instance().mapLayersByName("collar")
        if len(collar):
            collar[0].reload()
            collar[0].updateExtents()
            self.__iface.setActiveLayer(collar[0])
            QApplication.instance().processEvents()
            while self.__iface.mapCanvas().isDrawing():
                QApplication.instance().processEvents()
            self.__iface.zoomToActiveLayer()

        self.__iface.actionSaveProject().trigger()

        self.__viewer3d.widget().resetScene(self.project)
        self.__current_section.clear()
        self.__current_section.addItems(self.project.sections()) 
開發者ID:Oslandia,項目名稱:albion,代碼行數:43,代碼來源:plugin.py


注:本文中的qgis.PyQt.QtWidgets.QProgressBar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。