mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
ask whether to save or not when recording ends
This commit is contained in:
parent
8f7b6b71c4
commit
ab81d09741
@ -2,6 +2,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import time
|
import time
|
||||||
|
from tkinter.messagebox import askyesno
|
||||||
import typing
|
import typing
|
||||||
from tkinter.filedialog import asksaveasfile
|
from tkinter.filedialog import asksaveasfile
|
||||||
|
|
||||||
@ -53,16 +54,20 @@ class Recorder(IMode):
|
|||||||
logging.warning("Took too much time to record")
|
logging.warning("Took too much time to record")
|
||||||
|
|
||||||
hk.stop()
|
hk.stop()
|
||||||
|
self._ask_to_save()
|
||||||
|
|
||||||
|
def _ask_to_save(self):
|
||||||
def func():
|
def func():
|
||||||
_file = None
|
_file = None
|
||||||
files = [('Fishy File', '*.fishy')]
|
files = [('Fishy File', '*.fishy')]
|
||||||
while not _file:
|
while not _file and askyesno("Save Recording?", "Would you like to save the recording?"):
|
||||||
_file = asksaveasfile(mode='wb', filetypes=files, defaultextension=files)
|
_file = asksaveasfile(mode='wb', filetypes=files, defaultextension=files)
|
||||||
|
|
||||||
return _file
|
return _file
|
||||||
|
|
||||||
file: typing.BinaryIO = self.engine.get_gui().call_in_thread(func, block=True)
|
file: typing.BinaryIO = self.engine.get_gui().call_in_thread(func, block=True)
|
||||||
|
if not file:
|
||||||
|
return
|
||||||
|
|
||||||
data = {"full_auto_path": self.timeline}
|
data = {"full_auto_path": self.timeline}
|
||||||
pickle.dump(data, file)
|
pickle.dump(data, file)
|
||||||
config.set("full_auto_rec_file", file.name)
|
config.set("full_auto_rec_file", file.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user