11import json
22from bidict import bidict
33from PyQt5 .QtWidgets import QLabel , QComboBox , QLineEdit , QPushButton , QCheckBox , QFormLayout
4- from PyQt5 .QtCore import pyqtSignal
4+ from PyQt5 .QtCore import pyqtSignal , QRegExp
5+ from PyQt5 .QtGui import QRegExpValidator
56from .base_tab import BaseTab
67from ..constants import langcodes
78from .dictmanager import DictManager
@@ -23,6 +24,8 @@ def initWidgets(self):
2324 "\n for frequency lists from Migaku. " )
2425 self .bold_word = QCheckBox ("Bold selected word" )
2526 self .audio_format = QComboBox ()
27+ self .preferred_accent = QLineEdit ()
28+ self .preferred_accent .setValidator (QRegExpValidator (QRegExp ("[a-z]{2}" )))
2629 self .freq_source = QComboBox ()
2730 self .gtrans_lang = QComboBox ()
2831 self .web_preset = QComboBox ()
@@ -59,6 +62,9 @@ def setupLayout(self):
5962 layout .addRow (QLabel ("Forvo audio format" ), self .audio_format )
6063 layout .addRow (QLabel ("<i>◊ Choose mp3 for playing on iOS, "
6164 "but ogg may save space</i>" ))
65+ layout .addRow (QLabel ("Forvo preferred accent" ), self .preferred_accent )
66+ layout .addRow (QLabel ("<i>Will prefer provided accent by sorting it to the top of the pronunciations list</i>" ))
67+ layout .addRow (QLabel ("<i>Pronunciations have an accent in brackets e.g. yelkoastur(es)/gracias</i>" ))
6268 layout .addRow (QLabel ("Frequency list" ), self .freq_source )
6369 layout .addRow (self .lemfreq )
6470 layout .addRow (
@@ -105,6 +111,7 @@ def setupAutosave(self):
105111 'en' ,
106112 code_translate = True )
107113 self .register_config_handler (self .audio_format , 'audio_format' , 'mp3' )
114+ self .register_config_handler (self .preferred_accent , 'preferred_accent' , '' )
108115 self .register_config_handler (self .lemfreq , 'lemfreq' , True )
109116
110117 self .register_config_handler (
0 commit comments