21
21
from src .GUI .gui_params import GuiParams
22
22
from src .Image .constants import (
23
23
DEFAULT_PIXEL_FORMAT_NAME ,
24
+ ENDIANESS_TYPES_NAMES ,
24
25
PIXEL_FORMATS_NAMES ,
25
26
SWIZZLING_TYPES_NAMES ,
26
27
)
@@ -67,7 +68,7 @@ def __init__(self, master: tk.Tk, in_version_num: str, in_main_directory: str):
67
68
# IMAGE PARAMETERS BOX #
68
69
########################
69
70
self .parameters_labelframe = tk .LabelFrame (self .main_frame , text = "Image Parameters" , font = self .gui_font )
70
- self .parameters_labelframe .place (x = 5 , y = 5 , width = 160 , height = 210 )
71
+ self .parameters_labelframe .place (x = 5 , y = 5 , width = 160 , height = 260 )
71
72
72
73
###################################
73
74
# IMAGE PARAMETERS - IMAGE WIDTH #
@@ -199,18 +200,52 @@ def _get_next_pixel_format_by_key(event):
199
200
self .master .bind ("<z>" , _get_previous_pixel_format_by_key )
200
201
self .master .bind ("<x>" , _get_next_pixel_format_by_key )
201
202
203
+ ####################################
204
+ # IMAGE PARAMETERS - ENDIANESS #
205
+ ####################################
206
+
207
+ self .endianess_label = tk .Label (self .parameters_labelframe , text = "Endianess Type" , anchor = "w" , font = self .gui_font )
208
+ self .endianess_label .place (x = 5 , y = 140 , width = 100 , height = 20 )
209
+
210
+ self .current_endianess = tk .StringVar ()
211
+ self .endianess_combobox = ttk .Combobox (self .parameters_labelframe , values = ENDIANESS_TYPES_NAMES , textvariable = self .current_endianess ,
212
+ font = self .gui_font , state = 'readonly' )
213
+ self .endianess_combobox .bind ("<<ComboboxSelected>>" , reload_image_callback )
214
+ self .endianess_combobox .place (x = 5 , y = 160 , width = 135 , height = 20 )
215
+ self .endianess_combobox .set (ENDIANESS_TYPES_NAMES [0 ])
216
+
217
+ def _get_previous_endianess_type_by_key (event ):
218
+ selection = self .endianess_combobox .current ()
219
+ last = len (self .endianess_combobox ['values' ]) - 1
220
+ try :
221
+ self .endianess_combobox .current (selection - 1 )
222
+ except tk .TclError :
223
+ self .endianess_combobox .current (last )
224
+ reload_image_callback (event )
225
+
226
+ def _get_next_endianess_type_by_key (event ):
227
+ selection = self .endianess_combobox .current ()
228
+ try :
229
+ self .endianess_combobox .current (selection + 1 )
230
+ except tk .TclError :
231
+ self .endianess_combobox .current (0 )
232
+ reload_image_callback (event )
233
+
234
+ self .master .bind ("<q>" , _get_previous_endianess_type_by_key )
235
+ self .master .bind ("<w>" , _get_next_endianess_type_by_key )
236
+
237
+
202
238
####################################
203
239
# IMAGE PARAMETERS - SWIZZLING #
204
240
####################################
205
241
self .swizzling_label = tk .Label (self .parameters_labelframe , text = "Swizzling Type" , anchor = "w" , font = self .gui_font )
206
- self .swizzling_label .place (x = 5 , y = 140 , width = 100 , height = 20 )
207
-
242
+ self .swizzling_label .place (x = 5 , y = 185 , width = 100 , height = 20 )
208
243
209
244
self .current_swizzling = tk .StringVar ()
210
245
self .swizzling_combobox = ttk .Combobox (self .parameters_labelframe ,
211
246
values = SWIZZLING_TYPES_NAMES , textvariable = self .current_swizzling , font = self .gui_font , state = 'readonly' )
212
247
self .swizzling_combobox .bind ("<<ComboboxSelected>>" , reload_image_callback )
213
- self .swizzling_combobox .place (x = 5 , y = 160 , width = 135 , height = 20 )
248
+ self .swizzling_combobox .place (x = 5 , y = 205 , width = 135 , height = 20 )
214
249
self .swizzling_combobox .set (SWIZZLING_TYPES_NAMES [0 ])
215
250
216
251
def _get_previous_swizzling_type_by_key (event ):
@@ -266,7 +301,7 @@ def _force_reload_image_by_pressing_enter(event):
266
301
##########################
267
302
268
303
self .controls_labelframe = tk .LabelFrame (self .main_frame , text = "Controls" , font = self .gui_font )
269
- self .controls_labelframe .place (x = - 200 , y = 115 , width = 195 , height = 170 , relx = 1 )
304
+ self .controls_labelframe .place (x = - 200 , y = 115 , width = 195 , height = 190 , relx = 1 )
270
305
271
306
self .controls_img_width_label = HTMLLabel (self .controls_labelframe , html = self ._get_html_for_infobox_label ("Img width - " , "Left/Right" ), wrap = None )
272
307
self .controls_img_width_label .place (x = 5 , y = 5 , width = 175 , height = 18 )
@@ -283,11 +318,14 @@ def _force_reload_image_by_pressing_enter(event):
283
318
self .controls_pixel_format_label = HTMLLabel (self .controls_labelframe , html = self ._get_html_for_infobox_label ("Pixel Format - " , "Z/X" ), wrap = None )
284
319
self .controls_pixel_format_label .place (x = 5 , y = 85 , width = 175 , height = 18 )
285
320
321
+ self .controls_endianess_label = HTMLLabel (self .controls_labelframe , html = self ._get_html_for_infobox_label ("Endianess - " , "Q/W" ), wrap = None )
322
+ self .controls_endianess_label .place (x = 5 , y = 105 , width = 175 , height = 18 )
323
+
286
324
self .controls_swizzling_label = HTMLLabel (self .controls_labelframe , html = self ._get_html_for_infobox_label ("Swizzling - " , "A/S" ), wrap = None )
287
- self .controls_swizzling_label .place (x = 5 , y = 105 , width = 175 , height = 18 )
325
+ self .controls_swizzling_label .place (x = 5 , y = 125 , width = 175 , height = 18 )
288
326
289
327
self .controls_swizzling_label = HTMLLabel (self .controls_labelframe , html = self ._get_html_for_infobox_label ("Reload img - " , "Enter" ), wrap = None )
290
- self .controls_swizzling_label .place (x = 5 , y = 125 , width = 175 , height = 18 )
328
+ self .controls_swizzling_label .place (x = 5 , y = 145 , width = 175 , height = 18 )
291
329
292
330
293
331
########################
@@ -368,6 +406,7 @@ def get_gui_params_from_gui_elements(self) -> bool:
368
406
self .gui_params .img_height = self .get_spinbox_value (self .height_spinbox )
369
407
self .gui_params .img_width = self .get_spinbox_value (self .width_spinbox )
370
408
self .gui_params .pixel_format = self .pixel_format_combobox .get ()
409
+ self .gui_params .endianess_type = self .endianess_combobox .get ()
371
410
self .gui_params .swizzling_type = self .swizzling_combobox .get ()
372
411
self .gui_params .img_start_offset = self .get_spinbox_value (self .img_start_offset_spinbox )
373
412
self .gui_params .img_end_offset = self .get_spinbox_value (self .img_end_offset_spinbox )
0 commit comments