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.
- pyworkflow/__init__.py +33 -0
- 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 +113 -0
- pyworkflow/apps/pw_protocol_list.py +143 -0
- pyworkflow/apps/pw_protocol_run.py +51 -0
- pyworkflow/apps/pw_run_tests.py +267 -0
- pyworkflow/apps/pw_schedule_run.py +322 -0
- pyworkflow/apps/pw_sleep.py +37 -0
- pyworkflow/apps/pw_sync_data.py +439 -0
- pyworkflow/apps/pw_viewer.py +78 -0
- pyworkflow/config.py +536 -0
- pyworkflow/constants.py +212 -0
- pyworkflow/exceptions.py +18 -0
- pyworkflow/gui/__init__.py +36 -0
- pyworkflow/gui/browser.py +726 -0
- pyworkflow/gui/canvas.py +1190 -0
- pyworkflow/gui/dialog.py +976 -0
- pyworkflow/gui/form.py +2627 -0
- pyworkflow/gui/graph.py +247 -0
- pyworkflow/gui/graph_layout.py +271 -0
- pyworkflow/gui/gui.py +566 -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 +192 -0
- pyworkflow/gui/project/constants.py +139 -0
- pyworkflow/gui/project/labels.py +205 -0
- pyworkflow/gui/project/project.py +484 -0
- pyworkflow/gui/project/searchprotocol.py +154 -0
- pyworkflow/gui/project/searchrun.py +181 -0
- pyworkflow/gui/project/steps.py +166 -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 +510 -0
- pyworkflow/gui/project/viewprotocols.py +2093 -0
- pyworkflow/gui/project/viewprotocols_extra.py +560 -0
- pyworkflow/gui/text.py +771 -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 +222 -0
- pyworkflow/mapper/sqlite.py +1578 -0
- pyworkflow/mapper/sqlite_db.py +145 -0
- pyworkflow/object.py +1512 -0
- pyworkflow/plugin.py +712 -0
- pyworkflow/project/__init__.py +31 -0
- pyworkflow/project/config.py +451 -0
- pyworkflow/project/manager.py +179 -0
- pyworkflow/project/project.py +1990 -0
- pyworkflow/project/scripts/clean_projects.py +77 -0
- pyworkflow/project/scripts/config.py +92 -0
- pyworkflow/project/scripts/create.py +77 -0
- pyworkflow/project/scripts/edit_workflow.py +90 -0
- pyworkflow/project/scripts/fix_links.py +39 -0
- pyworkflow/project/scripts/load.py +87 -0
- pyworkflow/project/scripts/refresh.py +83 -0
- pyworkflow/project/scripts/schedule.py +111 -0
- pyworkflow/project/scripts/stack2volume.py +41 -0
- pyworkflow/project/scripts/stop.py +81 -0
- pyworkflow/protocol/__init__.py +38 -0
- pyworkflow/protocol/bibtex.py +48 -0
- pyworkflow/protocol/constants.py +86 -0
- pyworkflow/protocol/executor.py +334 -0
- pyworkflow/protocol/hosts.py +313 -0
- pyworkflow/protocol/launch.py +270 -0
- pyworkflow/protocol/package.py +42 -0
- pyworkflow/protocol/params.py +744 -0
- pyworkflow/protocol/protocol.py +2554 -0
- pyworkflow/resources/Imagej.png +0 -0
- pyworkflow/resources/chimera.png +0 -0
- pyworkflow/resources/fa-exclamation-triangle_alert.png +0 -0
- pyworkflow/resources/fa-info-circle_alert.png +0 -0
- pyworkflow/resources/fa-search.png +0 -0
- pyworkflow/resources/fa-times-circle_alert.png +0 -0
- pyworkflow/resources/file_vol.png +0 -0
- pyworkflow/resources/loading.gif +0 -0
- pyworkflow/resources/no-image128.png +0 -0
- pyworkflow/resources/scipion_bn.png +0 -0
- pyworkflow/resources/scipion_icon.png +0 -0
- pyworkflow/resources/scipion_icon.svg +397 -0
- pyworkflow/resources/scipion_icon_proj.png +0 -0
- pyworkflow/resources/scipion_icon_projs.png +0 -0
- pyworkflow/resources/scipion_icon_prot.png +0 -0
- pyworkflow/resources/scipion_logo.png +0 -0
- pyworkflow/resources/scipion_logo_normal.png +0 -0
- pyworkflow/resources/scipion_logo_small.png +0 -0
- pyworkflow/resources/sprites.png +0 -0
- pyworkflow/resources/sprites.xcf +0 -0
- pyworkflow/resources/wait.gif +0 -0
- pyworkflow/template.py +322 -0
- pyworkflow/tests/__init__.py +29 -0
- pyworkflow/tests/test_utils.py +25 -0
- pyworkflow/tests/tests.py +341 -0
- pyworkflow/utils/__init__.py +38 -0
- pyworkflow/utils/dataset.py +414 -0
- pyworkflow/utils/echo.py +104 -0
- pyworkflow/utils/graph.py +196 -0
- pyworkflow/utils/log.py +284 -0
- pyworkflow/utils/path.py +527 -0
- pyworkflow/utils/process.py +132 -0
- pyworkflow/utils/profiler.py +92 -0
- pyworkflow/utils/progressbar.py +154 -0
- pyworkflow/utils/properties.py +627 -0
- pyworkflow/utils/reflection.py +129 -0
- pyworkflow/utils/utils.py +877 -0
- pyworkflow/utils/which.py +229 -0
- pyworkflow/viewer.py +328 -0
- pyworkflow/webservices/__init__.py +8 -0
- pyworkflow/webservices/config.py +11 -0
- pyworkflow/webservices/notifier.py +162 -0
- pyworkflow/webservices/repository.py +59 -0
- pyworkflow/webservices/workflowhub.py +74 -0
- pyworkflow/wizard.py +64 -0
- pyworkflowtests/__init__.py +51 -0
- pyworkflowtests/bibtex.py +51 -0
- pyworkflowtests/objects.py +830 -0
- pyworkflowtests/protocols.py +154 -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 +72 -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.7.0.dist-info/LICENSE.txt +674 -0
- scipion_pyworkflow-3.7.0.dist-info/METADATA +107 -0
- scipion_pyworkflow-3.7.0.dist-info/RECORD +140 -0
- scipion_pyworkflow-3.7.0.dist-info/WHEEL +5 -0
- scipion_pyworkflow-3.7.0.dist-info/dependency_links.txt +1 -0
- scipion_pyworkflow-3.7.0.dist-info/entry_points.txt +5 -0
- scipion_pyworkflow-3.7.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,162 @@
|
|
1
|
+
# **************************************************************************
|
2
|
+
# *
|
3
|
+
# * Authors: Roberto Marabini (roberto@cnb.csic.es)
|
4
|
+
# J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
|
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
|
+
|
29
|
+
import os
|
30
|
+
import time
|
31
|
+
import threading
|
32
|
+
import uuid
|
33
|
+
from datetime import timedelta, datetime
|
34
|
+
from urllib.parse import urlencode
|
35
|
+
from urllib.request import build_opener, HTTPHandler
|
36
|
+
|
37
|
+
import pyworkflow
|
38
|
+
import pyworkflow.utils as pwutils
|
39
|
+
from . import config
|
40
|
+
|
41
|
+
|
42
|
+
class ProjectWorkflowNotifier(object):
|
43
|
+
""" Implement different types of notifications about a given
|
44
|
+
project. Currently, the protocols in a workflow will be sent.
|
45
|
+
"""
|
46
|
+
|
47
|
+
def __init__(self, project):
|
48
|
+
self.project = project
|
49
|
+
|
50
|
+
def _getUuidFileName(self):
|
51
|
+
return self.project.getLogPath("uuid.log")
|
52
|
+
|
53
|
+
def _getDataFileName(self, fileName="data.log"):
|
54
|
+
return self.project.getLogPath(fileName)
|
55
|
+
|
56
|
+
def _getUuid(self):
|
57
|
+
# Load (or create if not exits) a file
|
58
|
+
# in the project Logs folder to store an unique
|
59
|
+
# project identifier
|
60
|
+
uuidFn = self._getUuidFileName()
|
61
|
+
try:
|
62
|
+
with open(uuidFn) as f:
|
63
|
+
uuidValue = f.readline()
|
64
|
+
except IOError:
|
65
|
+
uuidValue = str(uuid.uuid4())
|
66
|
+
with open(uuidFn, 'w') as f:
|
67
|
+
f.write(uuidValue)
|
68
|
+
|
69
|
+
return uuidValue
|
70
|
+
|
71
|
+
def _modifiedBefore(self, seconds):
|
72
|
+
""" Return True if the uuid.log file has been modified within a given
|
73
|
+
number of seconds. """
|
74
|
+
uuidFn = self._getUuidFileName()
|
75
|
+
if not os.path.exists(uuidFn):
|
76
|
+
return False
|
77
|
+
mTime = datetime.fromtimestamp(os.path.getmtime(uuidFn))
|
78
|
+
delta = datetime.now() - mTime
|
79
|
+
|
80
|
+
return delta < timedelta(seconds=seconds)
|
81
|
+
|
82
|
+
def _sendData(self, url, dataDict=None):
|
83
|
+
try:
|
84
|
+
# then connect to webserver a send json
|
85
|
+
# set debuglevel=0 for no messages
|
86
|
+
opener = build_opener(HTTPHandler(debuglevel=0))
|
87
|
+
data = urlencode(dataDict).encode()
|
88
|
+
content = opener.open(url, data=data).read()
|
89
|
+
now = time.time()
|
90
|
+
os.utime(self._getUuidFileName(), (now, now))
|
91
|
+
except Exception as e:
|
92
|
+
pass
|
93
|
+
# print("Could not notify, maybe there is not internet connection.")
|
94
|
+
|
95
|
+
def _dataModified(self, projectWorfklow):
|
96
|
+
try:
|
97
|
+
with open(self._getDataFileName()) as f:
|
98
|
+
projectWorfklow2 = f.readline()
|
99
|
+
if projectWorfklow2 == projectWorfklow:
|
100
|
+
return False
|
101
|
+
except IOError:
|
102
|
+
pass
|
103
|
+
return True
|
104
|
+
|
105
|
+
def notifyWorkflow(self):
|
106
|
+
|
107
|
+
try:
|
108
|
+
# check if environment exists otherwise abort
|
109
|
+
if not pyworkflow.Config.SCIPION_NOTIFY:
|
110
|
+
return
|
111
|
+
|
112
|
+
# if project specifies not to send stats
|
113
|
+
if self._isProjectMuted():
|
114
|
+
return
|
115
|
+
# Check the seconds range of the notify, by default one day
|
116
|
+
seconds = int(os.environ.get('SCIPION_NOTIFY_SECONDS', '86400'))
|
117
|
+
|
118
|
+
if self._modifiedBefore(seconds): # notify not more than once a day
|
119
|
+
return
|
120
|
+
|
121
|
+
# INFO: now we are only sending the protocols names in the project.
|
122
|
+
# We could pass namesOnly=False to get the full workflow template
|
123
|
+
projectWorfklow = self.project.getProtocolsJson(namesOnly=True)
|
124
|
+
|
125
|
+
# if list with workflow has not been altered do not sent it
|
126
|
+
if not self._dataModified(projectWorfklow):
|
127
|
+
return
|
128
|
+
else:
|
129
|
+
# For compatibility with version 1.0 check
|
130
|
+
# if Log directory exists. If it does not
|
131
|
+
# create it
|
132
|
+
# TODO: REMOVE this check in scipion 1.3
|
133
|
+
dataFile = self._getDataFileName()
|
134
|
+
# create the folder of the file path if not exists
|
135
|
+
pwutils.makeFilePath(dataFile)
|
136
|
+
with open(dataFile, 'w') as f:
|
137
|
+
f.write(projectWorfklow)
|
138
|
+
dataDict = {'project_uuid': self._getUuid(),
|
139
|
+
'project_workflow': projectWorfklow}
|
140
|
+
|
141
|
+
urlName = os.environ.get('SCIPION_NOTIFY_URL',
|
142
|
+
config.SCIPION_STATS_WORKFLOW_APP).strip()
|
143
|
+
urlName += "addOrUpdateWorkflow/"
|
144
|
+
t = threading.Thread(name="notifier", target=lambda: self._sendData(urlName, dataDict))
|
145
|
+
t.start() # will execute function in a separate thread
|
146
|
+
except Exception as e:
|
147
|
+
print("Can't report usage: ", e)
|
148
|
+
|
149
|
+
def _isProjectMuted(self):
|
150
|
+
""" Projects are muted if they come from tests, Since there is no flag for it
|
151
|
+
we will assume that if the project name starts with Test it will be considered
|
152
|
+
a test and therefore no statistics will be sent"""
|
153
|
+
return os.path.basename(self.project.name).startswith("Test")
|
154
|
+
|
155
|
+
def getEntryFromWebservice(self, uuid):
|
156
|
+
if not pyworkflow.Config.SCIPION_NOTIFY:
|
157
|
+
return
|
158
|
+
urlName = os.environ.get('SCIPION_NOTIFY_URL').strip()
|
159
|
+
# remove last directory
|
160
|
+
urlName = os.path.split(urlName)[0]
|
161
|
+
url = urlName + "/?project_uuid=" + uuid
|
162
|
+
resultDict = self._sendData(url)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import webbrowser
|
2
|
+
import json
|
3
|
+
import requests
|
4
|
+
|
5
|
+
from pyworkflow import CORE_VERSION
|
6
|
+
from . import config
|
7
|
+
|
8
|
+
|
9
|
+
class WorkflowRepository(object):
|
10
|
+
""" Manager to communicate with the workflow repository services.
|
11
|
+
It will provide functions to:
|
12
|
+
- Search workflows (open the url in a browser).
|
13
|
+
- Upload a given workflow json file.
|
14
|
+
"""
|
15
|
+
def __init__(self,
|
16
|
+
repositoryUrl=config.WORKFLOW_REPOSITORY_SERVER,
|
17
|
+
uploadFileSuffix=config.WORKFLOW_PROG_STEP1,
|
18
|
+
uploadMdSuffix=config.WORKFLOW_PROG_STEP2):
|
19
|
+
self._url = repositoryUrl
|
20
|
+
self._uploadFileUrl = repositoryUrl + uploadFileSuffix
|
21
|
+
self._uploadMdUrl = repositoryUrl + uploadMdSuffix
|
22
|
+
|
23
|
+
def search(self):
|
24
|
+
""" Open the repository URL in a web browser. """
|
25
|
+
webbrowser.open(self._url)
|
26
|
+
|
27
|
+
def upload(self, jsonFileName):
|
28
|
+
""" Upload a given workflow providing the path ot the json file.
|
29
|
+
|
30
|
+
First the file is uploaded, then the metadata is uploaded.
|
31
|
+
The script uploads the file and then opens a browser for the metadata
|
32
|
+
Note that the two steps are needed since no initial value can be passed
|
33
|
+
to a file field. poster3 module is needed. Poster3 is pure python
|
34
|
+
so it may be added to the directory rather than installed if needed.
|
35
|
+
|
36
|
+
The server is django a uses filefield and csrf_exempt.
|
37
|
+
csrf_exempt disable csrf checking. filefield
|
38
|
+
"""
|
39
|
+
|
40
|
+
# we are going to upload a file so this is a multipart
|
41
|
+
# connection
|
42
|
+
with open(jsonFileName, "rb") as workflowFile:
|
43
|
+
file_dict = {"json": workflowFile}
|
44
|
+
response = requests.post(self._uploadFileUrl, files=file_dict)
|
45
|
+
|
46
|
+
# server returns a json stored as text at response.text
|
47
|
+
_dict = json.loads(response.text)
|
48
|
+
|
49
|
+
version = CORE_VERSION
|
50
|
+
# version hack end
|
51
|
+
|
52
|
+
fnUrl = "?jsonFileName=%s&versionInit=%s" % (_dict['jsonFileName'],
|
53
|
+
version) # use GET
|
54
|
+
# open browser to fill metadata, fileName will be saved as session
|
55
|
+
# variable. Note that I cannot save the file never in the
|
56
|
+
# session in the first connection because the browser changes
|
57
|
+
# from urlib2 to an actual browser
|
58
|
+
# so sessions are different
|
59
|
+
webbrowser.open(self._uploadMdUrl + fnUrl)
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import json
|
2
|
+
from urllib.request import Request, urlopen
|
3
|
+
from pyworkflow.template import Template
|
4
|
+
|
5
|
+
|
6
|
+
class WHTemplate(Template):
|
7
|
+
|
8
|
+
def __init__(self, source, name, description, url):
|
9
|
+
super().__init__(source, name, description)
|
10
|
+
self.url = url
|
11
|
+
|
12
|
+
def loadContent(self):
|
13
|
+
""" Download the file pointer by url and read the content"""
|
14
|
+
|
15
|
+
return make_request(self.url, asJson=False)
|
16
|
+
|
17
|
+
|
18
|
+
def make_request(url, asJson=True):
|
19
|
+
""" Makes a request to the url and returns the json as a dictionary"""
|
20
|
+
|
21
|
+
req = Request(url)
|
22
|
+
req.add_header("accept", "application/json")
|
23
|
+
|
24
|
+
with urlopen(req, timeout=1) as response:
|
25
|
+
if asJson:
|
26
|
+
data = json.load(response)
|
27
|
+
else:
|
28
|
+
html_response = response.read()
|
29
|
+
encoding = response.headers.get_content_charset('utf-8')
|
30
|
+
data = html_response.decode(encoding)
|
31
|
+
return data
|
32
|
+
|
33
|
+
|
34
|
+
def get_workflow_file_url(workflow_id, version):
|
35
|
+
root_url = "https://workflowhub.eu/workflows/%s/git/%s/" % (workflow_id, version)
|
36
|
+
url = root_url + 'tree'
|
37
|
+
|
38
|
+
result = make_request(url)
|
39
|
+
|
40
|
+
for file in result["tree"]:
|
41
|
+
path = (file["path"])
|
42
|
+
if path.endswith(".json.template"):
|
43
|
+
return root_url + 'raw/' + path
|
44
|
+
|
45
|
+
|
46
|
+
def get_wh_templates(template_id=None, organization="Scipion%20CNB"):
|
47
|
+
""" Returns a list of scipion templates available in workflow hub"""
|
48
|
+
|
49
|
+
url = "https://workflowhub.eu/ga4gh/trs/v2/tools?organization=%s" % organization
|
50
|
+
|
51
|
+
response = make_request(url)
|
52
|
+
|
53
|
+
template_list = []
|
54
|
+
|
55
|
+
for workflow in response:
|
56
|
+
workflow_id = workflow["id"]
|
57
|
+
name = workflow["name"]
|
58
|
+
description = workflow['description']
|
59
|
+
version = workflow["versions"][-1]
|
60
|
+
version_id = version["id"]
|
61
|
+
template_url = get_workflow_file_url(workflow_id, version_id)
|
62
|
+
|
63
|
+
new_template = WHTemplate("Workflow hub", name, description, template_url)
|
64
|
+
if template_id is None or new_template.getObjId() == template_id:
|
65
|
+
template_list.append(new_template)
|
66
|
+
|
67
|
+
return template_list
|
68
|
+
|
69
|
+
|
70
|
+
if __name__ == "__main__":
|
71
|
+
|
72
|
+
templates = get_wh_templates()
|
73
|
+
for template in templates:
|
74
|
+
print(template)
|
pyworkflow/wizard.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# **************************************************************************
|
2
|
+
# *
|
3
|
+
# * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
|
4
|
+
# * Jose Gutierrez (jose.gutierrez@cnb.csic.es)
|
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 module is mainly for the Viewer class, which
|
29
|
+
serve as base for implementing visualization tools(Viewer sub-classes).
|
30
|
+
"""
|
31
|
+
|
32
|
+
DESKTOP_TKINTER = 'tkinter'
|
33
|
+
WEB_DJANGO = 'django'
|
34
|
+
|
35
|
+
|
36
|
+
class Wizard(object):
|
37
|
+
""" This is a special case of GUI to help the user selecting important parameters.
|
38
|
+
|
39
|
+
The _targets attribute is used to define to which parameters the Wizard can deal with.
|
40
|
+
It will be a list of tuples such as::
|
41
|
+
|
42
|
+
_targets = [(DefImportMicrographs, ['voltage', sphericalAberration']), (DefCTFMicrographs, ['lowRes', 'highRes'])]
|
43
|
+
|
44
|
+
"""
|
45
|
+
|
46
|
+
_targets = []
|
47
|
+
_environments = [DESKTOP_TKINTER] # This can be ignored
|
48
|
+
|
49
|
+
def show(self, form, *params):
|
50
|
+
"""
|
51
|
+
EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.
|
52
|
+
|
53
|
+
:param form: the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.
|
54
|
+
:param params: a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.
|
55
|
+
"""
|
56
|
+
pass
|
57
|
+
|
58
|
+
def getView(self):
|
59
|
+
"""
|
60
|
+
EMPTY METHOD. Deprecated.This method should return the string value of the view in web
|
61
|
+
that will respond to this wizard. This method only should be implemented
|
62
|
+
in those wizards that have WEB_DJANGO environment defined.
|
63
|
+
"""
|
64
|
+
return None
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# **************************************************************************
|
3
|
+
# *
|
4
|
+
# * Authors: J.M. De la Rosa Trevin (delarosatrevin@scilifelab.se) [1]
|
5
|
+
# *
|
6
|
+
# * [1] SciLifeLab, Stockholm University
|
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, see <https://www.gnu.org/licenses/>.
|
20
|
+
# *
|
21
|
+
# * All comments concerning this program package may be sent to the
|
22
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
23
|
+
# *
|
24
|
+
# **************************************************************************
|
25
|
+
"""
|
26
|
+
Mock Domain definition that will be used by basic tests.
|
27
|
+
"""
|
28
|
+
|
29
|
+
from pyworkflow.protocol import Protocol
|
30
|
+
from pyworkflow.wizard import Wizard
|
31
|
+
from pyworkflow.viewer import Viewer
|
32
|
+
from pyworkflow.utils import getSubclasses
|
33
|
+
from pyworkflow.plugin import Domain as pwDomain, Plugin as pwPlugin
|
34
|
+
|
35
|
+
from .objects import MockObject
|
36
|
+
|
37
|
+
|
38
|
+
class TestDomain(pwDomain):
|
39
|
+
_name = __name__
|
40
|
+
_objectClass = MockObject
|
41
|
+
_protocolClass = Protocol
|
42
|
+
_viewerClass = Viewer
|
43
|
+
_wizardClass = Wizard
|
44
|
+
_baseClasses = getSubclasses(MockObject, globals())
|
45
|
+
|
46
|
+
|
47
|
+
Domain = TestDomain
|
48
|
+
|
49
|
+
|
50
|
+
class Plugin(pwPlugin):
|
51
|
+
pass
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# coding: latin-1
|
2
|
+
# **************************************************************************
|
3
|
+
# *
|
4
|
+
# * Authors: J.M. De la Rosa Trevin (delarosatrevin@scilifelab.se) [1]
|
5
|
+
# *
|
6
|
+
# * [1] SciLifeLab, Stockholm University
|
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
|
+
|
29
|
+
@article{delaRosaTrevin201693,
|
30
|
+
title = "Scipion: A software framework toward integration, reproducibility and validation in 3D electron microscopy ",
|
31
|
+
journal = "Journal of Structural Biology",
|
32
|
+
volume = "195",
|
33
|
+
number = "1",
|
34
|
+
pages = "93 - 99",
|
35
|
+
year = "2016",
|
36
|
+
note = "",
|
37
|
+
issn = "1047-8477",
|
38
|
+
doi = "http://doi.org/10.1016/j.jsb.2016.04.010",
|
39
|
+
url = "http://www.sciencedirect.com/science/article/pii/S104784771630079X",
|
40
|
+
author = "J.M. de la Rosa-Trev�n and A. Quintana and L. del Cano and A. Zald�var and I. Foche and J. Guti�rrez and
|
41
|
+
J. G�mez-Blanco and J. Burguet-Castell and J. Cuenca-Alba and V. Abrishami and J. Vargas and J. Ot�n and G. Sharov
|
42
|
+
and J.L. Vilas and J. Navas and P. Conesa and M. Kazemi and R. Marabini and C.O.S. Sorzano and J.M. Carazo",
|
43
|
+
keywords = "Electron microscopy",
|
44
|
+
keywords = "Single particle analysis",
|
45
|
+
keywords = "Image processing",
|
46
|
+
keywords = "Software package",
|
47
|
+
keywords = "Workflows",
|
48
|
+
keywords = "Reproducibility "
|
49
|
+
}
|
50
|
+
|
51
|
+
"""
|