本文整理汇总了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()
示例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)
示例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)
示例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
示例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()
示例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())