22from bidict import bidict
33from PyQt5 .QtWidgets import QLabel , QComboBox , QLineEdit , QPushButton , QCheckBox , QFormLayout
44from PyQt5 .QtCore import pyqtSignal
5+ from PyQt5 .QtGui import QRegExpValidator
6+ from PyQt5 .QtCore import QRegExp
57from .base_tab import BaseTab
68from ..constants import langcodes
79from .dictmanager import DictManager
@@ -23,6 +25,8 @@ def initWidgets(self):
2325 "\n for frequency lists from Migaku. " )
2426 self .bold_word = QCheckBox ("Bold selected word" )
2527 self .audio_format = QComboBox ()
28+ self .preferred_accent = QLineEdit ()
29+ self .preferred_accent .setValidator (QRegExpValidator (QRegExp ("[a-z]{2}" )))
2630 self .freq_source = QComboBox ()
2731 self .gtrans_lang = QComboBox ()
2832 self .web_preset = QComboBox ()
@@ -59,6 +63,9 @@ def setupLayout(self):
5963 layout .addRow (QLabel ("Forvo audio format" ), self .audio_format )
6064 layout .addRow (QLabel ("<i>◊ Choose mp3 for playing on iOS, "
6165 "but ogg may save space</i>" ))
66+ layout .addRow (QLabel ("Forvo preferred accent" ), self .preferred_accent )
67+ layout .addRow (QLabel ("<i>Will prefer provided accent by sorting it to the top of the pronunciations list</i>" ))
68+ layout .addRow (QLabel ("<i>Pronunciations have an accent in brackets e.g. yelkoastur(es)/gracias</i>" ))
6269 layout .addRow (QLabel ("Frequency list" ), self .freq_source )
6370 layout .addRow (self .lemfreq )
6471 layout .addRow (
@@ -105,6 +112,7 @@ def setupAutosave(self):
105112 'en' ,
106113 code_translate = True )
107114 self .register_config_handler (self .audio_format , 'audio_format' , 'mp3' )
115+ self .register_config_handler (self .preferred_accent , 'preferred_accent' , '' )
108116 self .register_config_handler (self .lemfreq , 'lemfreq' , True )
109117
110118 self .register_config_handler (
0 commit comments