Python qgis.PyQt.QtWidgets.QProgressBar() Examples
The following are 6
code examples of qgis.PyQt.QtWidgets.QProgressBar().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
qgis.PyQt.QtWidgets
, or try the search function
.
Example #1
Source File: progressWidget.py From DsgTools with GNU General Public License v2.0 | 6 votes |
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()
Example #2
Source File: processManager.py From DsgTools with GNU General Public License v2.0 | 6 votes |
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)
Example #3
Source File: hqgis.py From Hqgis with GNU General Public License v3.0 | 5 votes |
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)
Example #4
Source File: mapillary_coverage.py From go2mapillary with GNU General Public License v3.0 | 5 votes |
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
Example #5
Source File: mapillary_coverage.py From go2mapillary with GNU General Public License v3.0 | 5 votes |
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()
Example #6
Source File: plugin.py From albion with GNU General Public License v3.0 | 5 votes |
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())