From 9647607e526434f638a76c1b5f11992017479510 Mon Sep 17 00:00:00 2001 From: Santiago Castro Date: Fri, 5 May 2017 09:08:42 -0300 Subject: [PATCH] Create option in app.py to import and then save the project --- .dockerignore | 3 +++ Dockerfile | 27 +++++++++++++++++++++++++++ app.py | 11 +++++++++++ invesalius/control.py | 6 ++++++ 4 files changed, 47 insertions(+), 0 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..813dadb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git* +.python-version +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a6f39dd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu:16.04 + +RUN apt-get update +RUN apt-get install -y \ + cython \ + python-concurrent.futures \ + python-gdcm \ + python-matplotlib \ + python-nibabel \ + python-numpy \ + python-pil \ + python-psutil \ + python-scipy \ + python-serial \ + python-skimage \ + python-vtk6 \ + python-vtkgdcm \ + python-wxgtk3.0 \ + xvfb # For a virtual X server. + +WORKDIR /usr/local/app + +COPY . . + +RUN python setup.py build_ext --inplace + +RUN Xvfb :10 -ac -screen 0 1024x768x24 & diff --git a/app.py b/app.py index a76ba5f..dd9b2df 100755 --- a/app.py +++ b/app.py @@ -245,6 +245,12 @@ def parse_comand_line(): parser.add_option("-i", "--import", action="store", dest="dicom_dir") + + parser.add_option("-s", "--save", + action="store", + dest="save", + help="To save the project after an import.") + options, args = parser.parse_args() # If debug argument... @@ -256,6 +262,11 @@ def parse_comand_line(): if options.dicom_dir: import_dir = options.dicom_dir Publisher.sendMessage('Import directory', import_dir) + + if options.save: + Publisher.sendMessage('Save project', os.path.abspath(options.save)) + return True + return True # Check if there is a file path somewhere in what the user wrote diff --git a/invesalius/control.py b/invesalius/control.py index 54a4639..f81222b 100644 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -98,6 +98,8 @@ class Controller(): Publisher.subscribe(self.SetBitmapSpacing, 'Set bitmap spacing') + Publisher.subscribe(self.OnSaveProject, 'Save project') + def SetBitmapSpacing(self, pubsub_evt): proj = prj.Project() proj.spacing = pubsub_evt.data @@ -334,6 +336,10 @@ class Controller(): session.OpenProject(filepath) Publisher.sendMessage("Enable state project", True) + def OnSaveProject(self, pubsub_evt): + path = pubsub_evt.data + self.SaveProject(path) + def SaveProject(self, path=None): Publisher.sendMessage('Begin busy cursor') session = ses.Session() -- libgit2 0.21.2