Anchor-annotator 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Anchor_annotator-0.4.0.dist-info → Anchor_annotator-0.5.0.dist-info}/METADATA +1 -1
- Anchor_annotator-0.5.0.dist-info/RECORD +22 -0
- anchor/_version.py +2 -2
- anchor/main.py +174 -60
- anchor/models.py +34 -18
- anchor/plot.py +304 -119
- anchor/resources_rc.py +6475 -4801
- anchor/settings.py +177 -92
- anchor/ui_error_dialog.py +15 -16
- anchor/ui_main_window.py +40 -612
- anchor/ui_preferences.py +75 -44
- anchor/undo.py +0 -1
- anchor/widgets.py +74 -92
- anchor/workers.py +27 -1
- Anchor_annotator-0.4.0.dist-info/RECORD +0 -22
- {Anchor_annotator-0.4.0.dist-info → Anchor_annotator-0.5.0.dist-info}/LICENSE +0 -0
- {Anchor_annotator-0.4.0.dist-info → Anchor_annotator-0.5.0.dist-info}/WHEEL +0 -0
- {Anchor_annotator-0.4.0.dist-info → Anchor_annotator-0.5.0.dist-info}/top_level.txt +0 -0
anchor/ui_preferences.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
################################################################################
|
4
4
|
## Form generated from reading UI file 'preferences.ui'
|
5
5
|
##
|
6
|
-
## Created by: Qt User Interface Compiler version 6.
|
6
|
+
## Created by: Qt User Interface Compiler version 6.2.2
|
7
7
|
##
|
8
8
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
9
9
|
################################################################################
|
@@ -82,10 +82,8 @@ class Ui_PreferencesDialog(object):
|
|
82
82
|
self.scrollArea_3.setWidgetResizable(True)
|
83
83
|
self.scrollAreaWidgetContents_3 = QWidget()
|
84
84
|
self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3")
|
85
|
-
self.scrollAreaWidgetContents_3.setGeometry(QRect(0, 0,
|
86
|
-
self.
|
87
|
-
self.verticalLayout_9.setObjectName("verticalLayout_9")
|
88
|
-
self.formLayout = QFormLayout()
|
85
|
+
self.scrollAreaWidgetContents_3.setGeometry(QRect(0, 0, 258, 322))
|
86
|
+
self.formLayout = QFormLayout(self.scrollAreaWidgetContents_3)
|
89
87
|
self.formLayout.setObjectName("formLayout")
|
90
88
|
self.autosaveLabel = QLabel(self.scrollAreaWidgetContents_3)
|
91
89
|
self.autosaveLabel.setObjectName("autosaveLabel")
|
@@ -117,80 +115,93 @@ class Ui_PreferencesDialog(object):
|
|
117
115
|
|
118
116
|
self.formLayout.setWidget(2, QFormLayout.FieldRole, self.audioDeviceEdit)
|
119
117
|
|
120
|
-
self.
|
121
|
-
self.
|
118
|
+
self.fadeInLabel = QLabel(self.scrollAreaWidgetContents_3)
|
119
|
+
self.fadeInLabel.setObjectName("fadeInLabel")
|
122
120
|
|
123
|
-
self.formLayout.setWidget(
|
121
|
+
self.formLayout.setWidget(3, QFormLayout.LabelRole, self.fadeInLabel)
|
124
122
|
|
125
|
-
self.
|
126
|
-
self.
|
123
|
+
self.enableFadeCheckBox = QCheckBox(self.scrollAreaWidgetContents_3)
|
124
|
+
self.enableFadeCheckBox.setObjectName("enableFadeCheckBox")
|
127
125
|
|
128
|
-
self.formLayout.setWidget(
|
126
|
+
self.formLayout.setWidget(3, QFormLayout.FieldRole, self.enableFadeCheckBox)
|
129
127
|
|
130
128
|
self.useCudaLabel = QLabel(self.scrollAreaWidgetContents_3)
|
131
129
|
self.useCudaLabel.setObjectName("useCudaLabel")
|
132
130
|
|
133
131
|
self.formLayout.setWidget(5, QFormLayout.LabelRole, self.useCudaLabel)
|
134
132
|
|
135
|
-
self.cudaCheckBox = QCheckBox(self.scrollAreaWidgetContents_3)
|
136
|
-
self.cudaCheckBox.setObjectName("cudaCheckBox")
|
137
|
-
|
138
|
-
self.formLayout.setWidget(5, QFormLayout.FieldRole, self.cudaCheckBox)
|
139
|
-
|
140
133
|
self.numJobsLabel = QLabel(self.scrollAreaWidgetContents_3)
|
141
134
|
self.numJobsLabel.setObjectName("numJobsLabel")
|
142
135
|
|
143
|
-
self.formLayout.setWidget(
|
136
|
+
self.formLayout.setWidget(7, QFormLayout.LabelRole, self.numJobsLabel)
|
144
137
|
|
145
138
|
self.numJobsEdit = QSpinBox(self.scrollAreaWidgetContents_3)
|
146
139
|
self.numJobsEdit.setObjectName("numJobsEdit")
|
147
140
|
|
148
|
-
self.formLayout.setWidget(
|
141
|
+
self.formLayout.setWidget(7, QFormLayout.FieldRole, self.numJobsEdit)
|
149
142
|
|
150
143
|
self.githubTokenLabel = QLabel(self.scrollAreaWidgetContents_3)
|
151
144
|
self.githubTokenLabel.setObjectName("githubTokenLabel")
|
152
145
|
|
153
|
-
self.formLayout.setWidget(
|
146
|
+
self.formLayout.setWidget(8, QFormLayout.LabelRole, self.githubTokenLabel)
|
154
147
|
|
155
148
|
self.githubTokenEdit = QLineEdit(self.scrollAreaWidgetContents_3)
|
156
149
|
self.githubTokenEdit.setObjectName("githubTokenEdit")
|
157
150
|
|
158
|
-
self.formLayout.setWidget(
|
151
|
+
self.formLayout.setWidget(8, QFormLayout.FieldRole, self.githubTokenEdit)
|
159
152
|
|
160
153
|
self.resultsPerPageLabel = QLabel(self.scrollAreaWidgetContents_3)
|
161
154
|
self.resultsPerPageLabel.setObjectName("resultsPerPageLabel")
|
162
155
|
|
163
|
-
self.formLayout.setWidget(
|
156
|
+
self.formLayout.setWidget(10, QFormLayout.LabelRole, self.resultsPerPageLabel)
|
164
157
|
|
165
158
|
self.resultsPerPageEdit = QSpinBox(self.scrollAreaWidgetContents_3)
|
166
159
|
self.resultsPerPageEdit.setObjectName("resultsPerPageEdit")
|
167
160
|
self.resultsPerPageEdit.setMaximum(1000)
|
168
161
|
|
169
|
-
self.formLayout.setWidget(
|
162
|
+
self.formLayout.setWidget(10, QFormLayout.FieldRole, self.resultsPerPageEdit)
|
170
163
|
|
171
164
|
self.timeDirectionLabel = QLabel(self.scrollAreaWidgetContents_3)
|
172
165
|
self.timeDirectionLabel.setObjectName("timeDirectionLabel")
|
173
166
|
|
174
|
-
self.formLayout.setWidget(
|
167
|
+
self.formLayout.setWidget(12, QFormLayout.LabelRole, self.timeDirectionLabel)
|
175
168
|
|
176
169
|
self.timeDirectionComboBox = QComboBox(self.scrollAreaWidgetContents_3)
|
177
170
|
self.timeDirectionComboBox.addItem("")
|
178
171
|
self.timeDirectionComboBox.addItem("")
|
179
172
|
self.timeDirectionComboBox.setObjectName("timeDirectionComboBox")
|
180
173
|
|
181
|
-
self.formLayout.setWidget(
|
174
|
+
self.formLayout.setWidget(12, QFormLayout.FieldRole, self.timeDirectionComboBox)
|
182
175
|
|
183
|
-
self.
|
184
|
-
self.
|
176
|
+
self.visibleSpeakerLabel = QLabel(self.scrollAreaWidgetContents_3)
|
177
|
+
self.visibleSpeakerLabel.setObjectName("visibleSpeakerLabel")
|
185
178
|
|
186
|
-
self.formLayout.setWidget(
|
179
|
+
self.formLayout.setWidget(13, QFormLayout.LabelRole, self.visibleSpeakerLabel)
|
180
|
+
|
181
|
+
self.visibleSpeakerComboBox = QComboBox(self.scrollAreaWidgetContents_3)
|
182
|
+
self.visibleSpeakerComboBox.addItem("")
|
183
|
+
self.visibleSpeakerComboBox.addItem("")
|
184
|
+
self.visibleSpeakerComboBox.addItem("")
|
185
|
+
self.visibleSpeakerComboBox.addItem("")
|
186
|
+
self.visibleSpeakerComboBox.addItem("")
|
187
|
+
self.visibleSpeakerComboBox.setObjectName("visibleSpeakerComboBox")
|
188
|
+
|
189
|
+
self.formLayout.setWidget(13, QFormLayout.FieldRole, self.visibleSpeakerComboBox)
|
190
|
+
|
191
|
+
self.cudaCheckBox = QCheckBox(self.scrollAreaWidgetContents_3)
|
192
|
+
self.cudaCheckBox.setObjectName("cudaCheckBox")
|
193
|
+
|
194
|
+
self.formLayout.setWidget(5, QFormLayout.FieldRole, self.cudaCheckBox)
|
195
|
+
|
196
|
+
self.useMpCheckBox = QCheckBox(self.scrollAreaWidgetContents_3)
|
197
|
+
self.useMpCheckBox.setObjectName("useMpCheckBox")
|
187
198
|
|
188
|
-
self.
|
189
|
-
self.label_25.setObjectName("label_25")
|
199
|
+
self.formLayout.setWidget(6, QFormLayout.FieldRole, self.useMpCheckBox)
|
190
200
|
|
191
|
-
self.
|
201
|
+
self.useMpLabel = QLabel(self.scrollAreaWidgetContents_3)
|
202
|
+
self.useMpLabel.setObjectName("useMpLabel")
|
192
203
|
|
193
|
-
self.
|
204
|
+
self.formLayout.setWidget(6, QFormLayout.LabelRole, self.useMpLabel)
|
194
205
|
|
195
206
|
self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3)
|
196
207
|
|
@@ -425,7 +436,7 @@ class Ui_PreferencesDialog(object):
|
|
425
436
|
self.scrollArea_2.setWidgetResizable(True)
|
426
437
|
self.scrollAreaWidgetContents_2 = QWidget()
|
427
438
|
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
|
428
|
-
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0,
|
439
|
+
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 173, 410))
|
429
440
|
self.verticalLayout_7 = QVBoxLayout(self.scrollAreaWidgetContents_2)
|
430
441
|
self.verticalLayout_7.setObjectName("verticalLayout_7")
|
431
442
|
self.formLayout_2 = QFormLayout()
|
@@ -576,7 +587,7 @@ class Ui_PreferencesDialog(object):
|
|
576
587
|
self.scrollArea_4.setWidgetResizable(True)
|
577
588
|
self.scrollAreaWidgetContents_4 = QWidget()
|
578
589
|
self.scrollAreaWidgetContents_4.setObjectName("scrollAreaWidgetContents_4")
|
579
|
-
self.scrollAreaWidgetContents_4.setGeometry(QRect(0, 0,
|
590
|
+
self.scrollAreaWidgetContents_4.setGeometry(QRect(0, 0, 231, 228))
|
580
591
|
self.verticalLayout_11 = QVBoxLayout(self.scrollAreaWidgetContents_4)
|
581
592
|
self.verticalLayout_11.setObjectName("verticalLayout_11")
|
582
593
|
self.formLayout_6 = QFormLayout()
|
@@ -673,7 +684,7 @@ class Ui_PreferencesDialog(object):
|
|
673
684
|
self.scrollArea_5.setWidgetResizable(True)
|
674
685
|
self.scrollAreaWidgetContents_5 = QWidget()
|
675
686
|
self.scrollAreaWidgetContents_5.setObjectName("scrollAreaWidgetContents_5")
|
676
|
-
self.scrollAreaWidgetContents_5.setGeometry(QRect(0, 0,
|
687
|
+
self.scrollAreaWidgetContents_5.setGeometry(QRect(0, 0, 223, 250))
|
677
688
|
self.verticalLayout_13 = QVBoxLayout(self.scrollAreaWidgetContents_5)
|
678
689
|
self.verticalLayout_13.setObjectName("verticalLayout_13")
|
679
690
|
self.formLayout_7 = QFormLayout()
|
@@ -785,7 +796,8 @@ class Ui_PreferencesDialog(object):
|
|
785
796
|
self.buttonBox.accepted.connect(PreferencesDialog.accept)
|
786
797
|
self.buttonBox.rejected.connect(PreferencesDialog.reject)
|
787
798
|
|
788
|
-
self.tabWidget.setCurrentIndex(
|
799
|
+
self.tabWidget.setCurrentIndex(1)
|
800
|
+
self.visibleSpeakerComboBox.setCurrentIndex(1)
|
789
801
|
|
790
802
|
QMetaObject.connectSlotsByName(PreferencesDialog)
|
791
803
|
|
@@ -804,16 +816,15 @@ class Ui_PreferencesDialog(object):
|
|
804
816
|
self.audioDeviceLabel.setText(
|
805
817
|
QCoreApplication.translate("PreferencesDialog", "Audio device", None)
|
806
818
|
)
|
807
|
-
self.
|
808
|
-
QCoreApplication.translate("PreferencesDialog", "
|
819
|
+
self.fadeInLabel.setText(
|
820
|
+
QCoreApplication.translate("PreferencesDialog", "Fade in audio on play", None)
|
809
821
|
)
|
810
|
-
self.
|
822
|
+
self.enableFadeCheckBox.setText("")
|
811
823
|
self.useCudaLabel.setText(
|
812
824
|
QCoreApplication.translate("PreferencesDialog", "Use CUDA", None)
|
813
825
|
)
|
814
|
-
self.cudaCheckBox.setText("")
|
815
826
|
self.numJobsLabel.setText(
|
816
|
-
QCoreApplication.translate("PreferencesDialog", "Number of
|
827
|
+
QCoreApplication.translate("PreferencesDialog", "Number of MFA jobs", None)
|
817
828
|
)
|
818
829
|
self.githubTokenLabel.setText(
|
819
830
|
QCoreApplication.translate("PreferencesDialog", "Github request token", None)
|
@@ -831,9 +842,29 @@ class Ui_PreferencesDialog(object):
|
|
831
842
|
1, QCoreApplication.translate("PreferencesDialog", "Right-to-left", None)
|
832
843
|
)
|
833
844
|
|
834
|
-
self.
|
835
|
-
|
836
|
-
|
845
|
+
self.visibleSpeakerLabel.setText(
|
846
|
+
QCoreApplication.translate("PreferencesDialog", "Maximum visible speakers", None)
|
847
|
+
)
|
848
|
+
self.visibleSpeakerComboBox.setItemText(
|
849
|
+
0, QCoreApplication.translate("PreferencesDialog", "1", None)
|
850
|
+
)
|
851
|
+
self.visibleSpeakerComboBox.setItemText(
|
852
|
+
1, QCoreApplication.translate("PreferencesDialog", "2", None)
|
853
|
+
)
|
854
|
+
self.visibleSpeakerComboBox.setItemText(
|
855
|
+
2, QCoreApplication.translate("PreferencesDialog", "3", None)
|
856
|
+
)
|
857
|
+
self.visibleSpeakerComboBox.setItemText(
|
858
|
+
3, QCoreApplication.translate("PreferencesDialog", "4", None)
|
859
|
+
)
|
860
|
+
self.visibleSpeakerComboBox.setItemText(
|
861
|
+
4, QCoreApplication.translate("PreferencesDialog", "5", None)
|
862
|
+
)
|
863
|
+
|
864
|
+
self.cudaCheckBox.setText("")
|
865
|
+
self.useMpCheckBox.setText("")
|
866
|
+
self.useMpLabel.setText(
|
867
|
+
QCoreApplication.translate("PreferencesDialog", "Use multiprocessing?", None)
|
837
868
|
)
|
838
869
|
self.tabWidget.setTabText(
|
839
870
|
self.tabWidget.indexOf(self.generalTab),
|
@@ -844,7 +875,7 @@ class Ui_PreferencesDialog(object):
|
|
844
875
|
0, QCoreApplication.translate("PreferencesDialog", "MFA", None)
|
845
876
|
)
|
846
877
|
self.presetThemeEdit.setItemText(
|
847
|
-
1, QCoreApplication.translate("PreferencesDialog", "
|
878
|
+
1, QCoreApplication.translate("PreferencesDialog", "Native", None)
|
848
879
|
)
|
849
880
|
self.presetThemeEdit.setItemText(
|
850
881
|
2, QCoreApplication.translate("PreferencesDialog", "Custom", None)
|
anchor/undo.py
CHANGED
@@ -673,7 +673,6 @@ class UpdateUtteranceSpeakerCommand(FileCommand):
|
|
673
673
|
self.corpus_model.change_speaker_table_utterances(self.utterances)
|
674
674
|
self.file_model.change_speaker_table_utterances(self.utterances)
|
675
675
|
self.corpus_model.changeCommandFired.emit()
|
676
|
-
self.corpus_model.update_data()
|
677
676
|
self.corpus_model.runFunction.emit(
|
678
677
|
"Recalculating speaker ivectors",
|
679
678
|
self.finish_recalculate,
|
anchor/widgets.py
CHANGED
@@ -57,7 +57,7 @@ class ErrorButtonBox(QtWidgets.QDialogButtonBox):
|
|
57
57
|
super().__init__(*args, **kwargs)
|
58
58
|
self.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Close)
|
59
59
|
self.report_bug_button = QtWidgets.QPushButton("Report bug")
|
60
|
-
self.report_bug_button.setIcon(QtGui.QIcon("
|
60
|
+
self.report_bug_button.setIcon(QtGui.QIcon.fromTheme("folder-open"))
|
61
61
|
self.addButton(self.report_bug_button, QtWidgets.QDialogButtonBox.ButtonRole.ActionRole)
|
62
62
|
|
63
63
|
|
@@ -198,8 +198,9 @@ class MediaPlayer(QtMultimedia.QMediaPlayer): # pragma: no cover
|
|
198
198
|
)
|
199
199
|
return volume
|
200
200
|
|
201
|
-
def update_selection_times(self):
|
202
|
-
self.
|
201
|
+
def update_selection_times(self, update=False):
|
202
|
+
if update or self.playbackState() != QtMultimedia.QMediaPlayer.PlaybackState.PlayingState:
|
203
|
+
self.setCurrentTime(self.startTime())
|
203
204
|
|
204
205
|
def update_times(self):
|
205
206
|
if self.playbackState() == QtMultimedia.QMediaPlayer.PlaybackState.PlayingState:
|
@@ -271,9 +272,7 @@ class NewSpeakerField(QtWidgets.QLineEdit):
|
|
271
272
|
self.setSizePolicy(
|
272
273
|
QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred
|
273
274
|
)
|
274
|
-
clear_icon = QtGui.QIcon()
|
275
|
-
clear_icon.addFile(":clear.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
276
|
-
clear_icon.addFile(":disabled/clear.svg", mode=QtGui.QIcon.Mode.Active)
|
275
|
+
clear_icon = QtGui.QIcon.fromTheme("edit-clear")
|
277
276
|
|
278
277
|
self.clear_action = QtGui.QAction(icon=clear_icon, parent=self)
|
279
278
|
self.clear_action.triggered.connect(self.clear)
|
@@ -454,9 +453,7 @@ class CompleterLineEdit(QtWidgets.QWidget):
|
|
454
453
|
# self.model = QtCore.QStringListModel(self)
|
455
454
|
# self.completer.setModel(self.model)
|
456
455
|
layout.addWidget(self.line_edit)
|
457
|
-
clear_icon = QtGui.QIcon()
|
458
|
-
clear_icon.addFile(":clear.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
459
|
-
clear_icon.addFile(":disabled/clear.svg", mode=QtGui.QIcon.Mode.Active)
|
456
|
+
clear_icon = QtGui.QIcon.fromTheme("edit-clear")
|
460
457
|
self.button = QtWidgets.QToolButton(self)
|
461
458
|
self.button.clicked.connect(self.clear_text)
|
462
459
|
self.line_edit.textChanged.connect(self.check_actions)
|
@@ -515,9 +512,7 @@ class ClearableDropDown(QtWidgets.QWidget):
|
|
515
512
|
self.combo_box = QtWidgets.QComboBox(self)
|
516
513
|
layout = QtWidgets.QHBoxLayout()
|
517
514
|
layout.addWidget(self.combo_box)
|
518
|
-
clear_icon = QtGui.QIcon()
|
519
|
-
clear_icon.addFile(":clear.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
520
|
-
clear_icon.addFile(":disabled/clear.svg", mode=QtGui.QIcon.Mode.Active)
|
515
|
+
clear_icon = QtGui.QIcon.fromTheme("edit-clear")
|
521
516
|
self.combo_box.currentIndexChanged.connect(self.check_actions)
|
522
517
|
self.button = QtWidgets.QToolButton(self)
|
523
518
|
self.button.clicked.connect(self.clear_index)
|
@@ -568,10 +563,10 @@ class PaginationWidget(QtWidgets.QToolBar):
|
|
568
563
|
self.num_pages = 1
|
569
564
|
self.result_count = 0
|
570
565
|
self.next_page_action = QtGui.QAction(
|
571
|
-
icon=QtGui.QIcon("
|
566
|
+
icon=QtGui.QIcon.fromTheme("media-seek-forward"), text="Next page"
|
572
567
|
)
|
573
568
|
self.previous_page_action = QtGui.QAction(
|
574
|
-
icon=QtGui.QIcon("
|
569
|
+
icon=QtGui.QIcon.fromTheme("media-seek-backward"), text="Previous page"
|
575
570
|
)
|
576
571
|
self.addWidget(w)
|
577
572
|
self.page_label = QtWidgets.QLabel("Page 1 of 1")
|
@@ -1019,9 +1014,7 @@ class ClearableField(InternalToolButtonEdit):
|
|
1019
1014
|
def __init__(self, *args):
|
1020
1015
|
super().__init__(*args)
|
1021
1016
|
|
1022
|
-
clear_icon = QtGui.QIcon()
|
1023
|
-
clear_icon.addFile(":clear.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
1024
|
-
clear_icon.addFile(":disabled/clear.svg", mode=QtGui.QIcon.Mode.Active)
|
1017
|
+
clear_icon = QtGui.QIcon.fromTheme("edit-clear")
|
1025
1018
|
self.clear_action = QtGui.QAction(icon=clear_icon, parent=self)
|
1026
1019
|
self.clear_action.triggered.connect(self.clear)
|
1027
1020
|
self.clear_action.setVisible(False)
|
@@ -1075,28 +1068,16 @@ class SearchBox(ClearableField):
|
|
1075
1068
|
|
1076
1069
|
self.clear_action.triggered.connect(self.returnPressed.emit)
|
1077
1070
|
|
1078
|
-
regex_icon = QtGui.QIcon()
|
1079
|
-
regex_icon.addFile(":regex.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
1080
|
-
regex_icon.addFile(
|
1081
|
-
":highlighted/regex.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.On
|
1082
|
-
)
|
1071
|
+
regex_icon = QtGui.QIcon.fromTheme("edit-regex")
|
1083
1072
|
|
1084
1073
|
self.regex_action = QtGui.QAction(icon=regex_icon, parent=self)
|
1085
1074
|
self.regex_action.setCheckable(True)
|
1086
1075
|
|
1087
|
-
word_icon = QtGui.QIcon()
|
1088
|
-
word_icon.addFile(":word.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
1089
|
-
word_icon.addFile(
|
1090
|
-
":highlighted/word.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.On
|
1091
|
-
)
|
1076
|
+
word_icon = QtGui.QIcon.fromTheme("edit-word")
|
1092
1077
|
self.word_action = QtGui.QAction(icon=word_icon, parent=self)
|
1093
1078
|
self.word_action.setCheckable(True)
|
1094
1079
|
|
1095
|
-
case_icon = QtGui.QIcon()
|
1096
|
-
case_icon.addFile(":case.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
1097
|
-
case_icon.addFile(
|
1098
|
-
":highlighted/case.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.On
|
1099
|
-
)
|
1080
|
+
case_icon = QtGui.QIcon.fromTheme("edit-case")
|
1100
1081
|
self.case_action = QtGui.QAction(icon=case_icon, parent=self)
|
1101
1082
|
self.case_action.setCheckable(True)
|
1102
1083
|
|
@@ -1400,7 +1381,7 @@ class IconDelegate(QtWidgets.QStyledItemDelegate):
|
|
1400
1381
|
options = QtWidgets.QStyleOptionViewItem(option)
|
1401
1382
|
self.initStyleOption(options, index)
|
1402
1383
|
if options.checkState == QtCore.Qt.CheckState.Checked:
|
1403
|
-
icon = QtGui.QIcon(":
|
1384
|
+
icon = QtGui.QIcon(":oov-check.svg")
|
1404
1385
|
icon.paint(painter, options.rect, QtCore.Qt.AlignmentFlag.AlignCenter)
|
1405
1386
|
|
1406
1387
|
painter.restore()
|
@@ -1413,10 +1394,10 @@ class ModelIconDelegate(QtWidgets.QStyledItemDelegate):
|
|
1413
1394
|
|
1414
1395
|
self.settings = AnchorSettings()
|
1415
1396
|
self.icon_mapping = {
|
1416
|
-
"available": QtGui.QIcon("
|
1417
|
-
"unavailable": QtGui.QIcon("
|
1418
|
-
"remote": QtGui.QIcon("
|
1419
|
-
"unknown": QtGui.QIcon("
|
1397
|
+
"available": QtGui.QIcon.fromTheme("emblem-default"),
|
1398
|
+
"unavailable": QtGui.QIcon.fromTheme("emblem-important"),
|
1399
|
+
"remote": QtGui.QIcon.fromTheme("sync-synchronizing"),
|
1400
|
+
"unknown": QtGui.QIcon.fromTheme("emblem-unknown"),
|
1420
1401
|
}
|
1421
1402
|
|
1422
1403
|
def refresh_settings(self):
|
@@ -1437,7 +1418,16 @@ class ModelIconDelegate(QtWidgets.QStyledItemDelegate):
|
|
1437
1418
|
options = QtWidgets.QStyleOptionViewItem(option)
|
1438
1419
|
self.initStyleOption(options, index)
|
1439
1420
|
icon = self.icon_mapping[options.text]
|
1440
|
-
|
1421
|
+
r = option.rect
|
1422
|
+
half_size = int(self.settings.icon_size / 2)
|
1423
|
+
x = r.left() + (r.width() / 2) - half_size
|
1424
|
+
y = r.top() + (r.height() / 2) - half_size
|
1425
|
+
options.rect = QtCore.QRect(x, y, self.settings.icon_size, self.settings.icon_size)
|
1426
|
+
icon.paint(
|
1427
|
+
painter,
|
1428
|
+
options.rect,
|
1429
|
+
QtCore.Qt.AlignmentFlag.AlignCenter | QtCore.Qt.AlignmentFlag.AlignVCenter,
|
1430
|
+
)
|
1441
1431
|
|
1442
1432
|
painter.restore()
|
1443
1433
|
|
@@ -1459,7 +1449,7 @@ class StoppableProgressBar(QtWidgets.QWidget):
|
|
1459
1449
|
layout.addWidget(self.progress_bar)
|
1460
1450
|
self.cancel_button = QtWidgets.QToolButton()
|
1461
1451
|
self.cancel_action = QtGui.QAction("select", self)
|
1462
|
-
self.cancel_action.setIcon(QtGui.QIcon("
|
1452
|
+
self.cancel_action.setIcon(QtGui.QIcon.fromTheme("edit-clear"))
|
1463
1453
|
self.cancel_action.triggered.connect(worker.cancel)
|
1464
1454
|
self.cancel_button.setDefaultAction(self.cancel_action)
|
1465
1455
|
layout.addWidget(self.cancel_button)
|
@@ -1527,7 +1517,7 @@ class ProgressMenu(QtWidgets.QMenu):
|
|
1527
1517
|
class ProgressWidget(QtWidgets.QPushButton):
|
1528
1518
|
def __init__(self, *args):
|
1529
1519
|
super().__init__(*args)
|
1530
|
-
self.done_icon = QtGui.QIcon("
|
1520
|
+
self.done_icon = QtGui.QIcon.fromTheme("emblem-default")
|
1531
1521
|
self.animated = QtGui.QMovie(":spinning_blue.svg")
|
1532
1522
|
self.animated.frameChanged.connect(self.update_animation)
|
1533
1523
|
self.setIcon(self.done_icon)
|
@@ -1766,34 +1756,16 @@ class PronunciationInput(QtWidgets.QToolBar):
|
|
1766
1756
|
self.setContentsMargins(0, 0, 0, 0)
|
1767
1757
|
self.setFocusProxy(self.input)
|
1768
1758
|
|
1769
|
-
accept_icon = QtGui.QIcon()
|
1770
|
-
accept_icon.addFile(
|
1771
|
-
":check-circle.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off
|
1772
|
-
)
|
1773
|
-
accept_icon.addFile(
|
1774
|
-
":highlighted/check-circle.svg",
|
1775
|
-
mode=QtGui.QIcon.Mode.Normal,
|
1776
|
-
state=QtGui.QIcon.State.On,
|
1777
|
-
)
|
1759
|
+
accept_icon = QtGui.QIcon.fromTheme("emblem-default")
|
1778
1760
|
|
1779
1761
|
self.accept_action = QtGui.QAction(icon=accept_icon, parent=self)
|
1780
1762
|
self.accept_action.triggered.connect(self.returnPressed.emit)
|
1781
1763
|
|
1782
|
-
cancel_icon = QtGui.QIcon()
|
1783
|
-
cancel_icon.addFile(":undo.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off)
|
1784
|
-
cancel_icon.addFile(
|
1785
|
-
":highlighted/undo.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.On
|
1786
|
-
)
|
1764
|
+
cancel_icon = QtGui.QIcon.fromTheme("edit-undo")
|
1787
1765
|
|
1788
1766
|
self.cancel_action = QtGui.QAction(icon=cancel_icon, parent=self)
|
1789
1767
|
self.cancel_action.triggered.connect(self.cancel)
|
1790
|
-
keyboard_icon = QtGui.QIcon()
|
1791
|
-
keyboard_icon.addFile(
|
1792
|
-
":keyboard.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.Off
|
1793
|
-
)
|
1794
|
-
keyboard_icon.addFile(
|
1795
|
-
":highlighted/keyboard.svg", mode=QtGui.QIcon.Mode.Normal, state=QtGui.QIcon.State.On
|
1796
|
-
)
|
1768
|
+
keyboard_icon = QtGui.QIcon.fromTheme("input-keyboard")
|
1797
1769
|
|
1798
1770
|
self.keyboard_widget = QtWidgets.QPushButton(self)
|
1799
1771
|
self.keyboard_widget.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
|
@@ -1819,7 +1791,7 @@ class PronunciationInput(QtWidgets.QToolBar):
|
|
1819
1791
|
self.returnPressed.emit()
|
1820
1792
|
return True
|
1821
1793
|
elif (
|
1822
|
-
isinstance(watched,
|
1794
|
+
isinstance(watched, IpaKeyboard)
|
1823
1795
|
and event.type() == QtCore.QEvent.Type.KeyPress
|
1824
1796
|
and event.key() not in {QtGui.Qt.Key.Key_Escape}
|
1825
1797
|
):
|
@@ -1910,14 +1882,18 @@ class CountDelegate(QtWidgets.QStyledItemDelegate):
|
|
1910
1882
|
super().paint(painter, option, index)
|
1911
1883
|
painter.save()
|
1912
1884
|
r = option.rect
|
1913
|
-
|
1885
|
+
half_size = int(self.settings.icon_size / 2)
|
1914
1886
|
x = r.left() + r.width() - self.settings.icon_size
|
1915
|
-
y = r.top()
|
1887
|
+
y = r.top() + (r.height() / 2) - half_size
|
1916
1888
|
options = QtWidgets.QStyleOptionViewItem(option)
|
1917
|
-
options.rect = QtCore.QRect(x, y,
|
1889
|
+
options.rect = QtCore.QRect(x, y, self.settings.icon_size, self.settings.icon_size)
|
1918
1890
|
self.initStyleOption(options, index)
|
1919
|
-
icon = QtGui.QIcon("
|
1920
|
-
icon.paint(
|
1891
|
+
icon = QtGui.QIcon.fromTheme("folder-open")
|
1892
|
+
icon.paint(
|
1893
|
+
painter,
|
1894
|
+
options.rect,
|
1895
|
+
QtCore.Qt.AlignmentFlag.AlignCenter | QtCore.Qt.AlignmentFlag.AlignVCenter,
|
1896
|
+
)
|
1921
1897
|
|
1922
1898
|
painter.restore()
|
1923
1899
|
|
@@ -1941,14 +1917,18 @@ class WordTypeDelegate(QtWidgets.QStyledItemDelegate):
|
|
1941
1917
|
super().paint(painter, option, index)
|
1942
1918
|
painter.save()
|
1943
1919
|
r = option.rect
|
1944
|
-
|
1920
|
+
half_size = int(self.settings.icon_size / 2)
|
1945
1921
|
x = r.left() + r.width() - self.settings.icon_size
|
1946
|
-
y = r.top()
|
1922
|
+
y = r.top() + (r.height() / 2) - half_size
|
1947
1923
|
options = QtWidgets.QStyleOptionViewItem(option)
|
1948
|
-
options.rect = QtCore.QRect(x, y,
|
1924
|
+
options.rect = QtCore.QRect(x, y, self.settings.icon_size, self.settings.icon_size)
|
1949
1925
|
self.initStyleOption(options, index)
|
1950
|
-
icon = QtGui.QIcon("
|
1951
|
-
icon.paint(
|
1926
|
+
icon = QtGui.QIcon.fromTheme("sync-synchronizing")
|
1927
|
+
icon.paint(
|
1928
|
+
painter,
|
1929
|
+
options.rect,
|
1930
|
+
QtCore.Qt.AlignmentFlag.AlignCenter | QtCore.Qt.AlignmentFlag.AlignVCenter,
|
1931
|
+
)
|
1952
1932
|
|
1953
1933
|
painter.restore()
|
1954
1934
|
|
@@ -2483,13 +2463,13 @@ class SpeakerViewDelegate(QtWidgets.QStyledItemDelegate):
|
|
2483
2463
|
painter.save()
|
2484
2464
|
|
2485
2465
|
r = option.rect
|
2486
|
-
|
2466
|
+
half_size = int(self.settings.icon_size / 2)
|
2487
2467
|
x = r.left() + r.width() - self.settings.icon_size
|
2488
|
-
y = r.top()
|
2468
|
+
y = r.top() + (r.height() / 2) - half_size
|
2489
2469
|
options = QtWidgets.QStyleOptionViewItem(option)
|
2490
|
-
options.rect = QtCore.QRect(x, y,
|
2470
|
+
options.rect = QtCore.QRect(x, y, self.settings.icon_size, self.settings.icon_size)
|
2491
2471
|
self.initStyleOption(options, index)
|
2492
|
-
icon = QtGui.QIcon("
|
2472
|
+
icon = QtGui.QIcon.fromTheme("folder-open")
|
2493
2473
|
icon.paint(painter, options.rect, QtCore.Qt.AlignmentFlag.AlignCenter)
|
2494
2474
|
|
2495
2475
|
painter.restore()
|
@@ -2514,11 +2494,11 @@ class ButtonDelegate(QtWidgets.QStyledItemDelegate):
|
|
2514
2494
|
) -> None:
|
2515
2495
|
painter.save()
|
2516
2496
|
r = option.rect
|
2517
|
-
|
2497
|
+
half_size = int(self.settings.icon_size / 2)
|
2518
2498
|
x = r.left() + r.width() - self.settings.icon_size
|
2519
|
-
y = r.top()
|
2499
|
+
y = r.top() + (r.height() / 2) - half_size
|
2520
2500
|
options = QtWidgets.QStyleOptionViewItem(option)
|
2521
|
-
options.rect = QtCore.QRect(x, y,
|
2501
|
+
options.rect = QtCore.QRect(x, y, self.settings.icon_size, self.settings.icon_size)
|
2522
2502
|
self.initStyleOption(options, index)
|
2523
2503
|
icon = QtGui.QIcon(self.icon_path)
|
2524
2504
|
icon.paint(painter, options.rect, QtCore.Qt.AlignmentFlag.AlignCenter)
|
@@ -3054,11 +3034,11 @@ class DictionaryWidget(QtWidgets.QWidget):
|
|
3054
3034
|
self.current_search_query = None
|
3055
3035
|
self.current_search_text = ""
|
3056
3036
|
self.refresh_word_counts_action = QtGui.QAction(self)
|
3057
|
-
self.refresh_word_counts_action.setIcon(QtGui.QIcon("
|
3037
|
+
self.refresh_word_counts_action.setIcon(QtGui.QIcon.fromTheme("tools-check-spelling"))
|
3058
3038
|
self.refresh_word_counts_action.setEnabled(True)
|
3059
3039
|
self.toolbar.addAction(self.refresh_word_counts_action)
|
3060
3040
|
self.rebuild_lexicon_action = QtGui.QAction(self)
|
3061
|
-
self.rebuild_lexicon_action.setIcon(QtGui.QIcon("
|
3041
|
+
self.rebuild_lexicon_action.setIcon(QtGui.QIcon.fromTheme("sync-synchronizing"))
|
3062
3042
|
self.rebuild_lexicon_action.setEnabled(True)
|
3063
3043
|
self.toolbar.addAction(self.rebuild_lexicon_action)
|
3064
3044
|
dict_layout.addWidget(self.toolbar)
|
@@ -3297,31 +3277,33 @@ class SpeakerWidget(QtWidgets.QWidget):
|
|
3297
3277
|
|
3298
3278
|
|
3299
3279
|
class ColorEdit(QtWidgets.QPushButton): # pragma: no cover
|
3280
|
+
colorChanged = QtCore.Signal()
|
3281
|
+
|
3300
3282
|
def __init__(self, parent=None):
|
3301
3283
|
super(ColorEdit, self).__init__(parent=parent)
|
3302
3284
|
self.setText("")
|
3303
3285
|
self.clicked.connect(self.open_dialog)
|
3286
|
+
self.color = None
|
3304
3287
|
|
3305
|
-
def set_color(self, color: QtGui.QColor):
|
3306
|
-
|
3288
|
+
def set_color(self, color: typing.Union[str, QtGui.QColor]):
|
3289
|
+
if isinstance(color, str):
|
3290
|
+
color = QtGui.QColor(color)
|
3291
|
+
self.color = color
|
3307
3292
|
self.update_icon()
|
3308
3293
|
|
3309
3294
|
def update_icon(self):
|
3310
3295
|
pixmap = QtGui.QPixmap(100, 100)
|
3311
|
-
pixmap.fill(self.
|
3296
|
+
pixmap.fill(self.color)
|
3312
3297
|
icon = QtGui.QIcon(pixmap)
|
3313
3298
|
icon.addPixmap(pixmap, QtGui.QIcon.Mode.Disabled)
|
3314
3299
|
self.setIcon(icon)
|
3315
3300
|
|
3316
|
-
@property
|
3317
|
-
def color(self) -> str:
|
3318
|
-
return self._color.name()
|
3319
|
-
|
3320
3301
|
def open_dialog(self):
|
3321
3302
|
color = QtWidgets.QColorDialog.getColor()
|
3322
|
-
if color.isValid():
|
3323
|
-
self.
|
3303
|
+
if color.isValid() and self.color != color.name():
|
3304
|
+
self.color = color.name()
|
3324
3305
|
self.update_icon()
|
3306
|
+
self.colorChanged.emit()
|
3325
3307
|
|
3326
3308
|
|
3327
3309
|
class FontDialog(QtWidgets.QFontDialog):
|
@@ -3473,8 +3455,8 @@ class PathSelectWidget(QtWidgets.QWidget):
|
|
3473
3455
|
self.setLayout(layout)
|
3474
3456
|
|
3475
3457
|
self.select_button.clicked.connect(self.select_path)
|
3476
|
-
self.exists_icon = QtGui.QIcon("
|
3477
|
-
self.not_exists_icon = QtGui.QIcon("
|
3458
|
+
self.exists_icon = QtGui.QIcon.fromTheme("emblem-default")
|
3459
|
+
self.not_exists_icon = QtGui.QIcon.fromTheme("emblem-important")
|
3478
3460
|
|
3479
3461
|
def value(self):
|
3480
3462
|
if not self.path_edit.text():
|
anchor/workers.py
CHANGED
@@ -3071,7 +3071,11 @@ class WaveformWorker(FunctionWorker): # pragma: no cover
|
|
3071
3071
|
def run(self):
|
3072
3072
|
self.stopped.clear()
|
3073
3073
|
with self.lock:
|
3074
|
-
|
3074
|
+
try:
|
3075
|
+
y, _ = soundfile.read(self.file_path)
|
3076
|
+
except soundfile.LibsndfileError:
|
3077
|
+
logger.warning(f"Could not read {self.file_path}")
|
3078
|
+
y = None
|
3075
3079
|
if self.stopped.is_set():
|
3076
3080
|
return
|
3077
3081
|
self.signals.result.emit((y, self.file_path))
|
@@ -3351,6 +3355,9 @@ class DownloadWorker(FunctionWorker): # pragma: no cover
|
|
3351
3355
|
class ImportCorpusWorker(FunctionWorker): # pragma: no cover
|
3352
3356
|
def __init__(self, *args):
|
3353
3357
|
super().__init__("Importing corpus", *args)
|
3358
|
+
self.corpus_path = None
|
3359
|
+
self.dictionary_path = None
|
3360
|
+
self.reset = None
|
3354
3361
|
|
3355
3362
|
def stop(self):
|
3356
3363
|
if hasattr(self, "corpus") and self.corpus is not None:
|
@@ -3365,6 +3372,25 @@ class ImportCorpusWorker(FunctionWorker): # pragma: no cover
|
|
3365
3372
|
config.CLEAN = self.reset
|
3366
3373
|
corpus_name = os.path.basename(self.corpus_path)
|
3367
3374
|
dataset_type = inspect_database(corpus_name)
|
3375
|
+
if (
|
3376
|
+
dataset_type is DatasetType.ACOUSTIC_CORPUS_WITH_DICTIONARY
|
3377
|
+
and self.dictionary_path is None
|
3378
|
+
):
|
3379
|
+
string = f"postgresql+psycopg2://@/{corpus_name}?host={config.database_socket()}"
|
3380
|
+
try:
|
3381
|
+
engine = sqlalchemy.create_engine(
|
3382
|
+
string,
|
3383
|
+
poolclass=sqlalchemy.NullPool,
|
3384
|
+
pool_reset_on_return=None,
|
3385
|
+
isolation_level="AUTOCOMMIT",
|
3386
|
+
logging_name="inspect_dataset_engine",
|
3387
|
+
).execution_options(logging_token="inspect_dataset_engine")
|
3388
|
+
with sqlalchemy.orm.Session(engine) as session:
|
3389
|
+
dictionary = session.query(Dictionary.path).first()
|
3390
|
+
if dictionary is not None:
|
3391
|
+
self.dictionary_path = dictionary[0]
|
3392
|
+
except (sqlalchemy.exc.OperationalError, sqlalchemy.exc.ProgrammingError):
|
3393
|
+
pass
|
3368
3394
|
try:
|
3369
3395
|
if dataset_type is DatasetType.NONE:
|
3370
3396
|
if self.dictionary_path and os.path.exists(self.dictionary_path):
|