@@ -76,53 +76,58 @@ class ProperTree:
7676 int_label = tk .Label (self .settings_window ,text = "Integer Display Default:" )
7777 int_label .grid (row = 8 ,column = 0 ,sticky = "w" ,padx = 10 )
7878 self .int_type_menu .grid (row = 8 ,column = 1 ,sticky = "we" ,padx = 10 )
79+ self .bool_type_string = tk .StringVar (self .settings_window )
80+ self .bool_type_menu = tk .OptionMenu (self .settings_window , self .bool_type_string , "True/False" , "YES/NO" , "On/Off" , "1/0" , command = self .change_bool_type )
81+ bool_label = tk .Label (self .settings_window ,text = "Boolean Display Default:" )
82+ bool_label .grid (row = 9 ,column = 0 ,sticky = "w" ,padx = 10 )
83+ self .bool_type_menu .grid (row = 9 ,column = 1 ,sticky = "we" ,padx = 10 )
7984 self .snapshot_string = tk .StringVar (self .settings_window )
8085 self .snapshot_menu = tk .OptionMenu (self .settings_window , self .snapshot_string , "Latest" , command = self .change_snapshot_version )
8186 snapshot_label = tk .Label (self .settings_window ,text = "Snapshot OC Version:" )
82- snapshot_label .grid (row = 9 ,column = 0 ,sticky = "w" ,padx = 10 )
83- self .snapshot_menu .grid (row = 9 ,column = 1 ,sticky = "we" ,padx = 10 )
87+ snapshot_label .grid (row = 10 ,column = 0 ,sticky = "w" ,padx = 10 )
88+ self .snapshot_menu .grid (row = 10 ,column = 1 ,sticky = "we" ,padx = 10 )
8489 self .schema_check = tk .Checkbutton (self .settings_window ,text = "Force Update Snapshot Schema" ,variable = self .force_schema ,command = self .schema_command )
85- self .schema_check .grid (row = 10 ,column = 0 ,columnspan = 2 ,sticky = "w" ,padx = 10 )
90+ self .schema_check .grid (row = 11 ,column = 0 ,columnspan = 2 ,sticky = "w" ,padx = 10 )
8691 sep = ttk .Separator (self .settings_window ,orient = "horizontal" )
87- sep .grid (row = 11 ,column = 0 ,columnspan = 2 ,sticky = "we" ,padx = 10 ,pady = 10 )
92+ sep .grid (row = 12 ,column = 0 ,columnspan = 2 ,sticky = "we" ,padx = 10 ,pady = 10 )
8893 r1_label = tk .Label (self .settings_window ,text = "Alternating Row Color #1:" )
89- r1_label .grid (row = 12 ,column = 0 ,sticky = "w" ,padx = 10 )
94+ r1_label .grid (row = 13 ,column = 0 ,sticky = "w" ,padx = 10 )
9095 self .r1_canvas = tk .Canvas (self .settings_window , height = 20 , width = 30 , background = "black" , relief = "groove" , bd = 2 )
91- self .r1_canvas .grid (row = 12 ,column = 1 ,sticky = "we" ,padx = 10 )
96+ self .r1_canvas .grid (row = 13 ,column = 1 ,sticky = "we" ,padx = 10 )
9297 r2_label = tk .Label (self .settings_window ,text = "Alternating Row Color #2:" )
93- r2_label .grid (row = 13 ,column = 0 ,sticky = "w" ,padx = 10 )
98+ r2_label .grid (row = 14 ,column = 0 ,sticky = "w" ,padx = 10 )
9499 self .r2_canvas = tk .Canvas (self .settings_window , height = 20 , width = 30 , background = "black" , relief = "groove" , bd = 2 )
95- self .r2_canvas .grid (row = 13 ,column = 1 ,sticky = "we" ,padx = 10 )
100+ self .r2_canvas .grid (row = 14 ,column = 1 ,sticky = "we" ,padx = 10 )
96101 r3_label = tk .Label (self .settings_window ,text = "Background Color:" )
97- r3_label .grid (row = 14 ,column = 0 ,sticky = "w" ,padx = 10 )
102+ r3_label .grid (row = 15 ,column = 0 ,sticky = "w" ,padx = 10 )
98103 self .bg_canvas = tk .Canvas (self .settings_window , height = 20 , width = 30 , background = "black" , relief = "groove" , bd = 2 )
99- self .bg_canvas .grid (row = 14 ,column = 1 ,sticky = "we" ,padx = 10 )
104+ self .bg_canvas .grid (row = 15 ,column = 1 ,sticky = "we" ,padx = 10 )
100105 r4_label = tk .Label (self .settings_window ,text = "Highlight Color:" )
101- r4_label .grid (row = 15 ,column = 0 ,sticky = "w" ,padx = 10 )
106+ r4_label .grid (row = 16 ,column = 0 ,sticky = "w" ,padx = 10 )
102107 self .hl_canvas = tk .Canvas (self .settings_window , height = 20 , width = 30 , background = "black" , relief = "groove" , bd = 2 )
103- self .hl_canvas .grid (row = 15 ,column = 1 ,sticky = "we" ,padx = 10 )
108+ self .hl_canvas .grid (row = 16 ,column = 1 ,sticky = "we" ,padx = 10 )
104109 self .r1_inv_check = tk .IntVar ()
105110 self .r1_inv = tk .Checkbutton (self .settings_window ,text = "Invert Row #1 Text Color" ,variable = self .r1_inv_check ,command = self .check_r1_invert_command )
106- self .r1_inv .grid (row = 16 ,column = 1 ,sticky = "w" ,padx = 10 )
111+ self .r1_inv .grid (row = 17 ,column = 1 ,sticky = "w" ,padx = 10 )
107112 self .r2_inv_check = tk .IntVar ()
108113 self .r2_inv = tk .Checkbutton (self .settings_window ,text = "Invert Row #2 Text Color" ,variable = self .r2_inv_check ,command = self .check_r2_invert_command )
109- self .r2_inv .grid (row = 17 ,column = 1 ,sticky = "w" ,padx = 10 )
114+ self .r2_inv .grid (row = 18 ,column = 1 ,sticky = "w" ,padx = 10 )
110115 self .hl_inv_check = tk .IntVar ()
111116 self .hl_inv = tk .Checkbutton (self .settings_window ,text = "Invert Highlight Text Color" ,variable = self .hl_inv_check ,command = self .check_hl_invert_command )
112- self .hl_inv .grid (row = 18 ,column = 1 ,sticky = "w" ,padx = 10 )
117+ self .hl_inv .grid (row = 19 ,column = 1 ,sticky = "w" ,padx = 10 )
113118 self .drag_label = tk .Label (self .settings_window ,text = "Drag Dead Zone (1-100 pixels):" )
114- self .drag_label .grid (row = 19 ,column = 0 ,sticky = "w" ,padx = 10 )
119+ self .drag_label .grid (row = 20 ,column = 0 ,sticky = "w" ,padx = 10 )
115120 self .drag_scale = tk .Scale (self .settings_window ,from_ = 1 ,to = 100 ,orient = tk .HORIZONTAL )
116- self .drag_scale .grid (row = 19 ,column = 1 ,sticky = "we" ,padx = 10 )
121+ self .drag_scale .grid (row = 20 ,column = 1 ,sticky = "we" ,padx = 10 )
117122
118123 self .default_font = Font (font = 'TkTextFont' )
119124 self .custom_font = tk .IntVar ()
120125 self .font_check = tk .Checkbutton (self .settings_window ,text = "Use Custom Font Size" ,variable = self .custom_font ,command = self .font_command )
121126 self .font_string = tk .StringVar ()
122127 self .font_spinbox = tk .Spinbox (self .settings_window ,from_ = 1 ,to = 128 ,textvariable = self .font_string )
123128 self .font_string .trace ("w" ,self .update_font )
124- self .font_check .grid (row = 20 ,column = 0 ,sticky = "w" ,padx = 10 )
125- self .font_spinbox .grid (row = 20 ,column = 1 ,sticky = "we" ,padx = 10 )
129+ self .font_check .grid (row = 21 ,column = 0 ,sticky = "w" ,padx = 10 )
130+ self .font_spinbox .grid (row = 21 ,column = 1 ,sticky = "we" ,padx = 10 )
126131
127132 # Custom font picker - wacky implementation.
128133 self .font_var = tk .IntVar ()
@@ -131,21 +136,21 @@ class ProperTree:
131136 self .font_custom = ttk .Combobox (self .settings_window ,state = "readonly" ,textvariable = self .font_family ,values = sorted (families ()))
132137 self .font_custom .bind ('<<ComboboxSelected>>' ,self .font_pick )
133138 self .font_family .trace ("w" ,self .update_font_family )
134- self .font_custom_check .grid (row = 21 ,column = 0 ,stick = "w" ,padx = 10 )
135- self .font_custom .grid (row = 21 ,column = 1 ,sticky = "we" ,padx = 10 )
139+ self .font_custom_check .grid (row = 22 ,column = 0 ,stick = "w" ,padx = 10 )
140+ self .font_custom .grid (row = 22 ,column = 1 ,sticky = "we" ,padx = 10 )
136141
137142 sep_theme = ttk .Separator (self .settings_window ,orient = "horizontal" )
138- sep_theme .grid (row = 22 ,column = 0 ,columnspan = 2 ,sticky = "we" ,padx = 10 ,pady = 10 )
143+ sep_theme .grid (row = 23 ,column = 0 ,columnspan = 2 ,sticky = "we" ,padx = 10 ,pady = 10 )
139144 r5_label = tk .Label (self .settings_window ,text = "Default Theme Options:" )
140- r5_label .grid (row = 23 ,column = 0 ,sticky = "w" ,padx = 10 )
145+ r5_label .grid (row = 24 ,column = 0 ,sticky = "w" ,padx = 10 )
141146 default_high = tk .Button (self .settings_window ,text = "Reset Highlight" ,command = lambda :self .swap_colors ("highlight" ))
142- default_high .grid (row = 24 ,column = 0 ,sticky = "we" ,padx = 10 )
147+ default_high .grid (row = 25 ,column = 0 ,sticky = "we" ,padx = 10 )
143148 default_light = tk .Button (self .settings_window ,text = "Light Mode Defaults" ,command = lambda :self .swap_colors ("light" ))
144- default_light .grid (row = 23 ,column = 1 ,sticky = "we" ,padx = 10 )
149+ default_light .grid (row = 24 ,column = 1 ,sticky = "we" ,padx = 10 )
145150 default_dark = tk .Button (self .settings_window ,text = "Dark Mode Defaults" ,command = lambda :self .swap_colors ("dark" ))
146- default_dark .grid (row = 24 ,column = 1 ,sticky = "we" ,padx = 10 )
151+ default_dark .grid (row = 25 ,column = 1 ,sticky = "we" ,padx = 10 )
147152 reset_settings = tk .Button (self .settings_window ,text = "Reset All To Defaults" ,command = self .reset_settings )
148- reset_settings .grid (row = 25 ,column = 1 ,sticky = "we" ,padx = 10 ,pady = 10 )
153+ reset_settings .grid (row = 26 ,column = 1 ,sticky = "we" ,padx = 10 ,pady = 10 )
149154
150155 # Setup the color picker click methods
151156 self .r1_canvas .bind ("<ButtonRelease-1>" ,lambda x :self .pick_color ("alternating_color_1" ,self .r1_canvas ))
@@ -344,6 +349,7 @@ class ProperTree:
344349 self .allowed_types = ("XML" ,"Binary" )
345350 self .allowed_data = ("Hex" ,"Base64" )
346351 self .allowed_int = ("Decimal" ,"Hex" )
352+ self .allowed_bool = ("True/False" ,"YES/NO" ,"On/Off" ,"1/0" )
347353 self .update_settings ()
348354
349355 # Wait before opening a new document to see if we need to.
@@ -435,6 +441,9 @@ class ProperTree:
435441 def change_int_type (self , event = None ):
436442 self .settings ["display_int_as" ] = self .int_type_string .get ()
437443
444+ def change_bool_type (self , event = None ):
445+ self .settings ["display_bool_as" ] = self .bool_type_string .get ()
446+
438447 def change_snapshot_version (self , event = None ):
439448 self .settings ["snapshot_version" ] = self .snapshot_string .get ().split (" " )[0 ]
440449
@@ -520,6 +529,8 @@ class ProperTree:
520529 self .data_type_string .set (dat_type if dat_type in self .allowed_data else self .allowed_data [0 ])
521530 int_type = self .settings .get ("display_int_as" ,self .allowed_int [0 ])
522531 self .int_type_string .set (int_type if int_type in self .allowed_int else self .allowed_int [0 ])
532+ bool_type = self .settings .get ("display_bool_as" ,self .allowed_bool [0 ])
533+ self .bool_type_string .set (bool_type if bool_type in self .allowed_bool else self .allowed_bool [0 ])
523534 self .snapshot_menu ["menu" ].delete (0 ,"end" )
524535 snapshot_versions = ["{} -> {}" .format (x ["min_version" ],x .get ("max_version" ,"Current" )) if x ["min_version" ]!= x .get ("max_version" ,"Current" ) else x ["min_version" ] for x in self .snapshot_data if "min_version" in x and len (x ["min_version" ])]
525536 snapshot_choices = ["Latest" ] + sorted (snapshot_versions ,reverse = True )
@@ -865,6 +876,7 @@ class ProperTree:
865876 window .plist_type_string .set (self .plist_type_string .get ())
866877 window .data_type_string .set (self .data_type_string .get ())
867878 window .int_type_string .set (self .int_type_string .get ())
879+ window .bool_type_string .set (self .bool_type_string .get ())
868880 window .open_plist (final_title .capitalize (),{}) # Created an empty root
869881 window .current_plist = None # Ensure it's initialized as new
870882 self .lift_window (window )
0 commit comments