Commit 2595aafa2b46dbfb39cf1c271194c5cd21f20bbf
1 parent
9f428b6f
Exists in
master
and in
68 other branches
FIX: Write session fiel problem
Showing
2 changed files
with
11 additions
and
8 deletions
Show diff stats
invesalius/invesalius.py
... | ... | @@ -93,8 +93,9 @@ class SplashScreen(wx.SplashScreen): |
93 | 93 | from control import Controller |
94 | 94 | from project import Project |
95 | 95 | |
96 | - | |
96 | + print "antes primeiro import session" | |
97 | 97 | self.main = Frame(None) |
98 | + print "depois primeiro import session" | |
98 | 99 | self.control = Controller(self.main) |
99 | 100 | |
100 | 101 | self.fc = wx.FutureCall(1, self.ShowMain) | ... | ... |
invesalius/session.py
... | ... | @@ -104,7 +104,6 @@ class Session(object): |
104 | 104 | self.temp_item = False |
105 | 105 | |
106 | 106 | def CreateSessionFile(self): |
107 | - | |
108 | 107 | config = ConfigParser.RawConfigParser() |
109 | 108 | |
110 | 109 | config.add_section('session') |
... | ... | @@ -122,6 +121,7 @@ class Session(object): |
122 | 121 | config.set('paths','last_dicom_folder',self.last_dicom_folder) |
123 | 122 | path = os.path.join(self.homedir , |
124 | 123 | '.invesalius', 'config.cfg') |
124 | + | |
125 | 125 | configfile = open(path, 'wb') |
126 | 126 | config.write(configfile) |
127 | 127 | configfile.close() |
... | ... | @@ -202,10 +202,10 @@ class WriteSession(Thread): |
202 | 202 | def run(self): |
203 | 203 | while self.runing: |
204 | 204 | time.sleep(10) |
205 | - try: | |
206 | - self.Write() | |
207 | - except AttributeError: | |
208 | - pass | |
205 | + #try: | |
206 | + self.Write() | |
207 | + #except AttributeError: | |
208 | + # pass | |
209 | 209 | |
210 | 210 | def Stop(self): |
211 | 211 | self.runing = 0 |
... | ... | @@ -231,13 +231,15 @@ class WriteSession(Thread): |
231 | 231 | |
232 | 232 | path = os.path.join(self.session.homedir , |
233 | 233 | '.invesalius', 'config.cfg') |
234 | + | |
234 | 235 | try: |
235 | 236 | configfile = open(path, 'wb') |
236 | 237 | except IOError: |
237 | 238 | return |
238 | 239 | utl.debug("Session - IOError") |
239 | - else: | |
240 | - config.write(configfile) | |
240 | + finally: | |
241 | + self.session.CreateSessionFile() | |
242 | + | |
241 | 243 | configfile.close() |
242 | 244 | |
243 | 245 | ... | ... |