def OnQuit(self,event,dbfile):
if _plat.startswith('linux'):
dlg = wx.MessageDialog(self, 'Really quit?','', wx.OK | wx.CANCEL | wx.ICON_ERROR)
val = dlg.ShowModal()
dlg.Show()
if val == wx.ID_CANCEL:
dlg.Destroy()
elif val == wx.ID_OK:
OKQuit = self.DBQuit(dbfile)
if OKQuit == 42:
self.Close()
elif _plat.startswith('darwin'):
pass
elif _plat.startswith('win'):
OKQuit = self.DBQuit(dbfile)
if OKQuit == 42:
self.Close()
sys.exit()#windows
self.Refresh()
python类ICON_ERROR的实例源码
def DoLog(self, level, msg, time):
if level == wx.LOG_Warning:
caption = 'Warning'
elif level == wx.LOG_Error:
caption = 'Error'
else:
caption = 'Message'
fullMessage = caption + ': ' + msg + '\n'
if level == wx.LOG_Error:
sys.stderr.write(fullMessage)
sys.stderr.flush()
for tctrl in self.textCtrls:
tctrl.AppendText(fullMessage)
if level <= wx.LOG_Warning:
dialog = wx.MessageDialog(None, message=msg, caption=caption,
style=wx.ICON_ERROR | wx.OK)
dialog.ShowModal()
dialog.Destroy()
def tellToDoSwipeOrInput(self, evt):
operationString = self.OpeartionBox.GetStringSelection()
inputC = self.inputContent.GetValue()
sX = self.swipeStartX.GetValue()
sY = self.swipeStartY.GetValue()
eX = self.swipeEndX.GetValue()
eY = self.swipeEndY.GetValue()
if operationString=="??":
if inputC=="":
dlg = wx.MessageDialog(self, u"???????", u"????????", wx.OK | wx.ICON_ERROR)
if dlg.ShowModal() == wx.ID_OK:
dlg.Destroy()
else:
keyb = self.keyboardType.GetValue()
wx.CallAfter(pub.sendMessage, "DoSwipeOrInput", msg =inputC+"\n"+keyb)
else:
if sX=="" or sY=="" or eX=="" or eY=="":
dlg = wx.MessageDialog(self, u"?????????", u"??????????????????", wx.OK | wx.ICON_ERROR)
if dlg.ShowModal() == wx.ID_OK:
dlg.Destroy()
else:
wx.CallAfter(pub.sendMessage, "DoSwipeOrInput", msg ="??\n%d\n%d\n%d\n%d" % (sX,sY,eX,eY))
def on_transform_button_click(self, event):
slice_startswith = self.slice_text.GetValue()
template_path = self.get_template_path()
response_body = self.GetParent().get_response_content()
try:
handler = Request2Doc()
handler.set_slice_startswith(slice_startswith)
handler.set_response_body(response_body)
if not handler.get_response_data():
return wx.MessageDialog(None, u'Response body is not legal format', u"Information", wx.OK | wx.ICON_INFORMATION).ShowModal()
self.GetParent().set_document_content(handler.render_string(template_path))
except Exception, e:
return wx.MessageDialog(None, traceback.format_exc(), u"Exception", wx.OK | wx.ICON_ERROR).ShowModal()
def download_complete(self, errors):
if self.progress_dialog:
logger.info("Beginning download")
self.downloader.join()
if errors:
done_string = "Songs downloaded with {errors} error(s)".format(errors=len(errors))
else:
done_string = "All songs were downloaded succesfully!"
logger.info(done_string)
done_message = wx.MessageDialog(parent=self, message=done_string, caption="pyjam")
done_message.ShowModal()
done_message.Destroy()
if errors:
errors = '\n'.join(errors)
logger.critical("Error downloading these these URLs:\n{errors}".format(errors=errors))
error_dialog = wx.MessageDialog(parent=self, message="The following URLs caused errors\n" + errors,
caption="Download Error!", style=wx.ICON_ERROR)
error_dialog.ShowModal()
error_dialog.Destroy()
self.progress_dialog.Destroy()
self.Destroy()
wx.CallAfter(self.parent.convert, event=None, in_dir=self.out_dir.GetPath())
def convert_complete(self, errors):
if self.progress_dialog:
self.converter.join()
if errors:
done_string = "Songs converted with {errors} error(s)".format(errors=len(errors))
else:
done_string = "All songs were converted succesfully!"
done_message = wx.MessageDialog(parent=self, message=done_string, caption="pyjam")
done_message.ToggleWindowStyle(wx.STAY_ON_TOP)
done_message.ShowModal()
done_message.Destroy()
if errors:
errors = '\n'.join(errors)
error_dialog = wx.MessageDialog(parent=self, message="The following files caused errors\n" + errors,
caption="Conversion Error!", style=wx.OK | wx.ICON_ERROR)
error_dialog.ShowModal()
error_dialog.Destroy()
logger.critical("Error converting these files\n{errors}".format(errors=errors))
logger.info(done_string)
wx.CallAfter(self.progress_dialog.Destroy)
def OnGenerateProgramMenu(self, event):
dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), self.Controler.GetProgramFilePath(), _("ST files (*.st)|*.st|All files|*.*"), wx.SAVE | wx.CHANGE_DIR)
if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
message_text = ""
header, icon = _("Done"), wx.ICON_INFORMATION
if os.path.isdir(os.path.dirname(filepath)):
program, errors, warnings = self.Controler.GenerateProgram(filepath)
message_text += "".join([_("warning: %s\n") % warning for warning in warnings])
if len(errors) > 0:
message_text += "".join([_("error: %s\n") % error for error in errors])
message_text += _("Can't generate program to file %s!") % filepath
header, icon = _("Error"), wx.ICON_ERROR
else:
message_text += _("Program was successfully generated!")
else:
message_text += _("\"%s\" is not a valid folder!") % os.path.dirname(filepath)
header, icon = _("Error"), wx.ICON_ERROR
message = wx.MessageDialog(self, message_text, header, wx.OK | icon)
message.ShowModal()
message.Destroy()
dialog.Destroy()
def GetDimensions(self):
message = None
dimensions_list = []
dimension_strings = self.Dimensions.GetStrings()
if len(dimension_strings) == 0:
message = _("Empty dimension isn't allowed.")
for dimensions in dimension_strings:
result = DIMENSION_MODEL.match(dimensions)
if result is None:
message = _("\"%s\" value isn't a valid array dimension!") % dimensions
break
bounds = result.groups()
if int(bounds[0]) >= int(bounds[1]):
message = _("\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value.") % dimensions
break
dimensions_list.append(bounds)
if message is not None:
dlg = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return None
return dimensions_list
def OnOK(self, event):
message = None
step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
if step_name == "":
message = _("You must type a name!")
elif not TestIdentifier(step_name):
message = _("\"%s\" is not a valid identifier!") % step_name
elif step_name.upper() in IEC_KEYWORDS:
message = _("\"%s\" is a keyword. It can't be used!") % step_name
elif step_name.upper() in self.PouNames:
message = _("A POU named \"%s\" already exists!") % step_name
if message is not None:
dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
dialog.ShowModal()
dialog.Destroy()
else:
self.EndModal(wx.ID_OK)
event.Skip()
def OnOK(self, event):
message = None
step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
if step_name == "":
message = _("You must type a name!")
elif not TestIdentifier(step_name):
message = _("\"%s\" is not a valid identifier!") % step_name
elif step_name.upper() in IEC_KEYWORDS:
message = _("\"%s\" is a keyword. It can't be used!") % step_name
elif step_name.upper() in self.PouNames:
message = _("A POU named \"%s\" already exists!") % step_name
elif step_name.upper() in self.Variables:
message = _("A variable with \"%s\" as name already exists in this pou!") % step_name
elif step_name.upper() in self.StepNames:
message = _("\"%s\" step already exists!") % step_name
if message is not None:
dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
dialog.ShowModal()
dialog.Destroy()
else:
self.EndModal(wx.ID_OK)
event.Skip()
def OnTreeEndLabelEdit(self, event):
new_name = event.GetLabel()
if new_name != "":
old_filepath = self.GetPath(event.GetItem())
new_filepath = os.path.join(os.path.split(old_filepath)[0], new_name)
if new_filepath != old_filepath:
if not os.path.exists(new_filepath):
os.rename(old_filepath, new_filepath)
event.Skip()
else:
message = wx.MessageDialog(self,
_("File '%s' already exists!") % new_name,
_("Error"), wx.OK | wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
else:
event.Skip()
def ShowMessage(self, message):
"""
Show error message in Error Dialog
@param message: Error message to display
"""
dialog = wx.MessageDialog(self.ParentWindow,
message,
_("Error"),
wx.OK | wx.ICON_ERROR)
dialog.ShowModal()
dialog.Destroy()
# -------------------------------------------------------------------------------
# Debug Variable Graphic Viewer Class
# -------------------------------------------------------------------------------
def ShowMessage(self, message):
"""
Show error message in Error Dialog
@param message: Error message to display
"""
dialog = wx.MessageDialog(self.ParentWindow,
message,
_("Error"),
wx.OK | wx.ICON_ERROR)
dialog.ShowModal()
dialog.Destroy()
# -------------------------------------------------------------------------------
# Debug Variable Text Viewer Class
# -------------------------------------------------------------------------------
def OnEnumeratedValueEndEdit(self, event):
text = event.GetText()
values = self.EnumeratedValues.GetStrings()
index = event.GetIndex()
if index >= len(values) or values[index].upper() != text.upper():
if text.upper() in [value.upper() for value in values]:
message = wx.MessageDialog(self, _("\"%s\" value already defined!") % text, _("Error"), wx.OK | wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
elif text.upper() in IEC_KEYWORDS:
message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!") % text, _("Error"), wx.OK | wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
initial_selected = None
if index < len(values) and self.EnumeratedInitialValue.GetStringSelection() == values[index]:
initial_selected = text
wx.CallAfter(self.RefreshEnumeratedValues, initial_selected)
wx.CallAfter(self.RefreshTypeInfos)
event.Skip()
else:
event.Skip()
def Paste(self, bbx=None):
if not self.Debug:
element = self.ParentWindow.GetCopyBuffer()
if bbx is None:
mouse_pos = self.Editor.ScreenToClient(wx.GetMousePosition())
middle = wx.Rect(0, 0, *self.Editor.GetClientSize()).InsideXY(mouse_pos.x, mouse_pos.y)
if middle:
x, y = self.CalcUnscrolledPosition(mouse_pos.x, mouse_pos.y)
else:
x, y = self.CalcUnscrolledPosition(0, 0)
new_pos = [int(x / self.ViewScale[0]), int(y / self.ViewScale[1])]
else:
middle = True
new_pos = [bbx.x, bbx.y]
result = self.Controler.PasteEditedElementInstances(self.TagName, element, new_pos, middle, self.Debug)
if not isinstance(result, (StringType, UnicodeType)):
self.RefreshBuffer()
self.RefreshView(selection=result)
self.RefreshVariablePanel()
self.ParentWindow.RefreshPouInstanceVariablesPanel()
else:
message = wx.MessageDialog(self.Editor, result, "Error", wx.OK | wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
def validate_email(self):
self.CHECK_LIST_ITEMS=[]
sending_numbers=self.text_ctrl_selected_email.Value
sending_numbers=sending_numbers.split(";")
for email in sending_numbers:
print email
if not email:
continue
if self.V.validate_email(email)[0]:
self.CHECK_LIST_ITEMS.append(email)
else:
#msg=email+" is invalid email id. Either edit or delete it to continue!"
#dlg = wx.MessageDialog(self, msg, 'Error',wx.OK | wx.ICON_ERROR)
#dlg.ShowModal()
#dlg.Destroy()
return 0
return True
def validate_pass(self):
if not self.UO.Login_Check(self.combo_box_1.Value,self.text_ctrl_1.Value):
return False
if len(self.text_ctrl_2.Value)<5:
dlg = wx.MessageDialog(self, 'Password must be of at least five characters', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return False
if self.text_ctrl_2.Value!=self.text_ctrl_3.Value:
dlg = wx.MessageDialog(self, 'Passwords do not match', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return False
return True
def on_save(self, event): # wxGlade: institution.<event_handler>
try:
self.DB.Set_School_Name(self.text_ctrl_name.Value)
self.DB.Set_School_Code(self.text_ctrl_code.Value)
self.DB.Set_School_Email(self.text_ctrl_email.Value)
self.DB.Set_School_Contact(self.text_ctrl_phone.Value)
self.DB.Set_School_DEO(self.text_ctrl_deo.Value)
dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
except:
dlg = wx.MessageDialog(self, 'Could not save some values', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
self.Close(True)
event.Skip()
def validate_mobile(self):
self.SENDING_LIST=[]
V=validate()
sending_numbers=self.text_ctrl_selected_contacts.Value
sending_numbers=sending_numbers.split(";")
for mobile in sending_numbers:
if not mobile:
continue
if V.validate_mobile(mobile)[0]:
self.SENDING_LIST.append(mobile)
else:
msg=mobile+" is invalid mobile number. Either edit it or delete to continue!"
dlg = wx.MessageDialog(self, msg, 'Error',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return 0
return True
def Validate_Adm_No(self,value):
if not value.isdigit() and value!="":
'''dlg = wx.MessageDialog(None, 'Admission No should be integer', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
'''
return 0
else: # if admission no already exists
if self.DB.Admission_Exists(value)!=False:
print 'Admission No: ',value,' is already allotted to', self.DB.Admission_Exists(value)[1]
return 0
return 1
def OnSave(self, event): # wxGlade: MyFrame2.<event_handler>
CE=[self.ce_1,self.ce_2,self.ce_3,self.ce_4,self.ce_5,self.ce_6,self.ce_7,self.ce_8,self.ce_9,self.ce_10,self.ce_11,self.ce_12,self.ce_13]
TE=[self.te_1,self.te_2,self.te_3,self.te_4,self.te_5,self.te_6,self.te_7,self.te_8,self.te_9,self.te_10,self.te_11,self.te_12,self.te_13]
try:
for i in range(13):
if self.YEAR=='Select' or self.STD=='Select':
break
else:
index=i#in deb oper Get_CE_CE() index for work exp starts at 12
if i>=10:
index+=2
self.DB.Set_CE_TE(self.YEAR,self.STD,index,CE[i].Value,TE[i].Value)
dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
except:
dlg = wx.MessageDialog(self, 'Error! Could not Save', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
event.Skip()
def place(self, e):
if not hasattr(self, "brackets"):
errortext = "Make bracket before doing that"
w = wx.MessageDialog(self.parent, errortext,
"Error", wx.ICON_ERROR)
w.ShowModal()
w.Destroy()
return
placel = bracketfuncs.placing(self.brackets)
d = wx.Dialog(None)
d.SetTitle("Results")
a = wx.TextCtrl(d, style=wx.TE_MULTILINE)
a.SetEditable(False)
ptxt = ""
for p in placel:
if not p.isbye():
ptxt += str(placel[p]) + ". " + p.tag + "\n"
a.SetValue(ptxt)
d.SetSize((250, 320))
d.Show(True)
def OnAdd(self, evt):
dialog = wx.TextEntryDialog(self,
"Enter name:",
"Add", style = wx.OK | wx.CANCEL)
dialog.Centre(wx.BOTH)
if dialog.ShowModal() == wx.ID_OK:
name = dialog.GetValue()
if name not in ("CURRENT", ) and name not in self.all_hosts:
fpath = os.path.join(DataPath, name)
shutil.copy(os.path.join(DataPath, "default"), fpath)
call_editor(fpath)
self.all_hosts.append(name)
self.combo_box_1.AppendItems([name])
else:
msg_dialog = wx.MessageDialog(self,
"Failed to create \"%s\".\nFile already exists." % name,
'Failed to create "%s"' % name, wx.OK | wx.ICON_ERROR)
msg_dialog.Centre(wx.BOTH)
msg_dialog.ShowModal()
msg_dialog.Destroy()
dialog.Destroy()
def OnDelete(self, evt):
name = self.combo_box_1.GetValue()
fpath = os.path.join(DataPath, name)
if name != "default":
msg_dialog = wx.MessageDialog(self,
"Are you sure that you want to delete file \"%s\"" % name,
"Delete \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION)
msg_dialog.Centre(wx.BOTH)
r = msg_dialog.ShowModal()
if r == wx.ID_YES:
if os.path.exists(fpath) and os.path.isfile(fpath):
os.remove(fpath)
index = self.combo_box_1.GetSelection()
self.combo_box_1.Delete(index)
self.combo_box_1.Select(0)
msg_dialog.Destroy()
else:
msg_dialog = wx.MessageDialog(self,
"\"%s\" can't be deleted.\nYou can edit it only." % name,
"\"%s\" can't be deleted." % name, wx.OK | wx.ICON_ERROR)
msg_dialog.Centre(wx.BOTH)
msg_dialog.ShowModal()
msg_dialog.Destroy()
def OnInit(self):
"""
Run automatically when the wxPython application starts.
"""
self.frame = wx.Frame(None, title="PyUpdater wxPython Demo")
self.frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
self.frame.SetSize(wx.Size(400, 100))
self.statusBar = wx.StatusBar(self.frame)
self.statusBar.SetStatusText(self.status)
self.frame.SetStatusBar(self.statusBar)
self.panel = wx.Panel(self.frame)
self.sizer = wx.BoxSizer()
self.sizer.Add(
wx.StaticText(self.frame, label="Version %s" % __version__))
self.panel.SetSizerAndFit(self.sizer)
self.frame.Show()
if hasattr(sys, "frozen") and \
not os.environ.get('PYUPDATER_FILESERVER_DIR'):
dlg = wx.MessageDialog(
self.frame,
"The PYUPDATER_FILESERVER_DIR environment variable "
"is not set!", "PyUpdaterWxDemo File Server Error",
wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
return True
def TakeSnapshot(self,e,args):
logging.exception('CAPTURE')
if self.camset == 1:
self.framlog += 1
#print(self.camhero)#DEBUG
vidcap = vlc.libvlc_video_take_snapshot(self.player,0,os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'),0,0)
self.cur.execute('INSERT INTO Timeline VALUES(Null,?,?)', (str(self.framlog).zfill(3)+'.png',0))
# add graphically to timeline
img = self.MakeThumbnail(os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'), self.thumbsize)
self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=str(self.framlog).zfill(3)+'.png')
self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )
logging.exception(self.imageCtrl.GetId() )
self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )
# scroll right 100% to get close to new frame
self.panel3.Scroll(self.thumbsize,0)
self.Layout()
# draw new frame
self.hbox2.Layout()
self.panel3.Refresh()
# scroll WAY right again to show frame
self.panel3.Scroll(200,0)
# send the shot to onion skin
img = os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png')
self.OnionSkin(img)
logging.exception(self.framlog)
else:
dlg = wx.MessageDialog(self, 'Please select your camera first.','',wx.OK | wx.ICON_ERROR)
val = dlg.ShowModal()
if val == wx.ID_OK:
dlg.Destroy()
if val == wx.ID_CANCEL:
dlg.Destroy()
self.player.play()
self.brec.SetBitmapLabel(self.brecicon)
def on_ok(self, e):
self.session_file_path = self.session_picker.GetPath()
if not self.session_file_path:
wx.MessageBox(_("Please specify the Current Fest file."), "No Fest File", wx.OK | wx.ICON_ERROR, self)
return
self.config[Config.PROJECTOR_SCREEN] = self.screens_combobox.GetSelection()
self.config[Config.FILENAME_RE] = self.filename_re.GetValue()
self.config[Config.BG_TRACKS_DIR] = self.bg_tracks.GetPath()
self.config[Config.BG_ZAD_PATH] = self.bg_zad.GetPath()
self.config[Config.FILES_DIRS] = [picker.GetPath() for picker in self.dir_pickers]
self.EndModal(e.Id)
def switch_device(self, device, currently):
switch_path = "/home/" + pi_link_pnl.target_user + "/Pigrow/scripts/switches/"
if currently == "ON":
switch_command = switch_path + device + "_off.py"
future_state = "OFF"
elif currently == "OFF":
switch_command = switch_path + device + "_on.py"
future_state = "ON"
else:
switch_command = "ERROR"
#if error show error message
if not switch_command == "ERROR":
#make dialogue box to ask if should switch the device
d = wx.MessageDialog(
self, "Are you sure you want to switch " + device + " to the " +
future_state + " poisition?\n\n\n " +
"Note: automated control scripts might " +
"\n switch this " + currently + " again " +
"\n if thier trigger conditions are met. "
, "Switch " + device + " " + future_state + "?"
, wx.OK | wx.CANCEL | wx.ICON_QUESTION)
answer = d.ShowModal()
d.Destroy()
#if user said ok then switch device
if (answer == wx.ID_OK):
out, error = MainApp.localfiles_ctrl_pannel.run_on_pi(switch_command)
print out # shows box with switch info from pigrow
if not error == "": print error
config_ctrl_pnl.currently_toedit = future_state #for if toggling within the dialog box
self.update_box_text()
config_ctrl_pnl.currently_new = future_state
config_ctrl_pnl.device_new = device
config_ctrl_pnl.gpio_new = config_ctrl_pnl.gpio_toedit
config_ctrl_pnl.wiring_new = config_ctrl_pnl.wiring_toedit
else:
d = wx.MessageDialog(self, "Error, current state not determined\n You must upload the settings to the pigrow before switching the device", "Error", wx.OK | wx.ICON_ERROR)
answer = d.ShowModal()
d.Destroy()
return "ERROR"
def click_search_answer(self, event=None):
page_source_code = self.web_panel.get_page_source_code()
logic_controller = LogicController(parent=self, page_source_code=page_source_code, enable_web_copy=True)
parse_answers_result = logic_controller.get_parse_page_status()
logging.debug("result:%s" % str(parse_answers_result))
if parse_answers_result:
self.show_and_select_answer(
answer_choice_group_formated=logic_controller.get_answer_choice_group_formated(),
auto_select_answer_script=logic_controller.get_auto_select_answer_script())
self.show_on_statusbar(message=u"?????")
self.show_dialog(messgage=_HAS_FUND_MESSAGE, caption=u"????(?'?'?)", style=wx.OK)
else:
self.show_on_statusbar(message=logic_controller.get_error_message()) # u"?????????"
self.show_dialog(messgage=_NOT_FIND_MESSAGE, caption=u"Error", style=wx.ICON_ERROR)
def DoSwipeOrInput(self, msg):
global recordStatus
global treeDic
global recordTimeDelay
if treeDic!=None:
if recordStatus=="?":
if "??" in msg:
d = msg.replace("??\n", "").split("\n")
print("?????,", "???: ",d)
os.system("adb shell input swipe %d %d %d %d" % (int(d[0]), int(d[1]),int(d[2]),int(d[3])))
dlg = MessageDialog('??????????(?????%d?)' % recordTimeDelay, '??')
wx.CallLater(recordTimeDelay*1000, dlg.Destroy)
dlg.ShowModal()
getNewScreenShotAndDomFileThread()
else:
c = msg.split("\n")[0]
kT = msg.split("\n")[1]
print("?????,", "???",c)
if c!='':
if kT == "ADB":
os.system("adb shell am broadcast -a ADB_INPUT_TEXT --es msg '%s'" %c)
else:
os.system("adb shell input text '%s'" %c)
dlg = MessageDialog('??????????(?????%d?)' % recordTimeDelay, '??')
wx.CallLater(recordTimeDelay*1000, dlg.Destroy)
dlg.ShowModal()
getNewScreenShotAndDomFileThread()
else:
dlg = wx.MessageDialog(self, u"???????", u"????????", wx.OK | wx.ICON_ERROR)
if dlg.ShowModal() == wx.ID_OK:
dlg.Destroy()
else:
msg = "????????????????"
print(msg)
wx.CallAfter(pub.sendMessage, "update", msg=msg)
else:
msg = "?????????????"
print(msg)
wx.CallAfter(pub.sendMessage, "update", msg=msg)