本文整理汇总了Python中ErrorMessageClass类的典型用法代码示例。如果您正苦于以下问题:Python ErrorMessageClass类的具体用法?Python ErrorMessageClass怎么用?Python ErrorMessageClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorMessageClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: change_password_function
def change_password_function(self):
if self.menu.isHidden():
self.stacked_layout.setCurrentIndex(14)
self.setFixedSize(600,400)
self.change_password_instance.password1.setText("")
self.change_password_instance.password2.setText("")
else:
try:
self.send_code_to_email(self.log_in_instance.username.text())
self.stacked_layout.setCurrentIndex(15)
self.setFixedSize(650,400)
self.change_password_instance2.password1.setText("")
self.change_password_instance2.password2.setText("")
self.change_password_instance2.code.setText("")
except smtplib.SMTPAuthenticationError:
self.error_message_instance = ErrorMessageClass("Error: The Gmail account details are not valid.")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
except TimeoutError:
self.error_message_instance = ErrorMessageClass("A connection attempt failed because the connected party did not properly respond after a period of time.")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
except:
self.error_message_instance = ErrorMessageClass("An error occured and the email could not be sent.")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
示例2: match_codes
def match_codes(self):
if int(self.code) != int(self.change_password_instance2.code.text()):
self.error_message_instance = ErrorMessageClass(
"""The Code you entered does not match the one emailed to you.""")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
elif self.change_password_instance2.password1.text() != self.change_password_instance2.password2.text():
self.error_message_instance = ErrorMessageClass("The passwords you entered do not match")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
elif (self.change_password_instance2.password1.text() == self.change_password_instance2.password2.text(
) and int(self.code) == int(self.change_password_instance2.code.text())):
encrypted_password = change_password(self.change_password_instance2.password1.text(), 3)
change_employee_password(self.log_in_instance.username.text(), encrypted_password)
self.error_message_instance = ErrorMessageClass("Your Password has Sucessfully been changed!")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
self.create_new_order_function()
self.menu.show()
示例3: find_employee_by_id
def find_employee_by_id(self):
with sqlite3.connect("ProductDatabase.db") as db:
employee_id = self.find_employee_id_line_edit.text()
cursor = db.cursor()
cursor.execute("SELECT * FROM Employee WHERE EmployeeID = ?",(employee_id,))
employee_info = cursor.fetchall()
db.commit()
if employee_info[0][0] == 1:
self.error = ErrorMessageClass("You are not authorised to delete the admin account")
self.error.setFixedSize(400,150)
elif employee_info:
self.main_widget.setEnabled(True)
self.first_name.setText(employee_info[0][2])
self.first_name.setReadOnly(True)
self.last_name.setText(employee_info[0][3])
self.last_name.setReadOnly(True)
self.email_address.setText(employee_info[0][4])
self.email_address.setReadOnly(True)
self.user_name_output.setText(employee_info[0][1])
self.first_name_output.setText(self.first_name.text())
self.last_name_output.setText(self.last_name.text())
self.email_address_output.setText(self.email_address.text())
if not employee_info:
self.error = ErrorMessageClass("No user found with Member ID: {0}".format(self.find_employee_id_line_edit.text()))
self.error.setFixedSize(400,150)
self.clear_fields()
示例4: match_passwords
def match_passwords(self):
if self.change_password_instance.password1.text() == self.change_password_instance.password2.text():
encrypted_password = change_password(self.change_password_instance.password1.text(), 3)
change_employee_password(self.log_in_instance.username.text(), encrypted_password)
self.error_message_instance = ErrorMessageClass("Your Password has Sucessfully been changed!")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
self.create_new_order_function()
self.menu.show()
username = find_employee_by_username(self.log_in_instance.username.text())
EmployeeID = username[3]
if int(EmployeeID) != 1:
self.add_an_employee_action.setDisabled(True)
self.edit_employee_action.setDisabled(True)
self.remove_an_employee_action.setDisabled(True)
self.explanation_action.setVisible(True)
else:
self.add_an_employee_action.setEnabled(True)
self.edit_employee_action.setEnabled(True)
self.remove_an_employee_action.setEnabled(True)
self.explanation_action.setVisible(False)
else:
self.error_message_instance = ErrorMessageClass("Sorry your passwords do not match.")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
示例5: find_account
def find_account(self):
settings = getSettings()
encrypted_password_entered = change_password(
self.log_in_instance.password.text(), 3)
self.return_signal = find_username_and_password(
self.log_in_instance.username.text(), encrypted_password_entered)
if self.return_signal == 1:
self.error_message_instance = ErrorMessageClass(
"""Sorry the Username and Password you entered are incorrect""")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
elif self.return_signal == 2:
if self.log_in_instance.password.text() == 'password':
self.change_password_function()
else:
#IF THE LOG IN IS SUCCESSFUL
self.create_new_order_function()
self.menu.show()
username = find_employee_by_username(self.log_in_instance.username.text())
EmployeeID = username[3]
if int(EmployeeID) != 1:
self.add_an_employee_action.setDisabled(True)
self.edit_employee_action.setDisabled(True)
self.remove_an_employee_action.setDisabled(True)
self.explanation_action.setVisible(True)
else:
self.add_an_employee_action.setEnabled(True)
self.edit_employee_action.setEnabled(True)
self.remove_an_employee_action.setEnabled(True)
self.explanation_action.setVisible(False)
check_for_stock_updates(self)
示例6: explanation_function
def explanation_function(self):
self.error_message_instance = ErrorMessageClass(
"""The Reason you cannot access the above options is because you
\n must be logged into the master account to access them.""")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
示例7: find_product_by_id
def find_product_by_id(self):
with sqlite3.connect("ProductDatabase.db") as db:
product_id = self.find_product_id_line_edit.text()
cursor = db.cursor()
cursor.execute("SELECT * FROM Product WHERE ProductID = ?",(product_id,))
self.product_info = cursor.fetchall()
db.commit()
if self.product_info:
self.size = int(re.match(r'\d+', self.product_info[0][2]).group())
self.leftright_widget.setEnabled(True)
self.product_name.setText(self.product_info[0][1])
self.size_integer.setText(str(self.size))
self.price_button.setText(str(self.product_info[0][3]))
self.path.setText(self.product_info[0][7])
self.pixmap = QPixmap(self.path.text())
self.scaled_image = self.pixmap.scaled(300, 300, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
if not self.product_info:
self.error = ErrorMessageClass("No product with Product ID: {0}".format(self.find_product_id_line_edit.text()))
self.error.setFixedSize(400,150)
self.leftright_widget.setDisabled(True)
self.product_name.setText("")
self.size_integer.setText("")
self.price_button.setText("")
self.path.setText(".\ProductImages\Default.jpg")
self.image_pixmap = QPixmap(".\ProductImages\Default.jpg")
self.scaled_image = self.image_pixmap.scaled(300, 300, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
示例8: find_product_by_id
def find_product_by_id(self):
with sqlite3.connect("ProductDatabase.db") as db:
product_id = self.product_id.text()
cursor = db.cursor()
cursor.execute("SELECT ProductName, Location1, Location2, ImagePath FROM Product WHERE ProductID = ?",(product_id,))
self.product_info = cursor.fetchall()
db.commit()
if self.product_info:
self.current_stock_groupbox.setEnabled(True)
self.stock_prediction_groupbox.setEnabled(True)
self.product_name.setText(self.product_info[0][0])
self.stock1.setValue(self.product_info[0][1])
self.stock2.setValue(self.product_info[0][2])
self.path = self.product_info[0][3]
self.pixmap = QPixmap(self.path)
self.scaled_image = self.pixmap.scaled(180, 180, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
self.plot("week")
self.change_sales_box.setCurrentIndex(1)
if not self.product_info:
self.error = ErrorMessageClass("No product with Product ID: {0}".format(self.product_id.text()))
self.error.setFixedSize(400,150)
plt.clf()
self.current_stock_groupbox.setDisabled(True)
self.stock_prediction_groupbox.setDisabled(True)
self.product_name.setText("Product Name")
self.path = (".\images\Default.png")
self.image_pixmap = QPixmap(self.path)
self.scaled_image = self.image_pixmap.scaled(180, 180, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
self.stock1.setValue(0)
self.stock2.setValue(0)
示例9: find_employee_by_id
def find_employee_by_id(self):
with sqlite3.connect("ProductDatabase.db") as db:
employee_id = self.find_employee_id_line_edit.text()
cursor = db.cursor()
cursor.execute("SELECT * FROM Employee WHERE EmployeeID = ?",(employee_id,))
employee_info = cursor.fetchall()
db.commit()
if employee_info:
self.main_widget.setEnabled(True)
self.first_name.setText(employee_info[0][2])
self.last_name.setText(employee_info[0][3])
self.email_address.setText(employee_info[0][4])
self.user_name_output.setText(employee_info[0][1])
self.first_name_output.setText(self.first_name.text())
self.last_name_output.setText(self.last_name.text())
self.email_address_output.setText(self.email_address.text())
if not employee_info:
self.error = ErrorMessageClass("No employee found with Employee ID: {0}".format(self.find_employee_id_line_edit.text()))
self.error.setFixedSize(400,150)
self.main_widget.setDisabled(True)
self.first_name.setText("")
self.last_name.setText("")
self.email_address.setText("")
self.user_name_output.setText("")
self.first_name_output.setText("")
self.last_name_output.setText("")
self.email_address_output.setText("")
示例10: email_question
def email_question(self):
self.error_message_instance = ErrorMessageClass(
"""This is the email address and password used to send the: \n -
Invoice Form \n - Password Reset Code \n - Account Reminder
\n \n This must be a Gmail account.""")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
示例11: display_message
def display_message(self):
self.valid = find_employee_by_email(self.password_reset_instance.email_address.text())
if self.valid:
username = get_employee_username(self.password_reset_instance.email_address.text())
password = get_employee_password(self.password_reset_instance.email_address.text())
first_name = get_employee_first_name(self.password_reset_instance.email_address.text())
try:
self.send_password_reset_email(self.password_reset_instance.email_address.text(), username, password, first_name)
self.log_in_function()
self.error_message_instance = ErrorMessageClass("Your Username and Password have been sent to your email address.")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
except smtplib.SMTPAuthenticationError:
self.error_message_instance = ErrorMessageClass("The Gmail Account Details are not valid.")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
else:
self.error_message_instance = ErrorMessageClass("Sorry the Email address does not match any of the Accounts.")
示例12: save_clicked
def save_clicked(self):
encrypted_password = change_password(self.invoice_password.text(), 3)
updateSettings("./ProductImages/SystemLogo.png",
self.company_name.text(),
self.street.text(),
self.town.text(),
self.city.text(),
self.county.text(),
self.postcode.text(),
self.phone.text(),
self.email.text(),
self.invoice_email.text(),
encrypted_password)
self.info_saved_instance = ErrorMessageClass("Preferences Sucessfully Saved!")
self.info_saved_instance.setFixedSize(400,150)
self.setWindowTitle("{0} Stock Control".format(self.company_name.text()))
self.icon = QIcon("./ProductImages/SystemLogo.png")
self.setWindowIcon(self.icon)
示例13: find_member_by_id
def find_member_by_id(self):
with sqlite3.connect("ProductDatabase.db") as db:
member_id = self.find_member_id_line_edit.text()
cursor = db.cursor()
cursor.execute("SELECT * FROM Member WHERE MemberID = ?",(member_id,))
self.member_info = cursor.fetchall()
db.commit()
if self.member_info:
self.main_widget.setEnabled(True)
title_index = self.name_title.findText(self.member_info[0][1])
self.name_title.setCurrentIndex(title_index)
self.first_name.setText(self.member_info[0][2])
self.first_name.setReadOnly(True)
self.last_name.setText(self.member_info[0][3])
self.last_name.setReadOnly(True)
self.postcode.setText(self.member_info[0][9])
self.postcode.setReadOnly(True)
county_index = self.county.findText(self.member_info[0][8])
self.county.setCurrentIndex(county_index)
self.city.setText(self.member_info[0][7])
self.city.setReadOnly(True)
self.town.setText(self.member_info[0][6])
self.town.setReadOnly(True)
self.street.setText(self.member_info[0][5])
self.street.setReadOnly(True)
self.houseno.setValue(int(self.member_info[0][4]))
self.houseno.setReadOnly(True)
telephone_number = ("0" + str(self.member_info[0][10]))
self.telephone_number.setText(telephone_number)
self.telephone_number.setReadOnly(True)
self.email.setText(self.member_info[0][11])
self.email.setReadOnly(True)
if not self.member_info:
self.error = ErrorMessageClass("No user found with Member ID: {0}".format(self.find_member_id_line_edit.text()))
self.error.setFixedSize(400,150)
self.clear_fields()
示例14: MainWindow
#.........这里部分代码省略.........
self.add_employee_instance.first_name_output.setText("")
self.add_employee_instance.last_name.setText("")
self.add_employee_instance.last_name_output.setText("")
self.add_employee_instance.email_address.setText("")
self.add_employee_instance.email_address_output.setText("")
self.setFixedSize(700, 600)
def edit_employee_function(self):
self.stacked_layout.setCurrentIndex(9)
self.edit_employee_instance.find_employee_id_line_edit.setText("")
self.edit_employee_instance.user_name_output.setText("")
self.edit_employee_instance.first_name.setText("")
self.edit_employee_instance.first_name_output.setText("")
self.edit_employee_instance.last_name.setText("")
self.edit_employee_instance.last_name_output.setText("")
self.edit_employee_instance.email_address.setText("")
self.edit_employee_instance.email_address_output.setText("")
self.setFixedSize(700, 650)
def remove_an_employee_function(self):
self.stacked_layout.setCurrentIndex(10)
self.delete_employee_instance.find_employee_id_line_edit.setText("")
self.delete_employee_instance.user_name_output.setText("")
self.delete_employee_instance.first_name.setText("")
self.delete_employee_instance.first_name_output.setText("")
self.delete_employee_instance.last_name.setText("")
self.delete_employee_instance.last_name_output.setText("")
self.delete_employee_instance.email_address.setText("")
self.delete_employee_instance.email_address_output.setText("")
self.setFixedSize(700, 650)
def explanation_function(self):
self.error_message_instance = ErrorMessageClass(
"""The Reason you cannot access the above options is because you
\n must be logged into the master account to access them.""")
self.error_message_instance.move(750,500)
self.error_message_instance.show()
self.error_message_instance.raise_()
def search_product_function(self):
self.search()
def preferences_function(self):
self.stacked_layout.setCurrentIndex(11)
self.setFixedSize(900, 850)
def log_off_function(self):
self.decision = PopUpWindow("Are you sure you want to log off?",
QDialogButtonBox.Yes, QDialogButtonBox.No)
self.decision.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(
self.log_off_true)
self.decision.buttonBox.button(QDialogButtonBox.No).clicked.connect(
self.log_off_false)
def log_off_true(self):
self.log_in_function()
self.decision.close()
def log_off_false(self):
self.decision.close()
def log_in_function(self):
self.stacked_layout.setCurrentIndex(12)
self.setFixedSize(600,460)
self.menu.hide()
self.log_in_instance.username.setText("")
示例15: deleteProductClass
#.........这里部分代码省略.........
#main layout
self.leftright_layout = QHBoxLayout()
self.leftright_layout.addWidget(self.left_widget)
self.leftright_layout.addWidget(self.right_widget)
self.leftright_widget = QWidget()
self.leftright_widget.setLayout(self.leftright_layout)
self.leftright_widget.setDisabled(True)
self.add_product_layout = QHBoxLayout()
self.add_product_widget = QWidget()
self.spacer = QLabel()
self.spacer.setFixedWidth(600)
self.add_product_layout.addWidget(self.spacer)
self.add_product_layout.addWidget(self.done)
self.add_product_widget.setLayout(self.add_product_layout)
self.main_layout = QVBoxLayout()
self.main_layout.addWidget(self.find_product_id_widget)
self.main_layout.addWidget(self.leftright_widget)
self.main_layout.addWidget(self.add_product_widget)
self.main_widget = QWidget()
self.main_widget.setLayout(self.main_layout)
self.total_layout = QVBoxLayout()
self.total_layout.addWidget(self.main_widget)
self.setLayout(self.total_layout)
def CreatePopUpWindow(self):
self.pop_up_instance = PopUpWindow("Are you sure you want to Delete The Product?", QDialogButtonBox.Yes, QDialogButtonBox.No)
self.pop_up_instance.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(self.clicked_yes)
self.pop_up_instance.buttonBox.button(QDialogButtonBox.No).clicked.connect(self.clicked_no)
def AddProductSucess(self):
self.add_product_instance = PopUpWindow("Product Sucessfully Deleted!", QDialogButtonBox.Ok, QDialogButtonBox.Cancel)
self.add_product_instance.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.close_pop_ups)
self.add_product_instance.buttonBox.button(QDialogButtonBox.Cancel).clicked.connect(self.close_pop_ups)
def get_image_path(self):
path = QFileDialog.getOpenFileName()
self.path.setText(path)
def update_image(self):
self.pixmap = QPixmap(self.path.text())
self.scaled_image = self.pixmap.scaled(300, 300, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
def clicked_yes(self):
self.size_list = [self.size_integer.text(), self.size_button.currentText()]
self.temp = ""
self.category_string = str((self.category1_button.currentText() + " " + self.category2_button.currentText()))
self.size_string = self.temp.join(self.size_list)
deletingProduct(self.find_product_id_line_edit.text())
self.AddProductSucess()
def find_product_by_id(self):
with sqlite3.connect("ProductDatabase.db") as db:
product_id = self.find_product_id_line_edit.text()
cursor = db.cursor()
cursor.execute("SELECT * FROM Product WHERE ProductID = ?",(product_id,))
self.product_info = cursor.fetchall()
db.commit()
if self.product_info:
self.leftright_widget.setEnabled(True)
self.product_name.setText(self.product_info[0][1])
self.size_integer.setText(self.product_info[0][2])
self.price_button.setText(str(self.product_info[0][3]))
self.path.setText(self.product_info[0][7])
self.pixmap = QPixmap(self.path.text())
self.scaled_image = self.pixmap.scaled(300, 300, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
if not self.product_info:
self.error = ErrorMessageClass("No product found with Product ID: {0}".format(self.find_product_id_line_edit.text()))
self.error.setFixedSize(400,150)
self.clear_fields()
def clear_fields(self):
self.find_product_id_line_edit.setText("")
self.product_name.setText("")
self.size_integer.setText("")
self.price_button.setText("")
self.path.setText(".\ProductImages\Default.jpg")
self.image_pixmap = QPixmap(".\ProductImages\Default.jpg")
self.scaled_image = self.image_pixmap.scaled(300, 300, Qt.IgnoreAspectRatio, Qt.FastTransformation)
self.image.setPixmap(self.scaled_image)
def clicked_no(self):
self.pop_up_instance.close()
def close_pop_ups(self):
self.add_product_instance.close()
self.pop_up_instance.close()
self.clear_fields()