scipion-pyworkflow 3.11.0__py3-none-any.whl → 3.11.2__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.
- pyworkflow/apps/__init__.py +29 -0
- pyworkflow/apps/pw_manager.py +37 -0
- pyworkflow/apps/pw_plot.py +51 -0
- pyworkflow/apps/pw_project.py +130 -0
- pyworkflow/apps/pw_protocol_list.py +143 -0
- pyworkflow/apps/pw_protocol_run.py +51 -0
- pyworkflow/apps/pw_run_tests.py +268 -0
- pyworkflow/apps/pw_schedule_run.py +322 -0
- pyworkflow/apps/pw_sleep.py +37 -0
- pyworkflow/apps/pw_sync_data.py +440 -0
- pyworkflow/apps/pw_viewer.py +78 -0
- pyworkflow/constants.py +1 -1
- pyworkflow/gui/__init__.py +36 -0
- pyworkflow/gui/browser.py +768 -0
- pyworkflow/gui/canvas.py +1190 -0
- pyworkflow/gui/dialog.py +981 -0
- pyworkflow/gui/form.py +2727 -0
- pyworkflow/gui/graph.py +247 -0
- pyworkflow/gui/graph_layout.py +271 -0
- pyworkflow/gui/gui.py +571 -0
- pyworkflow/gui/matplotlib_image.py +233 -0
- pyworkflow/gui/plotter.py +247 -0
- pyworkflow/gui/project/__init__.py +25 -0
- pyworkflow/gui/project/base.py +193 -0
- pyworkflow/gui/project/constants.py +139 -0
- pyworkflow/gui/project/labels.py +205 -0
- pyworkflow/gui/project/project.py +491 -0
- pyworkflow/gui/project/searchprotocol.py +240 -0
- pyworkflow/gui/project/searchrun.py +181 -0
- pyworkflow/gui/project/steps.py +171 -0
- pyworkflow/gui/project/utils.py +332 -0
- pyworkflow/gui/project/variables.py +179 -0
- pyworkflow/gui/project/viewdata.py +472 -0
- pyworkflow/gui/project/viewprojects.py +519 -0
- pyworkflow/gui/project/viewprotocols.py +2141 -0
- pyworkflow/gui/project/viewprotocols_extra.py +562 -0
- pyworkflow/gui/text.py +774 -0
- pyworkflow/gui/tooltip.py +185 -0
- pyworkflow/gui/tree.py +684 -0
- pyworkflow/gui/widgets.py +307 -0
- pyworkflow/mapper/__init__.py +26 -0
- pyworkflow/mapper/mapper.py +226 -0
- pyworkflow/mapper/sqlite.py +1583 -0
- pyworkflow/mapper/sqlite_db.py +145 -0
- pyworkflow/object.py +1 -0
- pyworkflow/plugin.py +4 -4
- pyworkflow/project/__init__.py +31 -0
- pyworkflow/project/config.py +454 -0
- pyworkflow/project/manager.py +180 -0
- pyworkflow/project/project.py +2095 -0
- pyworkflow/project/usage.py +165 -0
- pyworkflow/protocol/__init__.py +38 -0
- pyworkflow/protocol/bibtex.py +48 -0
- pyworkflow/protocol/constants.py +87 -0
- pyworkflow/protocol/executor.py +515 -0
- pyworkflow/protocol/hosts.py +318 -0
- pyworkflow/protocol/launch.py +277 -0
- pyworkflow/protocol/package.py +42 -0
- pyworkflow/protocol/params.py +781 -0
- pyworkflow/protocol/protocol.py +2712 -0
- pyworkflow/resources/protlabels.xcf +0 -0
- pyworkflow/resources/sprites.png +0 -0
- pyworkflow/resources/sprites.xcf +0 -0
- pyworkflow/template.py +1 -1
- pyworkflow/tests/__init__.py +29 -0
- pyworkflow/tests/test_utils.py +25 -0
- pyworkflow/tests/tests.py +342 -0
- pyworkflow/utils/__init__.py +38 -0
- pyworkflow/utils/dataset.py +414 -0
- pyworkflow/utils/echo.py +104 -0
- pyworkflow/utils/graph.py +169 -0
- pyworkflow/utils/log.py +293 -0
- pyworkflow/utils/path.py +528 -0
- pyworkflow/utils/process.py +154 -0
- pyworkflow/utils/profiler.py +92 -0
- pyworkflow/utils/progressbar.py +154 -0
- pyworkflow/utils/properties.py +618 -0
- pyworkflow/utils/reflection.py +129 -0
- pyworkflow/utils/utils.py +880 -0
- pyworkflow/utils/which.py +229 -0
- pyworkflow/webservices/__init__.py +8 -0
- pyworkflow/webservices/config.py +8 -0
- pyworkflow/webservices/notifier.py +152 -0
- pyworkflow/webservices/repository.py +59 -0
- pyworkflow/webservices/workflowhub.py +86 -0
- pyworkflowtests/tests/__init__.py +0 -0
- pyworkflowtests/tests/test_canvas.py +72 -0
- pyworkflowtests/tests/test_domain.py +45 -0
- pyworkflowtests/tests/test_logs.py +74 -0
- pyworkflowtests/tests/test_mappers.py +392 -0
- pyworkflowtests/tests/test_object.py +507 -0
- pyworkflowtests/tests/test_project.py +42 -0
- pyworkflowtests/tests/test_protocol_execution.py +146 -0
- pyworkflowtests/tests/test_protocol_export.py +78 -0
- pyworkflowtests/tests/test_protocol_output.py +158 -0
- pyworkflowtests/tests/test_streaming.py +47 -0
- pyworkflowtests/tests/test_utils.py +210 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/METADATA +2 -2
- scipion_pyworkflow-3.11.2.dist-info/RECORD +162 -0
- scipion_pyworkflow-3.11.0.dist-info/RECORD +0 -71
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/WHEEL +0 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/entry_points.txt +0 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/licenses/LICENSE.txt +0 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
# **************************************************************************
|
2
|
+
# *
|
3
|
+
# * Authors: J.M. De la Rosa Trevin (delarosatrevin@scilifelab.se) [1]
|
4
|
+
# *
|
5
|
+
# * [1] SciLifeLab, Stockholm University
|
6
|
+
# *
|
7
|
+
# * This program is free software: you can redistribute it and/or modify
|
8
|
+
# * it under the terms of the GNU General Public License as published by
|
9
|
+
# * the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# * (at your option) any later version.
|
11
|
+
# *
|
12
|
+
# * This program is distributed in the hope that it will be useful,
|
13
|
+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# * GNU General Public License for more details.
|
16
|
+
# *
|
17
|
+
# * You should have received a copy of the GNU General Public License
|
18
|
+
# * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
# *
|
20
|
+
# * All comments concerning this program package may be sent to the
|
21
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
22
|
+
# *
|
23
|
+
# **************************************************************************
|
24
|
+
"""
|
25
|
+
Tooltip widget, taken from web.
|
26
|
+
"""
|
27
|
+
|
28
|
+
import tkinter as tk
|
29
|
+
|
30
|
+
'''Michael Lange <klappnase (at) freakmail (dot) de>
|
31
|
+
The ToolTip class provides a flexible tooltip widget for Tkinter; it is based on IDLE's ToolTip
|
32
|
+
module which unfortunately seems to be broken (at least the version I saw).
|
33
|
+
INITIALIZATION OPTIONS:
|
34
|
+
anchor : where the text should be positioned inside the widget, must be on of "n", "s", "e", "w", "nw" and so on;
|
35
|
+
default is "center"
|
36
|
+
bd : borderwidth of the widget; default is 1 (NOTE: don't use "borderwidth" here)
|
37
|
+
bg : background color to use for the widget; default is "lightyellow" (NOTE: don't use "background")
|
38
|
+
delay : time in ms that it takes for the widget to appear on the screen when the mouse pointer has
|
39
|
+
entered the parent widget; default is 1500
|
40
|
+
fg : foreground (i.e. text) color to use; default is "black" (NOTE: don't use "foreground")
|
41
|
+
follow_mouse : if set to 1 the tooltip will follow the mouse pointer instead of being displayed
|
42
|
+
outside of the parent widget; this may be useful if you want to use tooltips for
|
43
|
+
large widgets like listboxes or canvases; default is 0
|
44
|
+
font : font to use for the widget; default is system specific
|
45
|
+
justify : how multiple lines of text will be aligned, must be "left", "right" or "center"; default is "left"
|
46
|
+
padx : extra space added to the left and right within the widget; default is 4
|
47
|
+
pady : extra space above and below the text; default is 2
|
48
|
+
relief : one of "flat", "ridge", "groove", "raised", "sunken" or "solid"; default is "solid"
|
49
|
+
state : must be "normal" or "disabled"; if set to "disabled" the tooltip will not appear; default is "normal"
|
50
|
+
text : the text that is displayed inside the widget
|
51
|
+
textvariable : if set to an instance of Tkinter.StringVar() the variable's value will be used as text for the widget
|
52
|
+
width : width of the widget; the default is 0, which means that "wraplength" will be used to limit the widgets width
|
53
|
+
wraplength : limits the number of characters in each line; default is 150
|
54
|
+
|
55
|
+
WIDGET METHODS:
|
56
|
+
configure(**opts) : change one or more of the widget's options as described above; the changes will take effect the
|
57
|
+
next time the tooltip shows up; NOTE: follow_mouse cannot be changed after widget initialization
|
58
|
+
|
59
|
+
Other widget methods that might be useful if you want to subclass ToolTip:
|
60
|
+
enter() : callback when the mouse pointer enters the parent widget
|
61
|
+
leave() : called when the mouse pointer leaves the parent widget
|
62
|
+
motion() : is called when the mouse pointer moves inside the parent widget if follow_mouse is set to 1 and the
|
63
|
+
tooltip has shown up to continually update the coordinates of the tooltip window
|
64
|
+
coords() : calculates the screen coordinates of the tooltip window
|
65
|
+
create_contents() : creates the contents of the tooltip window (by default a Tkinter.Label)
|
66
|
+
'''
|
67
|
+
# Ideas gleaned from PySol
|
68
|
+
|
69
|
+
|
70
|
+
class ToolTip:
|
71
|
+
def __init__(self, master, text='Your text here', delay=1500, **opts):
|
72
|
+
self.master = master
|
73
|
+
self._opts = {'anchor': 'center', 'bd': 1, 'bg': 'lightyellow', 'delay': delay, 'fg': 'black',
|
74
|
+
'follow_mouse': 0, 'font': None, 'justify': 'left', 'padx': 4, 'pady': 2,
|
75
|
+
'relief': 'solid', 'state': 'normal', 'text': text, 'textvariable': None,
|
76
|
+
'width': 0, 'wraplength': 150}
|
77
|
+
self.configure(**opts)
|
78
|
+
self._tipwindow = None
|
79
|
+
self._id = None
|
80
|
+
self._id1 = self.master.bind("<Enter>", self.enter, '+')
|
81
|
+
self._id2 = self.master.bind("<Leave>", self.leave, '+')
|
82
|
+
self._id3 = self.master.bind("<ButtonPress>", self.leave, '+')
|
83
|
+
self._follow_mouse = 0
|
84
|
+
if self._opts['follow_mouse']:
|
85
|
+
self._id4 = self.master.bind("<Motion>", self.motion, '+')
|
86
|
+
self._follow_mouse = 1
|
87
|
+
|
88
|
+
def configure(self, **opts):
|
89
|
+
for key in opts:
|
90
|
+
if key in self._opts:
|
91
|
+
self._opts[key] = opts[key]
|
92
|
+
else:
|
93
|
+
KeyError = 'KeyError: Unknown option: "%s"' % key
|
94
|
+
raise KeyError
|
95
|
+
|
96
|
+
# ----these methods handle the callbacks on "<Enter>", "<Leave>" and "<Motion>"-------------
|
97
|
+
# ----events on the parent widget; override them if you want to change the widget's behavior
|
98
|
+
|
99
|
+
def enter(self, event=None):
|
100
|
+
self._schedule()
|
101
|
+
|
102
|
+
def leave(self, event=None):
|
103
|
+
self._unschedule()
|
104
|
+
self._hide()
|
105
|
+
|
106
|
+
def motion(self, event=None):
|
107
|
+
if self._tipwindow and self._follow_mouse:
|
108
|
+
x, y = self.coords()
|
109
|
+
self._tipwindow.wm_geometry("+%d+%d" % (x, y))
|
110
|
+
|
111
|
+
# ------the methods that do the work:---------------------------------------------------------##
|
112
|
+
|
113
|
+
def _schedule(self):
|
114
|
+
self._unschedule()
|
115
|
+
if self._opts['state'] == 'disabled':
|
116
|
+
return
|
117
|
+
self._id = self.master.after(self._opts['delay'], self._show)
|
118
|
+
|
119
|
+
def _unschedule(self):
|
120
|
+
id = self._id
|
121
|
+
self._id = None
|
122
|
+
if id:
|
123
|
+
self.master.after_cancel(id)
|
124
|
+
|
125
|
+
def _show(self):
|
126
|
+
if self._opts['state'] == 'disabled':
|
127
|
+
self._unschedule()
|
128
|
+
return
|
129
|
+
if not self._tipwindow:
|
130
|
+
self._tipwindow = tw = tk.Toplevel(self.master)
|
131
|
+
# hide the window until we know the geometry
|
132
|
+
tw.withdraw()
|
133
|
+
tw.wm_overrideredirect(1)
|
134
|
+
|
135
|
+
if tw.tk.call("tk", "windowingsystem") == 'aqua':
|
136
|
+
tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w, "help", "none")
|
137
|
+
|
138
|
+
self.create_contents()
|
139
|
+
tw.update_idletasks()
|
140
|
+
x, y = self.coords()
|
141
|
+
tw.wm_geometry("+%d+%d" % (x, y))
|
142
|
+
tw.deiconify()
|
143
|
+
|
144
|
+
def _hide(self):
|
145
|
+
tw = self._tipwindow
|
146
|
+
self._tipwindow = None
|
147
|
+
if tw:
|
148
|
+
tw.destroy()
|
149
|
+
|
150
|
+
##----these methods might be overridden in derived classes:----------------------------------##
|
151
|
+
|
152
|
+
def coords(self):
|
153
|
+
# The tip window must be completely outside the master widget;
|
154
|
+
# otherwise when the mouse enters the tip window we get
|
155
|
+
# a leave event and it disappears, and then we get an enter
|
156
|
+
# event and it reappears, and so on forever :-(
|
157
|
+
# or we take care that the mouse pointer is always outside the tipwindow :-)
|
158
|
+
tw = self._tipwindow
|
159
|
+
twx, twy = tw.winfo_reqwidth(), tw.winfo_reqheight()
|
160
|
+
w, h = tw.winfo_screenwidth(), tw.winfo_screenheight()
|
161
|
+
# calculate the y coordinate:
|
162
|
+
if self._follow_mouse:
|
163
|
+
y = tw.winfo_pointery() + 20
|
164
|
+
# make sure the tipwindow is never outside the screen:
|
165
|
+
if y + twy > h:
|
166
|
+
y = y - twy - 30
|
167
|
+
else:
|
168
|
+
y = self.master.winfo_rooty() + self.master.winfo_height() + 3
|
169
|
+
if y + twy > h:
|
170
|
+
y = self.master.winfo_rooty() - twy - 3
|
171
|
+
# we can use the same x coord in both cases:
|
172
|
+
x = tw.winfo_pointerx() - twx / 2
|
173
|
+
if x < 0:
|
174
|
+
x = 0
|
175
|
+
elif x + twx > w:
|
176
|
+
x = w - twx
|
177
|
+
return x, y
|
178
|
+
|
179
|
+
def create_contents(self):
|
180
|
+
opts = self._opts.copy()
|
181
|
+
for opt in ('delay', 'follow_mouse', 'state'):
|
182
|
+
del opts[opt]
|
183
|
+
label = tk.Label(self._tipwindow, **opts)
|
184
|
+
label.pack()
|
185
|
+
|