diff --git a/examples/gtk3.py b/examples/gtk3.py index e259c82..3f367c3 100644 --- a/examples/gtk3.py +++ b/examples/gtk3.py @@ -70,12 +70,13 @@ def __init__(self): self.button_change_variant.connect("clicked", self.change_variant) self.button_speak = Gtk.Button(label="Speak") self.button_speak.connect("clicked", self.speak) - + self.button_stop = Gtk.Button(label="Stop") + self.button_stop.connect("clicked", self.stop) hbox_bottom.pack_start(self.button_change_style, True, True, 0) hbox_bottom.pack_start(self.button_change_expression, True, True, 0) hbox_bottom.pack_start(self.button_change_variant, True, True, 0) hbox_bottom.pack_start(self.button_speak, True, True, 0) - + hbox_bottom.pack_start(self.button_stop, True, True, 0) # Load the model and the images self.__load_model("models/kurisu/model.json") @@ -99,6 +100,9 @@ def change_style(self, event): style = self.cycle_dict_values(self.model.get_styles(), str(self.model.get_current_style())) self.model.set_current_style(style) + def stop(self, event): + self.model.stop() + def change_expression(self, event): expression = self.cycle_dict_values(self.model.get_expressions(), str(self.model.get_current_expression())) self.model.set_current_expression(expression) diff --git a/src/livepng/model.py b/src/livepng/model.py index 81cd525..202eaa2 100644 --- a/src/livepng/model.py +++ b/src/livepng/model.py @@ -339,6 +339,7 @@ def __speak(self, wavfile: str, random_variant: bool = True, play_audio: bool = stream.close() p.terminate() audio_thread.join() + self.__update_frame(self.get_current_image()) # Speaking finished # Notify the threads and release the lock self.__notify_speak_finish(wavfile) @@ -356,6 +357,10 @@ def __update_images(self, frames: list[str], frame_rate:int = 10): break self.__update_frame(frame) sleep(1/frame_rate) + + def stop(self): + """Stop the speak function""" + self.__request_interrupt = True def calculate_frames_from_audio(self, wavfile: str, frame_rate:int=10): """Precalculate every frame for the model diff --git a/src/setup.py b/src/setup.py index 9938d83..dc5ac11 100644 --- a/src/setup.py +++ b/src/setup.py @@ -3,7 +3,7 @@ setup( name = 'livepng', packages = ['livepng'], - version = '0.1.7', + version = '0.1.8', license='GGPLv3', description = 'LivePNG is a format to create avatars based on PNG images with lipsync support', long_description=open('README.md').read(), @@ -11,7 +11,7 @@ author = 'Francesco Caracciolo', author_email = 'francescocaracciolo78@gmail.com', url = 'https://github.com/francescocaracciolo/livepng', - download_url = 'https://github.com/FrancescoCaracciolo/LivePNG/archive/refs/tags/0.1.7.tar.gz', + download_url = 'https://github.com/FrancescoCaracciolo/LivePNG/archive/refs/tags/0.1.8.tar.gz', keywords = ['avatar', 'png', 'lipsync', 'livepng', 'anime'], install_requires=[ 'pydub', @@ -23,10 +23,6 @@ 'Topic :: Software Development :: Build Tools', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10',