def monkey_app():
status_shebei=huoqushebeizhuangtai()
if status_shebei =='device':
try:
packname=baoming_t1.get('0.0',END).split()[0]
zhongzi=zhongzi_t.get('0.0',END).split()[0]
time=time_t.get().split()[0]
touch=touch_t.get('0.0',END).split()[0]
huadong=huadong_t.get('0.0',END).split()[0]
guiji=guiji_t.get('0.0',END).split()[0]
xitong=xitong_t.get('0.0',END).split()[0]
acti=acti_t.get('0.0',END).split()[0]
event=event_t.get('0.0',END).split()[0]
log=log_t.get('0.0',END).split()[0]
danghang=danghang_t.get('0.0',END).split()[0]
if len(packname)<=5:
LOG.info('???????')
messagebox.showwarning('??','???????')
if int(touch)+int(huadong)+int(guiji)+int(danghang)+int(xitong)+int(acti) >100:
messagebox.showerror('??','?????????????????100%')
LOG.info('?????????????????100')
adb_monkey(packagename=packname,s_num=zhongzi,throttle=time,pct_touch=touch,pct_motion=huadong,pct_trackball=guiji,pct_nav=danghang,pct_syskeys=xitong,pct_appswitch=acti,num=event,logfilepath=log)
except :
messagebox.showwarning('??','????monkey????')
LOG.info('monkey ???????:%s'%Exception)
else:
LOG.info('?????? ???????!')
messagebox.showwarning('??','?????? ???????!')
python类showwarning()的实例源码
def warningBox(self, title, message):
self.topLevel.update_idletasks()
MessageBox.showwarning(title, message)
self.__bringToFront()
def onWarn(self,message):
messagebox.showwarning("Warning", message)
Inspector.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 22
收藏 0
点赞 0
评论 0
def submitReportButtonClicked(self):
for i in range(0, 15):
if not self.itemScoreList[i].get():
messagebox.showwarning("Empty input", "Please enter a score for each item.")
return False
for i in range(0, 8):
if not (int(self.itemScoreList[i].get()) in range(0, 10)):
messagebox.showwarning("Input out of range", "For items 1-8, the score must be 0-9. You entered "
+ self.itemScoreList[i].get() + " for item " + str(i + 1) + ".")
return False
for i in range(8, 15):
if not (int(self.itemScoreList[i].get()) in range(0, 5)):
messagebox.showwarning("Input out of range", "For items 9-15, the score must be 0-4. You entered "
+ self.itemScoreList[i].get() + " for item " + str(i + 1) + ".")
return False
result = self.cursor.execute("SELECT iid FROM inspector WHERE iid = %s", self.inspectorID.get())
if not result:
messagebox.showwarning("Inspector ID is not exist")
return False
result = self.cursor.execute("SELECT rid FROM restaurant WHERE rid = %s", self.restaurantID.get())
if not result:
messagebox.showwarning("Restaurant ID is not exist")
return False
self.submitReportToDatabase()
messagebox.showwarning("Submission successful", "Your report has been submitted.")
self.insertReportWindow.withdraw()
self.inspectorMenuWindow.deiconify()
return True
#----------DATABASE INTERACTION METHODS---------------------------------------------
Inspector.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def connect(self):
try:
db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
return db
except:
messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
return False
UsersInterface.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def connect(self):
try:
db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
return db
except:
messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
return False
Guest.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def submitComplaintButtonClicked(self):
#submit the complaint to database
restaurant = self.complaintInfoList[0].get().split(',')[0]
self.cursor.execute("SELECT rid FROM restaurant WHERE name = %s", restaurant)
restaurantID = self.cursor.fetchone()[0]
phone = self.complaintInfoList[4].get()
cdate = self.complaintInfoList[1].get()
customerFirstName = self.complaintInfoList[2].get()
customerLastName = self.complaintInfoList[3].get()
'''
address = self.complaintInfoList[0].get().split(', ', 1)[1]
print("address: " + address)
self.cursor.execute("SELECT email FROM restaurant WHERE name = %s", restaurant)
operatorEmail = self.cursor.fetchone()[0]
print("email: " + operatorEmail)
self.cursor.execute("SELECT firstname, lastname FROM operatorowner WHERE email = %s", operatorEmail)
nameTuple = self.cursor.fetchall()
operatorName = nameTuple[0][0] + ' ' + nameTuple[0][1]
print(operatorName)
self.cursor.execute("SELECT totalscore FROM inspection WHERE rid = %s ORDER BY idate DESC", restaurantID)
score = self.cursor.fetchone()[0]
print("score: " + str(score))
'''
complaint = self.complaintInfoList[-1].get()
result = self.cursor.execute("SELECT * FROM customer WHERE phone = %s", phone)
if not result:
self.cursor.execute("INSERT INTO customer (phone, firstname, lastname) VALUES (%s, %s, %s)",
(phone, customerFirstName, customerLastName))
self.db.commit()
self.cursor.execute("INSERT INTO complaint (rid, phone, cdate, description) VALUES (%s, %s, %s, %s)",
(restaurantID, phone, cdate, complaint))
self.db.commit()
messagebox.showwarning("Submission Successful!", "Your complaint has been submitted.")
self.fileComplaintWindow.withdraw()
self.guestMenuWindow.deiconify()
Guest.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def connect(self):
try:
db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
return db
except:
messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
return False
Operator.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 22
收藏 0
点赞 0
评论 0
def searchButtonClicked(self):
if not self.restaurantIDChoice.get():
messagebox.showwarning("Empty restaurant ID input", "Please select restaurant ID.")
return False
if not self.restaurantNameChoice.get():
messagebox.showwarning("Empty restaurant name input", "Please select restaurant name.")
return False
if not self.addressChoice.get():
messagebox.showwarning("Empty address input", "Please select restaurant address.")
return False
# Check if the choices match (as one restaurant)
street = self.addressChoice.get().split(",")[0]
result = self.cursor.execute("SELECT * FROM restaurant WHERE (rid = %s AND name = %s AND street = %s AND email = %s)",
(int(self.restaurantIDChoice.get()),
self.restaurantNameChoice.get(), street, self.email))
if not result:
messagebox.showwarning("Error", "The restaurant ID, name and address you selected do not match.")
return False
self.displayReportWindow.withdraw()
self.buildGenerateReportWindow(self.restaurantIDChoice.get(),
self.restaurantNameChoice.get(),
self.addressChoice.get(),
self.generateReportWindow)
self.generateReportWindow.deiconify()
#------------------------------------BUILD WINDOW METHODS------------------------------------------------
Operator.py 文件源码
项目:CS-4400-Georgia-Restaurant-Inspections-report-database
作者: itsxiaoxiaoxiaoxiaoyu
项目源码
文件源码
阅读 29
收藏 0
点赞 0
评论 0
def connect(self):
try:
db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
return db
except:
messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
return False
def validate(self):
try:
result = self.getresult()
except ValueError:
messagebox.showwarning(
"Illegal value",
self.errormessage + "\nPlease try again",
parent = self
)
return 0
if self.minvalue is not None and result < self.minvalue:
messagebox.showwarning(
"Too small",
"The allowed minimum value is %s. "
"Please try again." % self.minvalue,
parent = self
)
return 0
if self.maxvalue is not None and result > self.maxvalue:
messagebox.showwarning(
"Too large",
"The allowed maximum value is %s. "
"Please try again." % self.maxvalue,
parent = self
)
return 0
self.result = result
return 1
def fileopen(self):
try:
self.v = self.fileName.get()
with open(self.v, "r") as r:
content = r.read()
self.contents.insert(INSERT, content)
except:
messagebox.showwarning("error", "file not found")
def save(self):
try:
self.v = self.fileName.get()
with open(self.v, "a") as w:
w.write(self.contents.get(1.0, END))
except:
messagebox.showwarning("error", "file not found")
def clearfile(self):
try:
self.v = self.fileName.get()
with open(self.v, "w+") as w:
w.write("")
self.contents.insert(INSERT, "")
except:
messagebox.showwarning("file not found")
def overwrite(self):
try:
self.v = self.fileName.get()
with open(self.v, "w") as w:
w.write(self.contents.get(1.0, END))
except:
messagebox.showwarning("error", "file not found")
def webview(self):
try:
self.v = self.fileName.get()
with open(self.v, "r") as r:
webbrowser.open_new(self.v)
except:
messagebox.showwarning("error", "file not found")
def clientConnectionFailed(self, connector, reason):
tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
def validate(self):
try:
result = self.getresult()
except ValueError:
messagebox.showwarning(
"Illegal value",
self.errormessage + "\nPlease try again",
parent = self
)
return 0
if self.minvalue is not None and result < self.minvalue:
messagebox.showwarning(
"Too small",
"The allowed minimum value is %s. "
"Please try again." % self.minvalue,
parent = self
)
return 0
if self.maxvalue is not None and result > self.maxvalue:
messagebox.showwarning(
"Too large",
"The allowed maximum value is %s. "
"Please try again." % self.maxvalue,
parent = self
)
return 0
self.result = result
return 1
def init_warn(self):
warnings = ''
if not len(cm.rates):
warnings += 'Currency information is empty because the server returned no data. ' \
'Currency rates will be 0 unless set manually.\n'
if not len(fm.autoFilters):
warnings += 'Filters were not generated because the server returned no data.\n'
if warnings:
warnings += '\nYou can either continue in this mode or restart the application if you wish to try again.'
messagebox.showwarning('Warning', warnings, parent=self)
def stop_scan(self):
self.btn_toggle.config(text="Stopping..", state=DISABLED)
ls = LoadingScreen(self, determinate=False)
threading.Thread(target=self._stop_scan, args=(ls,)).start()
self.wait_window(ls)
if self.stop_error:
self.update_started()
messagebox.showwarning('Operation timed out',
"Stop request timed out. If the issue persists, restart the application.",
parent=self)
else:
self.update_stopped()