Commit b0463caa805f54ff6e78eb9c0331d207b7d092fe
1 parent
e0376d66
Exists in
master
and in
6 other branches
STYLE: Renamed invdir to tempdir
Showing
1 changed file
with
11 additions
and
11 deletions
Show diff stats
invesalius/session.py
... | ... | @@ -37,10 +37,10 @@ class Session(object): |
37 | 37 | |
38 | 38 | # InVesalius default projects' directory |
39 | 39 | homedir = self.homedir = os.path.expanduser('~') |
40 | - invdir = os.path.join(homedir, ".invesalius", "temp") | |
41 | - if not os.path.isdir(invdir): | |
42 | - os.makedirs(invdir) | |
43 | - self.invdir = invdir | |
40 | + tempdir = os.path.join(homedir, ".invesalius", "temp") | |
41 | + if not os.path.isdir(tempdir): | |
42 | + os.makedirs(tempdir) | |
43 | + self.tempdir = tempdir | |
44 | 44 | |
45 | 45 | # GUI language |
46 | 46 | self.language = "" # "pt_BR", "es" |
... | ... | @@ -75,10 +75,10 @@ class Session(object): |
75 | 75 | def CreateProject(self, filename): |
76 | 76 | print "-- CreateProject" |
77 | 77 | # Set session info |
78 | - self.project_path = (self.invdir, filename) | |
78 | + self.project_path = (self.tempdir, filename) | |
79 | 79 | self.project_status = const.PROJ_NEW |
80 | 80 | self.temp_item = True |
81 | - return self.invdir | |
81 | + return self.tempdir | |
82 | 82 | |
83 | 83 | def OpenProject(self, filepath): |
84 | 84 | print "-- OpenProject" |
... | ... | @@ -116,12 +116,12 @@ class Session(object): |
116 | 116 | |
117 | 117 | def SavePlist(self): |
118 | 118 | filename = 'session.conf' |
119 | - filepath = os.join(self.invdir, filename) | |
119 | + filepath = os.join(self.tempdir, filename) | |
120 | 120 | plistlib.writePlist(self.__dict__, filepath) |
121 | 121 | |
122 | 122 | def OpenPlist(self): |
123 | 123 | filename = 'session.conf' |
124 | - filepath = os.join(self.invdir, filename) | |
124 | + filepath = os.join(self.tempdir, filename) | |
125 | 125 | # TODO: try/except |
126 | 126 | dict = plistlib.readPlist(main_plist) |
127 | 127 | for key in dict: |
... | ... | @@ -146,9 +146,9 @@ class Session(object): |
146 | 146 | self.language = config.get('session','language') |
147 | 147 | self.recent_projects = eval(config.get('project','recent_projects')) |
148 | 148 | self.homedir = config.get('paths','homedir') |
149 | - self.invdir = config.get('paths','invdir') | |
149 | + self.tempdir = config.get('paths','tempdir') | |
150 | 150 | return True |
151 | - except(ConfigParser.NoSectionError): | |
151 | + except(ConfigParser.NoSectionError, ConfigParser.NoOptionError): | |
152 | 152 | return False |
153 | 153 | |
154 | 154 | class WriteSession(Thread): |
... | ... | @@ -181,7 +181,7 @@ class WriteSession(Thread): |
181 | 181 | |
182 | 182 | config.add_section('paths') |
183 | 183 | config.set('paths','homedir',self.session.homedir) |
184 | - config.set('paths','invdir',self.session.invdir) | |
184 | + config.set('paths','tempdir',self.session.tempdir) | |
185 | 185 | path = os.path.join(self.session.homedir , |
186 | 186 | '.invesalius', 'config.cfg') |
187 | 187 | configfile = open(path, 'wb') | ... | ... |