本文整理汇总了Python中Message.raise_方法的典型用法代码示例。如果您正苦于以下问题:Python Message.raise_方法的具体用法?Python Message.raise_怎么用?Python Message.raise_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.raise_方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OutSign
# 需要导入模块: import Message [as 别名]
# 或者: from Message import raise_ [as 别名]
class OutSign(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
#Setting the window title
self.setWindowTitle("Sign Out")
#Widget set up
self.searchTerm = QLineEdit("")
self.btnSearch = QPushButton("Search")
self.searchList = QListWidget()
self.btnBack = QPushButton("Back")
self.btnOut = QPushButton("Sign Out")
self.labelT = QLabel("Please enter your Surname:")
self.vLayoutMAIN = QVBoxLayout()
self.hLayout1 = QHBoxLayout()
self.hLayout2 = QHBoxLayout()
self.hLayout1.addWidget(self.searchTerm)
self.hLayout1.addWidget(self.btnSearch)
self.hLayout2.addWidget(self.btnBack)
self.hLayout2.addWidget(self.btnOut)
self.vLayoutMAIN.addWidget(self.labelT)
self.vLayoutMAIN.addLayout(self.hLayout1)
self.vLayoutMAIN.addWidget(self.searchList)
self.vLayoutMAIN.addLayout(self.hLayout2)
self.widget = QWidget()
self.widget.setLayout(self.vLayoutMAIN)
self.setCentralWidget(self.widget)
#Setting up push button connections
self.btnSearch.clicked.connect(self.btnSearch_pushed)
self.btnBack.clicked.connect(self.btnBack_pushed)
self.btnOut.clicked.connect(self.btnOut_pushed)
def btnSearch_pushed(self):
#Clearing the list
self.searchList.clear()
#Retrieving all visitors from the database
visitors = g_database.GetAllEntries()
#Converting the users entry to text
term = self.searchTerm.text()
#converting the term to lower to allow for user input error
term = term.lower()
termFound = False
for visitor in visitors:
#Obtaing the surname from the database
surname = visitor[2]
#converting the surname to lower to allow for user input error
surname = surname.lower()
#Checking the search term matches the term in the database and the visitor isnt signed out
if term == surname and visitor[7] == "N/A":
#Creating a full name
name = ""
#Adding the forename and a space to the string
name= name + (visitor[1]) + " "
#Adding a surname
name = name + (visitor[2])
#Adding the full name to the list
self.searchList.addItem(name)
termFound = True
#If the term isnt found
if termFound == False:
#Calling the error window, passing in the message to display
self.message=Message(self,"No entries found, please search again")
#Showing the window
self.message.show()
#Raising the window the front of the screen
self.message.raise_()
#Returning the to the parent window
def btnBack_pushed(self):
self.parent.show()
self.parent.raise_()
self.close()
def btnOut_pushed(self):
#Converting the users selected item to text
currentItem = self.searchList.currentItem().text()
#Calling the clarification window, passing in the users selected name
self.clarification = Clarification(self,currentItem)
self.clarification.show()
self.clarification.raise_()
self.close()
示例2: InSign
# 需要导入模块: import Message [as 别名]
# 或者: from Message import raise_ [as 别名]
#.........这里部分代码省略.........
forename_valid = True
surname_valid = True
reg_valid = False
#Checking if the line edit has been left blank
if forename != "" and surname != "" and registration != "":
#Converting the forename and surname to lower case for easier validation
forename = forename.lower()
surname = surname.lower()
#Setting up blank lists to append the alphabet into
alphabet = ['-']
#Creating the alphabet from ascii characters
for letter in map(chr, range(97, 123)):
#Adding the character to the blank list
alphabet.append(letter)
count = -1
#Sorting through each character in 'forename'
for each in forename:
#Checking to see if its in the alphabet
if each not in alphabet:
forename_valid = False
#Sorting through each character in 'surname'
for each in surname:
#Checking to see if its in the alphabet
if each not in alphabet:
surname_valid = False
if forename_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Forename")
#Showing the window
self.error.show()
#Raising the window the front of the screen
self.error.raise_()
if surname_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Surname")
#Showing the window
self.error.show()
#Raising the window the front of the screen
self.error.raise_()
#Making the initial upper case
initial = forename[0].upper()
count = 1
#Adding the rest of the 'forename' to the new string
for each in range(len(forename)-1):
initial= initial + forename[count]
count +=1
forename = initial
#Making the initial upper case
initial = surname[0].upper()
count = 1
#Adding the rest of the 'forename' to the new string
for each in range(len(surname)-1):
initial= initial + surname[count]
count +=1
surname = initial
#Converting all of registration to upper case to format it correctly
registration= registration.upper()
#Checking that the registration number is less than or equal to 7
if len(registration) <= 7:
reg_valid = True
else:
示例3: VisitorBook
# 需要导入模块: import Message [as 别名]
# 或者: from Message import raise_ [as 别名]
#.........这里部分代码省略.........
#Setting the row count to the number of entries so that there are no empty rows
self.table.setRowCount(len(entries))
#Setting the coloumn count to 8
self.table.setColumnCount(8)
#Setting the header labels
self.table.setHorizontalHeaderLabels(["ID","Forename","Surname","Reg","Visiting","Date","Time In","Time Out"])
row = -1
#Sorting through each entry
for entry in entries:
column = 0
row += 1
#Sorting through each field in each entry
for field in entry:
#Adding each field to the table
self.table.setItem(row,column,QTableWidgetItem(str(field)))
column += 1
def btnSearchPushed(self):
#Clearing the table
self.table.clear()
#Converting the users input to text
term = self.searchTerm.text()
#converting the term to lower case to allow for user input error
term = term.lower()
#Checking if the user actually entered something
if term == "":
#Running the 'refreshTable' function
self.refreshTable()
else:
#Retrieving all visitor entries from the database
entries = g_database.GetAllEntries()
RowCount = 0
#Setting the row count
self.table.setRowCount(RowCount)
#Setting the coloumn count
self.table.setColumnCount(8)
#Setting the table headers
self.table.setHorizontalHeaderLabels(["ID","Forename","Surname","Reg","Visiting","Date","Time In","Time Out"])
row = -1
#Sorting through each entry in the database
#Setting the variable to True
table_empty =True
for entry in entries:
#Obtaining the forename from the database
forename = entry[1]
#converting the forename to lower case to allow for user input error
forename=forename.lower()
#Obtaining the surname from the database
surname = entry[2]
#converting the surname to lower case to allow for user input error
surname = surname.lower()
#Converting the id intger to a string so it can be compared to the term, as the term is text
ID = str(entry[0])
#Obtaining the registration number from the database
reg = entry[3]
#converting the registration number to lower case to allow for user input error
reg = reg.lower()
##Obtaining the employee being visited from the database
visiting = entry[4]
#converting visiting to lower case to allow for user input error
visiting = visiting.lower()
#Checking to see if the term matches any of the fields in the database
if term == ID or term == forename or term == surname or term == reg or term == visiting or term == entry[5] or term == entry[6] or term == entry[7]:
RowCount +=1
#Resetting the row count to allow the program to add the found visitor
self.table.setRowCount(RowCount)
column = 0
row += 1
#Sorting through each field in that entry
for field in entry:
#Adding the field to the table
self.table.setItem(row,column,QTableWidgetItem(str(field)))
column += 1
#Changing table_empty to False if an entry has been entered into the table
table_empty = False
if table_empty == True:
#Calling the message window, passing in the message to display
self.error = Message(self,"No entries found, please try again")
self.error.show()
self.error.raise_()
self.refreshTable()
#Returning to the parent window
def btnBackPushed(self):
self.parent.show()
self.parent.raise_()
self.close()
def btnClearPushed(self):
#Calling the clarification window
self.clear = Clarification(self)
#Showing the window
self.clear.show()
#Raising the window to the front of the screen
self.clear.raise_()
#Closing the current window
self.close()
示例4: addEmployee
# 需要导入模块: import Message [as 别名]
# 或者: from Message import raise_ [as 别名]
class addEmployee(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
#Setting the window title
self.setWindowTitle("Add employee")
#Widget set up
self.forename = QLineEdit()
self.labelF = QLabel("Forename: ")
self.surname = QLineEdit()
self.labelS = QLabel("Surname: ")
self.btnAdd = QPushButton("Add")
self.btnCancel = QPushButton("Cancel")
self.labelD = QLabel("Department:")
self.department = QComboBox()
#Adding the departments
self.department.addItem("Marketing")
self.department.addItem("Production")
self.department.addItem("Sales")
self.department.addItem("R&D")
self.VLayoutMAIN = QVBoxLayout()
self.VLayout1 = QVBoxLayout()
self.VLayout2 = QVBoxLayout()
self.HLayout1 = QHBoxLayout()
self.HLayout2 = QHBoxLayout()
self.VLayout1.addWidget(self.labelF)
self.VLayout1.addWidget(self.labelS)
self.VLayout1.addWidget(self.labelD)
self.VLayout2.addWidget(self.forename)
self.VLayout2.addWidget(self.surname)
self.VLayout2.addWidget(self.department)
self.HLayout1.addLayout(self.VLayout1)
self.HLayout1.addLayout(self.VLayout2)
self.HLayout2.addWidget(self.btnCancel)
self.HLayout2.addWidget(self.btnAdd)
self.VLayoutMAIN.addLayout(self.HLayout1)
self.VLayoutMAIN.addLayout(self.HLayout2)
self.widget = QWidget()
self.widget.setLayout(self.VLayoutMAIN)
self.setCentralWidget(self.widget)
#Setting up button connections, to run functions when the buttons are pushed
self.btnAdd.clicked.connect(self.btnAdd_pushed)
self.btnCancel.clicked.connect(self.btnCancel_pushed)
def btnAdd_pushed(self):
#Converting the entries to text
forename = self.forename.text()
surname = self.surname.text()
#Obtaining the selected index
index = self.department.currentIndex()
if index == 0:
department = "Marketing"
elif index == 1:
department = "Production"
elif index == 2:
department = "Sales"
elif index == 3:
department = "R&D"
forename_valid = True
surname_valid = True
#Checking if the line edit has been left blank
if forename != "" and surname != "":
#Converting the forename and surname to lower case for easier validation
forename = forename.lower()
surname = surname.lower()
#Setting up blank lists to append the alphabet into
alphabet = ['-']
#Creating the alphabet from ascii characters
for letter in map(chr, range(97, 123)):
#Adding the character to the blank list
alphabet.append(letter)
count = -1
#Sorting through each character in 'forename'
for each in forename:
#Checking to see if its in the alphabet
if each not in alphabet:
forename_valid = False
#Sorting through each character in 'surname'
for each in surname:
#Checking to see if its in the alphabet
if each not in alphabet:
surname_valid = False
if forename_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Forename")
#Showing the window
self.error.show()
#Raising the window the front of the screen
self.error.raise_()
if surname_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Surname")
#Showing the window
self.error.show()
#.........这里部分代码省略.........