spacr 0.2.5__py3-none-any.whl → 0.2.8__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 +1 -11
- spacr/core.py +226 -287
- spacr/deep_spacr.py +248 -269
- spacr/gui.py +41 -19
- spacr/gui_core.py +404 -151
- spacr/gui_elements.py +778 -179
- spacr/gui_utils.py +163 -106
- spacr/io.py +116 -45
- spacr/measure.py +1 -0
- spacr/plot.py +51 -5
- spacr/sequencing.py +477 -587
- spacr/settings.py +211 -66
- spacr/utils.py +34 -14
- {spacr-0.2.5.dist-info → spacr-0.2.8.dist-info}/METADATA +46 -39
- {spacr-0.2.5.dist-info → spacr-0.2.8.dist-info}/RECORD +19 -19
- {spacr-0.2.5.dist-info → spacr-0.2.8.dist-info}/WHEEL +1 -1
- {spacr-0.2.5.dist-info → spacr-0.2.8.dist-info}/LICENSE +0 -0
- {spacr-0.2.5.dist-info → spacr-0.2.8.dist-info}/entry_points.txt +0 -0
- {spacr-0.2.5.dist-info → spacr-0.2.8.dist-info}/top_level.txt +0 -0
spacr/gui.py
CHANGED
@@ -1,16 +1,35 @@
|
|
1
1
|
import tkinter as tk
|
2
2
|
from tkinter import ttk
|
3
|
-
from PIL import Image, ImageTk, ImageDraw
|
4
|
-
import os
|
5
3
|
from multiprocessing import set_start_method
|
6
4
|
from .gui_elements import spacrButton, create_menu_bar, set_dark_style
|
7
5
|
from .gui_core import initiate_root
|
6
|
+
from screeninfo import get_monitors
|
8
7
|
|
9
8
|
class MainApp(tk.Tk):
|
10
9
|
def __init__(self, default_app=None):
|
11
10
|
super().__init__()
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
# Initialize the window
|
13
|
+
self.geometry("100x100")
|
14
|
+
self.update_idletasks()
|
15
|
+
|
16
|
+
# Get the current window position
|
17
|
+
self.update_idletasks()
|
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
|
14
33
|
self.geometry(f"{width}x{height}")
|
15
34
|
self.title("SpaCr GUI Collection")
|
16
35
|
self.configure(bg='#333333') # Set window background to dark gray
|
@@ -29,7 +48,6 @@ class MainApp(tk.Tk):
|
|
29
48
|
}
|
30
49
|
|
31
50
|
self.additional_gui_apps = {
|
32
|
-
"Sequencing": (lambda frame: initiate_root(self, 'sequencing'), "Analyze sequencing data."),
|
33
51
|
"Umap": (lambda frame: initiate_root(self, 'umap'), "Generate UMAP embeddings with datapoints represented as images."),
|
34
52
|
"Train Cellpose": (lambda frame: initiate_root(self, 'train_cellpose'), "Train custom Cellpose models."),
|
35
53
|
"ML Analyze": (lambda frame: initiate_root(self, 'ml_analyze'), "Machine learning analysis of data."),
|
@@ -51,32 +69,36 @@ class MainApp(tk.Tk):
|
|
51
69
|
def create_widgets(self):
|
52
70
|
create_menu_bar(self)
|
53
71
|
|
54
|
-
|
55
|
-
self.canvas.grid(row=0, column=0, sticky="nsew")
|
72
|
+
# Use a grid layout for centering
|
56
73
|
self.grid_rowconfigure(0, weight=1)
|
57
74
|
self.grid_columnconfigure(0, weight=1)
|
58
75
|
|
59
|
-
self.content_frame = tk.Frame(self
|
76
|
+
self.content_frame = tk.Frame(self)
|
60
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)
|
61
82
|
|
62
|
-
self.
|
63
|
-
|
64
|
-
|
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])
|
65
87
|
|
66
88
|
self.create_startup_screen()
|
67
89
|
|
68
90
|
def create_startup_screen(self):
|
69
|
-
self.clear_frame(self.
|
91
|
+
self.clear_frame(self.inner_frame)
|
70
92
|
|
71
|
-
main_buttons_frame = tk.Frame(self.
|
93
|
+
main_buttons_frame = tk.Frame(self.inner_frame)
|
72
94
|
main_buttons_frame.pack(pady=10)
|
73
95
|
set_dark_style(ttk.Style(), containers=[main_buttons_frame])
|
74
96
|
|
75
|
-
additional_buttons_frame = tk.Frame(self.
|
97
|
+
additional_buttons_frame = tk.Frame(self.inner_frame)
|
76
98
|
additional_buttons_frame.pack(pady=10)
|
77
99
|
set_dark_style(ttk.Style(), containers=[additional_buttons_frame])
|
78
100
|
|
79
|
-
description_frame = tk.Frame(self.
|
101
|
+
description_frame = tk.Frame(self.inner_frame, height=70)
|
80
102
|
description_frame.pack(fill=tk.X, pady=10)
|
81
103
|
description_frame.pack_propagate(False)
|
82
104
|
set_dark_style(ttk.Style(), containers=[description_frame])
|
@@ -86,7 +108,7 @@ class MainApp(tk.Tk):
|
|
86
108
|
|
87
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)
|
88
110
|
logo_button.grid(row=0, column=0, padx=5, pady=5)
|
89
|
-
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."
|
90
112
|
|
91
113
|
for i, (app_name, app_data) in enumerate(self.main_gui_apps.items()):
|
92
114
|
app_func, app_desc = app_data
|
@@ -120,9 +142,9 @@ class MainApp(tk.Tk):
|
|
120
142
|
self.description_label.update_idletasks()
|
121
143
|
|
122
144
|
def load_app(self, app_name, app_func):
|
123
|
-
self.clear_frame(self.
|
145
|
+
self.clear_frame(self.inner_frame)
|
124
146
|
|
125
|
-
app_frame = tk.Frame(self.
|
147
|
+
app_frame = tk.Frame(self.inner_frame)
|
126
148
|
app_frame.pack(fill=tk.BOTH, expand=True)
|
127
149
|
set_dark_style(ttk.Style(), containers=[app_frame])
|
128
150
|
app_func(app_frame)
|
@@ -137,4 +159,4 @@ def gui_app():
|
|
137
159
|
|
138
160
|
if __name__ == "__main__":
|
139
161
|
set_start_method('spawn', force=True)
|
140
|
-
gui_app()
|
162
|
+
gui_app()
|