Commit 262a7d34fa59387876e233fc339bbd4c079fcfe7
1 parent
fbdeac95
Exists in
master
and in
68 other branches
FIX: Last folder is not being saved when click cancel in the import dialog #171
Showing
1 changed file
with
14 additions
and
12 deletions
Show diff stats
invesalius/gui/dialogs.py
| ... | ... | @@ -98,7 +98,7 @@ class ProgressDialog(object): |
| 98 | 98 | self.style = wx.PD_APP_MODAL |
| 99 | 99 | if abort: |
| 100 | 100 | self.style = wx.PD_APP_MODAL | wx.PD_CAN_ABORT |
| 101 | - | |
| 101 | + | |
| 102 | 102 | self.dlg = wx.ProgressDialog(self.title, |
| 103 | 103 | self.msg, |
| 104 | 104 | maximum = self.maximum, |
| ... | ... | @@ -183,11 +183,13 @@ def ShowImportDirDialog(): |
| 183 | 183 | else: |
| 184 | 184 | path = dlg.GetPath().encode('utf-8') |
| 185 | 185 | |
| 186 | - if (sys.platform != 'darwin'): | |
| 187 | - session.SetLastDicomFolder(path) | |
| 188 | - | |
| 189 | 186 | except(wx._core.PyAssertionError): #TODO: error win64 |
| 190 | - path = dlg.GetPath() | |
| 187 | + if (dlg.GetPath()): | |
| 188 | + path = dlg.GetPath() | |
| 189 | + | |
| 190 | + if (sys.platform != 'darwin'): | |
| 191 | + if (path): | |
| 192 | + session.SetLastDicomFolder(path) | |
| 191 | 193 | |
| 192 | 194 | # Only destroy a dialog after you're done with it. |
| 193 | 195 | dlg.Destroy() |
| ... | ... | @@ -423,7 +425,7 @@ class NewSurfaceDialog(wx.Dialog): |
| 423 | 425 | self.CenterOnScreen() |
| 424 | 426 | |
| 425 | 427 | # LINE 1: Surface name |
| 426 | - | |
| 428 | + | |
| 427 | 429 | label_surface = wx.StaticText(self, -1, _("New surface name:")) |
| 428 | 430 | |
| 429 | 431 | default_name = const.SURFACE_NAME_PATTERN %(surface.Surface.general_index+2) |
| ... | ... | @@ -442,7 +444,7 @@ class NewSurfaceDialog(wx.Dialog): |
| 442 | 444 | index_list = project.mask_dict.keys() |
| 443 | 445 | index_list.sort() |
| 444 | 446 | self.mask_list = [project.mask_dict[index].name for index in index_list] |
| 445 | - | |
| 447 | + | |
| 446 | 448 | |
| 447 | 449 | # Mask selection combo |
| 448 | 450 | combo_mask = wx.ComboBox(self, -1, "", choices= self.mask_list, |
| ... | ... | @@ -490,7 +492,7 @@ class NewSurfaceDialog(wx.Dialog): |
| 490 | 492 | btn_ok = wx.Button(self, wx.ID_OK) |
| 491 | 493 | btn_ok.SetDefault() |
| 492 | 494 | btn_cancel = wx.Button(self, wx.ID_CANCEL) |
| 493 | - | |
| 495 | + | |
| 494 | 496 | btnsizer = wx.StdDialogButtonSizer() |
| 495 | 497 | btnsizer.AddButton(btn_ok) |
| 496 | 498 | btnsizer.AddButton(btn_cancel) |
| ... | ... | @@ -509,10 +511,10 @@ class NewSurfaceDialog(wx.Dialog): |
| 509 | 511 | |
| 510 | 512 | def GetValue(self): |
| 511 | 513 | mask_index = self.combo_mask.GetSelection() |
| 512 | - surface_name = self.text.GetValue() | |
| 514 | + surface_name = self.text.GetValue() | |
| 513 | 515 | quality = const.SURFACE_QUALITY_LIST[self.combo_quality.GetSelection()] |
| 514 | 516 | fill_holes = self.check_box_holes.GetValue() |
| 515 | - keep_largest = self.check_box_largest.GetValue() | |
| 517 | + keep_largest = self.check_box_largest.GetValue() | |
| 516 | 518 | return (mask_index, surface_name, quality, fill_holes, keep_largest) |
| 517 | 519 | |
| 518 | 520 | INDEX_TO_EXTENSION = {0: "bmp", 1: "jpg", 2: "png", 3: "ps", 4:"povray", 5:"tiff"} |
| ... | ... | @@ -526,7 +528,7 @@ WILDCARD_SAVE_PICTURE = _("BMP image")+" (*.bmp)|*.bmp|"+\ |
| 526 | 528 | |
| 527 | 529 | def ExportPicture(type_=""): |
| 528 | 530 | import constants as const |
| 529 | - | |
| 531 | + | |
| 530 | 532 | INDEX_TO_TYPE = {0: const.FILETYPE_BMP, |
| 531 | 533 | 1: const.FILETYPE_JPG, |
| 532 | 534 | 2: const.FILETYPE_PNG, |
| ... | ... | @@ -548,7 +550,7 @@ def ExportPicture(type_=""): |
| 548 | 550 | WILDCARD_SAVE_PICTURE, |
| 549 | 551 | wx.SAVE|wx.OVERWRITE_PROMPT) |
| 550 | 552 | dlg.SetFilterIndex(1) # default is VTI |
| 551 | - | |
| 553 | + | |
| 552 | 554 | if dlg.ShowModal() == wx.ID_OK: |
| 553 | 555 | filetype_index = dlg.GetFilterIndex() |
| 554 | 556 | filetype = INDEX_TO_TYPE[filetype_index] | ... | ... |