def run_btn_event(self):
"""
click run button, show add_device_widget
:return:
"""
self.add_device_widget = AddDeviceWidget() # add device
self.add_device_widget.setWindowModality(Qt.ApplicationModal)
self.device_and_data_signal.connect(self.add_device_widget.add_radio_to_widget, Qt.QueuedConnection)
self.add_device_widget.run_editor_signal.connect(self.run_case, Qt.QueuedConnection)
devices = []
if self.is_running:
self.stop_case()
try:
devices = self.tester.devices()
except Exception as e:
self.add_info_console("<font color='red'>" + str(e) + "</font>")
if not devices: # There is no device connected
self.message_box.warning(self, "Message", "Please connect the device to your computer.", QMessageBox.Ok)
return
# get case data count
if self.case_id is not None:
self.case_data_count = self.case_data_manage.get_case_data_count(self.case_id)
self.device_and_data_signal.emit(devices, self.case_data_count)
self.add_device_widget.show()
python类Ok()的实例源码
def connection():
conn, data = SQL_Handler.connectToDatabase('fobs', form.UsernameField.text(), form.PasswordField.text(), 'localhost')
if conn is not None:
buildTable()
form.close()
form2.show()
form2.logoutButton.clicked.connect(mainMenu)
form2.refreshButton.clicked.connect(lambda: buildTable())
form2.validationButton.clicked.connect(lambda: saveChanges())
else:
Q = QMessageBox()
Q = QMessageBox.information(Q, 'Error', 'Connection failed.',
QMessageBox.Ok)
def error_message(exception,
text="An error occurred when processing your request",
title="Error"):
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setText(text)
msg.setWindowTitle(title)
msg.setDetailedText(str(exception))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec_()
def setupUi(self, message_list):
self.setGeometry(self.left, self.top, self.width, self.height)
self.msg = QMessageBox()
self.msg.setIcon(self.message_type[message_list[3]])
self.msg.setWindowTitle('Worksets')
self.msg.setText(message_list[0])
self.msg.setInformativeText(message_list[1])
self.msg.setDetailedText(message_list[2])
self.msg.setStandardButtons(QMessageBox.Ok)
self.msg.exec()
def showPopup(self):
self.clear()
self.updateList()
if self.lst == []:
QMessageBox.warning(self.parent, "Warning", "No device attached", QMessageBox.Ok, QMessageBox.NoButton)
super(ComboBox_Ports, self).showPopup()
def no_user_list(self):
reply = message.warning(self, 'Warning', no_user_list_message, message.Ok)
return reply == message.Ok
def no_subreddit_list(self):
reply = message.warning(self, 'No Subreddit List', no_subreddit_list_message, message.Ok)
return reply == message.Ok
def no_user_selected(self):
reply = message.information(self, 'No User Selected', no_user_selected_message, message.Ok)
return reply == message.Ok
def no_subreddit_selected(self):
reply = message.information(self, 'No Subreddit Selected', no_subreddit_selected_message, message.Ok)
return reply == message.Ok
def failed_to_save(self):
reply = message.information(self, 'Save Failed', failed_to_save_message, message.Ok)
return reply == message.Ok
def remove_subreddit(self):
reply = message.information(self, 'Remove Subreddit?', remove_subreddit_message, message.Ok, message.Cancel)
return reply == message.Ok
def remove_user_list(self):
reply = message.warning(self, 'Remove User List?', remove_user_list_message, message.Ok, message.Cancel)
return reply == message.Ok
def remove_subreddit_list(self):
reply = message.warning(self, 'Remove Subreddit List?', remove_subreddit_list_message, message.Ok, message.Cancel)
return reply == message.Ok
def not_valid_name(self):
text = 'Sorry, that is not a valid name'
reply = message.information(self, 'Invalid Name', text, message.Ok)
return reply == message.Ok
def name_in_list(self):
text = 'That name is already in the list'
reply = message.information(self, 'Existing Name', text, message.Ok)
return reply == message.Ok
def no_subreddit_download_folder(self):
text = 'The subreddit you selected does not appear to have a download folder. This is likely because nothing ' \
'has been downloaded for this subreddit yet.'
reply = message.information(self, 'Folder Does Not Exist', text, message.Ok)
return reply == message.Ok
def no_users_downloaded(self):
text = 'No users have been downloaded yet'
reply = message.information(self, 'No Content', text, message.Ok)
return reply == message.Ok
def nothing_to_download(self):
text = 'Nothing to download. Please add users or subreddits you would like to download from.'
reply = message.information(self, 'Nothing to Download', text, message.Ok)
return reply == message.Ok
def downloader_running_warning(self):
text = 'The user finder is still currently running. Closing now may cause unexpected behaviour and corrupted ' \
'files. Are you sure you want to close?'
reply = message.warning(self, 'User Finder Still Running', text, message.Ok, message.Cancel)
return reply == message.Ok
def restore_defaults_warning(self):
text = 'Defaults have been restored. If you save now, any settings controlled from this window will be ' \
'restored to their original values.\n\nAny user or subreddit who\'s custom settings have been changed ' \
'will also be restored to their default values.\n\nDo you wish to proceed?'
reply = message.warning(self, 'Defaults Restored', text, message.Ok, message.Cancel)
return reply == message.Ok