本文整理汇总了Python中PySide.QtUiTools.QUiLoader.setWindowModality方法的典型用法代码示例。如果您正苦于以下问题:Python QUiLoader.setWindowModality方法的具体用法?Python QUiLoader.setWindowModality怎么用?Python QUiLoader.setWindowModality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtUiTools.QUiLoader
的用法示例。
在下文中一共展示了QUiLoader.setWindowModality方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Update_Window
# 需要导入模块: from PySide.QtUiTools import QUiLoader [as 别名]
# 或者: from PySide.QtUiTools.QUiLoader import setWindowModality [as 别名]
class Update_Window(QDialog):
# def __init__(self, parent=None):
# QDialog.__init__(self, parent)
def __init__(self, parent=None):
super(Update_Window, self).__init__(parent)
self.getPath_update = os.path.abspath(os.path.join('gui', 'pp_update.ui'))
try:
self.ui_pp_update = QUiLoader()
self.file = QFile(self.getPath_search_ui, self)
self.file.open(QFile.ReadOnly)
self.myWidget = self.ui_pp_update.load(file, self)
self.file.close()
print "STATUS [OK] ", FILE_NAME, ": GUI is loaded from PySide"
except:
self.ui_pp_update = loadUi(self.getPath_update, self)
print "STATUS [OK] ", FILE_NAME, ": GUI is loaded from PyQt4"
self.ui_pp_update.setWindowModality(Qt.ApplicationModal)
# Set data for download and saving in path
self.location = os.path.abspath(os.path.join('temp', 'example-app-0.3.win32.zip'))
self.url = 'http://sophus.bplaced.net/download/example-app-0.3.win32.zip'
self.download_task = Download_Thread(self.location, self.url)
self.download_task.notify_progress.connect(self.on_progress)
self.download_task.finished_thread.connect(self.on_finished)
self.download_task.error_http.connect(self.on_HTTPError)
self.download_task.finished_download.connect(self.on_finish_download)
self.ui_pp_update.pushButtonUpdate.setEnabled(True)
self.create_actions_buttons()
def on_start(self):
self.ui_pp_update.progressBarUpdate.setRange(0, 0)
self.download_task.start()
def on_finish_download(self):
msg_box = QMessageBox()
QMessageBox.question(msg_box, ' Message ',
"The file has been fully downloaded.", msg_box.Ok)
def on_HTTPError(self):
reply = QMessageBox.question(self, ' Error ',
"The file could not be downloaded. Will they do it again?", QMessageBox.Yes |
QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
self.on_start()
else:
event.ignore()
def on_progress(self, i):
self.ui_pp_update.progressBarUpdate.setRange(0, 100)
self.ui_pp_update.progressBarUpdate.setValue(i)
def stop_progress(self):
self.download_task.stop()
self.ui_pp_update.progressBarUpdate.setValue(0)
def check_folder_exists(self):
location = os.path.abspath(os.path.join('temp'))
if not os.path.exists(location):
os.makedirs(location)
print "Folder was created"
self.on_start()
else:
print "Folder already exists"
self.on_start()
def on_finished(self):
self.download_task.stop()
self.ui_pp_update.progressBarUpdate.setValue(0)
self.close()
def set_ui_pp_update(self):
self.ui_pp_update.progressBarUpdate.setAlignment(Qt.AlignCenter)
self.ui_pp_update.progressBarUpdate.setValue(0)
def create_actions_buttons(self):
self.ui_pp_update.pushButtonUpdate.clicked.connect(self.check_folder_exists)
self.ui_pp_update.pushButtonCancel.clicked.connect(self.stop_progress)
self.ui_pp_update.pushButtonClose.clicked.connect(self.on_finished)
def closeEvent(self, event):
self.download_task.stop()
def show_and_raise(self):
self.show()
self.raise_()