Commit b0fe7063f4424ecca39b35341264bf05bed4e489
1 parent
0c1c228a
Exists in
master
Removed prints and some format
Showing
3 changed files
with
39 additions
and
39 deletions
Show diff stats
invesalius/data/slice_.py
@@ -381,7 +381,6 @@ class Slice(metaclass=utils.Singleton): | @@ -381,7 +381,6 @@ class Slice(metaclass=utils.Singleton): | ||
381 | return | 381 | return |
382 | proj = Project() | 382 | proj = Project() |
383 | index = proj.mask_dict.get_key(self.current_mask) | 383 | index = proj.mask_dict.get_key(self.current_mask) |
384 | - print(f"\n\n\n{index=}\n\n\n") | ||
385 | self.num_gradient += 1 | 384 | self.num_gradient += 1 |
386 | self.current_mask.matrix[:] = 0 | 385 | self.current_mask.matrix[:] = 0 |
387 | self.current_mask.clear_history() | 386 | self.current_mask.clear_history() |
invesalius/gui/language_dialog.py
1 | -#-------------------------------------------------------------------------- | 1 | +# -------------------------------------------------------------------------- |
2 | # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas | 2 | # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas |
3 | # Copyright: (C) 2001 Centro de Pesquisas Renato Archer | 3 | # Copyright: (C) 2001 Centro de Pesquisas Renato Archer |
4 | # Homepage: http://www.softwarepublico.gov.br | 4 | # Homepage: http://www.softwarepublico.gov.br |
5 | # Contact: invesalius@cti.gov.br | 5 | # Contact: invesalius@cti.gov.br |
6 | # License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) | 6 | # License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) |
7 | -#-------------------------------------------------------------------------- | 7 | +# -------------------------------------------------------------------------- |
8 | # Este programa e software livre; voce pode redistribui-lo e/ou | 8 | # Este programa e software livre; voce pode redistribui-lo e/ou |
9 | # modifica-lo sob os termos da Licenca Publica Geral GNU, conforme | 9 | # modifica-lo sob os termos da Licenca Publica Geral GNU, conforme |
10 | # publicada pela Free Software Foundation; de acordo com a versao 2 | 10 | # publicada pela Free Software Foundation; de acordo com a versao 2 |
@@ -15,11 +15,12 @@ | @@ -15,11 +15,12 @@ | ||
15 | # COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM | 15 | # COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM |
16 | # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais | 16 | # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais |
17 | # detalhes. | 17 | # detalhes. |
18 | -#-------------------------------------------------------------------------- | 18 | +# -------------------------------------------------------------------------- |
19 | 19 | ||
20 | import os | 20 | import os |
21 | import sys | 21 | import sys |
22 | import wx | 22 | import wx |
23 | + | ||
23 | try: | 24 | try: |
24 | from wx.adv import BitmapComboBox | 25 | from wx.adv import BitmapComboBox |
25 | except ImportError: | 26 | except ImportError: |
@@ -29,49 +30,53 @@ import invesalius.i18n as i18n | @@ -29,49 +30,53 @@ import invesalius.i18n as i18n | ||
29 | 30 | ||
30 | file_path = os.path.split(__file__)[0] | 31 | file_path = os.path.split(__file__)[0] |
31 | 32 | ||
32 | -if hasattr(sys,"frozen") and (sys.frozen == "windows_exe"\ | ||
33 | - or sys.frozen == "console_exe"): | ||
34 | - abs_file_path = os.path.abspath(file_path + os.sep + ".." +\ | ||
35 | - os.sep + ".." + os.sep + ".." + os.sep + "..") | ||
36 | - ICON_DIR = os.path.abspath(os.path.join(abs_file_path, 'icons')) | 33 | +if hasattr(sys, "frozen") and ( |
34 | + sys.frozen == "windows_exe" or sys.frozen == "console_exe" | ||
35 | +): | ||
36 | + abs_file_path = os.path.abspath( | ||
37 | + file_path + os.sep + ".." + os.sep + ".." + os.sep + ".." + os.sep + ".." | ||
38 | + ) | ||
39 | + ICON_DIR = os.path.abspath(os.path.join(abs_file_path, "icons")) | ||
37 | else: | 40 | else: |
38 | - ICON_DIR = os.path.abspath(os.path.join(file_path, '..', '..','icons')) | 41 | + ICON_DIR = os.path.abspath(os.path.join(file_path, "..", "..", "icons")) |
39 | 42 | ||
40 | # MAC App | 43 | # MAC App |
41 | if not os.path.exists(ICON_DIR): | 44 | if not os.path.exists(ICON_DIR): |
42 | - ICON_DIR = os.path.abspath(os.path.join(file_path, '..', '..', '..', '..', '..', 'icons')) | 45 | + ICON_DIR = os.path.abspath( |
46 | + os.path.join(file_path, "..", "..", "..", "..", "..", "icons") | ||
47 | + ) | ||
43 | 48 | ||
44 | -class ComboBoxLanguage: | ||
45 | 49 | ||
50 | +class ComboBoxLanguage: | ||
46 | def __init__(self, parent): | 51 | def __init__(self, parent): |
47 | """Initialize combobox bitmap""" | 52 | """Initialize combobox bitmap""" |
48 | - | ||
49 | - # Retrieve locales dictionary | 53 | + |
54 | + # Retrieve locales dictionary | ||
50 | dict_locales = i18n.GetLocales() | 55 | dict_locales = i18n.GetLocales() |
51 | - | 56 | + |
52 | # Retrieve locales names and sort them | 57 | # Retrieve locales names and sort them |
53 | self.locales = dict_locales.values() | 58 | self.locales = dict_locales.values() |
54 | self.locales = sorted(self.locales) | 59 | self.locales = sorted(self.locales) |
55 | - | 60 | + |
56 | # Retrieve locales keys (eg: pt_BR for Portuguese(Brazilian)) | 61 | # Retrieve locales keys (eg: pt_BR for Portuguese(Brazilian)) |
57 | self.locales_key = [dict_locales.get_key(value) for value in self.locales] | 62 | self.locales_key = [dict_locales.get_key(value) for value in self.locales] |
58 | 63 | ||
59 | # Find out OS locale | 64 | # Find out OS locale |
60 | self.os_locale = i18n.GetLocaleOS() | 65 | self.os_locale = i18n.GetLocaleOS() |
61 | - | 66 | + |
62 | try: | 67 | try: |
63 | os_lang = self.os_locale[0:2] | 68 | os_lang = self.os_locale[0:2] |
64 | except TypeError: | 69 | except TypeError: |
65 | os_lang = None | 70 | os_lang = None |
66 | 71 | ||
67 | # Default selection will be English | 72 | # Default selection will be English |
68 | - selection = self.locales_key.index('en') | 73 | + selection = self.locales_key.index("en") |
69 | 74 | ||
70 | # Create bitmap combo | 75 | # Create bitmap combo |
71 | self.bitmapCmb = bitmapCmb = BitmapComboBox(parent, style=wx.CB_READONLY) | 76 | self.bitmapCmb = bitmapCmb = BitmapComboBox(parent, style=wx.CB_READONLY) |
72 | for key in self.locales_key: | 77 | for key in self.locales_key: |
73 | # Based on composed flag filename, get bitmap | 78 | # Based on composed flag filename, get bitmap |
74 | - filepath = os.path.join(ICON_DIR, "%s.png" % (key)) | 79 | + filepath = os.path.join(ICON_DIR, "%s.png" % (key)) |
75 | bmp = wx.Bitmap(filepath, wx.BITMAP_TYPE_PNG) | 80 | bmp = wx.Bitmap(filepath, wx.BITMAP_TYPE_PNG) |
76 | # Add bitmap and info to Combo | 81 | # Add bitmap and info to Combo |
77 | bitmapCmb.Append(dict_locales[key], bmp, key) | 82 | bitmapCmb.Append(dict_locales[key], bmp, key) |
@@ -86,6 +91,7 @@ class ComboBoxLanguage: | @@ -86,6 +91,7 @@ class ComboBoxLanguage: | ||
86 | def GetLocalesKey(self): | 91 | def GetLocalesKey(self): |
87 | return self.locales_key | 92 | return self.locales_key |
88 | 93 | ||
94 | + | ||
89 | class LanguageDialog(wx.Dialog): | 95 | class LanguageDialog(wx.Dialog): |
90 | """Class define the language to be used in the InVesalius, | 96 | """Class define the language to be used in the InVesalius, |
91 | exist chcLanguage that list language EN and PT. The language | 97 | exist chcLanguage that list language EN and PT. The language |
@@ -94,26 +100,26 @@ class LanguageDialog(wx.Dialog): | @@ -94,26 +100,26 @@ class LanguageDialog(wx.Dialog): | ||
94 | def __init__(self, parent=None, startApp=None): | 100 | def __init__(self, parent=None, startApp=None): |
95 | super(LanguageDialog, self).__init__(parent, title="") | 101 | super(LanguageDialog, self).__init__(parent, title="") |
96 | self.__TranslateMessage__() | 102 | self.__TranslateMessage__() |
97 | - self.SetTitle(_('Language selection')) | 103 | + self.SetTitle(_("Language selection")) |
98 | self.__init_gui() | 104 | self.__init_gui() |
99 | self.Centre() | 105 | self.Centre() |
100 | - | ||
101 | - #def __init_combobox_bitmap__(self): | 106 | + |
107 | + # def __init_combobox_bitmap__(self): | ||
102 | # """Initialize combobox bitmap""" | 108 | # """Initialize combobox bitmap""" |
103 | - | ||
104 | - # # Retrieve locales dictionary | 109 | + |
110 | + # # Retrieve locales dictionary | ||
105 | # dict_locales = i18n.GetLocales() | 111 | # dict_locales = i18n.GetLocales() |
106 | - | 112 | + |
107 | # # Retrieve locales names and sort them | 113 | # # Retrieve locales names and sort them |
108 | # self.locales = dict_locales.values() | 114 | # self.locales = dict_locales.values() |
109 | # self.locales.sort() | 115 | # self.locales.sort() |
110 | - | 116 | + |
111 | # # Retrieve locales keys (eg: pt_BR for Portuguese(Brazilian)) | 117 | # # Retrieve locales keys (eg: pt_BR for Portuguese(Brazilian)) |
112 | # self.locales_key = [dict_locales.get_key(value)[0] for value in self.locales] | 118 | # self.locales_key = [dict_locales.get_key(value)[0] for value in self.locales] |
113 | 119 | ||
114 | # # Find out OS locale | 120 | # # Find out OS locale |
115 | # self.os_locale = i18n.GetLocaleOS() | 121 | # self.os_locale = i18n.GetLocaleOS() |
116 | - | 122 | + |
117 | # os_lang = self.os_locale[0:2] | 123 | # os_lang = self.os_locale[0:2] |
118 | 124 | ||
119 | # # Default selection will be English | 125 | # # Default selection will be English |
@@ -135,10 +141,8 @@ class LanguageDialog(wx.Dialog): | @@ -135,10 +141,8 @@ class LanguageDialog(wx.Dialog): | ||
135 | def GetComboBox(self): | 141 | def GetComboBox(self): |
136 | return self.bitmapCmb | 142 | return self.bitmapCmb |
137 | 143 | ||
138 | - | ||
139 | def __init_gui(self): | 144 | def __init_gui(self): |
140 | - self.txtMsg = wx.StaticText(self, -1, | ||
141 | - label=_('Choose user interface language')) | 145 | + self.txtMsg = wx.StaticText(self, -1, label=_("Choose user interface language")) |
142 | 146 | ||
143 | btnsizer = wx.StdDialogButtonSizer() | 147 | btnsizer = wx.StdDialogButtonSizer() |
144 | 148 | ||
@@ -150,7 +154,7 @@ class LanguageDialog(wx.Dialog): | @@ -150,7 +154,7 @@ class LanguageDialog(wx.Dialog): | ||
150 | btnsizer.AddButton(btn) | 154 | btnsizer.AddButton(btn) |
151 | btnsizer.Realize() | 155 | btnsizer.Realize() |
152 | 156 | ||
153 | - #self.__init_combobox_bitmap__() | 157 | + # self.__init_combobox_bitmap__() |
154 | self.cmb = ComboBoxLanguage(self) | 158 | self.cmb = ComboBoxLanguage(self) |
155 | self.bitmapCmb = self.cmb.GetComboBox() | 159 | self.bitmapCmb = self.cmb.GetComboBox() |
156 | 160 | ||
@@ -174,12 +178,12 @@ class LanguageDialog(wx.Dialog): | @@ -174,12 +178,12 @@ class LanguageDialog(wx.Dialog): | ||
174 | """Translate Messages of the Window""" | 178 | """Translate Messages of the Window""" |
175 | os_language = i18n.GetLocaleOS() | 179 | os_language = i18n.GetLocaleOS() |
176 | 180 | ||
177 | - if(os_language[0:2] == 'pt'): | ||
178 | - _ = i18n.InstallLanguage('pt_BR') | ||
179 | - elif(os_language[0:2] == 'es'): | ||
180 | - _ = i18n.InstallLanguage('es') | 181 | + if os_language[0:2] == "pt": |
182 | + _ = i18n.InstallLanguage("pt_BR") | ||
183 | + elif os_language[0:2] == "es": | ||
184 | + _ = i18n.InstallLanguage("es") | ||
181 | else: | 185 | else: |
182 | - _ = i18n.InstallLanguage('en') | 186 | + _ = i18n.InstallLanguage("en") |
183 | 187 | ||
184 | def Cancel(self, event): | 188 | def Cancel(self, event): |
185 | """Close Frm_Language""" | 189 | """Close Frm_Language""" |
invesalius/reader/dicom_grouper.py
@@ -131,7 +131,6 @@ class DicomGroup: | @@ -131,7 +131,6 @@ class DicomGroup: | ||
131 | filelist = [dicom.image.file for dicom in | 131 | filelist = [dicom.image.file for dicom in |
132 | self.slices_dict.values()] | 132 | self.slices_dict.values()] |
133 | 133 | ||
134 | - print(f"\n\n\n{filelist=}\n\n\n") | ||
135 | # Sort slices using GDCM | 134 | # Sort slices using GDCM |
136 | #if (self.dicom.image.orientation_label != "CORONAL"): | 135 | #if (self.dicom.image.orientation_label != "CORONAL"): |
137 | #Organize reversed image | 136 | #Organize reversed image |
@@ -141,7 +140,6 @@ class DicomGroup: | @@ -141,7 +140,6 @@ class DicomGroup: | ||
141 | try: | 140 | try: |
142 | sorter.Sort([utils.encode(i, const.FS_ENCODE) for i in filelist]) | 141 | sorter.Sort([utils.encode(i, const.FS_ENCODE) for i in filelist]) |
143 | except TypeError as e: | 142 | except TypeError as e: |
144 | - print(f"\n\n\nError: {e=}\n\n\n") | ||
145 | sorter.Sort(filelist) | 143 | sorter.Sort(filelist) |
146 | filelist = sorter.GetFilenames() | 144 | filelist = sorter.GetFilenames() |
147 | 145 | ||
@@ -149,7 +147,6 @@ class DicomGroup: | @@ -149,7 +147,6 @@ class DicomGroup: | ||
149 | if list(self.slices_dict.values())[0].parser.GetManufacturerName() == "Koning": | 147 | if list(self.slices_dict.values())[0].parser.GetManufacturerName() == "Koning": |
150 | filelist.sort() | 148 | filelist.sort() |
151 | 149 | ||
152 | - print(f"\n\n\n{filelist=}\n\n\n") | ||
153 | return filelist | 150 | return filelist |
154 | 151 | ||
155 | def GetHandSortedList(self): | 152 | def GetHandSortedList(self): |