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.
Files changed (104) hide show
  1. pyworkflow/apps/__init__.py +29 -0
  2. pyworkflow/apps/pw_manager.py +37 -0
  3. pyworkflow/apps/pw_plot.py +51 -0
  4. pyworkflow/apps/pw_project.py +130 -0
  5. pyworkflow/apps/pw_protocol_list.py +143 -0
  6. pyworkflow/apps/pw_protocol_run.py +51 -0
  7. pyworkflow/apps/pw_run_tests.py +268 -0
  8. pyworkflow/apps/pw_schedule_run.py +322 -0
  9. pyworkflow/apps/pw_sleep.py +37 -0
  10. pyworkflow/apps/pw_sync_data.py +440 -0
  11. pyworkflow/apps/pw_viewer.py +78 -0
  12. pyworkflow/constants.py +1 -1
  13. pyworkflow/gui/__init__.py +36 -0
  14. pyworkflow/gui/browser.py +768 -0
  15. pyworkflow/gui/canvas.py +1190 -0
  16. pyworkflow/gui/dialog.py +981 -0
  17. pyworkflow/gui/form.py +2727 -0
  18. pyworkflow/gui/graph.py +247 -0
  19. pyworkflow/gui/graph_layout.py +271 -0
  20. pyworkflow/gui/gui.py +571 -0
  21. pyworkflow/gui/matplotlib_image.py +233 -0
  22. pyworkflow/gui/plotter.py +247 -0
  23. pyworkflow/gui/project/__init__.py +25 -0
  24. pyworkflow/gui/project/base.py +193 -0
  25. pyworkflow/gui/project/constants.py +139 -0
  26. pyworkflow/gui/project/labels.py +205 -0
  27. pyworkflow/gui/project/project.py +491 -0
  28. pyworkflow/gui/project/searchprotocol.py +240 -0
  29. pyworkflow/gui/project/searchrun.py +181 -0
  30. pyworkflow/gui/project/steps.py +171 -0
  31. pyworkflow/gui/project/utils.py +332 -0
  32. pyworkflow/gui/project/variables.py +179 -0
  33. pyworkflow/gui/project/viewdata.py +472 -0
  34. pyworkflow/gui/project/viewprojects.py +519 -0
  35. pyworkflow/gui/project/viewprotocols.py +2141 -0
  36. pyworkflow/gui/project/viewprotocols_extra.py +562 -0
  37. pyworkflow/gui/text.py +774 -0
  38. pyworkflow/gui/tooltip.py +185 -0
  39. pyworkflow/gui/tree.py +684 -0
  40. pyworkflow/gui/widgets.py +307 -0
  41. pyworkflow/mapper/__init__.py +26 -0
  42. pyworkflow/mapper/mapper.py +226 -0
  43. pyworkflow/mapper/sqlite.py +1583 -0
  44. pyworkflow/mapper/sqlite_db.py +145 -0
  45. pyworkflow/object.py +1 -0
  46. pyworkflow/plugin.py +4 -4
  47. pyworkflow/project/__init__.py +31 -0
  48. pyworkflow/project/config.py +454 -0
  49. pyworkflow/project/manager.py +180 -0
  50. pyworkflow/project/project.py +2095 -0
  51. pyworkflow/project/usage.py +165 -0
  52. pyworkflow/protocol/__init__.py +38 -0
  53. pyworkflow/protocol/bibtex.py +48 -0
  54. pyworkflow/protocol/constants.py +87 -0
  55. pyworkflow/protocol/executor.py +515 -0
  56. pyworkflow/protocol/hosts.py +318 -0
  57. pyworkflow/protocol/launch.py +277 -0
  58. pyworkflow/protocol/package.py +42 -0
  59. pyworkflow/protocol/params.py +781 -0
  60. pyworkflow/protocol/protocol.py +2712 -0
  61. pyworkflow/resources/protlabels.xcf +0 -0
  62. pyworkflow/resources/sprites.png +0 -0
  63. pyworkflow/resources/sprites.xcf +0 -0
  64. pyworkflow/template.py +1 -1
  65. pyworkflow/tests/__init__.py +29 -0
  66. pyworkflow/tests/test_utils.py +25 -0
  67. pyworkflow/tests/tests.py +342 -0
  68. pyworkflow/utils/__init__.py +38 -0
  69. pyworkflow/utils/dataset.py +414 -0
  70. pyworkflow/utils/echo.py +104 -0
  71. pyworkflow/utils/graph.py +169 -0
  72. pyworkflow/utils/log.py +293 -0
  73. pyworkflow/utils/path.py +528 -0
  74. pyworkflow/utils/process.py +154 -0
  75. pyworkflow/utils/profiler.py +92 -0
  76. pyworkflow/utils/progressbar.py +154 -0
  77. pyworkflow/utils/properties.py +618 -0
  78. pyworkflow/utils/reflection.py +129 -0
  79. pyworkflow/utils/utils.py +880 -0
  80. pyworkflow/utils/which.py +229 -0
  81. pyworkflow/webservices/__init__.py +8 -0
  82. pyworkflow/webservices/config.py +8 -0
  83. pyworkflow/webservices/notifier.py +152 -0
  84. pyworkflow/webservices/repository.py +59 -0
  85. pyworkflow/webservices/workflowhub.py +86 -0
  86. pyworkflowtests/tests/__init__.py +0 -0
  87. pyworkflowtests/tests/test_canvas.py +72 -0
  88. pyworkflowtests/tests/test_domain.py +45 -0
  89. pyworkflowtests/tests/test_logs.py +74 -0
  90. pyworkflowtests/tests/test_mappers.py +392 -0
  91. pyworkflowtests/tests/test_object.py +507 -0
  92. pyworkflowtests/tests/test_project.py +42 -0
  93. pyworkflowtests/tests/test_protocol_execution.py +146 -0
  94. pyworkflowtests/tests/test_protocol_export.py +78 -0
  95. pyworkflowtests/tests/test_protocol_output.py +158 -0
  96. pyworkflowtests/tests/test_streaming.py +47 -0
  97. pyworkflowtests/tests/test_utils.py +210 -0
  98. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/METADATA +2 -2
  99. scipion_pyworkflow-3.11.2.dist-info/RECORD +162 -0
  100. scipion_pyworkflow-3.11.0.dist-info/RECORD +0 -71
  101. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/WHEEL +0 -0
  102. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/entry_points.txt +0 -0
  103. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/licenses/LICENSE.txt +0 -0
  104. {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,618 @@
1
+ # -*- coding: utf-8 -*-
2
+ # **************************************************************************
3
+ # *
4
+ # * Authors: Jose Gutierrez (jose.gutierrez@cnb.csic.es)
5
+ # * Adrian Quintana (aquintana@cnb.csic.es)
6
+ # *
7
+ # * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
8
+ # *
9
+ # * This program is free software; you can redistribute it and/or modify
10
+ # * it under the terms of the GNU General Public License as published by
11
+ # * the Free Software Foundation; either version 3 of the License, or
12
+ # * (at your option) any later version.
13
+ # *
14
+ # * This program is distributed in the hope that it will be useful,
15
+ # * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # * GNU General Public License for more details.
18
+ # *
19
+ # * You should have received a copy of the GNU General Public License
20
+ # * along with this program; if not, write to the Free Software
21
+ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22
+ # * 02111-1307 USA
23
+ # *
24
+ # * All comments concerning this program package may be sent to the
25
+ # * e-mail address 'scipion@cnb.csic.es'
26
+ # *
27
+ # **************************************************************************
28
+ """
29
+ This module defines the text used in the application.
30
+ """
31
+ # NOTE: DO NOT REMOVE UNTIL plugin manager uses Config.SCIPION_MAIN_COLOR and is released
32
+ from pyworkflow.constants import Color, DOCSITEURLS
33
+ from PIL import Image
34
+
35
+ class Message:
36
+ # Example Usage:
37
+ # MyMessage = Message()
38
+ # print MyMessage.label
39
+
40
+ # Header List
41
+ VIEW_PROJECTS = 'Projects'
42
+ VIEW_PROTOCOLS = 'Protocols'
43
+ VIEW_DATA = 'Data'
44
+ VIEW_UPLOAD = 'Upload'
45
+
46
+ # Projects Template
47
+ LABEL_PROJECTS = 'Projects'
48
+ LABEL_CREATE_PROJECT = 'Create Project'
49
+ LABEL_IMPORT_PROJECT = 'Import project'
50
+ TITLE_CREATE_PROJECT = 'Enter the project name'
51
+ TITLE_CREATE_PROJECT_NAME = 'Project Name: '
52
+ TITLE_EDIT_OBJECT = 'Edit Object properties'
53
+ MESSAGE_DELETE_PROJECT = 'This will *delete* the project and all its *data*. Are you sure?'
54
+ LABEL_DELETE_PROJECT = '[Delete]'
55
+ TITLE_DELETE_PROJECT = 'Confirm project deletion'
56
+ LABEL_RENAME_PROJECT = '[Rename]'
57
+ TITLE_RENAME_PROJECT = 'Confirm project renaming'
58
+ LABEL_CREATED = 'Created: '
59
+ LABEL_MODIFIED = 'Modified: '
60
+
61
+ # Project Content Template
62
+ LABEL_PROJECT = 'Project '
63
+
64
+ # -- Protocol Treeview --
65
+ LABEL_WORKFLOW = 'Workflow View: '
66
+ LABEL_PROTTREE_NONE = 'None'
67
+
68
+ # -- Toolbar --
69
+ LABEL_NEW = 'Add'
70
+ LABEL_EDIT = 'Edit'
71
+ LABEL_RENAME = 'Rename '
72
+ LABEL_COPY = 'Copy'
73
+ LABEL_PASTE = 'Paste'
74
+ LABEL_DUPLICATE = 'Duplicate'
75
+ LABEL_DELETE = 'Delete'
76
+ LABEL_STEPS = 'Steps'
77
+ LABEL_BROWSE = 'Browse'
78
+ LABEL_DB = 'Db'
79
+ LABEL_STOP = 'Stop'
80
+ LABEL_ANALYZE = 'Analyze results'
81
+ LABEL_TREE = 'Tree'
82
+ LABEL_SMALLTREE = 'Small Tree'
83
+ LABEL_REFRESH = 'Refresh'
84
+ LABEL_DEFAULT = 'Default'
85
+ LABEL_CONTINUE = 'Continue'
86
+ LABEL_EXPORT = 'Export'
87
+ LABEL_EXPORT_UPLOAD = 'Export & upload'
88
+ LABEL_RESTART_WORKFLOW = 'Restart all'
89
+ LABEL_CONTINUE_WORKFLOW = 'Continue all'
90
+ LABEL_STOP_WORKFLOW = 'Stop from'
91
+ LABEL_RESET_WORKFLOW = 'Reset from'
92
+
93
+ # -- Tabs --
94
+ LABEL_DATA = 'Data'
95
+ LABEL_SUMMARY = 'Summary'
96
+ LABEL_INPUT = 'Input'
97
+ LABEL_OUTPUT = 'Output'
98
+ LABEL_COMMENT = 'Comments'
99
+
100
+ LABEL_OBJSUMMARY = 'Object Summary'
101
+ LABEL_OBJINFO = 'Info'
102
+ LABEL_OBJCREATED = 'Created'
103
+ LABEL_OBJLABEL = 'Label'
104
+
105
+ LABEL_METHODS = 'Methods'
106
+ LABEL_BIB_BTN = 'Export references'
107
+ LABEL_LOGS = 'Output Logs'
108
+ LABEL_LOGS_OUTPUT = 'Output Log'
109
+ LABEL_LOGS_ERROR = 'Error Log'
110
+ LABEL_LOGS_SCIPION = 'Project Log'
111
+
112
+ NO_INFO_SUMMARY = 'No summary information.'
113
+ NO_INFO_METHODS = 'No methods information.'
114
+ NO_INFO_LOGS = 'No logs information.'
115
+ NO_SAVE_SETTINGS = 'Error trying to save settings.'
116
+
117
+ # ------- Protocol Form messages ----------
118
+ LABEL_CITE = 'Cite'
119
+ LABEL_HELP = 'Help'
120
+ TEXT_HELP = 'The file selected will be uploaded to the project folder. If the file was uploaded before, it will be replaced.'
121
+ LABEL_RUNNAME = 'Run name'
122
+ LABEL_EXECUTION = 'Run mode'
123
+ LABEL_RUNMODE = 'Mode'
124
+ LABEL_PARALLEL = 'Program compute'
125
+ LABEL_HOST = 'Host'
126
+ LABEL_QUEUE = 'Use a queue engine?'
127
+
128
+ LABEL_WAIT_FOR = 'Wait for'
129
+
130
+ LABEL_EXPERT = 'Expert Level'
131
+ LABEL_EXPERT_NORMAL = 'Normal'
132
+ LABEL_EXPERT_ADVANCE = 'Advanced'
133
+ LABEL_EXPERT_EXPERT = 'Expert'
134
+
135
+ HELP_RUNMODE = """
136
+ Normally, each protocol is composed of several atomic steps.
137
+ Each step could be computationally intensive, that's why
138
+ the *Continue* execution mode will try to continue from the
139
+ last completed step. On the other hand, the *Restart* mode
140
+ will clean the whole run directory and start from scratch.
141
+ """
142
+
143
+ HELP_PARALLEL_HEADER = 'Define the number of processors to be used in the execution.\nCheck %s for more detailed info.\n\n' % DOCSITEURLS.THREADS_MPIS_AND_GPUS
144
+
145
+ HELP_USEQUEUE = """
146
+ Click Yes if you want to send this execution to a queue engine like Slurm, Torque, ...
147
+ The queue commands to launch and stop jobs should be configured at
148
+ _%s_ file.
149
+
150
+ See %s for more information.
151
+ """
152
+ HELP_USEQUEUEPERJOB = """
153
+ Click *Yes* if you want to submit the multiple jobs per protocol to a Queue system.
154
+ The queue commands for launch and stop jobs should be configured
155
+ for the current host in the _hosts.conf_ file.
156
+ """
157
+
158
+ HELP_WAIT_FOR = """
159
+ Specify a comma separated list of protocol IDs if you want
160
+ to *schedule* this protocol and wait for those protocols to finish before
161
+ starting this one.
162
+
163
+ This function will allow you to "schedule" many
164
+ runs that will be executed after each other.
165
+
166
+ See %s for more information.
167
+ """
168
+
169
+ TITLE_NAME_RUN = ' Protocol Run: '
170
+ TITLE_RUN = 'Run'
171
+ TITLE_LABEL = 'Label'
172
+ LABEL_OPT_COMMENT = 'Describe your run here...'
173
+ TITLE_COMMENT = 'Comment'
174
+ LABEL_RUN_MODE_RESUME = 'resume'
175
+ LABEL_RUN_MODE_RESTART = 'restart'
176
+ TITLE_EXEC = 'Execution'
177
+ TITLE_BROWSE_DATA = 'Protocol data'
178
+ LABEL_QUEUE_YES = 'Yes'
179
+ LABEL_QUEUE_NO = 'No'
180
+ LABEL_PARAM_YES = 'Yes'
181
+ LABEL_PARAM_NO = 'No'
182
+ LABEL_BUTTON_CLOSE = 'Close'
183
+ LABEL_BUTTON_SAVE = 'Save'
184
+ LABEL_BUTTON_EXEC = 'Execute'
185
+ LABEL_BUTTON_VIS = 'Visualize'
186
+ LABEL_BUTTON_WIZ = 'Wizard'
187
+ LABEL_BUTTON_HELP = 'Help'
188
+ LABEL_BUTTON_RETURN = 'Save'
189
+ # VARS
190
+ VAR_EXEC_HOST = 'hostName'
191
+ VAR_EXPERT = 'expertLevel'
192
+ VAR_MPI = 'numberOfMpi'
193
+ VAR_QUEUE = '_useQueue'
194
+ VAR_RUN_NAME = 'runName'
195
+ VAR_COMMENT = 'comment'
196
+ VAR_RUN_MODE = 'runMode'
197
+ VAR_THREADS = 'numberOfThreads'
198
+
199
+ LABEL_PATTERN = 'Pattern'
200
+ TEXT_PATTERN = """\
201
+ Pattern (that can include wildcards) of the files to import.
202
+ For example:
203
+ *data/particles/***.spi*
204
+ *~/Micrographs/mic/***.mrc*"""
205
+ ERROR_PATTERN_EMPTY = 'The *pattern* cannot be empty.'
206
+ ERROR_PATTERN_FILES = 'There are no files matching the *pattern*'
207
+ LABEL_CHECKSTACK = 'Check stack files?'
208
+ LABEL_COPYFILES = 'Copy files?'
209
+ LABEL_VOLTAGE = 'Microscope voltage (kV)'
210
+ TEXT_VOLTAGE = "Microscope voltage"
211
+ LABEL_SPH_ABERRATION = 'Spherical aberration (mm)'
212
+ TEXT_SPH_ABERRATION = """\
213
+ Optical effect due to the increased refraction of light rays when they
214
+ strike the lens near its edge, in comparison with those that strike near
215
+ the center."""
216
+ LABEL_AMPLITUDE = 'Amplitude Contrast'
217
+ TEXT_AMPLITUDE = """\
218
+ Produced by the loss of amplitude (i.e. electrons) from the beam.
219
+
220
+ For a weak phase and weak amplitude object, the amplitude contrast ratio Qo
221
+ is automatically computed. It should be a positive number, typically between
222
+ 0.05 and 0.3."""
223
+ LABEL_PATTERNU = 'Pattern untilted'
224
+ LABEL_PATTERNT = 'Pattern tilted'
225
+
226
+ LABEL_SAMP_MODE = 'Sampling rate mode'
227
+ TEXT_SAMP_MODE = """\
228
+ You can specify the sampling rate (pixel size) directly from the image
229
+ (A/pixel, Ts) or by specifying the magnification rate (M) and the scanner
230
+ pixel size (microns/pixel, Tm).
231
+
232
+ They are related by Ts = Tm / M"""
233
+ LABEL_SAMP_MODE_1 = 'From image'
234
+ LABEL_SAMP_MODE_2 = 'From scanner'
235
+ LABEL_SAMP_RATE = 'Pixel size (sampling rate) Å/px'
236
+ TEXT_SAMP_RATE = "Pixel size"
237
+ LABEL_MAGNI_RATE = 'Magnification rate'
238
+ TEXT_MAGNI_RATE = """\
239
+ Electron optical magnification (M). It can be used to compute the Image Pixel
240
+ Size ("Sampling Rate") (Ts) using the Scanner Pixel Size (Tm), Ts = Tm / M."""
241
+ LABEL_SCANNED = 'Scanned pixel size (microns/px)'
242
+
243
+ ERROR_IMPORT_VOL = 'importVolumes: There are no filePaths matching the pattern'
244
+
245
+ LABEL_CTF_ESTI = 'CTF Estimation'
246
+ LABEL_INPUT_MIC = 'Input Micrographs'
247
+ LABEL_INPUT_PART = 'Input Particles'
248
+ LABEL_INPUT_VOLS = 'Input Volumes'
249
+ LABEL_INPUT_MOVS = 'Input Movies'
250
+ LABEL_ALIG_PART = 'Write aligned particles?'
251
+ TEXT_ALIG_PART = 'If set to *Yes*, the alignment will be applied to \n'+'input particles and a new aligned set will be created.'
252
+
253
+ TEXT_NO_INPUT_MIC = 'No *Input Micrographs* selected.'
254
+ TEXT_NO_CTF_READY = 'CTF of *Input Micrographs* not ready yet.'
255
+ TEXT_NO_OUTPUT_CO = 'Output coordinates not ready yet.'
256
+ ERROR_NO_EST_CTF = '_estimateCTF should be implemented'
257
+ TEXT_NO_OUTPUT_FILES = 'No output file produced'
258
+
259
+ TITLE_LAUNCHED = 'Success'
260
+ LABEL_LAUNCHED = 'The protocol was launched successfully.'
261
+ LABEL_FOUND_ERROR = 'Errors found'
262
+ TITLE_SAVED_FORM = 'Success'
263
+ LABEL_SAVED_FORM = 'The protocol was saved successfully.'
264
+ TITLE_DELETE_FORM = 'Confirm DELETE'
265
+ TITLE_RESTART_FORM = 'Confirm RESTART'
266
+ TITLE_CONTINUE_FORM = 'Confirm CONTINUE'
267
+ LABEL_DELETE_FORM = """
268
+ You are going to *DELETE* the run(s):
269
+ - %s
270
+ *ALL DATA* related will be permanently removed.
271
+
272
+ Do you really want to continue?'
273
+ """
274
+ MESSAGE_RESTART_FORM = """
275
+ You are going to *RESTART* the run:
276
+ %s
277
+
278
+ Do you really want to restart it?
279
+ """
280
+ MESSAGE_CONTINUE_FORM = """
281
+ You are going to *CONTINUE* the run:
282
+ %s
283
+
284
+ Do you really want to continue it?
285
+ """
286
+
287
+ MESSAGE_RESTART_WORKFLOW_WITH_RESULTS = """
288
+ All previous results of the following protocols will be deleted:
289
+ %s
290
+
291
+ Do you really want to *RESTART* the workflow?'
292
+ """
293
+
294
+ MESSAGE_CONTINUE_WORKFLOW_WITH_RESULTS = """
295
+ All previous results of the following protocols will be affected:
296
+ %s
297
+
298
+ Do you really want to *CONTINUE* the workflow?
299
+ """
300
+
301
+ MESSAGE_ASK_SINGLE_ALL = """
302
+ What do you want to do?
303
+
304
+ *Single* : Just this protocol.
305
+ *All*: All above listed protocols will be launched.
306
+ """
307
+
308
+
309
+ TITLE_STOP_FORM = 'Confirm STOP'
310
+ LABEL_STOP_FORM = 'Do you really want to *STOP* this run?'
311
+
312
+ NO_VIEWER_FOUND = 'There is no viewer for protocol:'
313
+
314
+ TITLE_SAVE_OUTPUT = 'Save protocol output'
315
+ LABEL_SAVE_OUTPUT = 'Do you wish to save protocol output?'
316
+
317
+ TITLE_RESTART_WORKFLOW_FORM = 'Confirm RESTART workflow'
318
+ TITLE_CONTINUE_WORKFLOW_FORM = 'Confirm CONTINUE workflow'
319
+ TITLE_STOP_WORKFLOW_FORM = 'Confirm STOP'
320
+ TITLE_RESET_WORKFLOW_FORM = 'Confirm RESET'
321
+ MESSAGE_RESTART_WORKFLOW = 'Do you really want to *RESTART* this workflow?'
322
+ MESSAGE_CONTINUE_WORKFLOW = 'Do you really want to *CONTINUE* this workflow?'
323
+ TITLE_STOP_WORKFLOW = 'Do you really want to *STOP* this Workflow?'
324
+ TITLE_RESET_WORKFLOW = 'Do you really want to *RESET* this Workflow?'
325
+ TITLE_LAUNCHED_WORKFLOW_FAILED_FORM = 'Error while launching the workflow'
326
+ TITLE_STOPPED_WORKFLOW_FAILED = 'Error while stopping the workflow'
327
+ TITLE_RESETED_WORKFLOW_FAILED = 'Error while resetting the workflow'
328
+ TITLE_LAUNCHED_WORKFLOW_FAILED = 'The workflow can not be relaunched from this protocol.\n'
329
+ TITLE_ACTIVE_PROTOCOLS = 'The following protocols are active:'
330
+
331
+ # SHOWJ_WEB
332
+ SHOWJ_TITLE = 'Showj'
333
+
334
+ LABEL_RESLICE = 'Reslice'
335
+ RESLICE_Z_NEGATIVE = 'Z Negative (Front)'
336
+ RESLICE_Y_NEGATIVE = 'Y Negative (Top)'
337
+ RESLICE_Y_POSITIVE = 'Y Positive (Bottom)'
338
+ RESLICE_X_NEGATIVE = 'X Negative (Left)'
339
+ RESLICE_X_POSITIVE = 'X Positive (Right)'
340
+
341
+ LABEL_COLS = 'Cols'
342
+ LABEL_ROWS = 'Rows'
343
+
344
+ LABEL_MIRRORY = 'Invert Y Axis'
345
+ LABEL_APPLY_TRANSFORM = 'Apply Transform Matrix'
346
+ LABEL_ONLY_SHIFTS = 'Only Shifts'
347
+ LABEL_WRAP = 'Wrap'
348
+
349
+ LABEL_BLOCK_SELECTION = 'Select Block'
350
+ LABEL_LABEL_SELECTION = 'Select Label'
351
+ LABEL_VOLUME_SELECTION = 'Select Volume'
352
+
353
+ LABEL_ENABLE = 'Enable'
354
+ LABEL_DISABLE = 'Disable'
355
+ LABEL_SELECT_ALL = 'Select all'
356
+ LABEL_SELECT_FROM = 'Select from'
357
+ LABEL_SELECT_TO = 'Select to'
358
+
359
+ LABEL_DISPLAY_TABLE_CONFIG = 'Display Table Configuration'
360
+
361
+ LABEL_LABEL = 'Label'
362
+ LABEL_VISIBLE = 'Visible'
363
+ LABEL_RENDER = 'Render'
364
+
365
+ LABEL_BUTTON_OK = 'Ok'
366
+ LABEL_BUTTON_CANCEL = 'Cancel'
367
+
368
+ LABEL_THRESHOLD = 'Threshold:'
369
+
370
+ ERROR_DIMENSIONS = 'Incorrect table width or height: '
371
+ ERROR_WEBGL = 'Your web browser does not support or is not configured for WebGL. See [[http://get.webgl.org/][WebGL Support]] for more information.'
372
+
373
+ TOOLTIP_SEARCH = 'Search for a given world in the text. '
374
+ TOOLTIP_SEARCH_NEXT = 'Move to the next highlighted item. Also, press <Down> or <F3>'
375
+ TOOLTIP_SEARCH_PREVIOUS = 'Move to the previous highlighted item. Also, press <Up> or <Shift-F3>'
376
+ TOOLTIP_REFRESH = 'Reload the content of the files in the viewer. '
377
+ TOOLTIP_EXTERNAL = 'Open the viewer in an external window. '
378
+
379
+ TITLE_PICK_GAUSS = 'Automatic gaussian picking'
380
+ LABEL_PICK_GAUSS = 'Do you wish to perform an automatic gaussian picking for the remaining micrographs?'
381
+
382
+ TITLE_INSPECTOR = 'Objects inspector'
383
+ LABEL_INSPECTOR = 'Objects inspector will inspect the whole project. ' \
384
+ 'Thus, it can take a while depending on the size of the project.\n' \
385
+ 'Do you want to continue?'
386
+ EXECUTE_PLUGINS_MANAGER_OPERATION = 'Execute all selected operations'
387
+ CANCEL_SELECTED_OPERATION = 'Cancel a selected operation'
388
+
389
+
390
+ # PLUGIN/BINARY STATES
391
+ class PluginStates:
392
+ PLUGIN = 'plugin'
393
+ BINARY = 'binary'
394
+ UNCHECKED = 'unchecked'
395
+ CHECKED = 'checked'
396
+ INSTALL = 'install'
397
+ UNINSTALL = 'uninstall'
398
+ TO_INSTALL = 'to_install'
399
+ INSTALLED = 'installed'
400
+ PRECESSING = 'processing'
401
+ FAILURE = 'failure'
402
+ AVAILABLE_RELEASE = 'available_release'
403
+ TO_UPDATE = 'to_update'
404
+ SUCCESS = 'success'
405
+ ERRORS = 'errors'
406
+ WAITING = 'waiting'
407
+
408
+
409
+ class PluginInformation:
410
+ PLUGIN_URL = 'pluginURL'
411
+ PLUGIN_NAME = 'pluginName'
412
+ PLUGIN_VERSION = 'pluginVersion'
413
+ PLUGIN_RELEASE_DATE = 'pluginUploadedDate'
414
+ PLUGIN_DESCRIPTION = 'pluginDescription'
415
+ PLUGIN_AUTHORS = 'pluginAuthor'
416
+
417
+ class SpriteImage:
418
+ def __init__(self, top, left, name, bottom=None, right=None):
419
+ self.top = top
420
+ self.left = left
421
+ self.bottom = bottom if bottom else top+16
422
+ self.right = right if right else left+16
423
+ self.name = name
424
+ def __str__(self):
425
+ return self.name
426
+ def __len__(self):
427
+ return len(self.name)
428
+
429
+ class Sprite:
430
+ _image=None
431
+ # Default width of the sprite to calculate the ratio. For other sprites make sprite file n times bigger
432
+ DEFAULT_WIDTH = 320
433
+ RATIO = None
434
+ "Ratio of the sprite file of the SpriteImage definitions"
435
+
436
+ @classmethod
437
+ def getSpritesFile(cls):
438
+ from pyworkflow import Config
439
+ return Config.getSpritesFile()
440
+ @classmethod
441
+ def loadSprites(cls):
442
+ """ Loads the image of the sprite"""
443
+ if not cls._image:
444
+ cls._image = Image.open(cls.getSpritesFile())
445
+
446
+ from pyworkflow import Config
447
+ # If any zoom to apply
448
+ if Config.SCIPION_ICON_ZOOM != 100:
449
+ factor = Config.SCIPION_ICON_ZOOM/100
450
+ size = cls._image.size
451
+ newSize=size[0] * factor, size[1]* factor
452
+ cls.image = cls._image.thumbnail(newSize)
453
+ width = cls._image.width
454
+ cls.RATIO = width/cls.DEFAULT_WIDTH
455
+ return cls._image
456
+
457
+ @classmethod
458
+ def getImage(cls, sprite:SpriteImage):
459
+ """ Returns the image cut put from the stripe file at the locations define by SpriteImage"""
460
+ sprites = cls.loadSprites()
461
+ return sprites.crop((sprite.left*cls.RATIO, sprite.top*cls.RATIO, sprite.right*cls.RATIO, sprite.bottom*cls.RATIO))
462
+
463
+
464
+ # To get font awesome icons into png use: http://fa2png.io/
465
+ class Icon:
466
+ # Protocols status
467
+ PROT_DISABLED = SpriteImage(16,32, 'prot_disabled.png', bottom=32, right=64)
468
+ BETA = SpriteImage(0, 0, 'beta.png', bottom=16, right=32)
469
+ NEW = SpriteImage(32, 0, 'new.png', bottom=48, right=32)
470
+ PRODUCTION = SpriteImage(32, 32, 'production.png', bottom=48, right=64)
471
+ UPDATED = SpriteImage(16, 0, 'updated.png', bottom=32, right=32)
472
+
473
+ GROUP = SpriteImage(80, 224, 'class_obj.png')
474
+ FAVORITE = SpriteImage(80, 256, 'bookmark.png')
475
+ DEBUG = SpriteImage(64, 288, 'debug.png')
476
+ DOWNLOAD = SpriteImage(48, 272, 'fa-download.png')
477
+ FIND = SpriteImage(80, 272, 'binoculares.png')
478
+ SELECT_ALL = SpriteImage(0, 32, 'workflow.png')
479
+
480
+ # Project window icons
481
+ RUNS_TREE = SpriteImage(16, 272, 'fa-sitemap.png')
482
+ ACTION_NEW = SpriteImage(80, 304, 'fa-plus-circle.png')
483
+ ACTION_EDIT = SpriteImage(32, 272, 'fa-pencil.png')
484
+ ACTION_SELECT_FROM = SpriteImage(64, 272, 'fa-arrow-down.png')
485
+ ACTION_SELECT_TO = SpriteImage(64, 256, 'fa-arrow-up.png')
486
+ ACTION_COPY = SpriteImage(80, 208, 'clipboard-regular.png')
487
+ ACTION_PASTE = SpriteImage(0, 64, 'paste-solid.png')
488
+ ACTION_DUPLICATE = SpriteImage(48, 208, 'fa-files-o.png')
489
+ ACTION_DELETE = SpriteImage(16, 176, 'fa-trash-o.png')
490
+ ACTION_REFRESH = SpriteImage(32, 144, 'fa-refresh.png')
491
+ ACTION_RENAME = SpriteImage(0, 48, 'rename.png')
492
+ ACTION_BROWSE = SpriteImage(32, 304, 'fa-folder-open.png')
493
+ ACTION_DB = SpriteImage(48, 288, 'fa-database.png')
494
+ ACTION_STOP = SpriteImage(16, 256, 'fa-stop.png')
495
+ ACTION_CONTINUE = SpriteImage(32, 256, 'fa-play-circle-o.png')
496
+ ACTION_STOP_WORKFLOW = SpriteImage(16, 240, 'fa-stop-workflow.png')
497
+ ACTION_RESULTS = SpriteImage(48, 240, 'fa-eye.png')
498
+ ACTION_SAVE = SpriteImage(32, 112, 'fa-save.png')
499
+ ACTION_VISUALIZE = ACTION_RESULTS
500
+ ACTION_WIZ = SpriteImage(32, 288, 'fa-magic.png')
501
+ ACTION_HELP = SpriteImage(32, 160, 'fa-question-circle.png')
502
+ ACTION_REFERENCES = SpriteImage(48, 256, 'link')
503
+ ACTION_EXPORT = ACTION_REFERENCES
504
+ ACTION_EXPORT_UPLOAD = SpriteImage(16, 96, 'fa-upload.png')
505
+ ACTION_SEARCH = SpriteImage(32, 96, 'fa-search.png')
506
+ SETTINGS = SpriteImage(48, 304, 'fa-cogs.png')
507
+ ACTION_EXECUTE = SETTINGS
508
+ ACTION_IN = SpriteImage(16, 304, 'fa-sign-in.png')
509
+ ACTION_OUT = SpriteImage(16, 288, 'fa-sign-out.png')
510
+ ACTION_FIND_NEXT = SpriteImage(32, 208, 'fa-next.png')
511
+ ACTION_FIND_PREVIOUS = SpriteImage(32, 192, 'fa-previous.png')
512
+ ACTION_COLLAPSE = SpriteImage(32, 240, 'fa-minus-square.png')
513
+ ACTION_EXPAND = SpriteImage(32, 224, 'fa-plus-square.png')
514
+ ACTION_CIRCLE = SpriteImage(48, 192, 'circle.png')
515
+ ACTION_PICKING = SpriteImage(64, 192, 'picking.png')
516
+ ACTION_STATS = SpriteImage(80, 192, 'stats.png')
517
+ ACTION_ZOOM = SpriteImage(64, 176, 'zoom.png')
518
+ ACTION_HAND = SpriteImage(80, 176, 'hand.png')
519
+ ACTION_FILAMENT_PICKING = SpriteImage(48, 176, 'filament.png')
520
+ ACTION_GRID = SpriteImage(64, 160, 'grid.png')
521
+ ACTION_CONTRAST = SpriteImage(80, 160, 'contrast.png')
522
+ ACTION_INTERPOLATE = SpriteImage(80, 144, 'interpolate.png')
523
+
524
+
525
+ # Host template
526
+ BUTTON_SELECT = SpriteImage(64, 224, 'fa-check.png')
527
+ BUTTON_CANCEL = SpriteImage(64, 240, 'fa-ban.png')
528
+ ACTION_CLOSE = BUTTON_CANCEL
529
+ BUTTON_CLOSE = ACTION_CLOSE
530
+ BUTTON_SAVE = ACTION_SAVE
531
+
532
+ ARROW_UP = ACTION_SELECT_TO
533
+ TAGS = SpriteImage(16, 224, 'fa-tags.png')
534
+ HOME = SpriteImage(0, 304, 'fa-home.png')
535
+ LIGHTBULB = SpriteImage(32, 80, 'fa-lightbulb-o.png')
536
+ ROCKET = SpriteImage(32, 128, 'fa-rocket.png')
537
+
538
+ # File browser icons
539
+ FOLDER_OPEN = ACTION_BROWSE
540
+ DB = SpriteImage(0, 144, 'file_sqlite.png')
541
+ TXT_FILE = SpriteImage(0, 96, 'file_text.png')
542
+ FILE_VOL = SpriteImage(0, 80, 'file_vol.png')
543
+ FILE_STACK = SpriteImage(0, 112, 'file_stack.png')
544
+ FILE_STACK_LINK = SpriteImage(0, 128, 'file_stack_link.png')
545
+ PYTHON_FILE = SpriteImage(0, 160, 'file_python.png')
546
+ FILE_METADATA = SpriteImage(0, 176, 'file_md.png')
547
+ FILE_METADATA_LINK = SpriteImage(0, 192, 'file_md_link.png')
548
+ FILE_IMAGE = SpriteImage(0, 208, 'file_image.png')
549
+ FILE_IMAGE_LINK = SpriteImage(0, 224, 'file_image_link.png')
550
+ FILE = SpriteImage(0, 240, 'file_generic.png')
551
+ FILE_LINK = SpriteImage(0, 256, 'file_generic_link.png')
552
+ FOLDER = SpriteImage(0, 272, 'file_folder.png')
553
+ FOLDER_LINK = SpriteImage(0, 288, 'file_folder_link.png')
554
+
555
+ BROOM = SpriteImage(80, 240, 'broom-solid.png')
556
+ BACKWARD = SpriteImage(80, 288, 'backward-solid.png')
557
+ CODE_BRANCH = SpriteImage(64, 304, 'code-branch-solid.png')
558
+
559
+ # Dialog icons
560
+ ERROR = 'fa-times-circle_alert.png'
561
+ INFO = 'fa-info-circle_alert.png'
562
+ ALERT = 'fa-exclamation-triangle_alert.png'
563
+ NO_IMAGE_128 = 'no-image128.png'
564
+
565
+ SCIPION_ICON = 'scipion_icon.png'
566
+ SCIPION_ICON_PROJ = 'scipion_icon_proj.png'
567
+ SCIPION_ICON_PROJS = 'scipion_icon_projs.png'
568
+ SCIPION_ICON_PROT = 'scipion_icon_prot.png'
569
+ SCIPION_LOGO_SMALL = 'scipion_logo_small.png'
570
+
571
+ # EXTERNAL PROGRAMS
572
+ CHIMERA = 'chimera.png'
573
+
574
+ # PLUGIN MANAGER ICONS
575
+ CHECKED = SpriteImage(64, 208, 'fa-checked.png')
576
+ UNCHECKED = SpriteImage(16, 160, 'fa-unchecked.png')
577
+ INSTALL = SpriteImage(32, 64, 'fa-install.png')
578
+ UNINSTALL = ACTION_CLOSE
579
+ TO_INSTALL = SpriteImage(32, 256, 'fa-to_install.png')
580
+ INSTALLED = SpriteImage(16, 64, 'fa-installed.png')
581
+ PROCESSING = SpriteImage(32, 176, 'fa-processing.png', 48, 192)
582
+ FAILURE = SpriteImage(48, 224, 'fa-failure.png')
583
+ DELETE_OPERATION = ACTION_DELETE
584
+ TO_UPDATE = SpriteImage(32, 144, 'fa-update.png')
585
+ WAITING = 'wait.gif'
586
+ ACTION_UNDO = SpriteImage(16, 144, 'fa-undo.png')
587
+
588
+ PLUGIN_AUTHORS = SpriteImage(16, 80, 'users.png')
589
+ PLUGIN_DESCRIPTION = FILE_STACK
590
+ PLUGIN_RELEASE_DATE = ACTION_EXPORT_UPLOAD
591
+ PLUGIN_VERSION = FILE_VOL
592
+ PLUGIN_PACKAGE = FOLDER
593
+
594
+
595
+ class colorText:
596
+ """printing in colors, bold, etc,
597
+ example: print colorText.BOLD + 'Hello World !' + color.END
598
+ """
599
+ PURPLE = '\033[95m'
600
+ CYAN = '\033[96m'
601
+ DARKCYAN = '\033[36m'
602
+ BLUE = '\033[94m'
603
+ GREEN = '\033[92m'
604
+ YELLOW = '\033[93m'
605
+ RED = '\033[91m'
606
+ BOLD = '\033[1m'
607
+ UNDERLINE = '\033[4m'
608
+ END = '\033[0m'
609
+
610
+
611
+ class KEYSYM:
612
+ """ Keysym values for evaluating key pressed within events
613
+ as reported at http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/key-names.html
614
+ """
615
+ DELETE = 'Delete'
616
+ RETURN = 'Return'
617
+ SHIFT = 'Shift'
618
+ CONTROL = 'Control'