def PiJuiceGuiOnclosing():
#if tkMessageBox.askokcancel("Quit", "Do you want to quit?"):
if not os.path.exists(os.path.dirname(PiJuiceConfigDataPath)):
print os.path.dirname(PiJuiceConfigDataPath)
os.makedirs(os.path.dirname(PiJuiceConfigDataPath))
#try:
with open(PiJuiceConfigDataPath , 'w+') as outputConfig:
json.dump(pijuiceConfigData, outputConfig, indent=2)
#except:
#print
root.destroy()
python类askokcancel()的实例源码
def _ResetToDefaultConfigCmd(self):
q = tkMessageBox.askokcancel('Reset Configuration','Warning! This action will reset PiJuice HAT configuration to default settings.', parent=self.frame)
if q:
status = pijuice.config.SetDefaultConfiguration()
if status['error'] != 'NO_ERROR':
tkMessageBox.showerror('Reset to default configuration', status['error'], parent=self.frame)
def PiJuiceGuiOnclosing():
#if tkMessageBox.askokcancel("Quit", "Do you want to quit?"):
if not os.path.exists(os.path.dirname(PiJuiceConfigDataPath)):
print os.path.dirname(PiJuiceConfigDataPath)
os.makedirs(os.path.dirname(PiJuiceConfigDataPath))
#try:
with open(PiJuiceConfigDataPath , 'w+') as outputConfig:
json.dump(pijuiceConfigData, outputConfig, indent=2)
#except:
#print
root.destroy()
def _ResetToDefaultConfigCmd(self):
q = tkMessageBox.askokcancel('Reset Configuration','Warning! This action will reset PiJuice HAT configuration to default settings.', parent=self.frame)
if q:
status = pijuice.config.SetDefaultConfiguration()
if status['error'] != 'NO_ERROR':
tkMessageBox.showerror('Reset to default configuration', status['error'], parent=self.frame)
def _ResetToDefaultConfigCmd(self):
q = tkMessageBox.askokcancel('Reset Configuration','Warning! This action will reset PiJuice HAT configuration to default settings.', parent=self.frame)
if q:
status = pijuice.config.SetDefaultConfiguration()
if status['error'] != 'NO_ERROR':
tkMessageBox.showerror('Reset to default configuration', status['error'], parent=self.frame)
def PiJuiceGuiOnclosing():
#if tkMessageBox.askokcancel("Quit", "Do you want to quit?"):
if not os.path.exists(os.path.dirname(PiJuiceConfigDataPath)):
print os.path.dirname(PiJuiceConfigDataPath)
os.makedirs(os.path.dirname(PiJuiceConfigDataPath))
#try:
with open(PiJuiceConfigDataPath , 'w+') as outputConfig:
json.dump(pijuiceConfigData, outputConfig, indent=2)
#except:
#print
root.destroy()
def _ResetToDefaultConfigCmd(self):
q = tkMessageBox.askokcancel('Reset Configuration','Warning! This action will reset PiJuice HAT configuration to default settings.', parent=self.frame)
if q:
status = pijuice.config.SetDefaultConfiguration()
if status['error'] != 'NO_ERROR':
tkMessageBox.showerror('Reset to default configuration', status['error'], parent=self.frame)
def PiJuiceGuiOnclosing():
#if tkMessageBox.askokcancel("Quit", "Do you want to quit?"):
if not os.path.exists(os.path.dirname(PiJuiceConfigDataPath)):
print os.path.dirname(PiJuiceConfigDataPath)
os.makedirs(os.path.dirname(PiJuiceConfigDataPath))
#try:
with open(PiJuiceConfigDataPath , 'w+') as outputConfig:
json.dump(pijuiceConfigData, outputConfig, indent=2)
#except:
#print
root.destroy()
def start(self):
print('--------------Start Gen Apk-------------------')
# ?????
# if os.path.exists(apks_dir):
# shutil.rmtree(apks_dir)
# ??apk?temp??
cmd_extract = r'java -jar %s\apktool\apktool_2.0.2.jar d -f -s %s\%s -o %s\temp' % (self.setupdir, self.setupdir, self.filename, self.setupdir)
os.system(cmd_extract)
# ??AndroidManifest.xml
if os.path.exists('%s\AndroidManifest.xml' % self.setupdir):
os.remove('%s\AndroidManifest.xml' % self.setupdir)
manifest_path = r'%s\temp\AndroidManifest.xml' % self.setupdir
shutil.copyfile(manifest_path, '%s\AndroidManifest.xml' % self.setupdir)
# ?????
for channel in self.channellist:
print('[Gen Apk] channel : %s' % channel)
self.modify_channel(channel)
# ??????
if os.path.exists('%s\temp' % self.setupdir):
shutil.rmtree('%s\temp' % self.setupdir)
if os.path.exists('%s\AndroidManifest.xml' % self.setupdir):
os.remove('%s\AndroidManifest.xml' % self.setupdir)
flag = tkMessageBox.askokcancel("??", "????!")
if flag:
os.system("explorer.exe %s" % self.apkdir)
print('--------------Done-------------------')
# ?????
def okBox(self, title, message):
self.topLevel.update_idletasks()
return MessageBox.askokcancel(title, message)
fft_spectrum_gui_3can.py 文件源码
项目:FFT-spectrum-analyzer
作者: ariquezada
项目源码
文件源码
阅读 18
收藏 0
点赞 0
评论 0
def on_closing(self):
if (self.f_saved==False):
if tkMessageBox.askokcancel("Quit", "Sampled data not saved. Do you wanto to quit?"):
root.destroy()
else:
root.destroy()
def on_closing(self):
if (self.f_saved==False):
if tkMessageBox.askokcancel("Quit", "Sampled data not saved. Do you wanto to quit?"):
root.destroy()
else:
root.destroy()
def del_dat(self):
cnt = tkMessageBox.askokcancel(title='Reconfirmation',
message='Are you sure to delete the data?',
parent=self.frame3)
if cnt is True:
cas_dir = self.bemoss_dir.replace('bemoss_os/', 'cassandra/')
path = cas_dir + 'data'
shutil.rmtree(path)
else:
return
def del_cas(self):
cnt = tkMessageBox.askokcancel(title='Reconfirmation',
message='Are you sure to delete the file?',
parent=self.frame3)
if cnt is True:
path = self.bemoss_dir + '/cassandra_settings.txt'
os.remove(path)
else:
return
def close(self):
"Extend EditorWindow.close()"
if self.executing:
response = tkMessageBox.askokcancel(
"Kill?",
"The program is still running!\n Do you want to kill it?",
default="ok",
parent=self.text)
if response is False:
return "cancel"
self.stop_readline()
self.canceled = True
self.closing = True
# Wait for poll_subprocess() rescheduling to stop
self.text.after(2 * self.pollinterval, self.close2)
def ask_save_dialog(self):
msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?"
confirm = tkMessageBox.askokcancel(title="Save Before Run or Check",
message=msg,
default=tkMessageBox.OK,
master=self.editwin.text)
return confirm
def execAction(self):
if not self.action is None:
action = getattr(self.controller, self.action)
location = self.current_dir
selection = self.getSelection()
if len(selection) > 0:
location = selection[0]
if len(self.items_selected) > 0:
if tkMessageBox.askokcancel(self.action.capitalize(), "Are you sure? This action can be permanent"):
if action(self.items_selected, location):
self.action = None
else:
tkMessageBox.showerror("Ops", "An error occurred :(")
self.reloadMainList()
def install_examples(): # pragma: no cover
"""
Pops up windows to allow the user to choose a directory for installation
of sfc_models examples.
Uses tkinter, which is installed in base Python (modern versions).
:return:
"""
if not mbox.askokcancel(title='sfc_models Example Installation',
message=validate_str):
return
target = fdog.askdirectory(title='Choose directory to for sfc_models examples installation')
if target == () or target == '':
return
install_example_scripts.install(target)
def play(self):
self.erase()
self.paint_board()
try:
self.put_chess()
except IndexError:
if askokcancel('????', '???????'):
self.file_window()
else:
self.root.destroy()
# ????FEN????
def play(self):
self.erase()
self.paint_board()
try:
self.put_chess()
except IndexError:
if askokcancel('????', '???????'):
self.file_window()
else:
self.root.destroy()
# ????FEN????