spacr 0.1.81__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spacr/__init__.py +6 -2
- spacr/app_annotate.py +6 -5
- spacr/app_make_masks.py +8 -15
- spacr/core.py +1 -1
- spacr/gui.py +72 -91
- spacr/gui_2.py +110 -113
- spacr/gui_core.py +113 -67
- spacr/gui_elements.py +233 -87
- spacr/gui_utils.py +3 -3
- spacr/icons/abort.png +0 -0
- spacr/icons/abort.svg +1 -0
- spacr/icons/download.png +0 -0
- spacr/icons/download.svg +1 -0
- spacr/icons/download_for_offline_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.png +0 -0
- spacr/icons/download_for_offline_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.svg +1 -0
- spacr/icons/logo_spacr.png +0 -0
- spacr/icons/make_masks.png +0 -0
- spacr/icons/make_masks.svg +1 -0
- spacr/icons/map_barcodes.png +0 -0
- spacr/icons/map_barcodes.svg +1 -0
- spacr/icons/mask.png +0 -0
- spacr/icons/mask.svg +1 -0
- spacr/icons/measure.png +0 -0
- spacr/icons/measure.svg +1 -0
- spacr/icons/play_circle_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.png +0 -0
- spacr/icons/play_circle_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.svg +1 -0
- spacr/icons/run.png +0 -0
- spacr/icons/run.svg +1 -0
- spacr/icons/sequencing.png +0 -0
- spacr/icons/sequencing.svg +1 -0
- spacr/icons/settings.png +0 -0
- spacr/icons/settings.svg +1 -0
- spacr/icons/settings_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.png +0 -0
- spacr/icons/settings_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.svg +1 -0
- spacr/icons/stop_circle_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.png +0 -0
- spacr/icons/stop_circle_100dp_E8EAED_FILL0_wght100_GRAD-25_opsz48.svg +1 -0
- spacr/icons/theater_comedy_100dp_E8EAED_FILL0_wght100_GRAD200_opsz48.png +0 -0
- spacr/icons/theater_comedy_100dp_E8EAED_FILL0_wght100_GRAD200_opsz48.svg +1 -0
- spacr/resources/icons/abort.png +0 -0
- spacr/resources/icons/abort.svg +1 -0
- spacr/resources/icons/annotate.png +0 -0
- spacr/resources/icons/annotate.svg +1 -0
- spacr/resources/icons/cellpose.png +0 -0
- spacr/resources/icons/cellpose_masks.png +0 -0
- spacr/resources/icons/classify.png +0 -0
- spacr/resources/icons/classify.svg +1 -0
- spacr/resources/icons/default.png +0 -0
- spacr/resources/icons/download.png +0 -0
- spacr/resources/icons/download.svg +1 -0
- spacr/resources/icons/icon.psd +0 -0
- spacr/resources/icons/logo_spacr.png +0 -0
- spacr/resources/icons/make_masks.png +0 -0
- spacr/resources/icons/make_masks.svg +1 -0
- spacr/resources/icons/map_barcodes.png +0 -0
- spacr/resources/icons/map_barcodes.svg +1 -0
- spacr/resources/icons/mask.png +0 -0
- spacr/resources/icons/mask.svg +1 -0
- spacr/resources/icons/measure.png +0 -0
- spacr/resources/icons/measure.svg +1 -0
- spacr/resources/icons/regression.png +0 -0
- spacr/resources/icons/run.png +0 -0
- spacr/resources/icons/run.svg +1 -0
- spacr/resources/icons/run_2.png +0 -0
- spacr/resources/icons/run_2.svg +1 -0
- spacr/resources/icons/sequencing.png +0 -0
- spacr/resources/icons/sequencing.svg +1 -0
- spacr/resources/icons/settings.png +0 -0
- spacr/resources/icons/settings.svg +1 -0
- spacr/resources/icons/train_cellpose.png +0 -0
- spacr/resources/icons/train_cellpose.svg +1 -0
- spacr/resources/icons/umap.png +0 -0
- spacr/resources/models/cp/toxo_plaque_cyto_e25000_X1120_Y1120.CP_model +0 -0
- spacr/resources/models/cp/toxo_plaque_cyto_e25000_X1120_Y1120.CP_model_settings.csv +23 -0
- spacr/resources/models/cp/toxo_pv_lumen.CP_model +0 -0
- spacr/settings.py +12 -12
- spacr/test_gui.py +0 -0
- {spacr-0.1.81.dist-info → spacr-0.2.0.dist-info}/METADATA +1 -1
- spacr-0.2.0.dist-info/RECORD +126 -0
- spacr-0.1.81.dist-info/RECORD +0 -60
- {spacr-0.1.81.dist-info → spacr-0.2.0.dist-info}/LICENSE +0 -0
- {spacr-0.1.81.dist-info → spacr-0.2.0.dist-info}/WHEEL +0 -0
- {spacr-0.1.81.dist-info → spacr-0.2.0.dist-info}/entry_points.txt +0 -0
- {spacr-0.1.81.dist-info → spacr-0.2.0.dist-info}/top_level.txt +0 -0
spacr/gui_core.py
CHANGED
@@ -17,7 +17,7 @@ except AttributeError:
|
|
17
17
|
pass
|
18
18
|
|
19
19
|
from .settings import set_default_train_test_model, get_measure_crop_settings, set_default_settings_preprocess_generate_masks, get_analyze_reads_default_settings, set_default_umap_image_settings
|
20
|
-
from .gui_elements import
|
20
|
+
from .gui_elements import spacrButton, spacrLabel, spacrFrame, spacrDropdownMenu ,set_dark_style, set_default_font
|
21
21
|
|
22
22
|
# Define global variables
|
23
23
|
q = None
|
@@ -231,25 +231,43 @@ def import_settings(settings_type='mask'):
|
|
231
231
|
vars_dict = hide_all_settings(vars_dict, categories=None)
|
232
232
|
|
233
233
|
def convert_settings_dict_for_gui(settings):
|
234
|
+
from torchvision import models as torch_models
|
235
|
+
torchvision_models = [name for name, obj in torch_models.__dict__.items() if callable(obj)]
|
236
|
+
chans = ['0', '1', '2', '3', '4', '5', '6', '7', '8', None]
|
237
|
+
chans_v2 = [0, 1, 2, 3, None]
|
234
238
|
variables = {}
|
235
239
|
special_cases = {
|
236
240
|
'metadata_type': ('combo', ['cellvoyager', 'cq1', 'nikon', 'zeis', 'custom'], 'cellvoyager'),
|
237
241
|
'channels': ('combo', ['[0,1,2,3]', '[0,1,2]', '[0,1]', '[0]'], '[0,1,2,3]'),
|
238
|
-
'
|
239
|
-
'
|
240
|
-
'
|
241
|
-
|
242
|
+
'channel_dims': ('combo', ['[0,1,2,3]', '[0,1,2]', '[0,1]', '[0]'], '[0,1,2,3]'),
|
243
|
+
'cell_mask_dim': ('combo', chans, None),
|
244
|
+
'cell_chann_dim': ('combo', chans, None),
|
245
|
+
'nucleus_mask_dim': ('combo', chans, None),
|
246
|
+
'nucleus_chann_dim': ('combo', chans, None),
|
247
|
+
'pathogen_mask_dim': ('combo', chans, None),
|
248
|
+
'pathogen_chann_dim': ('combo', chans, None),
|
249
|
+
'crop_mode': ('combo', ['cell', 'nucleus', 'pathogen', '[cell, nucleus, pathogen]', '[cell,nucleus, pathogen]'], ['cell']),
|
242
250
|
'magnification': ('combo', [20, 40, 60], 20),
|
243
|
-
'nucleus_channel': ('combo',
|
244
|
-
'cell_channel': ('combo',
|
245
|
-
'
|
251
|
+
'nucleus_channel': ('combo', chans_v2, None),
|
252
|
+
'cell_channel': ('combo', chans_v2, None),
|
253
|
+
'channel_of_interest': ('combo', chans_v2, None),
|
254
|
+
'pathogen_channel': ('combo', chans_v2, None),
|
246
255
|
'timelapse_mode': ('combo', ['trackpy', 'btrack'], 'trackpy'),
|
256
|
+
'train_mode': ('combo', ['erm', 'irm'], 'erm'),
|
257
|
+
'clustering': ('combo', ['dbscan', 'kmean'], 'dbscan'),
|
258
|
+
'reduction_method': ('combo', ['umap', 'tsne'], 'umap'),
|
259
|
+
'model_name': ('combo', ['cyto', 'cyto_2', 'cyto_3', 'nuclei'], 'cyto'),
|
260
|
+
'regression_type': ('combo', ['ols','gls','wls','rlm','glm','mixed','quantile','logit','probit','poisson','lasso','ridge'], 'ols'),
|
247
261
|
'timelapse_objects': ('combo', ['cell', 'nucleus', 'pathogen', 'cytoplasm', None], None),
|
248
|
-
'model_type': ('combo',
|
262
|
+
'model_type': ('combo', torchvision_models, 'resnet50'),
|
249
263
|
'optimizer_type': ('combo', ['adamw', 'adam'], 'adamw'),
|
250
264
|
'schedule': ('combo', ['reduce_lr_on_plateau', 'step_lr'], 'reduce_lr_on_plateau'),
|
251
265
|
'loss_type': ('combo', ['focal_loss', 'binary_cross_entropy_with_logits'], 'focal_loss'),
|
252
266
|
'normalize_by': ('combo', ['fov', 'png'], 'png'),
|
267
|
+
'agg_type': ('combo', ['mean', 'median'], 'mean'),
|
268
|
+
'grouping': ('combo', ['mean', 'median'], 'mean'),
|
269
|
+
'min_max': ('combo', ['allq', 'all'], 'allq'),
|
270
|
+
'transform': ('combo', ['log', 'sqrt', 'square', None], None)
|
253
271
|
}
|
254
272
|
|
255
273
|
for key, value in settings.items():
|
@@ -271,17 +289,16 @@ def convert_settings_dict_for_gui(settings):
|
|
271
289
|
|
272
290
|
def setup_settings_panel(vertical_container, settings_type='mask', window_dimensions=[500, 1000]):
|
273
291
|
global vars_dict, scrollable_frame
|
274
|
-
from .settings import
|
292
|
+
from .settings import get_identify_masks_finetune_default_settings, set_default_analyze_screen, set_default_settings_preprocess_generate_masks, get_measure_crop_settings, set_default_train_test_model, get_analyze_reads_default_settings, set_default_umap_image_settings, generate_fields, get_perform_regression_default_settings, get_train_cellpose_default_settings, get_map_barcodes_default_settings, get_analyze_recruitment_default_settings, get_check_cellpose_models_default_settings
|
275
293
|
|
276
|
-
width = (window_dimensions[0])//6
|
294
|
+
width = (window_dimensions[0]) // 6
|
277
295
|
height = window_dimensions[1]
|
278
296
|
|
279
|
-
|
280
|
-
settings_frame = tk.Frame(vertical_container, bg='black', height=height, width=width)
|
297
|
+
settings_frame = tk.Frame(vertical_container)
|
281
298
|
vertical_container.add(settings_frame, stretch="always")
|
282
|
-
settings_label = spacrLabel(settings_frame, text="Settings",
|
299
|
+
settings_label = spacrLabel(settings_frame, text="Settings", anchor='center', justify='center', align="center")
|
283
300
|
settings_label.grid(row=0, column=0, pady=10, padx=10)
|
284
|
-
scrollable_frame = spacrFrame(settings_frame
|
301
|
+
scrollable_frame = spacrFrame(settings_frame)
|
285
302
|
scrollable_frame.grid(row=1, column=0, sticky="nsew")
|
286
303
|
settings_frame.grid_rowconfigure(1, weight=1)
|
287
304
|
settings_frame.grid_columnconfigure(0, weight=1)
|
@@ -310,24 +327,18 @@ def setup_settings_panel(vertical_container, settings_type='mask', window_dimens
|
|
310
327
|
settings = get_perform_regression_default_settings(settings={})
|
311
328
|
elif settings_type == 'recruitment':
|
312
329
|
settings = get_analyze_recruitment_default_settings(settings={})
|
313
|
-
#elif settings_type == 'simulation':
|
314
|
-
# settings = set_default_
|
315
|
-
#elif settings_type == 'cellpose_dataset':
|
316
|
-
# settings = set_default_
|
317
|
-
#elif settings_type == 'plaques':
|
318
|
-
# settings = set_default_
|
319
|
-
#elif settings_type == 'cellpose_compare':
|
320
|
-
# settings = set_default_
|
321
|
-
#elif settings_type == 'vision_scores':
|
322
|
-
# settings = set_default_
|
323
|
-
#elif settings_type == 'vision_dataset':
|
324
|
-
# settings = set_default_
|
325
330
|
else:
|
326
331
|
raise ValueError(f"Invalid settings type: {settings_type}")
|
327
332
|
|
328
|
-
|
329
333
|
variables = convert_settings_dict_for_gui(settings)
|
330
334
|
vars_dict = generate_fields(variables, scrollable_frame)
|
335
|
+
|
336
|
+
containers = [settings_frame]
|
337
|
+
widgets = [settings_label, scrollable_frame]
|
338
|
+
|
339
|
+
style = ttk.Style(vertical_container)
|
340
|
+
_ = set_dark_style(style, containers=containers, widgets=widgets)
|
341
|
+
|
331
342
|
print("Settings panel setup complete")
|
332
343
|
return scrollable_frame, vars_dict
|
333
344
|
|
@@ -335,45 +346,58 @@ def setup_plot_section(vertical_container):
|
|
335
346
|
global canvas, canvas_widget
|
336
347
|
plot_frame = tk.PanedWindow(vertical_container, orient=tk.VERTICAL)
|
337
348
|
vertical_container.add(plot_frame, stretch="always")
|
338
|
-
figure = Figure(figsize=(30, 4), dpi=100
|
349
|
+
figure = Figure(figsize=(30, 4), dpi=100)
|
339
350
|
plot = figure.add_subplot(111)
|
340
351
|
plot.plot([], []) # This creates an empty plot.
|
341
352
|
plot.axis('off')
|
342
353
|
canvas = FigureCanvasTkAgg(figure, master=plot_frame)
|
343
|
-
canvas.get_tk_widget().configure(cursor='arrow',
|
354
|
+
canvas.get_tk_widget().configure(cursor='arrow', highlightthickness=0)
|
344
355
|
canvas_widget = canvas.get_tk_widget()
|
345
356
|
plot_frame.add(canvas_widget, stretch="always")
|
346
357
|
canvas.draw()
|
347
358
|
canvas.figure = figure
|
359
|
+
style_out = set_dark_style(ttk.Style())
|
360
|
+
|
361
|
+
figure.patch.set_facecolor(style_out['bg_color'])
|
362
|
+
plot.set_facecolor(style_out['bg_color'])
|
363
|
+
containers = [plot_frame]
|
364
|
+
widgets = [canvas_widget]
|
365
|
+
style = ttk.Style(vertical_container)
|
366
|
+
_ = set_dark_style(style, containers=containers, widgets=widgets)
|
348
367
|
return canvas, canvas_widget
|
349
368
|
|
350
369
|
def setup_console(vertical_container):
|
351
370
|
global console_output
|
352
|
-
|
353
|
-
console_frame = tk.Frame(vertical_container, bg='black')
|
371
|
+
console_frame = tk.Frame(vertical_container)
|
354
372
|
vertical_container.add(console_frame, stretch="always")
|
355
|
-
console_label = spacrLabel(console_frame, text="Console",
|
373
|
+
console_label = spacrLabel(console_frame, text="Console", anchor='center', justify='center', align="center")
|
356
374
|
console_label.grid(row=0, column=0, pady=10, padx=10)
|
357
|
-
console_output = scrolledtext.ScrolledText(console_frame, height=10
|
375
|
+
console_output = scrolledtext.ScrolledText(console_frame, height=10)
|
358
376
|
console_output.grid(row=1, column=0, sticky="nsew")
|
359
377
|
console_frame.grid_rowconfigure(1, weight=1)
|
360
378
|
console_frame.grid_columnconfigure(0, weight=1)
|
361
|
-
|
379
|
+
containers = [console_frame]
|
380
|
+
widgets = [console_label, console_output]
|
381
|
+
style = ttk.Style(vertical_container)
|
382
|
+
_ = set_dark_style(style, containers=containers, widgets=widgets)
|
362
383
|
return console_output
|
363
384
|
|
364
385
|
def setup_progress_frame(vertical_container):
|
365
386
|
global progress_output
|
366
|
-
progress_frame = tk.Frame(vertical_container
|
387
|
+
progress_frame = tk.Frame(vertical_container)
|
367
388
|
vertical_container.add(progress_frame, stretch="always")
|
368
|
-
label_frame = tk.Frame(progress_frame
|
389
|
+
label_frame = tk.Frame(progress_frame)
|
369
390
|
label_frame.grid(row=0, column=0, sticky="ew", pady=(5, 0), padx=10)
|
370
|
-
progress_label = spacrLabel(label_frame, text="Processing: 0%",
|
391
|
+
progress_label = spacrLabel(label_frame, text="Processing: 0%", font=('Helvetica', 12), anchor='w', justify='left', align="left")
|
371
392
|
progress_label.grid(row=0, column=0, sticky="w")
|
372
|
-
progress_output = scrolledtext.ScrolledText(progress_frame, height=10
|
393
|
+
progress_output = scrolledtext.ScrolledText(progress_frame, height=10)
|
373
394
|
progress_output.grid(row=1, column=0, sticky="nsew")
|
374
395
|
progress_frame.grid_rowconfigure(1, weight=1)
|
375
396
|
progress_frame.grid_columnconfigure(0, weight=1)
|
376
|
-
|
397
|
+
containers = [progress_frame, label_frame]
|
398
|
+
widgets = [progress_label, progress_output]
|
399
|
+
style = ttk.Style(vertical_container)
|
400
|
+
_ = set_dark_style(style, containers=containers, widgets=widgets)
|
377
401
|
return progress_output
|
378
402
|
|
379
403
|
def download_hug_dataset():
|
@@ -459,60 +483,78 @@ def download_dataset(repo_id, subfolder, local_dir=None, retries=5, delay=5):
|
|
459
483
|
|
460
484
|
raise Exception("Failed to download files after multiple attempts.")
|
461
485
|
|
462
|
-
def setup_button_section(horizontal_container, settings_type='mask',
|
486
|
+
def setup_button_section(horizontal_container, settings_type='mask', window_dimensions=[500, 1000], run=True, abort=True, download=True, import_btn=True):
|
463
487
|
global button_frame, button_scrollable_frame, run_button, abort_button, download_dataset_button, import_button, q, fig_queue, vars_dict
|
464
488
|
from .settings import descriptions
|
465
489
|
|
466
|
-
width = (window_dimensions[0])//8
|
490
|
+
width = (window_dimensions[0]) // 8
|
467
491
|
height = window_dimensions[1]
|
468
492
|
|
469
|
-
button_frame = tk.Frame(horizontal_container
|
493
|
+
button_frame = tk.Frame(horizontal_container)
|
470
494
|
horizontal_container.add(button_frame, stretch="always", sticky="nsew")
|
471
495
|
button_frame.grid_rowconfigure(0, weight=0)
|
472
496
|
button_frame.grid_rowconfigure(1, weight=1)
|
473
497
|
button_frame.grid_columnconfigure(0, weight=1)
|
474
498
|
|
475
|
-
categories_label = spacrLabel(button_frame, text="Categories",
|
499
|
+
categories_label = spacrLabel(button_frame, text="Categories", anchor='center', justify='center', align="center")
|
476
500
|
categories_label.grid(row=0, column=0, pady=10, padx=10)
|
477
|
-
button_scrollable_frame = spacrFrame(button_frame
|
501
|
+
button_scrollable_frame = spacrFrame(button_frame)
|
478
502
|
button_scrollable_frame.grid(row=1, column=0, sticky="nsew")
|
479
503
|
|
504
|
+
widgets = [categories_label, button_scrollable_frame.scrollable_frame]
|
505
|
+
|
480
506
|
btn_col = 0
|
481
507
|
btn_row = 1
|
482
|
-
|
508
|
+
|
483
509
|
if run:
|
484
|
-
run_button = spacrButton(button_scrollable_frame.scrollable_frame, text="
|
510
|
+
run_button = spacrButton(button_scrollable_frame.scrollable_frame, text="run", command=lambda: start_process(q, fig_queue, settings_type))
|
485
511
|
run_button.grid(row=btn_row, column=btn_col, pady=5, padx=5, sticky='ew')
|
512
|
+
widgets.append(run_button)
|
486
513
|
btn_row += 1
|
487
514
|
|
488
515
|
if abort and settings_type in ['mask', 'measure', 'classify', 'sequencing', 'umap']:
|
489
|
-
abort_button = spacrButton(button_scrollable_frame.scrollable_frame, text="
|
516
|
+
abort_button = spacrButton(button_scrollable_frame.scrollable_frame, text="abort", command=initiate_abort)
|
490
517
|
abort_button.grid(row=btn_row, column=btn_col, pady=5, padx=5, sticky='ew')
|
518
|
+
widgets.append(abort_button)
|
491
519
|
btn_row += 1
|
492
520
|
|
493
521
|
if download and settings_type in ['mask']:
|
494
|
-
download_dataset_button = spacrButton(button_scrollable_frame.scrollable_frame, text="
|
522
|
+
download_dataset_button = spacrButton(button_scrollable_frame.scrollable_frame, text="download", command=download_hug_dataset)
|
495
523
|
download_dataset_button.grid(row=btn_row, column=btn_col, pady=5, padx=5, sticky='ew')
|
524
|
+
widgets.append(download_dataset_button)
|
496
525
|
btn_row += 1
|
497
526
|
|
498
527
|
if import_btn:
|
499
|
-
import_button = spacrButton(button_scrollable_frame.scrollable_frame, text="
|
528
|
+
import_button = spacrButton(button_scrollable_frame.scrollable_frame, text="settings", command=lambda: import_settings(settings_type))
|
500
529
|
import_button.grid(row=btn_row, column=btn_col, pady=5, padx=5, sticky='ew')
|
530
|
+
widgets.append(import_button)
|
501
531
|
|
502
|
-
# Call toggle_settings after vars_dict is initialized
|
503
532
|
if vars_dict is not None:
|
504
533
|
toggle_settings(button_scrollable_frame)
|
505
534
|
|
506
|
-
|
507
|
-
description_frame = tk.Frame(horizontal_container, bg='black', height=height, width=width)
|
535
|
+
description_frame = tk.Frame(horizontal_container)
|
508
536
|
horizontal_container.add(description_frame, stretch="always", sticky="nsew")
|
509
|
-
description_frame.grid_columnconfigure(0, weight=1)
|
510
|
-
|
511
|
-
|
537
|
+
description_frame.grid_columnconfigure(0, weight=1)
|
538
|
+
description_frame.grid_rowconfigure(0, weight=1) # Add this line to make the row expandable
|
539
|
+
|
540
|
+
description_label = tk.Label(description_frame, text="Module Description", anchor='nw', justify='left', wraplength=width - 50)
|
541
|
+
description_label.grid(row=0, column=0, pady=50, padx=20, sticky='nsew')
|
512
542
|
description_text = descriptions.get(settings_type, "No description available for this module.")
|
513
543
|
description_label.config(text=description_text)
|
514
544
|
|
515
|
-
|
545
|
+
def update_wraplength(event):
|
546
|
+
new_width = event.width - 40 # Adjust as needed
|
547
|
+
description_label.config(wraplength=new_width)
|
548
|
+
|
549
|
+
description_label.bind('<Configure>', update_wraplength)
|
550
|
+
|
551
|
+
containers = [button_frame, description_frame]
|
552
|
+
widgets.extend([description_label])
|
553
|
+
|
554
|
+
style = ttk.Style(horizontal_container)
|
555
|
+
_ = set_dark_style(style, containers=containers, widgets=widgets)
|
556
|
+
|
557
|
+
return button_frame, button_scrollable_frame, description_frame, description_label
|
516
558
|
|
517
559
|
def hide_all_settings(vars_dict, categories):
|
518
560
|
"""
|
@@ -561,7 +603,6 @@ def toggle_settings(button_scrollable_frame):
|
|
561
603
|
def on_category_select(selected_category):
|
562
604
|
if selected_category == "Select Category":
|
563
605
|
return
|
564
|
-
#print(f"Selected category: {selected_category}")
|
565
606
|
if selected_category in categories:
|
566
607
|
toggle_category(categories[selected_category])
|
567
608
|
if selected_category in active_categories:
|
@@ -569,12 +610,12 @@ def toggle_settings(button_scrollable_frame):
|
|
569
610
|
else:
|
570
611
|
active_categories.add(selected_category)
|
571
612
|
category_dropdown.update_styles(active_categories)
|
572
|
-
category_var.set("Select Category")
|
613
|
+
category_var.set("Select Category")
|
573
614
|
|
574
615
|
category_var = tk.StringVar()
|
575
616
|
non_empty_categories = [category for category, settings in categories.items() if any(setting in vars_dict for setting in settings)]
|
576
617
|
category_dropdown = spacrDropdownMenu(button_scrollable_frame.scrollable_frame, category_var, non_empty_categories, command=on_category_select)
|
577
|
-
category_dropdown.grid(row=
|
618
|
+
category_dropdown.grid(row=5, column=0, sticky="ew", pady=2, padx=2)
|
578
619
|
vars_dict = hide_all_settings(vars_dict, categories)
|
579
620
|
|
580
621
|
def process_fig_queue():
|
@@ -627,24 +668,29 @@ def set_globals(q_var, console_output_var, parent_frame_var, vars_dict_var, canv
|
|
627
668
|
progress_label = progress_label_var
|
628
669
|
fig_queue = fig_queue_var
|
629
670
|
|
671
|
+
def create_containers(parent_frame):
|
672
|
+
vertical_container = tk.PanedWindow(parent_frame, orient=tk.VERTICAL)
|
673
|
+
horizontal_container = tk.PanedWindow(vertical_container, orient=tk.HORIZONTAL)
|
674
|
+
settings_frame = tk.Frame(horizontal_container)
|
675
|
+
return vertical_container, horizontal_container, settings_frame
|
676
|
+
|
630
677
|
def setup_frame(parent_frame):
|
631
678
|
style = ttk.Style(parent_frame)
|
632
|
-
|
679
|
+
vertical_container, horizontal_container, settings_frame = create_containers(parent_frame)
|
680
|
+
containers = [vertical_container, horizontal_container, settings_frame]
|
681
|
+
|
682
|
+
set_dark_style(style, parent_frame, containers)
|
633
683
|
set_default_font(parent_frame, font_name="Helvetica", size=8)
|
634
|
-
|
635
|
-
parent_frame.grid_rowconfigure(0, weight=1)
|
636
|
-
parent_frame.grid_columnconfigure(0, weight=1)
|
637
|
-
vertical_container = tk.PanedWindow(parent_frame, orient=tk.VERTICAL, bg='black')
|
684
|
+
|
638
685
|
vertical_container.grid(row=0, column=0, sticky=tk.NSEW)
|
639
|
-
horizontal_container = tk.PanedWindow(vertical_container, orient=tk.HORIZONTAL, bg='black')
|
640
686
|
vertical_container.add(horizontal_container, stretch="always")
|
641
687
|
horizontal_container.grid_columnconfigure(0, weight=1)
|
642
688
|
horizontal_container.grid_columnconfigure(1, weight=1)
|
643
|
-
settings_frame = tk.Frame(horizontal_container, bg='black')
|
644
689
|
settings_frame.grid_rowconfigure(0, weight=0)
|
645
690
|
settings_frame.grid_rowconfigure(1, weight=1)
|
646
691
|
settings_frame.grid_columnconfigure(0, weight=1)
|
647
692
|
horizontal_container.add(settings_frame, stretch="always", sticky="nsew")
|
693
|
+
|
648
694
|
return parent_frame, vertical_container, horizontal_container
|
649
695
|
|
650
696
|
def initiate_root(parent, settings_type='mask'):
|