Commit 55e04e1f4066d2a4629f682a52cc9cbb151a958a
1 parent
1db06cb6
Exists in
master
and in
68 other branches
FIX: 196, error on config parser (all characters messed up)
Showing
3 changed files
with
20 additions
and
15 deletions
Show diff stats
invesalius/data/slice_.py
| ... | ... | @@ -88,15 +88,22 @@ class Slice(object): |
| 88 | 88 | ps.Publisher().subscribe(self.OnDuplicateMasks, 'Duplicate masks') |
| 89 | 89 | |
| 90 | 90 | def OnRemoveMasks(self, pubsub_evt): |
| 91 | + print "slice_: OnRemoveMasks" | |
| 91 | 92 | selected_items = pubsub_evt.data |
| 93 | + print "selected_items:", selected_items | |
| 92 | 94 | proj = Project() |
| 95 | + print "1", proj.mask_dict | |
| 93 | 96 | for item in selected_items: |
| 94 | 97 | proj.RemoveMask(item) |
| 98 | + print "2", proj.mask_dict | |
| 95 | 99 | #index = self.current_mask.index |
| 100 | + print "current_mask", self.current_mask.index | |
| 96 | 101 | if (proj.mask_dict) and (self.current_mask.index in selected_items): |
| 102 | + print "first mask exist" | |
| 97 | 103 | self.current_mask = proj.mask_dict[0] |
| 98 | 104 | self.SelectCurrentMask(0) |
| 99 | 105 | elif not proj.mask_dict: |
| 106 | + print "no mask" | |
| 100 | 107 | self.blend_filter.SetOpacity(1, 0) |
| 101 | 108 | self.blend_filter.Update() |
| 102 | 109 | ps.Publisher().sendMessage('Update slice viewer') |
| ... | ... | @@ -208,6 +215,8 @@ class Slice(object): |
| 208 | 215 | def __show_mask(self, pubsub_evt): |
| 209 | 216 | # "if" is necessary because wx events are calling this before any mask |
| 210 | 217 | # has been created |
| 218 | + print "__show_mask" | |
| 219 | + print "self.current_mask", self.current_mask | |
| 211 | 220 | if self.current_mask: |
| 212 | 221 | index, value = pubsub_evt.data |
| 213 | 222 | self.ShowMask(index, value) |
| ... | ... | @@ -359,6 +368,8 @@ class Slice(object): |
| 359 | 368 | # This condition is not necessary in Linux, only under mac and windows |
| 360 | 369 | # because combobox event is binded when the same item is selected again. |
| 361 | 370 | #if index != self.current_mask.index: |
| 371 | + print "SelectCurrentMask" | |
| 372 | + print "index:", index | |
| 362 | 373 | if self.current_mask and self.blend_filter and index > -1: |
| 363 | 374 | proj = Project() |
| 364 | 375 | future_mask = proj.GetMask(index) |
| ... | ... | @@ -367,6 +378,7 @@ class Slice(object): |
| 367 | 378 | |
| 368 | 379 | colour = future_mask.colour |
| 369 | 380 | #index = future_mask.index |
| 381 | + print index | |
| 370 | 382 | self.SetMaskColour(index, colour, update=False) |
| 371 | 383 | |
| 372 | 384 | imagedata = future_mask.imagedata | ... | ... |
invesalius/gui/data_notebook.py
| ... | ... | @@ -324,9 +324,11 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
| 324 | 324 | self.ToggleItem(evt.m_itemIndex) |
| 325 | 325 | |
| 326 | 326 | def OnCheckItem(self, index, flag): |
| 327 | + print "OnCheckItem", index, flag | |
| 327 | 328 | if flag: |
| 328 | 329 | for key in self.mask_list_index.keys(): |
| 329 | 330 | if key != index: |
| 331 | + print "x" | |
| 330 | 332 | self.SetItemImage(key, 0) |
| 331 | 333 | ps.Publisher().sendMessage('Change mask selected',index) |
| 332 | 334 | self.current_index = index | ... | ... |
invesalius/session.py
| ... | ... | @@ -144,19 +144,6 @@ class Session(object): |
| 144 | 144 | for i in xrange(len(l)-const.PROJ_MAX): |
| 145 | 145 | l.pop() |
| 146 | 146 | |
| 147 | - def SavePlist(self): | |
| 148 | - filename = 'session.conf' | |
| 149 | - filepath = os.join(self.tempdir, filename) | |
| 150 | - plistlib.writePlist(self.__dict__, filepath) | |
| 151 | - | |
| 152 | - def OpenPlist(self): | |
| 153 | - filename = 'session.conf' | |
| 154 | - filepath = os.join(self.tempdir, filename) | |
| 155 | - # TODO: try/except | |
| 156 | - dict = plistlib.readPlist(main_plist) | |
| 157 | - for key in dict: | |
| 158 | - setattr(self, key, dict[key]) | |
| 159 | - | |
| 160 | 147 | def GetLanguage(self): |
| 161 | 148 | return self.language |
| 162 | 149 | |
| ... | ... | @@ -178,7 +165,9 @@ class Session(object): |
| 178 | 165 | config.read(path) |
| 179 | 166 | self.language = config.get('session','language') |
| 180 | 167 | return self.language |
| 181 | - except(ConfigParser.NoSectionError, ConfigParser.NoOptionError): | |
| 168 | + except (ConfigParser.NoSectionError, | |
| 169 | + ConfigParser.NoOptionError, | |
| 170 | + ConfigParser.MissingSectionHeaderError): | |
| 182 | 171 | return False |
| 183 | 172 | |
| 184 | 173 | def ReadSession(self): |
| ... | ... | @@ -197,7 +186,9 @@ class Session(object): |
| 197 | 186 | self.tempdir = config.get('paths','tempdir') |
| 198 | 187 | self.last_dicom_folder = config.get('paths','last_dicom_folder') |
| 199 | 188 | return True |
| 200 | - except(ConfigParser.NoSectionError, ConfigParser.NoOptionError): | |
| 189 | + except(ConfigParser.NoSectionError, | |
| 190 | + ConfigParser.NoOptionError, | |
| 191 | + ConfigParser.MissingSectionHeaderError): | |
| 201 | 192 | return False |
| 202 | 193 | |
| 203 | 194 | ... | ... |