-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathText_grabber_settings.py
2088 lines (1690 loc) · 111 KB
/
Text_grabber_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
import configparser
import ctypes
import gettext
import os
import shutil
import sys
import tkinter as tk
from ctypes import windll
from dataclasses import dataclass
from os.path import exists as file_exists
from tkinter import PhotoImage
from tkinter import filedialog
import appdirs
import ttkbootstrap as ttk
from printy import printy
from result import Result, Ok, Err, is_ok
from ttkbootstrap.dialogs.dialogs import Messagebox
from ttkbootstrap.tooltip import ToolTip
import image_edit
import locale
Window_Text_grabber: ttk.Window
Window_Hidden: ttk.Toplevel
Window_settings_app: ttk.Toplevel
current_locale, encoding = locale.getdefaultlocale()
class WindowSettings:
color2_Dark_grey = "#313131" # Dark grey
color3_Grey = "#595959" # Grey
color_grey_blue = '#505E8C'
color_yellow_meadow = '#ECDB54'
font1 = 'Consolas 11'
Title_font_color = color_yellow_meadow
Title_bg = '#313131'
geometry = '+300+400'
minsizeX, minsizeY = (200, 50)
datapath = os.path.dirname(sys.argv[0]) + "/locale/"
locale_path = 'locale/'
gettext.install('T_test', locale_path)
# gettext.install('GUI_config', datapath, names=("ngettext",))
ru_i18n = gettext.translation('T_test', locale_path, fallback=False, languages=['ru'])
en_i18n = gettext.translation('T_test', locale_path, fallback=False, languages=['en'])
language_changed = False
class ToolTipImage(ToolTip):
def __init__(self, widget, text=None, bootstyle=None, wraplength=None, delay=250, image=None, **kwargs):
super().__init__(widget, text, bootstyle, wraplength, delay, **kwargs)
self.image = image
def show_tip(self, *_):
"""Create a show the tooltip window"""
if self.toplevel:
return
x = self.widget.winfo_pointerx() + 25
y = self.widget.winfo_pointery() + 10
self.toplevel = ttk.Toplevel(position=(x, y), **self.toplevel_kwargs)
lbl = ttk.Label(
master=self.toplevel,
padding=0,
image=self.image
)
lbl.pack(fill=ttk.BOTH, expand=ttk.YES)
if self.text:
lbl_label = ttk.Label(
master=self.toplevel,
text="\t" + self.text,
justify=ttk.LEFT,
wraplength=self.wraplength,
)
lbl_label.pack(fill=ttk.BOTH, expand=ttk.YES, )
if self.bootstyle:
lbl.configure(bootstyle=self.bootstyle)
if self.text:
lbl_label.configure(bootstyle=self.bootstyle)
else:
lbl.configure(style="tooltip.TLabel")
if self.text:
lbl_label.configure(style="tooltip.TLabel")
config = configparser.RawConfigParser(allow_no_value=True)
config.optionxform = str
class OriginalSettingsFileText:
A1_Settings = '''[General]
Settings_language = en
Game_language = Russian
Path_to_Data = D:/Games/steamapps/common/RimWorld/Data
Path_to_Mod_folder = D:/Games/steamapps/workshop/content/294100
Path_to_Another_folder = None
Delete_old_versions_translation = True
Merge_folders = True
Not_rename_files = False
Check_update = True
[Comment]
Add_filename_comment = True
Add_comment = True
Comment_add_EN = False
Comment_starting_similar_as_ogiganal_text = True
Comment_spacing_before_tag = False
Comment_replace_n_as_new_line = False
[Grabbing]
Check_at_least_one_letter_in_text = True
add_titleFemale = True
add_titleShortFemale = True
Add_stuffAdjective_and_mark_it = True
Add_stuffAdjective_and_mark_it_text = Adjective ~LABEL~
labelPlural = True
labelMale = False
labelFemale = False
labelMalePlural = False
labelFemalePlural = False
tags_left_spacing = " "
Add_new_line_next_defname = True
Add_new_line_next_defname_treshhold = True
Tkey_system_on = True
[About.xml]
Author = Kamikadza13
New_Name = ~MOD_NAME~ rus
Add_mod_Dependence = True
[Preview]
Image_on_Preview = True
Position = Top right
Offset_x = 0
Offset_y = 0'''
A2_Description = '''Перевод ~MOD_NAME~
~MOD_DESCRIPTION~
~MOD_URL~
Если вы заметили что-то не переведенное, то напишите об этом в комментариях под переводом ^_^
Также мой перевод кучи мелких QOL модов
QOL rus
https://steamcommunity.com/sharedfiles/filedetails/?id=2791163039
(зайдите посмотрите, там много вкусного)'''
E1_Tags_to_extraction = '''label
labelNoun
labelPlural
text
description
jobString
desc
customLabel
customLetterLabel
customLetterText
ingestCommandString
ingestReportString
outOfFuelMessage
name
summary
pawnSingular
pawnsPlural
adjective
ideoName
member
theme
; type
reportString
; Добавил:
stuffAdjective
deathMessage
letterText
slateRef
text
title
titleshort
verb
commandDesc
commandLabel
baseInspectLine
leaderTitle
structureLabel'''
E2_Part_of_tag_to_extraction = '''Message
Label
label
Title
Text
gerund
Gerund
Explanation
title
description'''
E3_Tag_before_li = '''rulesStrings
rulesFiles
customLetterText'''
F1_Forbidden_tags = '''defaultLabelColor
thingClass
only
developmentalStageFilter
context
count
value
offset
volume
drawSize
wornGraphicPath
labelKey
messageTypeDef
texturePath
explanationKeyAbstract
texture
allowedDevelopmentalStages'''
F2_Forbidden_part_of_tag = '''Texture
colorChannels
foodType
showMessageIfOwned
labelUsedInLogging
texPath
developmentalStageFilter'''
F3_Forbidden_part_of_path = '''colorChannels
shadowData'''
F4_Forbidden_text = '''True
False
true
false
asker
askerIsNull
siteThreatChance
Mote
mote'''
O1_Li_Class_Replace = '''QuestNode_=
ScenPart_='''
class TestApp(ttk.Toplevel):
def __init__(self, master_widget):
global Window_settings_app
Window_settings_app = self
ttk.Toplevel.__init__(self, master=master_widget)
self.protocol("WM_DELETE_WINDOW", self.exit_app)
update_settings_new(Window_Text_grabber, Window_Hidden, Window_settings_app)
a = self.style
a.theme_use('darkly')
self.Title_frame = ttk.Frame(self)
self.Title_frame.pack(side=tk.TOP, fill=tk.X)
self.Title_label = ttk.Label(self.Title_frame, text=_('Text Grabber Settings'),
foreground=WindowSettings.Title_font_color)
self.Title_label.pack(side=tk.LEFT, fill=tk.X, anchor=tk.CENTER)
# Pack the close button to the right-most side
self.Title_close_btn = tk.Button(self.Title_frame, text='x', bd=0, width=2, font=WindowSettings.font1,
command=self.exit_app, bg=WindowSettings.Title_bg, takefocus=0)
self.Title_close_btn.pack(side=tk.RIGHT)
self.languages = ['English', 'Русский']
self.Title_language_selector = ttk.Combobox(self.Title_frame, values=self.languages, state='readonly',
width=10, bootstyle='light', )
self.Title_language_selector.pack(side=tk.RIGHT, padx=(0, 10))
self.Title_language_Label = ttk.Label(self.Title_frame, text="Language =", width=10, )
self.Title_language_Label.pack(side=tk.RIGHT, padx=(0, 10))
self.Title_language_Label.ToolTip = ToolTip(self.Title_language_Label,
text=_("Select Language of Settings Programm"), wraplength=320)
def Title_language_selector_selected(event):
selection = self.Title_language_selector.get()
match selection:
case 'Русский':
ru_i18n.install()
SettingsValues.Settings_language = 'ru'
case 'English':
en_i18n.install()
SettingsValues.Settings_language = 'en'
case _:
en_i18n.install()
SettingsValues.Settings_language = 'en'
config.set("General", "Settings_language", SettingsValues.Settings_language)
settings_config_update_write()
global language_changed
language_changed = True
Window_settings_app.destroy()
run_settings_app()
self.Title_language_selector.bind("<<ComboboxSelected>>", Title_language_selector_selected)
self.Title_language_selector.current(1 if SettingsValues.Settings_language == 'ru' else 0)
self.Title_language_selector.ToolTip = ToolTip(self.Title_language_selector,
text=_("Select Language of Settings Programm"), wraplength=320)
self.Title_frame.bind("<ButtonPress-1>", self.start_move)
self.Title_frame.bind("<ButtonRelease-1>", self.stop_move)
self.Title_frame.bind("<B1-Motion>", self.do_move)
self.Content_frame = ttk.Frame(self, padding=2, bootstyle='light')
self.Content_frame.pack(expand=True, fill='both', side=tk.BOTTOM)
self.Top_Notebook = ttk.Notebook(self.Content_frame)
self.Top_Notebook.pack(expand=True, fill=tk.BOTH)
self.General_Settings_frame = ttk.Frame(self.Top_Notebook, padding=10)
self.General_Settings_frame.pack(expand=True, fill=tk.BOTH)
# -- GENERAL SETTINGS FRAME
# -- ----------------------
# -- ----------------------
# -- ----------------------
# -- ----------------------
# -- ----------------------
self.General_Settings_frame.Frame1 = ttk.Frame(self.General_Settings_frame)
self.General_Settings_frame.Frame1.pack(expand=False, fill=tk.X)
self.languages = ["Russian", "Catalan", "ChineseSimplified", "ChineseTraditional", "Czech", "Dutch", "French",
"German",
"Hungarian", "Italian", "Korean", "Polish", "PortugueseBrazilian", "Romanian", "Spanish",
"SpanishLatin",
"Turkish", "Ukrainian", _("Enter your language")]
self.General_Settings_frame.Frame1.Label = ttk.Label(self.General_Settings_frame.Frame1,
text=_("Select language:"))
self.General_Settings_frame.Frame1.Label.pack(expand=True, fill=ttk.Y, side='left', anchor='ne', padx=10)
self.General_Settings_frame.Frame1.Label.ToolTip = ToolTip(self.General_Settings_frame.Frame1.Label, _(
f"Choose the language you are going to translate mods into."
f"\n Rimworld официально переведен на несколько языков и для чтобы ваш перевод мода был автоматически добавлен в игру, а не выступал как отдельный новый язык, используйте предустановленные языки из списка."
), wraplength=320)
self.General_Settings_frame.Frame1.Lang_selector = ttk.Combobox(self.General_Settings_frame.Frame1,
values=self.languages, state="readonly")
# Disable MouseWheel chosing
self.General_Settings_frame.Frame1.Lang_selector.bind("<MouseWheel>", 'break')
self.General_Settings_frame.Frame1.Lang_selector.set(SettingsValues.Game_language)
def callbackFunc(event):
lang = event.widget.get()
SettingsValues.Game_language = lang
config.set("General", "Game_language", lang)
settings_config_update_write()
if lang == self.languages[-1]:
self.General_Settings_frame.Frame1.Lang_selector['state'] = "!readonly"
self.General_Settings_frame.Frame1.Lang_selector.set('')
else:
self.General_Settings_frame.Frame1.Lang_selector['state'] = "readonly"
self.General_Settings_frame.Frame1.Lang_selector.bind("<<ComboboxSelected>>", callbackFunc)
self.General_Settings_frame.Frame1.Lang_selector.bind("<Return>", callbackFunc)
self.General_Settings_frame.Frame1.Lang_selector.pack(expand=True, fill=tk.X, side='left')
self.General_Settings_frame.Frame1.Lang_selector.ToolTip = ToolTip(
self.General_Settings_frame.Frame1.Lang_selector, _(
f"Choose the language you are going to translate mods into."
f"\n Rimworld has been officially translated into several languages, and in order for your translation of the mod to be automatically added to the game,"
f" and not act as a separate new language, use the preset languages from the list.\n"
f" If you want to change the program language, then the language is selected at the top next to the program close button."
), wraplength=320)
self.General_Settings_frame.Pathes_to_Rimworld_frame = ttk.Labelframe(self.General_Settings_frame,
text=_("Pathes to Rimworld folders"),
padding=10)
self.General_Settings_frame.Pathes_to_Rimworld_frame.pack()
self.General_Settings_frame.Frame3 = ttk.Frame(self.General_Settings_frame.Pathes_to_Rimworld_frame)
self.General_Settings_frame.Frame3.pack(anchor='nw')
def Frame3_Path_to_Data_select_path():
a = filedialog.askdirectory(title=_("Select Data folder"))
SettingsValues.Path_to_Data = a if a else 'None'
config.set("General", "Path_to_Data", SettingsValues.Path_to_Data)
settings_config_update_write()
self.General_Settings_frame.Frame3.Label['text'] = _("Rimworld Data:\n{Path_to_Data}").format(Path_to_Data=SettingsValues.Path_to_Data)
self.General_Settings_frame.Frame3.Path_to_Data = ttk.Button(self.General_Settings_frame.Frame3,
text=_("Select path to Rimworld Data"), width=50,
command=Frame3_Path_to_Data_select_path)
self.General_Settings_frame.Frame3.Path_to_Data.pack(expand=False, fill=tk.X, side='left')
self.General_Settings_frame.Frame3.Label = ttk.Label(self.General_Settings_frame.Frame3,
text=_("Rimworld Data:\n{Path_to_Data}").format(Path_to_Data=SettingsValues.Path_to_Data),
wraplength=500)
self.General_Settings_frame.Frame3.Label.pack(padx=(20, 20), anchor='nw')
self.General_Settings_frame.Frame4 = ttk.Frame(self.General_Settings_frame.Pathes_to_Rimworld_frame)
self.General_Settings_frame.Frame4.pack(expand=False, fill=tk.X)
def Frame4_Path_to_Mod_select_path():
a = filedialog.askdirectory(title=_("Select MOD folder"))
SettingsValues.Path_to_Mod_folder = a if a else 'None'
config.set("General", "Path_to_Mod_folder", SettingsValues.Path_to_Mod_folder)
settings_config_update_write()
self.General_Settings_frame.Frame4.Label['text'] = _(
"Rimworld Mods Folder:\n{Path_to_Mod_folder}").format(Path_to_Mod_folder=SettingsValues.Path_to_Mod_folder)
self.General_Settings_frame.Frame4.Path_to_Mod = ttk.Button(self.General_Settings_frame.Frame4,
text=_("Select path to Rimworld Mods Folder"),
width=50, command=Frame4_Path_to_Mod_select_path)
self.General_Settings_frame.Frame4.Path_to_Mod.pack(expand=False, fill=tk.X, side='left')
self.General_Settings_frame.Frame4.Label = ttk.Label(self.General_Settings_frame.Frame4, text=_(
"Rimworld Mods Folder:\n{Path_to_Mod_folder}").format(Path_to_Mod_folder=SettingsValues.Path_to_Mod_folder), wraplength=500)
self.General_Settings_frame.Frame4.Label.pack(padx=(20, 20), anchor='nw')
self.General_Settings_frame.Frame5 = ttk.Frame(self.General_Settings_frame.Pathes_to_Rimworld_frame)
self.General_Settings_frame.Frame5.pack(expand=False, fill=tk.X)
def Frame5_Path_to_Another_folder_select_path():
a = filedialog.askdirectory(title=_("Select Another mod folder"))
SettingsValues.Path_to_Another_folder = a if a else _('None')
config.set("General", "Path_to_Another_folder", SettingsValues.Path_to_Another_folder)
settings_config_update_write()
self.General_Settings_frame.Frame5.Label['text'] = _(
"Another Rimworld Mods Folder:\n{Path_to_Another_folder}").format(Path_to_Another_folder=SettingsValues.Path_to_Another_folder)
self.General_Settings_frame.Frame5.Path_to_Another_folder = ttk.Button(self.General_Settings_frame.Frame5,
text=_(
"Select path to another Rimworld Mods Folder"),
width=50,
command=Frame5_Path_to_Another_folder_select_path)
self.General_Settings_frame.Frame5.Path_to_Another_folder.pack(expand=False, fill=tk.X, side='left')
self.General_Settings_frame.Frame5.Label = ttk.Label(self.General_Settings_frame.Frame5, text=_(
"Another Rimworld Mods Folder:\n{Path_to_Another_folder}").format(Path_to_Another_folder=SettingsValues.Path_to_Another_folder), wraplength=500)
self.General_Settings_frame.Frame5.Label.pack(padx=(20, 20), anchor='nw')
self.General_Settings_frame.Frame5.Path_to_Another_folder.ToolTip = ToolTip(
self.General_Settings_frame.Frame5.Path_to_Another_folder,
_('If you suddenly store mods somewhere else, you can specify this folder here. In this case, the program will work better with mods that depend on other mods (in case the values for translation are inherited from another mod).'),
wraplength=320)
'''Если вы внезапно храните моды где-то еще, то можете указать эту папку тут. В этом случае программа будет лучше работать с модами, которые зависят от других модов (В случае, если значения для перевода наследуются от другого мода).'''
self.General_Settings_frame.Frame6 = ttk.Labelframe(self.General_Settings_frame,
text=_("Extraction files rules"))
self.General_Settings_frame.Frame6.pack(anchor=tk.N, side=tk.LEFT)
self.General_Settings_frame.Frame_left = ttk.Frame(self.General_Settings_frame.Frame6, padding=10)
self.General_Settings_frame.Frame_left.pack(anchor=tk.W)
self.Delete_old_versions_language = ttk.BooleanVar(value=SettingsValues.Delete_old_versions_translation)
def General_Settings_frame_Frame7_Delete_old_folders():
SettingsValues.Delete_old_versions_translation = bool(self.Delete_old_versions_language.get())
config.set("General", "Delete_old_versions_translation",
str(SettingsValues.Delete_old_versions_translation))
settings_config_update_write()
self.General_Settings_frame.Frame_left.Delete_old_version_translate = ttk.Checkbutton(
self.General_Settings_frame.Frame_left, text=_("Delete old version folders"),
variable=self.Delete_old_versions_language, command=General_Settings_frame_Frame7_Delete_old_folders)
self.General_Settings_frame.Frame_left.Delete_old_version_translate.pack(anchor=tk.W, pady=(0, 0))
self.General_Settings_frame.Frame_left.Delete_old_version_translate.ToolTip = ToolTip(
self.General_Settings_frame.Frame_left.Delete_old_version_translate, text=_(
'Delete (Not extract) text for older versions of Rimworld.\nBy default, the program extracts text for all available versions ( ... 1.0, 1.1, 1.2 ...). You can leave only the newest version, so as not to translate too much (Which I advise you to do)'),
wraplength=320)
self.Merge_folders = ttk.BooleanVar(value=SettingsValues.Merge_folders)
def General_Settings_frame_Frame8_Merge_folders():
SettingsValues.Merge_folders = bool(self.Merge_folders.get())
config.set("General", "Merge_folders", str(SettingsValues.Merge_folders))
settings_config_update_write()
self.General_Settings_frame.Frame_left.Merge_folders = ttk.Checkbutton(self.General_Settings_frame.Frame_left,
text=_("Merge Folders"),
variable=self.Merge_folders,
command=General_Settings_frame_Frame8_Merge_folders)
self.General_Settings_frame.Frame_left.Merge_folders.pack(anchor=tk.W, pady=(10, 0))
self.General_Settings_frame.Frame_left.Merge_folders.ToolTip = ToolTip(
self.General_Settings_frame.Frame_left.Merge_folders,
text=_('Merge version and Language folders into one Language folder\n'
'(If there is only one version folder)'), wraplength=320)
self.Not_rename_files = ttk.BooleanVar(value=SettingsValues.Not_rename_files)
def General_Settings_frame_Frame9_Not_rename():
SettingsValues.Not_rename_files = bool(self.Not_rename_files.get())
config.set("General", "Not_rename_files", str(SettingsValues.Not_rename_files))
settings_config_update_write()
self.General_Settings_frame.Frame_left.Not_rename = ttk.Checkbutton(self.General_Settings_frame.Frame_left,
text=_("Not rename files"),
variable=self.Not_rename_files,
command=General_Settings_frame_Frame9_Not_rename)
self.General_Settings_frame.Frame_left.Not_rename.pack(anchor=tk.W, pady=(10, 0))
self.General_Settings_frame.Frame_left.Not_rename.ToolTip = ToolTip(
self.General_Settings_frame.Frame_left.Not_rename, text=_(
"Files are automatically renamed depending on the folders they fall into. This is necessary to prevent the files from having the same names, which may lead to the fact that the game will not read the translation files.\n"
"(Check the box if you don't like it and you want to keep the original titles)"), wraplength=320)
self.General_Settings_frame.Frame7 = ttk.Labelframe(self.General_Settings_frame,
text=_("Update"))
self.General_Settings_frame.Frame7.pack(anchor=tk.N, side=tk.LEFT, padx=(5,0))
self.General_Settings_frame.Frame7.F1 = ttk.Frame(self.General_Settings_frame.Frame7, padding=10)
self.General_Settings_frame.Frame7.F1.pack()
self.Check_update = ttk.BooleanVar(value=SettingsValues.Check_update)
def General_Settings_frame_Frame7Update_ckeckbtn():
SettingsValues.Check_update = bool(self.Check_update.get())
config.set("General", "Check_update", str(SettingsValues.Check_update))
settings_config_update_write()
self.General_Settings_frame.Frame7.F1.Update_ckeckbtn = ttk.Checkbutton(self.General_Settings_frame.Frame7.F1,
text=_("Check updates"),
variable=self.Check_update,
command=General_Settings_frame_Frame7Update_ckeckbtn)
self.General_Settings_frame.Frame7.F1.Update_ckeckbtn.pack(anchor=tk.W, pady=(0, 0))
self.General_Settings_frame.Frame7.F1.Update_ckeckbtn.ToolTip = ToolTip(
self.General_Settings_frame.Frame7.F1.Update_ckeckbtn, text=_("Check updates from GitHub and Download it if find new version"), wraplength=320)
# -- COMMENT SETTINGS FRAME
# -- ----------------------
# -- ----------------------
# -- ----------------------
# -- ----------------------
# -- ----------------------
self.CommFrame = ttk.Frame(self.Top_Notebook)
self.CommFrame.pack(expand=True, fill=tk.BOTH)
self.CommFrame.Frame_all = ttk.Frame(self.CommFrame)
self.CommFrame.Frame_all.pack(expand=False, fill=tk.X, padx=100)
self.CommFrame.Frame_left = ttk.Frame(self.CommFrame.Frame_all)
self.CommFrame.Frame_left.pack(anchor=tk.W, side=tk.LEFT)
def CommFrame_Add_filename_comment():
SettingsValues.Add_filename_comment = bool(self.Add_filename_comment.get())
config.set("Comment", "Add_filename_comment",
str(SettingsValues.Add_filename_comment))
settings_config_update_write()
change_comm_checkbtn_img()
self.Add_filename_comment = ttk.BooleanVar(value=SettingsValues.Add_filename_comment)
self.CommFrame.Frame_left.Add_filename_comment = ttk.Checkbutton(self.CommFrame.Frame_left, text=_(
"Add in file comment with FullPath of Original file"), variable=self.Add_filename_comment,
command=CommFrame_Add_filename_comment)
self.CommFrame.Frame_left.Add_filename_comment.pack(anchor=tk.W, pady=(10, 0))
def CommFrame_Add_comment():
SettingsValues.Add_comment = bool(self.Add_comment.get())
config.set("Comment", "Add_comment",
str(SettingsValues.Add_comment))
settings_config_update_write()
if self.Add_comment.get():
self.CommFrame.Frame_left.Comment_add_EN.configure(state='normal')
self.CommFrame.Frame_right.Comment_starting_similar_as_ogiganal_text.configure(state='normal')
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='normal')
self.CommFrame.Frame_right.Comment_replace_n_as_new_line.configure(state='normal')
if self.Comment_starting_similar_as_ogiganal_text.get():
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='normal')
else:
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='disabled')
else:
self.CommFrame.Frame_left.Comment_add_EN.configure(state='disabled')
self.CommFrame.Frame_right.Comment_starting_similar_as_ogiganal_text.configure(state='disabled')
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='disabled')
self.CommFrame.Frame_right.Comment_replace_n_as_new_line.configure(state='disabled')
change_comm_checkbtn_img()
self.Add_comment = ttk.BooleanVar(value=SettingsValues.Add_comment)
self.CommFrame.Frame_left.Add_comment = ttk.Checkbutton(self.CommFrame.Frame_left,
text=_("Add comments to grabbed text"),
variable=self.Add_comment,
command=CommFrame_Add_comment)
self.CommFrame.Frame_left.Add_comment.pack(anchor=tk.W, pady=(10, 0))
def CommFrame_Comment_add_EN():
SettingsValues.Comment_add_EN = bool(self.Comment_add_EN.get())
config.set("Comment", "Comment_add_EN",
str(SettingsValues.Comment_add_EN))
settings_config_update_write()
change_comm_checkbtn_img()
self.Comment_add_EN = ttk.BooleanVar(value=SettingsValues.Comment_add_EN)
self.CommFrame.Frame_left.Comment_add_EN = ttk.Checkbutton(self.CommFrame.Frame_left,
text=_('Add "EN:" before comment text'),
variable=self.Comment_add_EN,
command=CommFrame_Comment_add_EN)
self.CommFrame.Frame_left.Comment_add_EN.pack(anchor=tk.W, pady=(10, 0))
self.CommFrame.Frame_right = ttk.Frame(self.CommFrame.Frame_all)
self.CommFrame.Frame_right.pack(anchor='nw', side=tk.RIGHT)
def CommFrame_Comment_starting_similar_as_ogiganal_text():
SettingsValues.Comment_starting_similar_as_ogiganal_text = bool(
self.Comment_starting_similar_as_ogiganal_text.get())
config.set("Comment", "Comment_starting_similar_as_ogiganal_text",
str(SettingsValues.Comment_starting_similar_as_ogiganal_text))
settings_config_update_write()
if self.Comment_starting_similar_as_ogiganal_text.get():
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='normal')
else:
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='disabled')
change_comm_checkbtn_img()
self.Comment_starting_similar_as_ogiganal_text = ttk.BooleanVar(
value=SettingsValues.Comment_starting_similar_as_ogiganal_text)
self.CommFrame.Frame_right.Comment_starting_similar_as_ogiganal_text = ttk.Checkbutton(
self.CommFrame.Frame_right, text=_("Place the comment text exactly above the original text"),
variable=self.Comment_starting_similar_as_ogiganal_text,
command=CommFrame_Comment_starting_similar_as_ogiganal_text)
self.CommFrame.Frame_right.Comment_starting_similar_as_ogiganal_text.pack(anchor=tk.W, pady=(10, 0))
def CommFrame_Comment_spacing_before_tag():
SettingsValues.Comment_spacing_before_tag = bool(self.Comment_spacing_before_tag.get())
config.set("Comment", "Comment_spacing_before_tag",
str(SettingsValues.Comment_spacing_before_tag))
settings_config_update_write()
change_comm_checkbtn_img()
self.Comment_spacing_before_tag = ttk.BooleanVar(value=SettingsValues.Comment_spacing_before_tag)
self.CommFrame.Frame_right.Comment_spacing_before_tag = ttk.Checkbutton(self.CommFrame.Frame_right, text=_(
"Left spacing are in before the comment"), variable=self.Comment_spacing_before_tag,
command=CommFrame_Comment_spacing_before_tag)
self.CommFrame.Frame_right.Comment_spacing_before_tag.pack(anchor=tk.W, pady=(10, 0))
def CommFrame_Comment_replace_n_as_new_line():
SettingsValues.Comment_replace_n_as_new_line = bool(self.Comment_replace_n_as_new_line.get())
config.set("Comment", "Comment_replace_n_as_new_line",
str(SettingsValues.Comment_replace_n_as_new_line))
settings_config_update_write()
change_comm_checkbtn_img()
self.Comment_replace_n_as_new_line = ttk.BooleanVar(value=SettingsValues.Comment_replace_n_as_new_line)
self.CommFrame.Frame_right.Comment_replace_n_as_new_line = ttk.Checkbutton(self.CommFrame.Frame_right, text=_(
"Comment replace \\n as new line"), variable=self.Comment_replace_n_as_new_line,
command=CommFrame_Comment_replace_n_as_new_line)
self.CommFrame.Frame_right.Comment_replace_n_as_new_line.pack(anchor=tk.W, pady=(10, 0))
if not self.Add_comment.get():
self.CommFrame.Frame_left.Comment_add_EN.configure(state='disabled')
self.CommFrame.Frame_right.Comment_starting_similar_as_ogiganal_text.configure(state='disabled')
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='disabled')
self.CommFrame.Frame_right.Comment_replace_n_as_new_line.configure(state='disabled')
if not self.Comment_starting_similar_as_ogiganal_text.get():
self.CommFrame.Frame_right.Comment_spacing_before_tag.configure(state='disabled')
def change_comm_checkbtn_img():
def get_img_code() -> str:
if self.Add_filename_comment.get():
a1 = 1
else:
a1 = 0
if self.Add_comment.get():
a2 = 1
else:
a2 = 0
if self.Comment_add_EN.get():
a3 = 1
else:
a3 = 0
if self.Comment_starting_similar_as_ogiganal_text.get():
a4 = 1
else:
a4 = 0
if self.Comment_spacing_before_tag.get():
a5 = 1
else:
a5 = 0
if self.Comment_replace_n_as_new_line.get():
a6 = 1
else:
a6 = 0
if a2 == 0:
a3, a4, a5, a6 = 0, 0, 0, 0
if a4 == 0:
a5 = 0
return str(a1) + str(a2) + str(a3) + str(a4) + str(a5) + str(a6)
# self.Comm_Image_label.configure(image=PhotoImage(file=f'Images/Comments/{get_img_code()}.png'))
self.Comm_Image.configure(file=f'Images/Comments/{get_img_code()}.png')
self.Comm_Image_Frame = ttk.Frame(self.CommFrame)
self.Comm_Image_Frame.pack(anchor=tk.CENTER)
self.Comm_Image = PhotoImage(file='Images/Comments/000000.png')
self.Comm_Image_label = ttk.Label(self.Comm_Image_Frame, image=self.Comm_Image)
self.Comm_Image_label.pack(anchor=tk.CENTER)
change_comm_checkbtn_img()
# -- Grabbing SETTINGS FRAME
# -- ----------------------
# -- ----------------------
# -- ----------------------
# -- ----------------------
# -- ----------------------
self.GrabFrame = ttk.Frame(self.Top_Notebook)
self.GrabFrame.pack(expand=True, fill=tk.BOTH)
self.GrabFrame.Frame_all = ttk.Frame(self.GrabFrame)
self.GrabFrame.Frame_all.pack(expand=False, fill=tk.X, padx=100)
self.GrabFrame.Frame_left = ttk.LabelFrame(self.GrabFrame.Frame_all, text=_('StuffAdjective'))
self.GrabFrame.Frame_left.pack(anchor=tk.W, side=tk.LEFT)
def GrabFrame_Add_stuffAdjective_and_mark_it():
SettingsValues.Add_stuffAdjective_and_mark_it = bool(self.Add_stuffAdjective_and_mark_it.get())
config.set("Grabbing", "Add_stuffAdjective_and_mark_it",
str(SettingsValues.Add_stuffAdjective_and_mark_it))
settings_config_update_write()
if bool(self.Add_stuffAdjective_and_mark_it.get()):
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.mark_entry.configure(state='normal')
else:
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.mark_entry.configure(state='disabled')
self.Add_stuffAdjective_and_mark_it = ttk.BooleanVar(value=SettingsValues.Add_stuffAdjective_and_mark_it)
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it = ttk.Checkbutton(self.GrabFrame.Frame_left, text=_(
"Add stuffAdjective and mark it"), variable=self.Add_stuffAdjective_and_mark_it,
command=GrabFrame_Add_stuffAdjective_and_mark_it)
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.pack(anchor=tk.W, pady=(10, 0), padx=10)
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.ToolTip = ToolTip(
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it, text=_(
"Some materials can be used to build buildings / make objects, but the authors do not add a special label for this. And in translation it turns out: 'Made of stone'. This is normal for English, but not for some languages. Therefore, I decided to add a special label to understand how to translate a word as an adjective/ genitive. \n You can write yourself how to designate such words in the text. To correctly translate such a word, you need to mentally put 'The house is made of' in front of it. \n '~LABEL~' will be replaced with the original word. If you just want to add such words for translation, but do not want to mark them separately, then you can only write '~LABEL~'."))
'''Из некоторых материалов можно строить здания / делать предметы, но авторы не добавляет специальную метку для этого. И в переводе получается: 'Сделанный из камень'. Для английского языка это нормально, но для некоторых языков нет. Поэтому я решил добавить специальную метку, чтобы понимать как нужно переводить слово как прилагательное / родительный падеж. \n Вы можете написать сами как обозначать в тексте такие слова. \n '~LABEL~' будет заменен на оригинальное слово. Если вы хотите просто добавить такие слова для перевода, но не хотите их отдельно отмечать, то можете написать только '~LABEL~'.'''
self.Add_stuffAdjective_and_mark_it_text_var = ttk.StringVar(
value=SettingsValues.Add_stuffAdjective_and_mark_it_text)
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.mark_entry = ttk.Entry(self.GrabFrame.Frame_left,
textvariable=self.Add_stuffAdjective_and_mark_it_text_var,
width=32)
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.mark_entry.pack(anchor=tk.W, pady=(10, 10), padx=10)
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.mark_entry.ToolTip = ToolTip(
self.GrabFrame.Frame_left.Add_stuffAdjective_and_mark_it.mark_entry, text=_(
"'~LABEL~' will be replaced with the original word. \n If you just want to add such words for translation, but do not want to mark them separately, then you can only write '~LABEL~'"))
def Add_stuffAdjective_and_mark_it_text_var_callback(*_):
SettingsValues.Add_stuffAdjective_and_mark_it_text = self.Add_stuffAdjective_and_mark_it_text_var.get()
if '~LABEL~' not in SettingsValues.Add_stuffAdjective_and_mark_it_text:
self.Add_stuffAdjective_and_mark_it_text_var.set(
SettingsValues.Add_stuffAdjective_and_mark_it_text + "~LABEL~")
SettingsValues.Add_stuffAdjective_and_mark_it_text = self.Add_stuffAdjective_and_mark_it_text_var.get()
config.set("Grabbing", "Add_stuffAdjective_and_mark_it_text",
str(SettingsValues.Add_stuffAdjective_and_mark_it_text))
settings_config_update_write()
self.Add_stuffAdjective_and_mark_it_text_var.trace_add('write',
Add_stuffAdjective_and_mark_it_text_var_callback)
self.GrabFrame.Frame_right = ttk.Frame(self.GrabFrame.Frame_all)
self.GrabFrame.Frame_right.pack(anchor=tk.W, side=tk.RIGHT)
self.Check_one_letter = ttk.BooleanVar(value=SettingsValues.Check_at_least_one_letter_in_text)
def General_Settings_frame_Frame9_Check_one_letter():
SettingsValues.Check_at_least_one_letter_in_text = bool(self.Check_one_letter.get())
config.set("Grabbing", "Check_at_least_one_letter_in_text",
str(SettingsValues.Check_at_least_one_letter_in_text))
settings_config_update_write()
self.GrabFrame.Frame_right.Not_rename = ttk.Checkbutton(self.GrabFrame.Frame_right,
text=_("Check at least one letter in text"),
variable=self.Check_one_letter,
command=General_Settings_frame_Frame9_Check_one_letter)
self.GrabFrame.Frame_right.Not_rename.pack(anchor=tk.W, pady=(10, 0))
self.GrabFrame.Frame_right.Not_rename.ToolTip = ToolTip(self.GrabFrame.Frame_right.Not_rename, text=_(
'Check if there is at least one letter in the extracted text. This is necessary so as not to extract all sorts of (255, 123, 112).\nYou may want to remove the flag if the mod adds various symbols without letters that you want to translate like "<--",\nI do not know why to translate it at all, but who knows ^_^'),
wraplength=320)
self.add_titleFemale = ttk.BooleanVar(value=SettingsValues.add_titleFemale)
def General_Settings_frame_Frame10_add_titleFemale():
SettingsValues.add_titleFemale = bool(self.add_titleFemale.get())
config.set("Grabbing", "add_titleFemale", str(SettingsValues.add_titleFemale))
settings_config_update_write()
self.GrabFrame.Frame_right.add_titleFemale = ttk.Checkbutton(self.GrabFrame.Frame_right, text=_(
"Add titleFemale if it is not in the original file"), variable=self.add_titleFemale,
command=General_Settings_frame_Frame10_add_titleFemale)
self.GrabFrame.Frame_right.add_titleFemale.pack(anchor=tk.W, pady=(10, 0))
self.add_titleShortFemale = ttk.BooleanVar(value=SettingsValues.add_titleShortFemale)
def General_Settings_frame_Frame10_add_titleShortFemale():
SettingsValues.add_titleShortFemale = bool(self.add_titleShortFemale.get())
config.set("Grabbing", "add_titleShortFemale", str(SettingsValues.add_titleShortFemale))
settings_config_update_write()
self.GrabFrame.Frame_right.add_titleShortFemale = ttk.Checkbutton(self.GrabFrame.Frame_right, text=_(
"Add titleShortFemale if it is not in the original file"), variable=self.add_titleShortFemale,
command=General_Settings_frame_Frame10_add_titleShortFemale)
self.GrabFrame.Frame_right.add_titleShortFemale.pack(anchor=tk.W, pady=(10, 0))
def callback_Tkey_system_on():
SettingsValues.Tkey_system_on = bool(self.Tkey_system_on.get())
config.set("Grabbing", "Tkey_system_on", str(SettingsValues.Tkey_system_on))
settings_config_update_write()
self.Tkey_system_on = ttk.BooleanVar(value=SettingsValues.Tkey_system_on)
self.GrabFrame.Frame_right.Tkey_system_on = ttk.Checkbutton(self.GrabFrame.Frame_right,
text=_("QuestScriptDef Tkey system"),
variable=self.Tkey_system_on,
command=callback_Tkey_system_on)
self.GrabFrame.Frame_right.Tkey_system_on.pack(anchor=tk.W, pady=(10, 0))
self.GrabFrame.Frame_right.Tkey_system_on.ToolTip = ToolTip(self.GrabFrame.Frame_right.Tkey_system_on,
text=_(
"At 1.4 patch TKey system was broken. If the developers fix it, then enable this feature.\n The Tkey system is specifically designed to simplify long tag paths."))
self.GrabFrame.Frame_2 = ttk.Frame(self.GrabFrame, )
self.GrabFrame.Frame_2.pack(anchor=tk.W, pady=(5, 0))
self.GrabFrame.Next_Frame = ttk.Frame(self.GrabFrame.Frame_2)
self.GrabFrame.Next_Frame.pack(fill=ttk.Y, anchor=tk.W, pady=(5, 0), padx=(100, 15), side='left')
def make_plural_frames():
self.GrabFrame.Plurel_Frame = ttk.Labelframe(self.GrabFrame.Frame_2, text=_("PawnKindDef Plural labels"))
self.GrabFrame.Plurel_Frame.pack(anchor=tk.W, pady=(5, 0), side='left', fill=ttk.Y)
self.GrabFrame.Plurel_Frame_inside = ttk.Frame(self.GrabFrame.Plurel_Frame, padding=5)
self.GrabFrame.Plurel_Frame_inside.pack(anchor=tk.W, padx=2)
self.labelPlural = ttk.BooleanVar(value=SettingsValues.labelPlural)
self.labelMale = ttk.BooleanVar(value=SettingsValues.labelMale)
self.labelFemale = ttk.BooleanVar(value=SettingsValues.labelFemale)
self.labelMalePlural = ttk.BooleanVar(value=SettingsValues.labelMalePlural)
self.labelFemalePlural = ttk.BooleanVar(value=SettingsValues.labelFemalePlural)
def callback_Plural_Checkbuttons():
SettingsValues.labelPlural = bool(self.labelPlural.get())
SettingsValues.labelMale = bool(self.labelMale.get())
SettingsValues.labelFemale = bool(self.labelFemale.get())
SettingsValues.labelMalePlural = bool(self.labelMalePlural.get())
SettingsValues.labelFemalePlural = bool(self.labelFemalePlural.get())
config.set("Grabbing", "labelPlural", str(SettingsValues.labelPlural))
config.set("Grabbing", "labelMale", str(SettingsValues.labelMale))
config.set("Grabbing", "labelFemale", str(SettingsValues.labelFemale))
config.set("Grabbing", "labelMalePlural", str(SettingsValues.labelMalePlural))
config.set("Grabbing", "labelFemalePlural", str(SettingsValues.labelFemalePlural))
settings_config_update_write()
self.GrabFrame.Plurel_Frame_inside.labelPlural = ttk.Checkbutton(self.GrabFrame.Plurel_Frame_inside,
text=_("Add labelPlural"),
variable=self.labelPlural,
command=callback_Plural_Checkbuttons)
self.GrabFrame.Plurel_Frame_inside.labelPlural.pack(anchor=tk.W, pady=(0, 0))
self.GrabFrame.Plurel_Frame_inside.labelPlural.ToolTip = ToolTip(
self.GrabFrame.Plurel_Frame_inside.labelPlural,
text=_("Add missing tags to choose from in PawnKindDef if they don't exist."))
self.GrabFrame.Plurel_Frame_inside.labelMale = ttk.Checkbutton(self.GrabFrame.Plurel_Frame_inside,
text=_("Add labelMale"),
variable=self.labelMale,
command=callback_Plural_Checkbuttons)
self.GrabFrame.Plurel_Frame_inside.labelMale.pack(anchor=tk.W, pady=(1, 0))
self.GrabFrame.Plurel_Frame_inside.labelMale.ToolTip = ToolTip(self.GrabFrame.Plurel_Frame_inside.labelMale,
text=_(
"Add missing tags to choose from in PawnKindDef if they don't exist."))
self.GrabFrame.Plurel_Frame_inside.labelFemale = ttk.Checkbutton(self.GrabFrame.Plurel_Frame_inside,
text=_("Add labelFemale"),
variable=self.labelFemale,
command=callback_Plural_Checkbuttons)
self.GrabFrame.Plurel_Frame_inside.labelFemale.pack(anchor=tk.W, pady=(1, 0))
self.GrabFrame.Plurel_Frame_inside.labelFemale.ToolTip = ToolTip(
self.GrabFrame.Plurel_Frame_inside.labelFemale,
text=_("Add missing tags to choose from in PawnKindDef if they don't exist."))
self.GrabFrame.Plurel_Frame_inside.labelMalePlural = ttk.Checkbutton(self.GrabFrame.Plurel_Frame_inside,
text=_("Add labelMalePlural"),
variable=self.labelMalePlural,
command=callback_Plural_Checkbuttons)
self.GrabFrame.Plurel_Frame_inside.labelMalePlural.pack(anchor=tk.W, pady=(1, 0))
self.GrabFrame.Plurel_Frame_inside.labelMalePlural.ToolTip = ToolTip(
self.GrabFrame.Plurel_Frame_inside.labelMalePlural,
text=_("Add missing tags to choose from in PawnKindDef if they don't exist."))
self.GrabFrame.Plurel_Frame_inside.labelFemalePlural = ttk.Checkbutton(self.GrabFrame.Plurel_Frame_inside,
text=_("Add labelFemalePlural"),
variable=self.labelFemalePlural,
command=callback_Plural_Checkbuttons)
self.GrabFrame.Plurel_Frame_inside.labelFemalePlural.pack(anchor=tk.W, pady=(1, 0))
self.GrabFrame.Plurel_Frame_inside.labelFemalePlural.ToolTip = ToolTip(
self.GrabFrame.Plurel_Frame_inside.labelFemalePlural,
text=_("Add missing tags to choose from in PawnKindDef if they don't exist."))
make_plural_frames()
self.GrabFrame.Next_Frame_inside = ttk.LabelFrame(self.GrabFrame.Next_Frame, padding=5, text=_('Spacing'))
self.GrabFrame.Next_Frame_inside.pack(anchor=tk.W, padx=0)
self.GrabFrame.tags_left_spacing_frame = ttk.Frame(self.GrabFrame.Next_Frame_inside)
self.GrabFrame.tags_left_spacing_frame.pack(anchor=tk.W, padx=10)
self.GrabFrame.tags_left_spacing_radibtns_frame = ttk.Labelframe(self.GrabFrame.tags_left_spacing_frame,
text=_('Grabbed lines left spacing'))
self.GrabFrame.tags_left_spacing_radibtns_frame.pack(anchor=tk.W, pady=(5, 10))
self.GrabFrame.tags_left_spacing_radibtns_frame_inside = ttk.Frame(
self.GrabFrame.tags_left_spacing_radibtns_frame)
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.pack(anchor=tk.W, padx=5, pady=5)
self.GrabFrame.tags_left_spacing_var = tk.StringVar(value=SettingsValues.tags_left_spacing)
def tags_left_spacing_var_change():
SettingsValues.tags_left_spacing = f'"{self.GrabFrame.tags_left_spacing_var.get()}"'
config.set("Grabbing", "tags_left_spacing",
str(SettingsValues.tags_left_spacing))
settings_config_update_write()
self.GrabFrame.tags_left_spacing_var.trace("w", lambda *_: tags_left_spacing_var_change())
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.one_tab = ttk.Radiobutton(
self.GrabFrame.tags_left_spacing_radibtns_frame_inside, text=_("One tab"), value='\t',
variable=self.GrabFrame.tags_left_spacing_var)
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.one_tab.pack(anchor=tk.W, padx=(2, 0), pady=(1, 0))
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.one_tab.ToolTip_image = PhotoImage(
file='Images/Grabbing/One_tab.png')
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.one_tab.ToolTip = ToolTipImage(
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.one_tab,
image=self.GrabFrame.tags_left_spacing_radibtns_frame_inside.one_tab.ToolTip_image)
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.two_spaces = ttk.Radiobutton(
self.GrabFrame.tags_left_spacing_radibtns_frame_inside, text=_("Two spaces"), value=' ',
variable=self.GrabFrame.tags_left_spacing_var)
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.two_spaces.pack(anchor=tk.W, padx=(2, 0), pady=(0, 0))
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.two_spaces.ToolTip_image = PhotoImage(
file='Images/Grabbing/Two_spaces.png')
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.two_spaces.ToolTip = ToolTipImage(
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.two_spaces,
image=self.GrabFrame.tags_left_spacing_radibtns_frame_inside.two_spaces.ToolTip_image)
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.no_spaces = ttk.Radiobutton(
self.GrabFrame.tags_left_spacing_radibtns_frame_inside, text=_("No spaces"), value='',
variable=self.GrabFrame.tags_left_spacing_var)
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.no_spaces.pack(anchor=tk.W, padx=(2, 0), pady=(0, 2))
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.no_spaces.ToolTip_image = PhotoImage(
file='Images/Grabbing/No_spaces.png')
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.no_spaces.ToolTip = ToolTipImage(
self.GrabFrame.tags_left_spacing_radibtns_frame_inside.no_spaces,
image=self.GrabFrame.tags_left_spacing_radibtns_frame_inside.no_spaces.ToolTip_image)
def callback_Add_new_line_next_defname():
SettingsValues.Add_new_line_next_defname = bool(self.Add_new_line_next_defname.get())
config.set("Grabbing", "Add_new_line_next_defname", str(SettingsValues.Add_new_line_next_defname))
settings_config_update_write()
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname_treshhold.configure(state='normal' if self.Add_new_line_next_defname.get() else 'disabled')
self.Add_new_line_next_defname = ttk.BooleanVar(value=SettingsValues.Add_new_line_next_defname)
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname = ttk.Checkbutton(self.GrabFrame.Next_Frame_inside,
text=_(
"Add empty line before new grabbed defname"),
variable=self.Add_new_line_next_defname,
command=callback_Add_new_line_next_defname)
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname.pack(anchor=tk.W, pady=(0, 0), padx=10)
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname.ToolTip_image = PhotoImage(
file='Images/Grabbing/Add_new_line_next_defname.png')
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname.ToolTip = ToolTipImage(
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname,
image=self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname.ToolTip_image,
text=_("Divide the text into blocks by Defname"))
def callback_Add_new_line_next_defname_treshhold():
SettingsValues.Add_new_line_next_defname_treshhold = bool(self.Add_new_line_next_defname_treshhold.get())
config.set("Grabbing", "Add_new_line_next_defname_treshhold", str(SettingsValues.Add_new_line_next_defname_treshhold))
settings_config_update_write()
self.Add_new_line_next_defname_treshhold = ttk.BooleanVar(value=SettingsValues.Add_new_line_next_defname_treshhold)
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname_treshhold = ttk.Checkbutton(self.GrabFrame.Next_Frame_inside,
text=_(
"Threshold for adding an empty line"),
variable=self.Add_new_line_next_defname_treshhold,
command=callback_Add_new_line_next_defname_treshhold,
state='normal' if self.Add_new_line_next_defname.get() else 'disabled')
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname_treshhold.pack(anchor=tk.W, pady=(5, 0), padx=10)
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname_treshhold.ToolTip = ToolTip(
self.GrabFrame.Next_Frame_inside.Add_new_line_next_defname_treshhold,
text=_("Empty lines will be added if there are many lines with the same defname in the file. (If the number of different defnames is less than half of all strings.)"))
# -- About SETTINGS FRAME
# -- ----------------------
# -- ----------------------
#
# -- ----------------------
# -- ----------------------