spacr 0.2.66__py3-none-any.whl → 0.2.68__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/gui.py +35 -20
- spacr/gui_core.py +1 -1
- spacr/gui_utils.py +28 -17
- {spacr-0.2.66.dist-info → spacr-0.2.68.dist-info}/METADATA +5 -2
- {spacr-0.2.66.dist-info → spacr-0.2.68.dist-info}/RECORD +9 -9
- {spacr-0.2.66.dist-info → spacr-0.2.68.dist-info}/LICENSE +0 -0
- {spacr-0.2.66.dist-info → spacr-0.2.68.dist-info}/WHEEL +0 -0
- {spacr-0.2.66.dist-info → spacr-0.2.68.dist-info}/entry_points.txt +0 -0
- {spacr-0.2.66.dist-info → spacr-0.2.68.dist-info}/top_level.txt +0 -0
spacr/gui.py
CHANGED
@@ -3,6 +3,7 @@ from tkinter import ttk
|
|
3
3
|
from multiprocessing import set_start_method
|
4
4
|
from .gui_elements import spacrButton, create_menu_bar, set_dark_style
|
5
5
|
from .gui_core import initiate_root
|
6
|
+
from screeninfo import get_monitors
|
6
7
|
|
7
8
|
class MainApp(tk.Tk):
|
8
9
|
def __init__(self, default_app=None):
|
@@ -12,12 +13,23 @@ class MainApp(tk.Tk):
|
|
12
13
|
self.geometry("100x100")
|
13
14
|
self.update_idletasks()
|
14
15
|
|
15
|
-
#
|
16
|
-
self.attributes('-fullscreen', True)
|
16
|
+
# Get the current window position
|
17
17
|
self.update_idletasks()
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
x = self.winfo_x()
|
19
|
+
y = self.winfo_y()
|
20
|
+
|
21
|
+
# Find the monitor where the window is located
|
22
|
+
for monitor in get_monitors():
|
23
|
+
if monitor.x <= x < monitor.x + monitor.width and monitor.y <= y < monitor.y + monitor.height:
|
24
|
+
width = monitor.width
|
25
|
+
height = monitor.height
|
26
|
+
break
|
27
|
+
else:
|
28
|
+
monitor = get_monitors()[0]
|
29
|
+
width = monitor.width
|
30
|
+
height = monitor.height
|
31
|
+
|
32
|
+
# Set the window size to the dimensions of the monitor where it is located
|
21
33
|
self.geometry(f"{width}x{height}")
|
22
34
|
self.title("SpaCr GUI Collection")
|
23
35
|
self.configure(bg='#333333') # Set window background to dark gray
|
@@ -36,7 +48,6 @@ class MainApp(tk.Tk):
|
|
36
48
|
}
|
37
49
|
|
38
50
|
self.additional_gui_apps = {
|
39
|
-
#"Sequencing": (lambda frame: initiate_root(self, 'sequencing'), "Analyze sequencing data."),
|
40
51
|
"Umap": (lambda frame: initiate_root(self, 'umap'), "Generate UMAP embeddings with datapoints represented as images."),
|
41
52
|
"Train Cellpose": (lambda frame: initiate_root(self, 'train_cellpose'), "Train custom Cellpose models."),
|
42
53
|
"ML Analyze": (lambda frame: initiate_root(self, 'ml_analyze'), "Machine learning analysis of data."),
|
@@ -58,32 +69,36 @@ class MainApp(tk.Tk):
|
|
58
69
|
def create_widgets(self):
|
59
70
|
create_menu_bar(self)
|
60
71
|
|
61
|
-
|
62
|
-
self.canvas.grid(row=0, column=0, sticky="nsew")
|
72
|
+
# Use a grid layout for centering
|
63
73
|
self.grid_rowconfigure(0, weight=1)
|
64
74
|
self.grid_columnconfigure(0, weight=1)
|
65
75
|
|
66
|
-
self.content_frame = tk.Frame(self
|
76
|
+
self.content_frame = tk.Frame(self)
|
67
77
|
self.content_frame.grid(row=0, column=0, sticky="nsew")
|
78
|
+
|
79
|
+
# Center the content frame within the window
|
80
|
+
self.content_frame.grid_rowconfigure(0, weight=1)
|
81
|
+
self.content_frame.grid_columnconfigure(0, weight=1)
|
68
82
|
|
69
|
-
self.
|
70
|
-
|
71
|
-
|
83
|
+
self.inner_frame = tk.Frame(self.content_frame)
|
84
|
+
self.inner_frame.grid(row=0, column=0)
|
85
|
+
|
86
|
+
set_dark_style(ttk.Style(), containers=[self.content_frame, self.inner_frame])
|
72
87
|
|
73
88
|
self.create_startup_screen()
|
74
89
|
|
75
90
|
def create_startup_screen(self):
|
76
|
-
self.clear_frame(self.
|
91
|
+
self.clear_frame(self.inner_frame)
|
77
92
|
|
78
|
-
main_buttons_frame = tk.Frame(self.
|
93
|
+
main_buttons_frame = tk.Frame(self.inner_frame)
|
79
94
|
main_buttons_frame.pack(pady=10)
|
80
95
|
set_dark_style(ttk.Style(), containers=[main_buttons_frame])
|
81
96
|
|
82
|
-
additional_buttons_frame = tk.Frame(self.
|
97
|
+
additional_buttons_frame = tk.Frame(self.inner_frame)
|
83
98
|
additional_buttons_frame.pack(pady=10)
|
84
99
|
set_dark_style(ttk.Style(), containers=[additional_buttons_frame])
|
85
100
|
|
86
|
-
description_frame = tk.Frame(self.
|
101
|
+
description_frame = tk.Frame(self.inner_frame, height=70)
|
87
102
|
description_frame.pack(fill=tk.X, pady=10)
|
88
103
|
description_frame.pack_propagate(False)
|
89
104
|
set_dark_style(ttk.Style(), containers=[description_frame])
|
@@ -93,7 +108,7 @@ class MainApp(tk.Tk):
|
|
93
108
|
|
94
109
|
logo_button = spacrButton(main_buttons_frame, text="SpaCr", command=lambda: self.load_app("logo_spacr", initiate_root), icon_name="logo_spacr", size=100, show_text=False)
|
95
110
|
logo_button.grid(row=0, column=0, padx=5, pady=5)
|
96
|
-
self.main_buttons[logo_button] = "SpaCr provides a flexible toolset to extract single-cell images and measurements from high-content cell painting experiments, train deep-learning models to classify cellular/subcellular phenotypes, simulate, and analyze pooled CRISPR-Cas9 imaging screens
|
111
|
+
self.main_buttons[logo_button] = "SpaCr provides a flexible toolset to extract single-cell images and measurements from high-content cell painting experiments, train deep-learning models to classify cellular/subcellular phenotypes, simulate, and analyze pooled CRISPR-Cas9 imaging screens."
|
97
112
|
|
98
113
|
for i, (app_name, app_data) in enumerate(self.main_gui_apps.items()):
|
99
114
|
app_func, app_desc = app_data
|
@@ -127,9 +142,9 @@ class MainApp(tk.Tk):
|
|
127
142
|
self.description_label.update_idletasks()
|
128
143
|
|
129
144
|
def load_app(self, app_name, app_func):
|
130
|
-
self.clear_frame(self.
|
145
|
+
self.clear_frame(self.inner_frame)
|
131
146
|
|
132
|
-
app_frame = tk.Frame(self.
|
147
|
+
app_frame = tk.Frame(self.inner_frame)
|
133
148
|
app_frame.pack(fill=tk.BOTH, expand=True)
|
134
149
|
set_dark_style(ttk.Style(), containers=[app_frame])
|
135
150
|
app_func(app_frame)
|
@@ -144,4 +159,4 @@ def gui_app():
|
|
144
159
|
|
145
160
|
if __name__ == "__main__":
|
146
161
|
set_start_method('spawn', force=True)
|
147
|
-
gui_app()
|
162
|
+
gui_app()
|
spacr/gui_core.py
CHANGED
@@ -841,7 +841,7 @@ def initiate_root(parent, settings_type='mask'):
|
|
841
841
|
from .gui_utils import setup_frame
|
842
842
|
from .settings import descriptions
|
843
843
|
|
844
|
-
uppdate_frequency =
|
844
|
+
uppdate_frequency = 500
|
845
845
|
|
846
846
|
# Start tracemalloc and initialize global variables
|
847
847
|
tracemalloc.start()
|
spacr/gui_utils.py
CHANGED
@@ -574,32 +574,43 @@ def setup_frame(parent_frame):
|
|
574
574
|
size_dict = set_element_size()
|
575
575
|
style_out = set_dark_style(style)
|
576
576
|
|
577
|
-
|
578
|
-
|
579
|
-
|
577
|
+
# Configure the main layout using PanedWindow
|
578
|
+
main_paned = tk.PanedWindow(parent_frame, orient=tk.HORIZONTAL, bg=style_out['bg_color'], bd=0, relief='flat')
|
579
|
+
main_paned.grid(row=0, column=0, sticky="nsew")
|
580
580
|
|
581
|
+
# Allow the main_paned to expand and fill the window
|
581
582
|
parent_frame.grid_rowconfigure(0, weight=1)
|
582
|
-
parent_frame.
|
583
|
-
parent_frame.grid_columnconfigure(0, weight=0)
|
584
|
-
parent_frame.grid_columnconfigure(1, weight=1)
|
583
|
+
parent_frame.grid_columnconfigure(0, weight=1)
|
585
584
|
|
586
|
-
|
587
|
-
|
588
|
-
|
585
|
+
# Create the settings container on the left
|
586
|
+
settings_container = tk.PanedWindow(main_paned, orient=tk.VERTICAL, width=size_dict['settings_width'], bg=style_out['bg_color'], bd=0, relief='flat')
|
587
|
+
main_paned.add(settings_container, minsize=100) # Allow resizing with a minimum size
|
589
588
|
|
590
|
-
#
|
591
|
-
|
592
|
-
|
589
|
+
# Create a right container frame to hold vertical and horizontal containers
|
590
|
+
right_frame = tk.Frame(main_paned, bg=style_out['bg_color'], bd=0, highlightthickness=0, relief='flat')
|
591
|
+
main_paned.add(right_frame, stretch="always")
|
593
592
|
|
594
|
-
|
593
|
+
# Configure the right_frame grid layout
|
594
|
+
right_frame.grid_rowconfigure(0, weight=1) # Vertical container expands
|
595
|
+
right_frame.grid_rowconfigure(1, weight=0) # Horizontal container at bottom
|
596
|
+
right_frame.grid_columnconfigure(0, weight=1)
|
595
597
|
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
598
|
+
# Inside right_frame, add vertical_container at the top
|
599
|
+
vertical_container = tk.PanedWindow(right_frame, orient=tk.VERTICAL, bg=style_out['bg_color'], bd=0, relief='flat')
|
600
|
+
vertical_container.grid(row=0, column=0, sticky="nsew")
|
601
|
+
|
602
|
+
# Add horizontal_container aligned with the bottom of settings_container
|
603
|
+
horizontal_container = tk.PanedWindow(right_frame, orient=tk.HORIZONTAL, height=size_dict['panel_height'], bg=style_out['bg_color'], bd=0, relief='flat')
|
604
|
+
horizontal_container.grid(row=1, column=0, sticky="ew")
|
605
|
+
|
606
|
+
# Example content for settings_container
|
607
|
+
tk.Label(settings_container, text="Settings Container", bg=style_out['bg_color']).pack(fill=tk.BOTH, expand=True)
|
608
|
+
|
609
|
+
set_dark_style(style, parent_frame, [settings_container, vertical_container, horizontal_container, main_paned])
|
600
610
|
|
601
611
|
return parent_frame, vertical_container, horizontal_container, settings_container
|
602
612
|
|
613
|
+
|
603
614
|
def download_hug_dataset(q, vars_dict):
|
604
615
|
dataset_repo_id = "einarolafsson/toxo_mito"
|
605
616
|
settings_repo_id = "einarolafsson/spacr_settings"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: spacr
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.68
|
4
4
|
Summary: Spatial phenotype analysis of crisp screens (SpaCr)
|
5
5
|
Home-page: https://github.com/EinarOlafsson/spacr
|
6
6
|
Author: Einar Birnir Olafsson
|
@@ -13,9 +13,9 @@ Requires-Dist: torch<3.0,>=2.0
|
|
13
13
|
Requires-Dist: torchvision<1.0,>=0.1
|
14
14
|
Requires-Dist: torch-geometric<3.0,>=2.5
|
15
15
|
Requires-Dist: numpy<2.0,>=1.26.4
|
16
|
-
Requires-Dist: pandas<3.0,>=2.2.1
|
17
16
|
Requires-Dist: bottleneck<2.0,>=1.3.6
|
18
17
|
Requires-Dist: numexpr<3.0,>=2.8.4
|
18
|
+
Requires-Dist: pandas<3.0,>=2.2.1
|
19
19
|
Requires-Dist: statsmodels<1.0,>=0.14.1
|
20
20
|
Requires-Dist: scikit-image<1.0,>=0.22.0
|
21
21
|
Requires-Dist: scikit-learn<2.0,>=1.4.1
|
@@ -47,6 +47,9 @@ Requires-Dist: gpustat<2.0,>=1.1.1
|
|
47
47
|
Requires-Dist: pyautogui<1.0,>=0.9.54
|
48
48
|
Requires-Dist: tables<4.0,>=3.8.0
|
49
49
|
Requires-Dist: rapidfuzz<4.0,>=3.9
|
50
|
+
Requires-Dist: importlib-metadata<4.0,>=3.6
|
51
|
+
Requires-Dist: keyring<16.0,>=15.1
|
52
|
+
Requires-Dist: screeninfo<1.0,>=0.8.1
|
50
53
|
Requires-Dist: huggingface-hub<0.25,>=0.24.0
|
51
54
|
Provides-Extra: dev
|
52
55
|
Requires-Dist: pytest<3.11,>=3.9; extra == "dev"
|
@@ -11,10 +11,10 @@ spacr/chris.py,sha256=YlBjSgeZaY8HPy6jkrT_ISAnCMAKVfvCxF0I9eAZLFM,2418
|
|
11
11
|
spacr/core.py,sha256=IDme9j7eeC_49KGaNk_xPOKtpxdcXKMhYtoo3xhjQMM,146502
|
12
12
|
spacr/deep_spacr.py,sha256=a2YewgkQvLV-95NYJAutnojvJmX4S8z_wv6Tb-XIgUI,34484
|
13
13
|
spacr/graph_learning.py,sha256=1tR-ZxvXE3dBz1Saw7BeVFcrsUFu9OlUZeZVifih9eo,13070
|
14
|
-
spacr/gui.py,sha256=
|
15
|
-
spacr/gui_core.py,sha256=
|
14
|
+
spacr/gui.py,sha256=RMg0bgbUpO6JwaWuNVMwuVZ18j4WlER3nW0Eaa0YZ30,7883
|
15
|
+
spacr/gui_core.py,sha256=KAZmk1LHqI2WcB2-QO9De6mHAiDRQMU21nu5948UcF4,38745
|
16
16
|
spacr/gui_elements.py,sha256=7YLyIeK5JFqzevzEruvfQOrfDGOS9ZgD8ZE-dxywp3g,122706
|
17
|
-
spacr/gui_utils.py,sha256=
|
17
|
+
spacr/gui_utils.py,sha256=pq_bmZ527S1j2s6McvqMhHNI05hJycBhHM8GY_jH9Ng,30597
|
18
18
|
spacr/io.py,sha256=ZtVNbEom8X8p_KfsuWw0glGwLg6S0CfwwevDPGdfiSc,117342
|
19
19
|
spacr/logger.py,sha256=7Zqr3TuuOQLWT32gYr2q1qvv7x0a2JhLANmZcnBXAW8,670
|
20
20
|
spacr/measure.py,sha256=4rmzH_a5Y0s1qALVi6YRut3xpnkJXs5vzeTPCEf3QS8,54871
|
@@ -92,9 +92,9 @@ spacr/resources/icons/umap.png,sha256=dOLF3DeLYy9k0nkUybiZMe1wzHQwLJFRmgccppw-8b
|
|
92
92
|
spacr/resources/models/cp/toxo_plaque_cyto_e25000_X1120_Y1120.CP_model,sha256=z8BbHWZPRnE9D_BHO0fBREE85c1vkltDs-incs2ytXQ,26566572
|
93
93
|
spacr/resources/models/cp/toxo_plaque_cyto_e25000_X1120_Y1120.CP_model_settings.csv,sha256=fBAGuL_B8ERVdVizO3BHozTDSbZUh1yFzsYK3wkQN68,420
|
94
94
|
spacr/resources/models/cp/toxo_pv_lumen.CP_model,sha256=2y_CindYhmTvVwBH39SNILF3rI3x9SsRn6qrMxHy3l0,26562451
|
95
|
-
spacr-0.2.
|
96
|
-
spacr-0.2.
|
97
|
-
spacr-0.2.
|
98
|
-
spacr-0.2.
|
99
|
-
spacr-0.2.
|
100
|
-
spacr-0.2.
|
95
|
+
spacr-0.2.68.dist-info/LICENSE,sha256=SR-2MeGc6SCM1UORJYyarSWY_A-JaOMFDj7ReSs9tRM,1083
|
96
|
+
spacr-0.2.68.dist-info/METADATA,sha256=4LBYVSDjugrE-XkXdwP-A9U4QH7QOXMKcBhiv1QGnWM,5408
|
97
|
+
spacr-0.2.68.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
98
|
+
spacr-0.2.68.dist-info/entry_points.txt,sha256=BMC0ql9aNNpv8lUZ8sgDLQMsqaVnX5L535gEhKUP5ho,296
|
99
|
+
spacr-0.2.68.dist-info/top_level.txt,sha256=GJPU8FgwRXGzKeut6JopsSRY2R8T3i9lDgya42tLInY,6
|
100
|
+
spacr-0.2.68.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|