scipion-pyworkflow 3.7.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.
Files changed (140) hide show
  1. pyworkflow/__init__.py +33 -0
  2. pyworkflow/apps/__init__.py +29 -0
  3. pyworkflow/apps/pw_manager.py +37 -0
  4. pyworkflow/apps/pw_plot.py +51 -0
  5. pyworkflow/apps/pw_project.py +113 -0
  6. pyworkflow/apps/pw_protocol_list.py +143 -0
  7. pyworkflow/apps/pw_protocol_run.py +51 -0
  8. pyworkflow/apps/pw_run_tests.py +267 -0
  9. pyworkflow/apps/pw_schedule_run.py +322 -0
  10. pyworkflow/apps/pw_sleep.py +37 -0
  11. pyworkflow/apps/pw_sync_data.py +439 -0
  12. pyworkflow/apps/pw_viewer.py +78 -0
  13. pyworkflow/config.py +536 -0
  14. pyworkflow/constants.py +212 -0
  15. pyworkflow/exceptions.py +18 -0
  16. pyworkflow/gui/__init__.py +36 -0
  17. pyworkflow/gui/browser.py +726 -0
  18. pyworkflow/gui/canvas.py +1190 -0
  19. pyworkflow/gui/dialog.py +976 -0
  20. pyworkflow/gui/form.py +2627 -0
  21. pyworkflow/gui/graph.py +247 -0
  22. pyworkflow/gui/graph_layout.py +271 -0
  23. pyworkflow/gui/gui.py +566 -0
  24. pyworkflow/gui/matplotlib_image.py +233 -0
  25. pyworkflow/gui/plotter.py +247 -0
  26. pyworkflow/gui/project/__init__.py +25 -0
  27. pyworkflow/gui/project/base.py +192 -0
  28. pyworkflow/gui/project/constants.py +139 -0
  29. pyworkflow/gui/project/labels.py +205 -0
  30. pyworkflow/gui/project/project.py +484 -0
  31. pyworkflow/gui/project/searchprotocol.py +154 -0
  32. pyworkflow/gui/project/searchrun.py +181 -0
  33. pyworkflow/gui/project/steps.py +166 -0
  34. pyworkflow/gui/project/utils.py +332 -0
  35. pyworkflow/gui/project/variables.py +179 -0
  36. pyworkflow/gui/project/viewdata.py +472 -0
  37. pyworkflow/gui/project/viewprojects.py +510 -0
  38. pyworkflow/gui/project/viewprotocols.py +2093 -0
  39. pyworkflow/gui/project/viewprotocols_extra.py +560 -0
  40. pyworkflow/gui/text.py +771 -0
  41. pyworkflow/gui/tooltip.py +185 -0
  42. pyworkflow/gui/tree.py +684 -0
  43. pyworkflow/gui/widgets.py +307 -0
  44. pyworkflow/mapper/__init__.py +26 -0
  45. pyworkflow/mapper/mapper.py +222 -0
  46. pyworkflow/mapper/sqlite.py +1578 -0
  47. pyworkflow/mapper/sqlite_db.py +145 -0
  48. pyworkflow/object.py +1512 -0
  49. pyworkflow/plugin.py +712 -0
  50. pyworkflow/project/__init__.py +31 -0
  51. pyworkflow/project/config.py +451 -0
  52. pyworkflow/project/manager.py +179 -0
  53. pyworkflow/project/project.py +1990 -0
  54. pyworkflow/project/scripts/clean_projects.py +77 -0
  55. pyworkflow/project/scripts/config.py +92 -0
  56. pyworkflow/project/scripts/create.py +77 -0
  57. pyworkflow/project/scripts/edit_workflow.py +90 -0
  58. pyworkflow/project/scripts/fix_links.py +39 -0
  59. pyworkflow/project/scripts/load.py +87 -0
  60. pyworkflow/project/scripts/refresh.py +83 -0
  61. pyworkflow/project/scripts/schedule.py +111 -0
  62. pyworkflow/project/scripts/stack2volume.py +41 -0
  63. pyworkflow/project/scripts/stop.py +81 -0
  64. pyworkflow/protocol/__init__.py +38 -0
  65. pyworkflow/protocol/bibtex.py +48 -0
  66. pyworkflow/protocol/constants.py +86 -0
  67. pyworkflow/protocol/executor.py +334 -0
  68. pyworkflow/protocol/hosts.py +313 -0
  69. pyworkflow/protocol/launch.py +270 -0
  70. pyworkflow/protocol/package.py +42 -0
  71. pyworkflow/protocol/params.py +744 -0
  72. pyworkflow/protocol/protocol.py +2554 -0
  73. pyworkflow/resources/Imagej.png +0 -0
  74. pyworkflow/resources/chimera.png +0 -0
  75. pyworkflow/resources/fa-exclamation-triangle_alert.png +0 -0
  76. pyworkflow/resources/fa-info-circle_alert.png +0 -0
  77. pyworkflow/resources/fa-search.png +0 -0
  78. pyworkflow/resources/fa-times-circle_alert.png +0 -0
  79. pyworkflow/resources/file_vol.png +0 -0
  80. pyworkflow/resources/loading.gif +0 -0
  81. pyworkflow/resources/no-image128.png +0 -0
  82. pyworkflow/resources/scipion_bn.png +0 -0
  83. pyworkflow/resources/scipion_icon.png +0 -0
  84. pyworkflow/resources/scipion_icon.svg +397 -0
  85. pyworkflow/resources/scipion_icon_proj.png +0 -0
  86. pyworkflow/resources/scipion_icon_projs.png +0 -0
  87. pyworkflow/resources/scipion_icon_prot.png +0 -0
  88. pyworkflow/resources/scipion_logo.png +0 -0
  89. pyworkflow/resources/scipion_logo_normal.png +0 -0
  90. pyworkflow/resources/scipion_logo_small.png +0 -0
  91. pyworkflow/resources/sprites.png +0 -0
  92. pyworkflow/resources/sprites.xcf +0 -0
  93. pyworkflow/resources/wait.gif +0 -0
  94. pyworkflow/template.py +322 -0
  95. pyworkflow/tests/__init__.py +29 -0
  96. pyworkflow/tests/test_utils.py +25 -0
  97. pyworkflow/tests/tests.py +341 -0
  98. pyworkflow/utils/__init__.py +38 -0
  99. pyworkflow/utils/dataset.py +414 -0
  100. pyworkflow/utils/echo.py +104 -0
  101. pyworkflow/utils/graph.py +196 -0
  102. pyworkflow/utils/log.py +284 -0
  103. pyworkflow/utils/path.py +527 -0
  104. pyworkflow/utils/process.py +132 -0
  105. pyworkflow/utils/profiler.py +92 -0
  106. pyworkflow/utils/progressbar.py +154 -0
  107. pyworkflow/utils/properties.py +627 -0
  108. pyworkflow/utils/reflection.py +129 -0
  109. pyworkflow/utils/utils.py +877 -0
  110. pyworkflow/utils/which.py +229 -0
  111. pyworkflow/viewer.py +328 -0
  112. pyworkflow/webservices/__init__.py +8 -0
  113. pyworkflow/webservices/config.py +11 -0
  114. pyworkflow/webservices/notifier.py +162 -0
  115. pyworkflow/webservices/repository.py +59 -0
  116. pyworkflow/webservices/workflowhub.py +74 -0
  117. pyworkflow/wizard.py +64 -0
  118. pyworkflowtests/__init__.py +51 -0
  119. pyworkflowtests/bibtex.py +51 -0
  120. pyworkflowtests/objects.py +830 -0
  121. pyworkflowtests/protocols.py +154 -0
  122. pyworkflowtests/tests/__init__.py +0 -0
  123. pyworkflowtests/tests/test_canvas.py +72 -0
  124. pyworkflowtests/tests/test_domain.py +45 -0
  125. pyworkflowtests/tests/test_logs.py +74 -0
  126. pyworkflowtests/tests/test_mappers.py +392 -0
  127. pyworkflowtests/tests/test_object.py +507 -0
  128. pyworkflowtests/tests/test_project.py +42 -0
  129. pyworkflowtests/tests/test_protocol_execution.py +72 -0
  130. pyworkflowtests/tests/test_protocol_export.py +78 -0
  131. pyworkflowtests/tests/test_protocol_output.py +158 -0
  132. pyworkflowtests/tests/test_streaming.py +47 -0
  133. pyworkflowtests/tests/test_utils.py +210 -0
  134. scipion_pyworkflow-3.7.0.dist-info/LICENSE.txt +674 -0
  135. scipion_pyworkflow-3.7.0.dist-info/METADATA +107 -0
  136. scipion_pyworkflow-3.7.0.dist-info/RECORD +140 -0
  137. scipion_pyworkflow-3.7.0.dist-info/WHEEL +5 -0
  138. scipion_pyworkflow-3.7.0.dist-info/dependency_links.txt +1 -0
  139. scipion_pyworkflow-3.7.0.dist-info/entry_points.txt +5 -0
  140. scipion_pyworkflow-3.7.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,212 @@
1
+ # -*- coding: utf-8 -*-
2
+ # **************************************************************************
3
+ # *
4
+ # * Authors: Scipion team
5
+ # *
6
+ # * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
7
+ # *
8
+ # * This program is free software; you can redistribute it and/or modify
9
+ # * it under the terms of the GNU General Public License as published by
10
+ # * the Free Software Foundation; either version 3 of the License, or
11
+ # * (at your option) any later version.
12
+ # *
13
+ # * This program is distributed in the hope that it will be useful,
14
+ # * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # * GNU General Public License for more details.
17
+ # *
18
+ # * You should have received a copy of the GNU General Public License
19
+ # * along with this program; if not, write to the Free Software
20
+ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21
+ # * 02111-1307 USA
22
+ # *
23
+ # * All comments concerning this program package may be sent to the
24
+ # * e-mail address 'scipion@cnb.csic.es'
25
+ # *
26
+ # **************************************************************************
27
+ """
28
+ This modules contains constants related to Pyworkflow
29
+ """
30
+ from enum import Enum
31
+
32
+ # This variable is useful to determinate the plugins compatibility with the
33
+ # current Scipion core release.
34
+ # This version does not need to change with future scipion releases
35
+ # if plugins are still compatible, so future hot fixes releases or even micros
36
+ # or minor release should not change this CORE_VERSION. Only, when a new release
37
+ # will break existing plugins, this number needs to be incremented.
38
+ CORE_VERSION = '3.0.0'
39
+
40
+ # Versions
41
+ VERSION_1 = '1.0.0'
42
+ VERSION_1_1 = '1.1.0'
43
+ VERSION_1_2 = '1.2.0'
44
+ VERSION_2_0 = '2.0.0'
45
+ VERSION_3_0 = '3.7.0'
46
+
47
+ # For a new release, define a new constant and assign it to LAST_VERSION
48
+ # The existing one has to be added to OLD_VERSIONS list.
49
+ LAST_VERSION = VERSION_3_0
50
+ OLD_VERSIONS = (VERSION_1, VERSION_1_1, VERSION_1_2, VERSION_2_0)
51
+
52
+ # STATUS
53
+ PROD = 0
54
+ BETA = 1
55
+ NEW = 2
56
+ UPDATED = 3
57
+
58
+ # Dir names
59
+ APPS = 'apps'
60
+ DATA_TAG = 'data'
61
+
62
+ # Scripts
63
+ PW_SYNC_DATA = 'pw_sync_data.py'
64
+ PW_SCHEDULE_RUN = 'pw_schedule_run.py'
65
+ PW_RUN_TESTS = 'pw_run_tests.py'
66
+ PW_VIEWER = 'pw_viewer.py'
67
+
68
+ # PW Config
69
+ SCIPION_PYTHON = 'SCIPION_PYTHON'
70
+ SCIPION_PYTHON_DEFAULT = 'python3'
71
+ SCIPION_HOME_VAR = 'SCIPION_HOME'
72
+ SCIPION_TESTS = 'SCIPION_TESTS'
73
+ SCIPION_SCRATCH = 'SCIPION_SCRATCH'
74
+
75
+ # FONT
76
+ SCIPION_DEFAULT_FONT_SIZE = 10
77
+
78
+ # NOTES CONSTANTS
79
+ SCIPION_NOTES_FILE = 'SCIPION_NOTES_FILE'
80
+ SCIPION_NOTES_FILE_DEFAULT = 'notes.txt'
81
+ SCIPION_NOTES_PROGRAM = 'SCIPION_NOTES_PROGRAM'
82
+ SCIPION_NOTES_ARGS = 'SCIPION_NOTES_ARGS'
83
+ SCIPION_NOTES_HEADING_MSG = \
84
+ '############################################ SCIPION NOTES ##############################################' \
85
+ '\n\nThis document can be used to store your notes within your project from Scipion framework.\n\n' \
86
+ 'Scipion notes behaviour can be managed in the Scipion config file by creating or editing, if they\n' \
87
+ 'already exist, the following variables:\n\n' \
88
+ '\t-%s is used to store the file name (default is %s)\n' \
89
+ '\t-%s is used to select the program which will be used to open the notes file. If \n' \
90
+ '\t empty, it will use the default program used by your OS to open that type of file.\n' \
91
+ '\t-%s is used to add input arguments that will be used in the calling of the program\n' \
92
+ '\t specified in %s.\n\n' \
93
+ 'These lines can be removed if desired.\n\n' \
94
+ '###########################################################################################################' \
95
+ '\n\nPROJECT NOTES:' % (SCIPION_NOTES_FILE, SCIPION_NOTES_FILE_DEFAULT,
96
+ SCIPION_NOTES_PROGRAM, SCIPION_NOTES_ARGS,
97
+ SCIPION_NOTES_PROGRAM)
98
+
99
+ SCIPION_DOMAIN = 'SCIPION_DOMAIN'
100
+
101
+ # Text editor:
102
+ SCIPION_TEXT_EDITOR = 'SCIPION_TEXT_EDITOR'
103
+
104
+ # Debug constants
105
+ SCIPION_DEBUG = 'SCIPION_DEBUG'
106
+ SCIPION_JSON_TEMPLATES = '.json.template'
107
+ SCIPION_DEBUG_NOCLEAN = 'SCIPION_DEBUG_NOCLEAN'
108
+ SCIPION_DEBUG_SQLITE = 'SCIPION_DEBUG_SQLITE'
109
+ SCIPION_LOG_LEVEL = 'SCIPION_LOG_LEVEL'
110
+
111
+ # Color and appearance constants
112
+ TK_GRAY_DEFAULT = '#d9d9d9'
113
+
114
+ # Other
115
+ SCIPION_TESTS_CMD = 'SCIPION_TESTS_CMD'
116
+ CONDA_ACTIVATION_CMD_VAR = 'CONDA_ACTIVATION_CMD'
117
+ VIEWERS = 'VIEWERS'
118
+
119
+ # Results when updating a protocol
120
+ NOT_UPDATED_READ_ONLY = 0
121
+ NOT_UPDATED_UNNECESSARY = 1
122
+ NOT_UPDATED_ERROR = 2
123
+ PROTOCOL_UPDATED = 3
124
+
125
+ # Db names
126
+ PROJECT_DBNAME = 'project.sqlite'
127
+ PROJECT_SETTINGS = 'settings.sqlite'
128
+
129
+ # Python values in str
130
+ FALSE_STR = str(False)
131
+ TRUE_STR = str(True)
132
+ NONE_STR = str(None)
133
+ EMPTY_STR = ""
134
+
135
+ # GUI colors
136
+ class Color:
137
+ RED_COLOR = 'Firebrick' # REMOVE when not used. Red color for background label = #B22222
138
+
139
+ # Color agnostic constants
140
+ MAIN_COLOR = RED_COLOR
141
+ ALT_COLOR = '#EAEBEC' # Light grey for background color in form, protocol, table header and west container
142
+ ALT_COLOR_2 = '#F2F2F2' # Very light grey for odd rows, input background, etc
143
+ ALT_COLOR_DARK= '#6E6E6E' # Very dark grey for project title, tubes, etc
144
+ BG_COLOR = 'white'
145
+
146
+ STATUS_SAVED = '#D9F1FA',
147
+ STATUS_LAUNCHED = '#D9F1FA',
148
+ STATUS_RUNNING = '#FCCE62',
149
+ STATUS_FINISHED = '#D2F5CB',
150
+ STATUS_FAILED = '#F5CCCB',
151
+ STATUS_INTERACTIVE = '#F3F5CB',
152
+ STATUS_ABORTED = '#F5CCCB',
153
+
154
+
155
+
156
+ # Terminal ASCII colors and tkinter map
157
+ # Enum with ascii code colors based on -->https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
158
+ class StrColors(Enum):
159
+ gray = '30'
160
+ red = '31'
161
+ green = '32'
162
+ yellow = '33'
163
+ blue = '34'
164
+ magenta = '35'
165
+ cyan = '36'
166
+ white = '37'
167
+ lightgreen = '92'
168
+
169
+ # Console (and XMIPP) escaped colors, and the related tags that we create
170
+ # with Text.tag_config(). This dict is used in OutputText:addLine()
171
+ ASCII_COLOR_2_TKINTER =\
172
+ {StrColors.gray.value: 'gray',
173
+ StrColors.red.value: 'red',
174
+ StrColors.green.value: 'yellowgreen',
175
+ StrColors.lightgreen.value: 'yellowgreen',
176
+ StrColors.yellow.value: 'yellow',
177
+ StrColors.blue.value: 'blue',
178
+ StrColors.magenta.value: 'magenta',
179
+ StrColors.cyan.value: 'cyan',
180
+ StrColors.white.value: 'white'}
181
+
182
+ class DOCSITEURLS:
183
+ """Documentation site URL useful when exceptions happen and you want to point to some pages"""
184
+ HOME = 'https://scipion-em.github.io/docs/release-3.0.0/'
185
+ DOCS = HOME + 'docs/'
186
+ CONFIG = DOCS + 'scipion-modes/scipion-configuration.html'
187
+ CONFIG_SECTION = CONFIG + '#%s'
188
+ CONTACTUS = 'https://scipion.i2pc.es/contact'
189
+ USER = DOCS + 'user/'
190
+ GUI = USER + 'scipion-gui.html'
191
+ WAIT_FOR = GUI + '#waiting-for-other-protocols'
192
+ PLUGIN_MANAGER = USER + 'plugin-manager.html'
193
+ HOST_CONFIG = DOCS + "scipion-modes/host-configuration.html"
194
+
195
+
196
+ # tkinter bind constants
197
+ class TK:
198
+ LEFT_CLICK = '<Button-1>'
199
+ RETURN = '<Return>'
200
+ ENTER = '<KP_Enter>'
201
+ LEFT_DOUBLE_CLICK = '<Double-1>'
202
+ TREEVIEW_OPEN = '<<TreeviewOpen>>'
203
+ TREEVIEW_CLOSE = '<<TreeviewClose>>'
204
+
205
+
206
+ HELP_DURATION_FORMAT = "Duration format example: 1d 20h 30m 30s --> 1 day 20 hours 30 minutes and 30 seconds"
207
+
208
+ # Run protocol modes
209
+ DEFAULT_EXECUTION_ACTION_ASK = 1
210
+ DEFAULT_EXECUTION_ACTION_SINGLE = 2
211
+ DEFAULT_EXECUTION_ACTION_ALL = 3
212
+
@@ -0,0 +1,18 @@
1
+ """ Module to define pyworkflow exceptions"""
2
+ from pyworkflow import DOCSITEURLS
3
+
4
+
5
+ class PyworkflowException(Exception):
6
+ """Root exception it has an extra attribute url that is meant to provide
7
+ information about the error and how to solve it"""
8
+ def __init__(self, *args, url=DOCSITEURLS.CONTACTUS):
9
+ self._url = url
10
+ super().__init__(*args)
11
+
12
+ def getUrl(self):
13
+ return self._url
14
+
15
+
16
+ class ValidationException(PyworkflowException):
17
+ """ Validation exception"""
18
+ pass
@@ -0,0 +1,36 @@
1
+ # **************************************************************************
2
+ # *
3
+ # * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
4
+ # *
5
+ # * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
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, write to the Free Software
19
+ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20
+ # * 02111-1307 USA
21
+ # *
22
+ # * All comments concerning this program package may be sent to the
23
+ # * e-mail address 'scipion@cnb.csic.es'
24
+ # *
25
+ # **************************************************************************
26
+ from .gui import *
27
+ from .canvas import *
28
+ from .widgets import *
29
+ from .graph import *
30
+ from .graph_layout import *
31
+ from .tree import *
32
+ from .browser import *
33
+ from .text import *
34
+ from .dialog import *
35
+
36
+ from . import tooltip