-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSettings.py
2808 lines (2735 loc) · 162 KB
/
Settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#// auth_ Mohamad Janati
#// Copyright (c) 2019-2023 Mohamad Janati
from os.path import join, dirname
from datetime import datetime
import webbrowser
from aqt import mw
from aqt.qt import *
from aqt.utils import tooltip, showInfo, askUser, getText
from anki.utils import is_lin, is_mac, is_win
import random
import os
import json
import subprocess
def refreshConfig():
#// Makes the information that it gets from "config" global, so I can use them for loading the current settings in "loadCurrent(self)" function
global C_style_mainScreenButtons, C_button_style, C_hover_effect, C_active_indicator, C_bottombarButtons_style, C_cursor_style, C_interval_style, C_showAnswerBorderColor_style, C_buttonTransition_time, C_buttonBorderRadius, C_wideButton_percent, C_reviewTooltip, C_reviewTooltip_timer, C_reviewTooltipText_color, C_reviewTooltip_style, C_reviewTooltip_position, C_reviewTooltip_offset, C_info, C_skip, C_showSkipped, C_undo, C_hideHard, C_hideGood, C_hideEasy, C_right_info, C_middleRight_info, C_middleLeft_info, C_left_info, C_right_skip, C_middleRight_skip, C_middleLeft_skip, C_left_skip, C_right_showSkipped, C_middleRight_showSkipped, C_middleLeft_showSkipped, C_left_showSkipped, C_right_undo, C_middleRight_undo, C_middleLeft_undo, C_left_undo, C_skip_shortcut, C_showSkipped_shortcut, C_info_shortcut, C_undo_shortcut, C_custom_sizes, C_text_size, C_buttonFontWeight, C_buttons_height, C_reviewButtons_width, C_edit_width, C_answer_width, C_more_width, C_info_width, C_skip_width, C_showSkipped_width, C_undo_width, C_buttonLabel_studyNow, C_buttonLabel_edit, C_buttonLabel_showAnswer, C_buttonLabel_more, C_buttonLabel_info, C_buttonLabel_skip, C_buttonLabel_showSkipped, C_buttonLabel_undo, C_buttonLabel_again, C_buttonLabel_hard, C_buttonLabel_good, C_buttonLabel_easy, C_sidebar_theme, C_sidebar_font, C_sidebar_hideCurrentCard, C_sidebar_PreviousCards, C_sidebar_reviewsToShow, C_sidebar_currentReviewCount, C_sidebar_reviewsToShow, C_sidebar_dateCreated, C_sidebar_dateEdited, C_sidebar_firstReview, C_sidebar_latestReview, C_sidebar_due, C_sidebar_interval, C_sidebar_ease, C_sidebar_numberOfReviews, C_sidebar_lapses, C_infobar_correctPercent, C_infobar_fastestReview, C_infobar_slowestReview, C_sidebar_averageTime, C_sidebar_totalTime, C_sidebar_cardType, C_sidebar_noteType, C_sidebar_deck, C_sidebar_tags, C_infobar_noteID, C_infobar_cardID, C_sidebar_sortField, C_sidebar_autoOpen, C_sidebar_warningNote, C_custom_reviewButtonColors, C_custom_reviewButtonTextColor, C_custom_activeIndicatorColor, C_custom_bottombarButtonTextColor, C_custom_bottombarButtonBorderColor, C_reviewButtonText_color, C_activeIndicator_color, C_bottombarButtonText_color, C_bottombarButtonBorder_color, C_again_color, C_againHover_color, C_hard_color, C_hardHover_color, C_good_color, C_goodHover_color, C_easy_color, C_easyHover_color, C_button_colors, C_showAnswerEase1, C_showAnswerEase2, C_showAnswerEase3, C_showAnswerEase4, C_showAnswerEase1_color, C_showAnswerEase2_color, C_showAnswerEase3_color, C_showAnswerEase4_color, C_addOn_speedFocus, C_addOn_rebuildEmptyAll, C_configEdit, C_hideEasyIfNotLearning, C_overViewStats, C_settingsMenu_palce, C_skipMethod
config = mw.addonManager.getConfig(__name__)
#// Gets the information from the config and assigns them to the "C_" variables, so I can make them global | "C_" is added to the name of the parts of the settings variables to avoid confusion :D
#// Just delete the "C_" from the name to find related parts of the settings (C_style_mainScreenButtons -> style_mainScreenButtons)
C_style_mainScreenButtons = config[' Style Main Screen Buttons']
C_button_style = config[' Review_ Buttons Style']
C_hover_effect = config[' Review_ Hover Effect']
C_active_indicator = config[' Review_ Active Button Indicator']
C_bottombarButtons_style = config[' Review_ Bottombar Buttons Style']
C_cursor_style = config[' Review_ Cursor Style']
C_interval_style = config[' Review_ Interval Style']
C_buttonTransition_time = config[' Review_ Button Transition Time']
# Button Border Radius is used for all buttons, not just the review buttons
C_buttonBorderRadius = config[' Review_ Button Border Radius']
C_wideButton_percent = config[' Review_ Wide Button Percent']
C_reviewTooltip = config['Tooltip']
C_reviewTooltip_timer = config['Tooltip Timer']
C_reviewTooltipText_color = config['Tooltip Text Color']
C_reviewTooltip_style = config['Tooltip Style']
C_reviewTooltip_position = config['Tooltip Position']
C_reviewTooltip_offset = config['Tooltip Offset']
C_info = config['Button_ Info Button']
C_skip = config['Button_ Skip Button']
C_showSkipped = config['Button_ Show Skipped Button']
C_undo = config['Button_ Undo Button']
C_hideHard = config['Button_ Hide Hard']
C_hideGood = config['Button_ Hide Good']
C_hideEasy = config['Button_ Hide Easy']
C_info_position = config['Button_ Position_ Info Button']
C_skip_position = config['Button_ Position_ Skip Button']
C_showSkipped_position = config['Button_ Position_ Show Skipped Button']
C_undo_position = config['Button_ Position_ Undo Button']
C_skip_shortcut = config ['Button_ Shortcut_ Skip Button']
C_showSkipped_shortcut = config ['Button_ Shortcut_ Show Skipped Button']
C_info_shortcut = config['Button_ Shortcut_ Info Button']
C_undo_shortcut = config['Button_ Shortcut_ Undo Button']
C_custom_sizes = config ['Button_ Custom Button Sizes']
C_text_size = config['Button_ Text Size']
C_buttonFontWeight = config['Button_ Font Weight']
C_buttons_height = config['Button_ Height_ All Bottombar Buttons']
C_reviewButtons_width = config['Button_ Width_ Review Buttons']
C_edit_width = config['Button_ Width_ Edit Button']
C_answer_width = config['Button_ Width_ Show Answer Button']
C_more_width = config['Button_ Width_ More Button']
C_info_width = config['Button_ Width_ Info Button']
C_skip_width = config['Button_ Width_ Skip Button']
C_showSkipped_width = config['Button_ Width_ Show Skipped Button']
C_undo_width = config['Button_ Width_ Undo Button']
C_buttonLabel_studyNow = config['Button Label_ Study Now']
C_buttonLabel_edit = config['Button Label_ Edit']
C_buttonLabel_showAnswer = config['Button Label_ Show Answer']
C_buttonLabel_more = config['Button Label_ More']
C_buttonLabel_info = config['Button Label_ Info']
C_buttonLabel_skip = config['Button Label_ Skip']
C_buttonLabel_showSkipped = config['Button Label_ Show Skipped']
C_buttonLabel_undo = config['Button Label_ Undo']
C_buttonLabel_again = config['Button Label_ Again']
C_buttonLabel_hard = config['Button Label_ Hard']
C_buttonLabel_good = config['Button Label_ Good']
C_buttonLabel_easy = config['Button Label_ Easy']
C_sidebar_theme = config['Card Info sidebar_ theme']
C_sidebar_font = config['Card Info sidebar_ Font']
C_sidebar_hideCurrentCard = config['Card Info sidebar_ Hide Current Card']
C_sidebar_PreviousCards = config['Card Info sidebar_ Number of previous cards to show']
C_sidebar_reviewsToShow = config['Card Info sidebar_ number of reviews to show for a card']
C_sidebar_currentReviewCount = config['Card Info sidebar_ Current Review Count']
C_sidebar_dateCreated = config['Card Info sidebar_ Created']
C_sidebar_dateEdited = config['Card Info sidebar_ Edited']
C_sidebar_firstReview = config['Card Info sidebar_ First Review']
C_sidebar_latestReview = config['Card Info sidebar_ Latest Review']
C_sidebar_due = config['Card Info sidebar_ Due']
C_sidebar_interval = config['Card Info sidebar_ Interval']
C_sidebar_ease = config['Card Info sidebar_ Ease']
C_sidebar_numberOfReviews = config['Card Info sidebar_ Reviews']
C_sidebar_lapses = config['Card Info sidebar_ Lapses']
C_infobar_correctPercent = config['Card Info Sidebar_ Correct Percent']
C_infobar_fastestReview = config['Card Info Sidebar_ Fastest Review']
C_infobar_slowestReview = config['Card Info Sidebar_ Slowest Review']
C_sidebar_averageTime = config['Card Info sidebar_ Average Time']
C_sidebar_totalTime = config['Card Info sidebar_ Total Time']
C_sidebar_cardType = config['Card Info sidebar_ Card Type']
C_sidebar_noteType = config['Card Info sidebar_ Note Type']
C_sidebar_deck = config['Card Info sidebar_ Deck']
C_sidebar_tags = config['Card Info sidebar_ Tags']
C_infobar_noteID = config['Card Info Sidebar_ Note ID']
C_infobar_cardID = config['Card Info Sidebar_ Card ID']
C_sidebar_sortField = config['Card Info sidebar_ Sort Field']
C_sidebar_autoOpen = config['Card Info sidebar_ Auto Open']
C_sidebar_warningNote = config['Card Info sidebar_ warning note']
C_custom_reviewButtonColors = config[' Review_ Custom Colors']
C_custom_reviewButtonTextColor = config[' Review_ Custom Review Button Text Color']
C_custom_activeIndicatorColor = config[' Review_ Custom Active Indicator Color']
C_custom_bottombarButtonTextColor = config['Color_ Custom Bottombar Button Text Color']
C_custom_bottombarButtonBorderColor = config['Color_ Custom Bottombar Button Border Color']
C_reviewButtonText_color = config['Color_ General Text Color']
C_activeIndicator_color = config['Color_ Active Button Indicator']
C_bottombarButtonText_color = config['Color_ Bottombar Button Text Color']
C_bottombarButtonBorder_color = config['Color_ Bottombar Button Border Color']
C_again_color = config['Color_ Again']
C_againHover_color = config['Color_ Again on hover']
C_hard_color = config['Color_ Hard']
C_hardHover_color = config['Color_ Hard on hover']
C_good_color = config['Color_ Good']
C_goodHover_color = config['Color_ Good on hover']
C_easy_color = config['Color_ Easy']
C_easyHover_color = config['Color_ Easy on hover']
C_showAnswerBorderColor_style = config['ShowAnswer_ Border Color Style']
C_showAnswerEase1 = config['ShowAnswer_ Ease1']
C_showAnswerEase2 = config['ShowAnswer_ Ease2']
C_showAnswerEase3 = config['ShowAnswer_ Ease3']
C_showAnswerEase4 = config['ShowAnswer_ Ease4']
C_showAnswerEase1_color = config['ShowAnswer_ Ease1 Color']
C_showAnswerEase2_color = config['ShowAnswer_ Ease2 Color']
C_showAnswerEase3_color = config['ShowAnswer_ Ease3 Color']
C_showAnswerEase4_color = config['ShowAnswer_ Ease4 Color']
C_button_colors = config[' Button Colors']
C_configEdit = config[' Direct Config Edit']
C_hideEasyIfNotLearning = config[' Hide Easy if not in Learning']
C_overViewStats = config[' More Overview Stats']
C_settingsMenu_palce = config[' Settings Menu Place']
C_skipMethod = config[' Skip Method']
C_addOn_speedFocus = config[' Speed Focus Add-on']
C_addOn_rebuildEmptyAll = config[' Rebuild Empty All Add-on']
#// it's easier to store extra button positions as text in config | but here in the settings, I hate to turn it into true/false as each checkbox is disabled/enabled like that :|
#// Every checkbox is disabled by default
C_right_info = False
C_middleRight_info = False
C_middleLeft_info = False
C_left_info = False
C_right_skip = False
C_middleRight_skip = False
C_middleLeft_skip = False
C_left_showSkipped = False
C_right_showSkipped = False
C_middleRight_showSkipped = False
C_middleLeft_showSkipped = False
C_left_showSkipped = False
C_right_undo = False
C_middleRight_undo = False
C_middleLeft_undo = False
C_left_undo = False
#// here we enable (make it "True") the correct checkbox based on the config value
#// All of this is for loading the current settings in "loadCurrent(self)" function
if C_info_position == "right":
C_right_info = True
elif C_info_position == "middle right":
C_middleRight_info = True
elif C_info_position == "middle left":
C_middleLeft_info = True
else:
C_left_info = True
if C_skip_position == "right":
C_right_skip = True
elif C_skip_position == "middle right":
C_middleRight_skip = True
elif C_skip_position == "middle left":
C_middleLeft_skip = True
else:
C_left_skip = True
if C_showSkipped_position == "right":
C_right_showSkipped = True
elif C_showSkipped_position == "middle right":
C_middleRight_showSkipped = True
elif C_showSkipped_position == "middle left":
C_middleLeft_showSkipped = True
else:
C_left_showSkipped = True
if C_undo_position == "right":
C_right_undo = True
elif C_undo_position == "middle right":
C_middleRight_undo = True
elif C_undo_position == "middle left":
C_middleLeft_undo = True
else:
C_left_undo = True
class GetShortcut(QDialog):
def __init__(self, parent, button_variable):
QDialog.__init__(self, parent=parent)
self.parent = parent
self.button_variable = button_variable
#// when recording a shortcut, there is 0 active (pushed) key at first | by pressing each key, this increases by +1
self.active = 0
#// and the state of all the accepted keys on the keyboard is "False" | by pressing each key, the state for that button changes to "True"
self.ctrl = False
self.alt = False
self.shift = False
self.f1 = False
self.f2 = False
self.f3 = False
self.f4 = False
self.f5 = False
self.f3 = False
self.f6 = False
self.f7 = False
self.f8 = False
self.f9 = False
self.f10 = False
self.f11 = False
self.f12 = False
self.extra = None
self.getShortcutWindow()
def getShortcutWindow(self):
#// Sets up the screen that asks you to press the shortcut you want to assign
text = QLabel('<div style="font-size: 15px">Press the new shortcut key...</div>')
mainLayout = QVBoxLayout()
mainLayout.addWidget(text)
self.setLayout(mainLayout)
self.setWindowTitle('Set Shortcut')
def keyPressEvent(self, evt):
#// increases the active keys count upon pressing each key
self.active += 1
#// limits the allowed keys to keyboard keys
if evt.key() > 30 and evt.key() < 127:
self.extra = chr(evt.key())
#// stores the pressed key in a variable, so we could later add it in a list and use it as a key combination
elif evt.key() == Qt.Key.Key_Control:
self.ctrl = True
elif evt.key() == Qt.Key.Key_Alt:
self.alt = True
elif evt.key() == Qt.Key.Key_Shift:
self.shift = True
elif evt.key() == Qt.Key.Key_F1:
self.f1 = True
elif evt.key() == Qt.Key.Key_F2:
self.f2 = True
elif evt.key() == Qt.Key.Key_F3:
self.f3 = True
elif evt.key() == Qt.Key.Key_F4:
self.f4 = True
elif evt.key() == Qt.Key.Key_F5:
self.f5 = True
elif evt.key() == Qt.Key.Key_F6:
self.f6 = True
elif evt.key() == Qt.Key.Key_F7:
self.f7 = True
elif evt.key() == Qt.Key.Key_F8:
self.f8 = True
elif evt.key() == Qt.Key.Key_F9:
self.f9 = True
elif evt.key() == Qt.Key.Key_F10:
self.f10 = True
elif evt.key() == Qt.Key.Key_F11:
self.f11 = True
elif evt.key() == Qt.Key.Key_F12:
self.f12 = True
def keyReleaseEvent(self, evt):
#// reduces the number of held keys upon releasing each key
self.active -= 1
message = "You can't set \"{}\" as a shortcut!"
if is_mac:
altMessage = message.format("Option")
ctrlMessage = message.format("Command")
else:
altMessage = message.format("Alt")
ctrlMessage = message.format("Ctrl")
if not (self.f1 or self.f2 or self.f3 or self.f4 or self.f5 or self.f6 or self.f7 or self.f8 or self.f9 or self.f10 or self.f11 or self.f12):
if not self.extra:
#// lets the users that the pressed key is not allowed to be used in a shortcut
if self.alt:
showInfo(f"{altMessage}".format(), title="Advanced Review Bottombar")
elif self.shift:
showInfo(message.format("Shift"), title="Advanced Review Bottombar")
elif self.ctrl:
showInfo(f"{ctrlMessage}".format(), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Escape:
showInfo(message.format("Esc"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Tab:
showInfo(message.format("Tab"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Backspace:
showInfo(message.format("Backspace"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Enter:
showInfo(message.format("Esc"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Return:
showInfo(message.format("Enter"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Insert:
showInfo(message.format("Insert"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Delete:
showInfo(message.format("Delete"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Pause:
showInfo(message.format("Pause/Break"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Home:
showInfo(message.format("Home Key"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Left:
showInfo(message.format("Left"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Up:
showInfo(message.format("Up"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Right:
showInfo(message.format("Right"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_Down:
showInfo(message.format("Down"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_PageUp:
showInfo(message.format("Page Up"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_PageDown:
showInfo(message.format("Page DOwn"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_CapsLock:
showInfo(message.format("CAPS Lock"), title="Advanced Review Bottombar")
elif evt.key() == Qt.Key_NumLock:
showInfo(message.format("Num Lock"), title="Advanced Review Bottombar")
else:
showInfo("You can't use that as shortcut, try something else.", title="Advanced Review Bottombar")
self.alt = False
self.shift = False
self.ctrl = False
self.extra = None
self.active = 0
evt = False
combination = []
return
#// the (empty) list for storing keys and then turning them into a shortcut
combination = []
if self.ctrl:
combination.append("Ctrl")
if self.shift:
combination.append("Shift")
if self.alt:
combination.append("Alt")
if self.f1:
combination.append("F1")
if self.f2:
combination.append("F2")
if self.f3:
combination.append("F3")
if self.f4:
combination.append("F4")
if self.f5:
combination.append("F5")
if self.f6:
combination.append("F6")
if self.f7:
combination.append("F7")
if self.f8:
combination.append("F8")
if self.f9:
combination.append("F9")
if self.f10:
combination.append("F10")
if self.f11:
combination.append("F11")
if self.f12:
combination.append("F12")
if self.extra:
combination.append(self.extra)
combination = "+".join(combination)
#// preventing users from assigning a default Anki shortcut to something else | to avoid conflicts and stuff :|
if combination in ["E", " ", "F5", "Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4", "Shift+*", "=", "-", "Shift+!", "Shift+@", "Ctrl+Delete", "V", "Shift+V", "O", "1", "2", "3", "4", "5", "6", "7", "T", "Y", "A", "S", "D", "F", "B", "I", "/", "F1", "Ctrl+Q", "Ctrl+E", "Ctrl+P", "Ctrl+Shift+I", "Ctrl+Shift+P", "Ctrl+Shift+A", "Ctrl+Shift+:", "Ctrl+Shift+N"]:
if combination == "E":
showInfo("\"E\" is default Anki shortcut for \"Edit Current Card\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == " ":
showInfo("\"Space Bar\" is default Anki shortcut for \"Show Answer\" or \"Default Review Button\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "F5":
showInfo("\"F5\" is default Anki shortcut for \"Replay Audio\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+1":
showInfo("\"Ctrl+1\" is default Anki shortcut for \"Set Red Flag\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+2":
showInfo("\"Ctrl+2\" is default Anki shortcut for \"Set Orange Flag\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+3":
showInfo("\"Ctrl+3\" is default Anki shortcut for \"Set Green Flag\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+4":
showInfo("\"Ctrl+4\" is default Anki shortcut for \"Set Blue Flag\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Shift+*":
showInfo("\"*\" is default Anki shortcut for \"Mark Current Card\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "=":
showInfo("\"=\" is default Anki shortcut for \"Bury Note\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "-":
showInfo("\"-\" is default Anki shortcut for \"Bury Current Card\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Shift+!":
showInfo("\"!\" is default Anki shortcut for \"Suspend Note\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Shift+@":
showInfo("\"@\" is default Anki shortcut for \"Suspend Current Card\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Delete":
showInfo("\"Ctrl+Delete\" is default Anki shortcut for \"Delete Note\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "V":
showInfo("\"V\" is default Anki shortcut for \"Replay Audio\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Shift+V":
showInfo("\"Shift+V\" is default Anki shortcut for \"Record Voice\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "O":
showInfo("\"O\" is default Anki shortcut for \"Options\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "1":
showInfo("\"1\" is default Anki shortcut for \"Answer with ease 1 (Again)\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "2":
showInfo("\"2\" is default Anki shortcut for \"Answer with ease 2 (usually Hard)\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "3":
showInfo("\"3\" is default Anki shortcut for \"Answer with ease 3 (usually Good)\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "4":
showInfo("\"4\" is default Anki shortcut for \"Answer with ease 4 (Easy)\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "5":
showInfo("\"5\" is default Anki shortcut for \"Pause Audio\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "6":
showInfo("\"6\" is default Anki shortcut for \"Seek Backward\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "7":
showInfo("\"7\" is default Anki shortcut for \"Seek Forward\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "T":
showInfo("\"T\" is default Anki shortcut for \"Stats\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Y":
showInfo("\"Y\" is default Anki shortcut for \"Sync\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "A":
showInfo("\"A\" is default Anki shortcut for \"Add Cards\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "S":
showInfo("\"S\" is default Anki shortcut for \"Toggle Study Current Deck\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "D":
showInfo("\"D\" is default Anki shortcut for \"Decks View\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "F":
showInfo("\"F\" is default Anki shortcut for \"Create Filtered Deck\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "B":
showInfo("\"B\" is default Anki shortcut for \"Browse\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "I":
showInfo("\"I\" is default Anki shortcut for \"Card Info Window\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "/":
showInfo("\"/\" is default Anki shortcut for \"Study Deck\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "F1":
showInfo("\"F1\" is default Anki shortcut for \"Open Guide (Anki Manual)\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Q":
showInfo("\"Ctrl+Q\" is default Anki shortcut for \"Exit\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+E":
showInfo("\"Ctrl+E\" is default Anki shortcut for \"Export\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+P":
showInfo("\"Ctrl+P\" is default Anki shortcut for \"Preferences\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Shift+I":
showInfo("\"Ctrl+Shift+I\" is default Anki shortcut for \"Import\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Shift+P":
showInfo("\"Ctrl+Shift+P\" is default Anki shortcut for \"Switch Profile\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Shift+A":
showInfo("\"Ctrl+Shift+A\" is default Anki shortcut for \"Add-ons\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Shift+:":
showInfo("\"Ctrl+Shift+:\" is default Anki shortcut for \"Debug Console\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Shift+N":
showInfo("\"Ctrl+Shift+N\" is default Anki shortcut for \"Manage Note Types\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
if combination == "Ctrl+Shift+Z":
showInfo("\"Ctrl+Shift+Z\" is default Anki shortcut for \"Undo\" You can't use this shortcut.", type="warning", title="Advanced Review Bottombar")
self.ctrl = False
self.alt = False
self.shift = False
self.extra = None
self.f1 = False
self.f5 = False
self.active = 0
combination = []
return
elif combination == "Ctrl+Z":
combination = "NOT_SET"
self.parent.updateShortcut(self.button_variable, combination)
self.close()
class SettingsMenu(QDialog):
refreshConfig()
addon_path = dirname(__file__)
images = join(addon_path, 'images')
begin = "<div style='font-size: 14px'>"
end = "</div>"
info_shortcut = C_info_shortcut
skip_shortcut = C_skip_shortcut
showSkipped_shortcut = C_showSkipped_shortcut
undo_shortcut = C_undo_shortcut
def __init__(self, parent=None):
super(SettingsMenu, self).__init__(parent)
self.mainWindow()
self.reviewButtonText_color = C_reviewButtonText_color
self.activeIndicator_color = C_activeIndicator_color
self.bottombarButtonText_color = C_bottombarButtonText_color
self.bottombarButtonBorder_color = C_bottombarButtonBorder_color
self.reviewTooltipText_color = C_reviewTooltipText_color
self.again_color = C_again_color
self.againHover_color = C_againHover_color
self.hard_color = C_hard_color
self.hardHover_color = C_hardHover_color
self.good_color = C_good_color
self.goodHover_color = C_goodHover_color
self.easy_color = C_easy_color
self.easyHover_color = C_easyHover_color
self.showAnswerEase1_color = C_showAnswerEase1_color
self.showAnswerEase2_color = C_showAnswerEase2_color
self.showAnswerEase3_color = C_showAnswerEase3_color
self.showAnswerEase4_color = C_showAnswerEase4_color
def mainWindow(self):
images = self.images
self.createFirstTab()
self.createSecondTab()
self.createThirdTab()
self.createFourthTab()
self.createFifthTab()
self.createSixthTab()
self.createSeventhTab()
self.createEighthTab()
self.createNinthTab()
self.loadCurrent()
#// Create the bottom row of settings menu
loadSettingsButton = QPushButton("&Load Settings")
loadSettingsButton.clicked.connect(self.onLoadSettings)
saveSettingsButton = QPushButton("&Backup Settings")
saveSettingsButton.clicked.connect(self.onSaveSettings)
acceptButton = QPushButton("&Apply")
acceptButton.clicked.connect(self.onApply)
rejectButton = QPushButton("&Discard")
rejectButton.clicked.connect(self.reject)
rejectButton.clicked.connect(lambda: tooltip("Changes Discarded."))
buttonbox = QHBoxLayout()
buttonbox.addWidget(loadSettingsButton)
buttonbox.addWidget(saveSettingsButton)
buttonbox.addStretch()
buttonbox.addWidget(acceptButton)
buttonbox.addWidget(rejectButton)
supportMe_button = QPushButton("❤️ Support Me")
supportMe_button.clicked.connect(lambda: webbrowser.open('https://www.buymeacoffee.com/noobj2'))
support_box = QHBoxLayout()
support_box.addWidget(supportMe_button)
#// create tabs widget and adds each tab
tabs = QTabWidget()
tabs.addTab(self.tab1, "Styles")
tabs.addTab(self.tab2, "Answer Tooltip")
tabs.addTab(self.tab3, "Bottombar Buttons")
tabs.addTab(self.tab4, "Button Sizes")
tabs.addTab(self.tab5, "Button Labels")
tabs.addTab(self.tab6, "Sidebar")
tabs.addTab(self.tab7, "Colors")
tabs.addTab(self.tab8, "Misc")
tabs.addTab(self.tab9, "About")
vbox = QVBoxLayout()
vbox.addWidget(tabs)
vbox.addLayout(buttonbox)
vbox.addLayout(support_box)
self.setLayout(vbox)
self.setWindowTitle("Advanced Review Bottombar Settings Menu")
self.setWindowIcon(QIcon(images + "/icon.png"))
def createFirstTab(self):
begin = self.begin
end = self.end
images = self.images
buttonStyle_label = QLabel("Button Style:")
buttonStyle_label.setToolTip("{0} Changes the way review buttons look.{1}".format(begin, end))
buttonStyle_label.setFixedWidth(180)
self.button_style = QComboBox()
self.button_style.addItems(["Default + Text Color", "Default + Background Color", "Wide + Text Color", "Wide + Background Color", "Neon 1", "Neon 2", "Fill 1", "Fill 2"])
self.button_style.setToolTip("{0}To see designs please go to about tab.{1}".format(begin, end))
self.button_style.setFixedWidth(180)
reviewButtonDesigns_button = QPushButton("Show Designs")
reviewButtonDesigns_button.setFixedWidth(180)
reviewButtonDesigns_text = "{0}Default + Text Color <br> <img src='{2}/buttonStyle_defaultText.png'><hr> Default\
+ Background Color<br> <img src='{2}/buttonStyle_defaultBackground.png'><hr>\
Wide + Text Color<br> <img src='{2}/buttonStyle_wideText.png'><hr>Wide +\
Background Color<br> <img src='{2}/buttonStyle_wideBackground.png'><hr>Neon1 (Easy is hovered over)<br>\
<img src='{2}/buttonStyle_neon1.png'><hr>Neon2 (Easy is hovered over)<br>\
<img src='{2}/buttonStyle_neon2.png'><hr> Fill1 (Easy is hovered over)<br><img src='{2}/buttonStyle_fill1.png'><hr>\
Fill2 (Easy is hovered over)<br><img src='{2}/buttonStyle_fill2.png'>{1}".format(begin, end, images)
reviewButton_designs = QLabel()
reviewButton_designs.setText(reviewButtonDesigns_text)
reviewButtonDesigns_scroll = QScrollArea()
reviewButtonDesigns_scroll.setWidget(reviewButton_designs)
reviewButtonDesigns_layout = QVBoxLayout()
reviewButtonDesigns_layout.addWidget(reviewButtonDesigns_scroll)
reviewButtonDesigns_window = QDialog()
reviewButtonDesigns_window.setWindowTitle("Advanced Review Bottombar [Review Button Designs]")
reviewButtonDesigns_window.setWindowIcon(QIcon(images + "/icon.png"))
reviewButtonDesigns_window.setLayout(reviewButtonDesigns_layout)
reviewButtonDesigns_button.clicked.connect(lambda: reviewButtonDesigns_window.exec())
buttonStyle_holder = QHBoxLayout()
buttonStyle_holder.addWidget(buttonStyle_label)
buttonStyle_holder.addWidget(self.button_style)
buttonStyle_holder.addWidget(reviewButtonDesigns_button)
buttonStyle_holder.addStretch()
bottombaButtonsStyle_label = QLabel("General Buttons Style:")
bottombaButtonsStyle_label.setToolTip("{0} Changes The way general buttons (main screen bottombar, deck overview, show answer, edit, etc.) look. {1}".format(begin, end))
bottombaButtonsStyle_label.setFixedWidth(180)
self.bottombarButtons_style = QComboBox()
self.bottombarButtons_style.addItems(["Default", "Neon 1", "Neon 2", "Fill1", "Fill 2"])
self.bottombarButtons_style.setToolTip("{0}To see what every design looks like, please go to about tab{1}".format(begin, end))
self.bottombarButtons_style.setMinimumWidth(180)
otherBottombarButtonDesigns_button = QPushButton("Show Designs")
otherBottombarButtonDesigns_button.setFixedWidth(180)
otherBottombarButtonDesigns_text = "{0} Default<br><img src='{2}/bottombarButtonsStyle_default.png'><hr>\
Neon1 (Show answer is hovered over)<br> <img src='{2}/bottombarButtonsStyle_neon1.png'>\
<hr>Neon2 (Show answer is hovered over)<br> <img src='{2}/bottombarButtonsStyle_neon2.png'><hr>Fill1 (Show answer is hovered over)<br>\
<img src='{2}/bottombarButtonsStyle_fill1.png'><hr>Fill2 (Show answer is hovered over)<br>\
<img src='{2}/bottombarButtonsStyle_fill2.png'>{1}".format(begin, end, images)
otherBottombarButton_designs = QLabel()
otherBottombarButton_designs.setText(otherBottombarButtonDesigns_text)
otherBottombarButtonDesigns_scroll = QScrollArea()
otherBottombarButtonDesigns_scroll.setWidget(otherBottombarButton_designs)
otherBottombarButtonDesigns_layout = QVBoxLayout()
otherBottombarButtonDesigns_layout.addWidget(otherBottombarButtonDesigns_scroll)
otherBottombarButtonDesigns_window = QDialog()
otherBottombarButtonDesigns_window.setWindowTitle("Advanced Review Bottombar [Other Bottombar Buttons Designs]")
otherBottombarButtonDesigns_window.setWindowIcon(QIcon(images + "/icon.png"))
otherBottombarButtonDesigns_window.setLayout(otherBottombarButtonDesigns_layout)
otherBottombarButtonDesigns_button.clicked.connect(lambda: otherBottombarButtonDesigns_window.exec())
bottombarButtonsStyle_holder = QHBoxLayout()
bottombarButtonsStyle_holder.addWidget(bottombaButtonsStyle_label)
bottombarButtonsStyle_holder.addWidget(self.bottombarButtons_style)
bottombarButtonsStyle_holder.addWidget(otherBottombarButtonDesigns_button)
bottombarButtonsStyle_holder.addStretch()
hoverEffect_label = QLabel("Hover Effect:")
hoverEffect_label.setToolTip("{0} Changes the way review buttons look when you hover over them.\
<hr> This option does not change hover effect for neon buttons.<hr> If you use\
custom colors for review buttons, brighten and glow colors will be the color\
you have set for each buttons hover color.{1}".format(begin, end))
hoverEffect_label.setFixedWidth(180)
self.hover_effect = QComboBox()
self.hover_effect.addItems(["Disable", "Brighten", "Glow", "Brighten + Glow"])
self.hover_effect.setToolTip("{0} Disable -> Buttons won't change as you hover\
over them.<hr> Brighten -> The text or the background color will get brightened\
as you hover over them.<br><img src='{2}/hoverEffect_brighten.png'><hr> Glow ->\
There will be a shadow around the button as you hover them.<br><img src='{2}/hoverEffect_glow.png'><hr>\
Glow + Brighten -> Combines both glow and brighten effects.<br> <img src='{2}/hoverEffect_glowBrighten.png'>{1}".format(begin, end, images))
self.hover_effect.setMinimumWidth(180)
hoverEffect_holder = QHBoxLayout()
hoverEffect_holder.addWidget(hoverEffect_label)
hoverEffect_holder.addWidget(self.hover_effect)
hoverEffect_holder.addStretch()
activeIndicator_label = QLabel("Active Indicator:")
activeIndicator_label.setToolTip("{0} Changes the way active review button looks. active button\
is the button that is clicked if you press spacebar or enter.<hr> This option can not change active\
indicator for neon and fill buttons as it's disabled on those designs. {1}".format(begin, end))
activeIndicator_label.setFixedWidth(180)
self.active_indicator = QComboBox()
self.active_indicator.addItems(["Disable", "Border", "Glow"])
self.active_indicator.setToolTip("{0} Indicator is turned off and all review buttons are the\
same.<br> {1} <img src='{2}/activeIndicator_none.png'>{0}<hr> Indicator is\
set on border and there is a thin border around active button.<br>\
{1} <img src='{2}/activeIndicator_border.png'>{0}<hr> Indicator is set on\
glow and active button is glowing. <br> {1}\
<img src='{2}/activeIndicator_glow.png'>".format(begin, end, images))
self.active_indicator.setMinimumWidth(180)
activeIndicator_holder = QHBoxLayout()
activeIndicator_holder.addWidget(activeIndicator_label)
activeIndicator_holder.addWidget(self.active_indicator)
activeIndicator_holder.addStretch()
cursorStyle_label = QLabel("Cursor Style:")
cursorStyle_label.setToolTip("{0}Changes the cursor style when hovered over buttons.{1}".format(begin, end))
cursorStyle_label.setFixedWidth(180)
self.cursor_style = QComboBox()
self.cursor_style.addItems(["Normal", "Pointer"])
self.cursor_style.setFixedWidth(180)
cursorStyle_holder = QHBoxLayout()
cursorStyle_holder.addWidget(cursorStyle_label)
cursorStyle_holder.addWidget(self.cursor_style)
cursorStyle_holder.addStretch()
showAnswerBorderType_label = QLabel("Show Answer Border Color Style:")
showAnswerBorderType_label.setToolTip("{0}Changes how show answer border color behaves.<hr>\
if set on \"Fixed\" it's border color will be the same as other bottombar buttons.<br>\
if set on \"Bases on Card Ease\" it's color will change based on card ease.\
<hr> you can change it's color for each ease range in colors tab.{1}".format(begin, end))
showAnswerBorderType_label.setFixedWidth(180)
self.showAnswerBorderColor_style = QComboBox()
self.showAnswerBorderColor_style.addItems(["Fixed", "Show Based on Card Ease"])
self.showAnswerBorderColor_style.setFixedWidth(180)
showAnswerBorderType_holder = QHBoxLayout()
showAnswerBorderType_holder.addWidget(showAnswerBorderType_label)
showAnswerBorderType_holder.addWidget(self.showAnswerBorderColor_style)
showAnswerBorderType_holder.addStretch()
intervalStyle_label = QLabel("Button Interval Style:")
intervalStyle_label.setToolTip("{0}Changes the style of button intervals.{1}".format(begin, end))
intervalStyle_label.setFixedWidth(180)
self.interval_style = QComboBox()
self.interval_style.addItems(["Stock", "Colored Stock", "Inside the Buttons"])
self.interval_style.setFixedWidth(180)
if not mw.col.conf["estTimes"]:
self.interval_style.setDisabled(True)
intervalStyle_label.setToolTip("{0}To enable this option you need to enable \"Show next review time above answer buttons\" in \"Tools > Preferences > Review\".{1}".format(begin, end))
intervalStyle_holder = QHBoxLayout()
intervalStyle_holder.addWidget(intervalStyle_label)
intervalStyle_holder.addWidget(self.interval_style)
intervalStyle_holder.addStretch()
buttonFontWeight_label = QLabel("Button Font Weight:")
buttonFontWeight_label.setToolTip("{0}Change font weight for the buttons.{1}".format(begin, end))
buttonFontWeight_label.setFixedWidth(180)
self.buttonFontWeight = QComboBox()
self.buttonFontWeight.addItems(["Thin", "Extra Light", "Light", "Normal", "Medium", "Semi Bold", "Bold", "Extra Bold", "Black"])
self.buttonFontWeight.setFixedWidth(180)
buttonFontWeight_holder = QHBoxLayout()
buttonFontWeight_holder.addWidget(buttonFontWeight_label)
buttonFontWeight_holder.addWidget(self.buttonFontWeight)
buttonFontWeight_holder.addStretch()
buttonTransitionTime_label = QLabel("Button Transition Time:")
buttonTransitionTime_label.setToolTip("{0}Changes button animation time for fill and neon styles.{1}".format(begin, end))
buttonTransitionTime_label.setFixedWidth(180)
self.buttonTransition_time = QSpinBox()
self.buttonTransition_time.setMinimum(0)
self.buttonTransition_time.setMaximum(10000)
self.buttonTransition_time.setSingleStep(20)
self.buttonTransition_time.setFixedWidth(180)
buttonTransitionTime_ms = QLabel("ms")
buttonTransitionTime_holder = QHBoxLayout()
buttonTransitionTime_holder.addWidget(buttonTransitionTime_label)
buttonTransitionTime_holder.addWidget(self.buttonTransition_time)
buttonTransitionTime_holder.addWidget(buttonTransitionTime_ms)
buttonTransitionTime_holder.addStretch()
buttonBorderRadius_label = QLabel("Button Border Radius:")
buttonBorderRadius_label.setToolTip("{0}Changer the roundness of the buttons.{1}".format(begin, end))
buttonBorderRadius_label.setFixedWidth(180)
self.buttonBorderRadius = QSpinBox()
self.buttonBorderRadius.setMinimum(0)
self.buttonBorderRadius.setMaximum(100)
self.buttonBorderRadius.setSingleStep(1)
self.buttonBorderRadius.setFixedWidth(180)
buttonBorderRadius_px = QLabel("px")
buttonBorderRadius_holder = QHBoxLayout()
buttonBorderRadius_holder.addWidget(buttonBorderRadius_label)
buttonBorderRadius_holder.addWidget(self.buttonBorderRadius)
buttonBorderRadius_holder.addWidget(buttonBorderRadius_px)
wideButtonPercent_label = QLabel("Wide Review Buttons Percent:")
wideButtonPercent_label.setToolTip("{0}Changes the percent of the empty bottombar that's occupied by\
the review buttons to change the spacing between the review buttons and the other bottombar buttons for wide buttons.{1}".format(begin, end))
wideButtonPercent_label.setFixedWidth(180)
self.wideButtonPercent = QSpinBox()
self.wideButtonPercent.setMinimum(0)
self.wideButtonPercent.setMaximum(100)
self.wideButtonPercent.setSingleStep(1)
self.wideButtonPercent.setFixedWidth(180)
wideButtonPercent_sign = QLabel("%")
wideButtonPercent_holder = QHBoxLayout()
wideButtonPercent_holder.addWidget(wideButtonPercent_label)
wideButtonPercent_holder.addWidget(self.wideButtonPercent)
wideButtonPercent_holder.addWidget(wideButtonPercent_sign)
def buttonStyle_signal():
buttonStyle_index = self.button_style.currentIndex()
self.hover_effect.setDisabled(True)
if buttonStyle_index in [0, 1, 2, 3]:
self.hover_effect.setEnabled(True)
self.active_indicator.setDisabled(True)
if buttonStyle_index in [0, 1, 2, 3]:
self.active_indicator.setEnabled(True)
# self.cursor_style.setDisabled(True)
self.buttonTransition_time.setDisabled(True)
if buttonStyle_index in [4, 5, 6, 7]:
# self.cursor_style.setEnabled(True)
self.buttonTransition_time.setEnabled(True)
self.wideButtonPercent.setDisabled(True)
if buttonStyle_index in [2, 3]:
self.wideButtonPercent.setEnabled(True)
buttonStyle_signal()
self.button_style.currentIndexChanged.connect(buttonStyle_signal)
self.style_mainScreenButtons = QCheckBox("Style Main Screen Buttons")
self.style_mainScreenButtons.setToolTip("{0}Changes style of main screen and deck overview buttons if enabled.<hr>\
<img src='{2}/changeMainScreenButtons.png'><br>\
<img src='{2}/changeMainScreenButtons2.png'><br>\
<img src='{2}/changeMainScreenButtons3.png'>{1}".format(begin, end, images))
self.style_mainScreenButtons.setFixedWidth(180)
tab1line5 = QHBoxLayout()
tab1line5.addWidget(self.style_mainScreenButtons)
tab1line5.addStretch()
layout = QVBoxLayout()
layout.addLayout(buttonStyle_holder)
layout.addLayout(bottombarButtonsStyle_holder)
layout.addLayout(hoverEffect_holder)
layout.addLayout(activeIndicator_holder)
layout.addLayout(cursorStyle_holder)
layout.addLayout(showAnswerBorderType_holder)
layout.addLayout(intervalStyle_holder)
layout.addLayout(buttonFontWeight_holder)
layout.addLayout(buttonTransitionTime_holder)
layout.addLayout(buttonBorderRadius_holder)
layout.addLayout(wideButtonPercent_holder)
layout.addLayout(tab1line5)
layout.addStretch()
layout_holder = QWidget()
layout_holder.setLayout(layout)
self.tab1 = QScrollArea()
self.tab1.setFixedWidth(690)
self.tab1.setAlignment(Qt.AlignmentFlag.AlignHCenter)
self.tab1.setWidgetResizable(True)
self.tab1.setWidget(layout_holder)
def createSecondTab(self):
begin = self.begin
end = self.end
images = self.images
# start 1 box
reviewTooltip_label = QLabel("Review Confirmation Tooltip:")
reviewTooltip_label.setToolTip("{0}Shows a tooltip when you press any of\
review buttons, showing you what button you have pressed.{1}".format(begin, end))
reviewTooltip_label.setFixedWidth(180)
self.reviewTooltip_on = QRadioButton("On")
self.reviewTooltip_on.setFixedWidth(90)
self.reviewTooltip_off = QRadioButton("off")
self.reviewTooltip_off.setFixedWidth(90)
reviewTooltip_holder = QHBoxLayout()
reviewTooltip_holder.addWidget(reviewTooltip_label)
reviewTooltip_holder.addWidget(self.reviewTooltip_on)
reviewTooltip_holder.addWidget(self.reviewTooltip_off)
reviewTooltip_holder.addStretch()
tab2box1 = QGroupBox()
tab2box1.setLayout(reviewTooltip_holder)
# end 1 box
# start 2 box
reviewTooltipStyle_label = QLabel("Tooltip Position:")
reviewTooltipStyle_label.setToolTip("{0}Changes the position of answer tooltip.{1}".format(begin, end))
reviewTooltipStyle_label.setFixedWidth(180)
self.reviewTooltip_style = QComboBox()
self.reviewTooltip_style.addItems(["On Buttons", "Fixed Position"])
self.reviewTooltip_style.setToolTip("{0}On buttons -> Shows the tooltip on the button that you have pressed<hr>\
Fixed Position -> Shows all the tooltips in a position that you have chosen in review tooltip position box.{1}".format(begin, end))
self.reviewTooltip_style.setFixedWidth(180)
reviewTooltipStyle_holder = QHBoxLayout()
reviewTooltipStyle_holder.addWidget(reviewTooltipStyle_label)
reviewTooltipStyle_holder.addWidget(self.reviewTooltip_style)
reviewTooltipStyle_holder.addStretch()
reviewTooltipTimer_label = QLabel("Tooltip Show Duration:")
reviewTooltipTimer_label.setToolTip("{0}Changes length of the period that tooltip is shown.<hr>the unit is millisecond, 1000ms = 1s{1} (I know everybody knows this, put it here just in case :|)".format(begin, end))
reviewTooltipTimer_label.setFixedWidth(180)
self.reviewTooltip_timer = QSpinBox()
self.reviewTooltip_timer.setFixedWidth(180)
self.reviewTooltip_timer.setMinimum(100)
self.reviewTooltip_timer.setMaximum(10000)
reviewerTooltipTimer_ms = QLabel("ms")
reviewTooltipTimer_holder = QHBoxLayout()
reviewTooltipTimer_holder.addWidget(reviewTooltipTimer_label)
reviewTooltipTimer_holder.addWidget(self.reviewTooltip_timer)
reviewTooltipTimer_holder.addWidget(reviewerTooltipTimer_ms)
reviewTooltipTimer_holder.addStretch()
reviewTooltipTextColor_label = QLabel("Tooltip Text Color:")
reviewTooltipTextColor_label.setToolTip("{0}Changes color of the text inside tooltips.{1}".format(begin, end))
reviewTooltipTextColor_label.setFixedWidth(180)
self.reviewTooltipTextColor_button = QPushButton()
self.reviewTooltipTextColor_button.setFixedWidth(180)
self.reviewTooltipTextColor_button.clicked.connect(lambda: self.getNewColor("reviewTooltipText_color", self.reviewTooltipTextColor_button))
reviewTooltipTextColor_holder = QHBoxLayout()
reviewTooltipTextColor_holder.addWidget(reviewTooltipTextColor_label)
reviewTooltipTextColor_holder.addWidget(self.reviewTooltipTextColor_button)
reviewTooltipTextColor_holder.addStretch()
tab2line2 = QVBoxLayout()
tab2line2.addLayout(reviewTooltipStyle_holder)
tab2line2.addLayout(reviewTooltipTimer_holder)
tab2line2.addLayout(reviewTooltipTextColor_holder)
tab2box2 = QGroupBox()
tab2box2.setLayout(tab2line2)
# end 2 box
# start 3 box
self.reviewTooltipPositionX = QSlider(Qt.Orientation.Horizontal)
self.reviewTooltipPositionX.setFixedWidth(200)
self.reviewTooltipPositionX.setMinimum(0)
self.reviewTooltipPositionX.setMaximum(1850)
self.reviewTooltipPositionX.setPageStep(100)
self.reviewTooltipPositionX.setSliderPosition(0)
reviewerTooltipPosition_holder = QHBoxLayout()
self.reviewTooltipPositionY = QSlider(Qt.Orientation.Vertical)
self.reviewTooltipPositionY.setFixedHeight(200)
self.reviewTooltipPositionY.setMinimum(-950)
self.reviewTooltipPositionY.setMaximum(0)
self.reviewTooltipPositionY.setPageStep(100)
self.reviewTooltipPositionY.setSliderPosition(0)
reviewerTooltipPosition_holder = QHBoxLayout()
reviewerTooltipPosition_holder.addWidget(self.reviewTooltipPositionX)
reviewerTooltipPosition_holder.addWidget(self.reviewTooltipPositionY)
reviewerTooltipPosition_holder.addStretch()
tab2line3 = QVBoxLayout()
tab2line3.addLayout(reviewerTooltipPosition_holder)
tab2box3 = QGroupBox("Tooltip Position (Fixed Position)")
tab2box3.setToolTip("{0}Changes position of the fixed tooltip.<hr>\
<font color=red># NOTE:</font> If your resulotion is not 1920 x 1080, it's not accurate, but you\
can find the place that you wanna put the tooltip on, by toying with the sliders\
and restarting anki till you get the desired result.<br>\
<font color=red># NOTE:</font> If your resolution is 1920 x 1080 the sliders are accurate for\
maximized anki window.<br> <font color=red># NOTE:</font> If you set the position for a window that\
it's size is for example 500 x 500, the position will not be accurate when you\
change anki's window size to any other size. and if you decide to resize anki's\
window, you should set the positions again in order for the tooltip to be in the\
position you want.{1}".format(begin, end))
tab2box3.setLayout(tab2line3)
tab2box3.setEnabled(True)
self.reviewTooltip_off.toggled.connect(tab2box3.setDisabled)
tab2box2.setDisabled(True)
if self.reviewTooltip_on.isChecked():
tab2box2.setEnabled(True)
self.reviewTooltip_on.toggled.connect(tab2box2.setEnabled)
# end 3 box
# start 4 box
self.reviewTooltipOffsetX = QSlider(Qt.Orientation.Horizontal)
self.reviewTooltipOffsetX.setFixedWidth(200)
self.reviewTooltipOffsetX.setMinimum(-800)
self.reviewTooltipOffsetX.setMaximum(800)
self.reviewTooltipOffsetX.setPageStep(100)
self.reviewTooltipOffsetX.setSliderPosition(0)
reviewerTooltipOffset_holder = QHBoxLayout()
self.reviewTooltipOffsetY = QSlider(Qt.Orientation.Vertical)
self.reviewTooltipOffsetY.setFixedHeight(200)
self.reviewTooltipOffsetY.setMinimum(0)
self.reviewTooltipOffsetY.setMaximum(500)
self.reviewTooltipOffsetY.setPageStep(100)
self.reviewTooltipOffsetY.setSliderPosition(0)
reviewerTooltipOffset_holder = QHBoxLayout()
reviewerTooltipOffset_holder.addWidget(self.reviewTooltipOffsetX)
reviewerTooltipOffset_holder.addWidget(self.reviewTooltipOffsetY)
reviewerTooltipOffset_holder.addStretch()
tab2line4 = QVBoxLayout()
tab2line4.addLayout(reviewerTooltipOffset_holder)
tab2box4 = QGroupBox("Tooltip Position (On Buttons)")
tab2box4.setToolTip("{0}Change the offset according to the button..<hr>\
<font color=red># NOTE:</font> The centre of the x-axis is the zero point, moving to the left is \
offset to the left according to the button and moving to the right is offset to \
the right according to the button.{1}".format(begin, end))
tab2box4.setLayout(tab2line4)
tab2box4.setEnabled(True)
self.reviewTooltip_off.toggled.connect(tab2box4.setDisabled)
tab2box2.setDisabled(True)
if self.reviewTooltip_on.isChecked():
tab2box2.setEnabled(True)
self.reviewTooltip_on.toggled.connect(tab2box2.setEnabled)
# end 4 box
layout = QVBoxLayout()
layout.addWidget(tab2box1)
layout.addWidget(tab2box2)
layout.addWidget(tab2box3)
layout.addWidget(tab2box4)
layout.addStretch()
layout_holder = QWidget()
layout_holder.setLayout(layout)
self.tab2 = QScrollArea()
self.tab2.setFixedWidth(690)
self.tab2.setAlignment(Qt.AlignmentFlag.AlignHCenter)
self.tab2.setWidgetResizable(True)
self.tab2.setWidget(layout_holder)
def createThirdTab(self):
begin = self.begin
end = self.end
images = self.images
self.info = QCheckBox("Info")
self.info.setToolTip("{0} If enabled adds info button to review bottombar. {1}".format(begin, end))
self.skip = QCheckBox("Skip")
self.skip.setToolTip("{0} If enabled adds skip card button to review bottombar. {1}".format(begin, end))
self.showSkipped = QCheckBox("Show Skipped")
self.showSkipped.setToolTip("{0} If enabled adds show skipped button to review bottombar. {1}".format(begin, end))
self.undo = QCheckBox("Undo")
self.undo.setToolTip("{0} If enabled adds undo review button to review bottombar. {1}".format(begin, end))
extraButtonsPart = QHBoxLayout()
extraButtonsPart.addWidget(self.info)
extraButtonsPart.addWidget(self.skip)
extraButtonsPart.addWidget(self.showSkipped)
extraButtonsPart.addWidget(self.undo)
extraButtonsBox = QGroupBox("Extra Buttons")
extraButtonsBox.setLayout(extraButtonsPart)
self.hideHard = QCheckBox("Hide Hard")
self.hideHard.setToolTip("{0}Hides the Hard button.{1}".format(begin, end))
self.hideGood = QCheckBox("Hide Good")
self.hideGood.setToolTip("{0}Hides the Good button.{1}".format(begin, end))
self.hideEasy = QCheckBox("Hide Easy")
self.hideEasy.setToolTip("{0}Hides the Easy button.{1}".format(begin, end))
hideButtonsPart = QHBoxLayout()
hideButtonsPart.addWidget(self.hideHard)
hideButtonsPart.addWidget(self.hideGood)
hideButtonsPart.addWidget(self.hideEasy)
hideButtonsPart.addWidget(QLabel(""))
hideButtonsBox = QGroupBox("Hide Buttons")
hideButtonsBox.setLayout(hideButtonsPart)
infoPosition_label = QLabel("Info:")
infoPosition_label.setToolTip("{0} Changes info button position in bottombar. {1}".format(begin, end))
self.left_info = QRadioButton("Left")