本文整理汇总了Python中main_window.MainWindow.showTable方法的典型用法代码示例。如果您正苦于以下问题:Python MainWindow.showTable方法的具体用法?Python MainWindow.showTable怎么用?Python MainWindow.showTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main_window.MainWindow
的用法示例。
在下文中一共展示了MainWindow.showTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PSSOptimisation
# 需要导入模块: from main_window import MainWindow [as 别名]
# 或者: from main_window.MainWindow import showTable [as 别名]
#.........这里部分代码省略.........
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)
keyring.set_password("PSSO", username, password)
def getLoginData(self):
"""Try to retrieve previously saved username and password. Returns
a tuple of two empty strings on failure.
"""
username = str(self.settings.value("username").toString() or "")
try:
password = keyring.get_password("PSSO", username) or ""
except IOError:
return "", ""
return username, password
def clearLoginData(self, username=None):
"""Remove username and password settings. If a username is given,
its password will be removed. If there is a saved username,
it will also get removed alongside with the corresponding password.
"""
username2 = str(self.settings.value("username").toString() or "")
try:
keyring.delete_password("PSSO", username)
except:
pass
try: