Commit 360d4cba4c58a78193a9e0196a3366ba207c0e46
1 parent
e6f597e7
Exists in
master
and in
68 other branches
ADD: Open inv3 projects using command line (no tag is needed)
Showing
1 changed file
with
24 additions
and
7 deletions
Show diff stats
invesalius/invesalius.py
1 | +#!/usr/local/bin/python | |
1 | 2 | #-------------------------------------------------------------------------- |
2 | 3 | # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas |
3 | 4 | # Copyright: (C) 2001 Centro de Pesquisas Renato Archer |
... | ... | @@ -38,6 +39,7 @@ import wx.lib.pubsub as ps |
38 | 39 | from gui.frame import Frame |
39 | 40 | from control import Controller |
40 | 41 | from project import Project |
42 | +from session import Session | |
41 | 43 | |
42 | 44 | class InVesalius(wx.App): |
43 | 45 | def OnInit(self): |
... | ... | @@ -59,8 +61,11 @@ def parse_comand_line(): |
59 | 61 | # Add comand line option debug(-d or --debug) to print all pubsub message is |
60 | 62 | # being sent |
61 | 63 | parser.add_option("-d", "--debug", action="store_true", dest="debug") |
62 | - parser.add_option("-i", "--import", action="store", dest="directory") | |
64 | + parser.add_option("-i", "--import", action="store", dest="dicom_dir") | |
65 | + | |
63 | 66 | options, args = parser.parse_args() |
67 | + print "ARRRRRGHs", args | |
68 | + | |
64 | 69 | |
65 | 70 | if options.debug: |
66 | 71 | # The user passed the debug option? |
... | ... | @@ -68,15 +73,27 @@ def parse_comand_line(): |
68 | 73 | # Then all pubsub message must be printed. |
69 | 74 | ps.Publisher().subscribe(print_events, ps.ALL_TOPICS) |
70 | 75 | |
71 | - proj = Project() | |
72 | - proj.debug = 1 | |
76 | + session = Session() | |
77 | + session.debug = 1 | |
73 | 78 | |
74 | - if options.directory: | |
79 | + elif options.dicom_dir: | |
75 | 80 | # The user passed directory to me? |
76 | - import_dir = options.directory | |
81 | + import_dir = options.dicom_dir | |
77 | 82 | ps.Publisher().sendMessage('Import directory', import_dir) |
78 | - else: | |
79 | - print "Hey, guy you must pass a directory to me!" | |
83 | + #print "Hey, guy you must pass a directory to me!" | |
84 | + #else: | |
85 | + # print "Hey, guy, you need to pass a inv3 file to me!" | |
86 | + | |
87 | + # Check if there is a file path somewhere in what the user wrote | |
88 | + i = len(args) | |
89 | + while i: | |
90 | + i -= 1 | |
91 | + file = args[i] | |
92 | + if os.path.isfile(file): | |
93 | + path = os.path.abspath(file) | |
94 | + ps.Publisher().sendMessage('Open project', path) | |
95 | + i = 0 | |
96 | + | |
80 | 97 | |
81 | 98 | def print_events(data): |
82 | 99 | print data.topic | ... | ... |