本文整理匯總了Python中main_window.MainWindow.setDisabled方法的典型用法代碼示例。如果您正苦於以下問題:Python MainWindow.setDisabled方法的具體用法?Python MainWindow.setDisabled怎麽用?Python MainWindow.setDisabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類main_window.MainWindow
的用法示例。
在下文中一共展示了MainWindow.setDisabled方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: PSSOptimisation
# 需要導入模塊: from main_window import MainWindow [as 別名]
# 或者: from main_window.MainWindow import setDisabled [as 別名]
#.........這裏部分代碼省略.........
action.connect(action, SIGNAL("triggered()"),
lambda nr=nr: self.proxy_model.toggleColumn(nr))
# add that menu as context menu for the header
header.addActions(self.header_actions.actions())
header.setContextMenuPolicy(
QtCore.Qt.ActionsContextMenu)
# and put it into the main window's menus
self.main_window.menu_table_columns.clear()
for action in self.header_actions.actions():
self.main_window.menu_table_columns.addAction(action)
# automatically download new grades (depends on settings)
if self.settings.value("updateOnStart", False).toBool():
QtCore.QTimer.singleShot(200, self.tryAutoDownloadFromPSSO)
def openLoginDialog(self):
self.login_dialog = LoginDialog(self.main_window)
self.login_dialog.exec_()
if self.login_dialog.result():
username = str(self.login_dialog.username_line.text())
password = str(self.login_dialog.password_line.text())
if username and password:
remember = self.login_dialog.remember_checkbox.isChecked()
self.handleLoginData(username, password, remember)
def handleLoginData(self, username, password, remember=False):
"""Try to load the grades by using the provided login credentials.
On failure, an error popup is displayed. On success a loading progress
bar and after that a table is shown.
If "remember" is True, then the login data is saved.
"""
self.main_window.setDisabled(True)
QtGui.QApplication.processEvents()
QtGui.QApplication.processEvents()
progress = 0
try:
iterator = self.grades_model.getFromPSSOIterator(username, password)
for step in iterator:
self.main_window.showProgress(progress, step)
# getFromPSSOIterator defines 8 steps, but 1st is at 0
progress += 100.0/7
QtGui.QApplication.processEvents()
except (ConnectionError, ServiceUnavailableError, ParsingError) as e:
QtGui.QMessageBox.critical(self.main_window,
e.title, e.message)
return
except LoginError as e:
self.clearLoginData(username)
QtGui.QMessageBox.critical(self.main_window,
e.title, e.message)
return
finally:
self.main_window.setEnabled(True)
self.main_window.showProgress(-1)
self.main_window.showTable()
self.main_window.setEnabled(True)
if remember:
self.saveLoginData(username, password)
def saveLoginData(self, username, password):
assert username and password
self.settings.setValue("username", username)