Works but circular import
This commit is contained in:
@@ -14,10 +14,14 @@
|
||||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from gi.repository import Gtk
|
||||
import logging
|
||||
|
||||
from .. import helper
|
||||
|
||||
from gajim.plugins.gajimplugin import GajimPluginConfig
|
||||
from gajim.plugins.plugins_i18n import _
|
||||
|
||||
log = logging.getLogger('gajim.p.stt_voice_messages_sttbox')
|
||||
|
||||
class STTBox(Gtk.Box):
|
||||
def __init__(self,
|
||||
@@ -48,15 +52,25 @@ class STTBox(Gtk.Box):
|
||||
|
||||
self.show_all()
|
||||
|
||||
def _on_transcribe_clicked(self, _button: Gtk.Button):
|
||||
#transcription_task = helper.BackgroundTask(
|
||||
# self._model.transcribe(),
|
||||
# self._show_result
|
||||
#)
|
||||
#transcription_task.start()
|
||||
pass
|
||||
#def update_config(self, config: GajimPluginConfig):
|
||||
# self._model = config.data['class']()
|
||||
|
||||
def _on_transcribe_clicked(self, _button: Gtk.Button) -> None:
|
||||
log.debug('config.data = %s', self._config.data)
|
||||
model_class = self._config.data['model_class']
|
||||
if model_class is None:
|
||||
return
|
||||
|
||||
self._model = model_class()
|
||||
|
||||
transcription_task = helper.BackgroundTask(
|
||||
self._model.transcribe(self._audio_file),
|
||||
self._show_result
|
||||
)
|
||||
transcription_task.start()
|
||||
|
||||
def _show_result(self):
|
||||
self._text = self._model.result
|
||||
if self._text.strip() != '':
|
||||
self._transcription_label.set_text(self._text.strip())
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user