Commit aa9c59d2c839081ec5ae0a7ce0280428037ced8a

Authored by Paulo Henrique Junqueira Amorim
1 parent a391e2fa

FIX: Bug in the Windows platebutton always selected

invesalius/gui/task_importer.py
@@ -34,19 +34,19 @@ WILDCARD_OPEN = "InVesalius 1 project (*.promed)|*.promed|"\ @@ -34,19 +34,19 @@ WILDCARD_OPEN = "InVesalius 1 project (*.promed)|*.promed|"\
34 class TaskPanel(wx.Panel): 34 class TaskPanel(wx.Panel):
35 def __init__(self, parent): 35 def __init__(self, parent):
36 wx.Panel.__init__(self, parent) 36 wx.Panel.__init__(self, parent)
37 - 37 +
38 inner_panel = InnerTaskPanel(self) 38 inner_panel = InnerTaskPanel(self)
39 - 39 +
40 sizer = wx.BoxSizer(wx.HORIZONTAL) 40 sizer = wx.BoxSizer(wx.HORIZONTAL)
41 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | 41 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT |
42 wx.LEFT, 7) 42 wx.LEFT, 7)
43 sizer.Fit(self) 43 sizer.Fit(self)
44 - 44 +
45 self.SetSizer(sizer) 45 self.SetSizer(sizer)
46 self.Update() 46 self.Update()
47 self.SetAutoLayout(1) 47 self.SetAutoLayout(1)
48 -  
49 -class InnerTaskPanel(wx.Panel): 48 +
  49 +class InnerTaskPanel(wx.Panel):
50 def __init__(self, parent): 50 def __init__(self, parent):
51 wx.Panel.__init__(self, parent) 51 wx.Panel.__init__(self, parent)
52 self.SetBackgroundColour(wx.Colour(255,255,255)) 52 self.SetBackgroundColour(wx.Colour(255,255,255))
@@ -54,7 +54,7 @@ class InnerTaskPanel(wx.Panel): @@ -54,7 +54,7 @@ class InnerTaskPanel(wx.Panel):
54 54
55 # Counter for projects loaded in current GUI 55 # Counter for projects loaded in current GUI
56 self.proj_count = 0 56 self.proj_count = 0
57 - 57 +
58 # Floating items (to be inserted) 58 # Floating items (to be inserted)
59 self.float_hyper_list = [] 59 self.float_hyper_list = []
60 60
@@ -85,20 +85,20 @@ class InnerTaskPanel(wx.Panel): @@ -85,20 +85,20 @@ class InnerTaskPanel(wx.Panel):
85 link_open_proj.AutoBrowse(False) 85 link_open_proj.AutoBrowse(False)
86 link_open_proj.UpdateLink() 86 link_open_proj.UpdateLink()
87 link_open_proj.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkOpenProject) 87 link_open_proj.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkOpenProject)
88 - 88 +
89 # Image(s) for buttons 89 # Image(s) for buttons
90 BMP_IMPORT = wx.Bitmap("../icons/file_import.png", wx.BITMAP_TYPE_PNG) 90 BMP_IMPORT = wx.Bitmap("../icons/file_import.png", wx.BITMAP_TYPE_PNG)
91 BMP_NET = wx.Bitmap("../icons/file_from_internet.png", wx.BITMAP_TYPE_PNG) 91 BMP_NET = wx.Bitmap("../icons/file_from_internet.png", wx.BITMAP_TYPE_PNG)
92 BMP_NULL = wx.Bitmap("../icons/object_invisible.jpg", wx.BITMAP_TYPE_JPEG) 92 BMP_NULL = wx.Bitmap("../icons/object_invisible.jpg", wx.BITMAP_TYPE_JPEG)
93 - 93 +
94 bmp_list = [BMP_IMPORT, BMP_NET, BMP_NULL] 94 bmp_list = [BMP_IMPORT, BMP_NET, BMP_NULL]
95 for bmp in bmp_list: 95 for bmp in bmp_list:
96 bmp.SetWidth(25) 96 bmp.SetWidth(25)
97 bmp.SetHeight(25) 97 bmp.SetHeight(25)
98 - 98 +
99 # Buttons related to hyperlinks 99 # Buttons related to hyperlinks
100 - button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_NOBG  
101 - 100 + button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT
  101 +
102 button_import_local = pbtn.PlateButton(self, BTN_IMPORT_LOCAL, "", 102 button_import_local = pbtn.PlateButton(self, BTN_IMPORT_LOCAL, "",
103 BMP_IMPORT, style=button_style) 103 BMP_IMPORT, style=button_style)
104 button_import_pacs = pbtn.PlateButton(self, BTN_IMPORT_PACS, "", BMP_NET, 104 button_import_pacs = pbtn.PlateButton(self, BTN_IMPORT_PACS, "", BMP_NET,
@@ -121,21 +121,21 @@ class InnerTaskPanel(wx.Panel): @@ -121,21 +121,21 @@ class InnerTaskPanel(wx.Panel):
121 (button_import_pacs, 0, flag_button), 121 (button_import_pacs, 0, flag_button),
122 (link_open_proj, 1, flag_link, 3), 122 (link_open_proj, 1, flag_link, 3),
123 (button_open_proj, 0, flag_button) ]) 123 (button_open_proj, 0, flag_button) ])
124 - 124 +
125 # Add line sizers into main sizer 125 # Add line sizers into main sizer
126 main_sizer = wx.BoxSizer(wx.VERTICAL) 126 main_sizer = wx.BoxSizer(wx.VERTICAL)
127 main_sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND) 127 main_sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND)
128 -  
129 - # Update main sizer and panel layout 128 +
  129 + # Update main sizer and panel layout
130 self.SetSizer(main_sizer) 130 self.SetSizer(main_sizer)
131 self.Fit() 131 self.Fit()
132 self.sizer = main_sizer 132 self.sizer = main_sizer
133 - 133 +
134 # Test load and unload specific projects' links 134 # Test load and unload specific projects' links
135 self.TestLoadProjects() 135 self.TestLoadProjects()
136 #self.UnloadProjects() 136 #self.UnloadProjects()
137 137
138 - 138 +
139 def OnLinkImport(self, evt=None): 139 def OnLinkImport(self, evt=None):
140 dlg = wx.DirDialog(self, "Choose a directory:", "", 140 dlg = wx.DirDialog(self, "Choose a directory:", "",
141 style=wx.DD_DEFAULT_STYLE 141 style=wx.DD_DEFAULT_STYLE
@@ -145,29 +145,29 @@ class InnerTaskPanel(wx.Panel): @@ -145,29 +145,29 @@ class InnerTaskPanel(wx.Panel):
145 if dlg.ShowModal() == wx.ID_OK: 145 if dlg.ShowModal() == wx.ID_OK:
146 path = dlg.GetPath() 146 path = dlg.GetPath()
147 ps.Publisher().sendMessage("Show import panel", path) 147 ps.Publisher().sendMessage("Show import panel", path)
148 - 148 +
149 # Only destroy a dialog after you're done with it. 149 # Only destroy a dialog after you're done with it.
150 dlg.Destroy() 150 dlg.Destroy()
151 - 151 +
152 if evt: 152 if evt:
153 evt.Skip() 153 evt.Skip()
154 - 154 +
155 def OnLinkImportPACS(self, evt=None): 155 def OnLinkImportPACS(self, evt=None):
156 print "TODO: Send Signal - Import DICOM files from PACS" 156 print "TODO: Send Signal - Import DICOM files from PACS"
157 if evt: 157 if evt:
158 evt.Skip() 158 evt.Skip()
159 - 159 +
160 def OnLinkOpenProject(self, evt=None, proj_name=""): 160 def OnLinkOpenProject(self, evt=None, proj_name=""):
161 if proj_name: 161 if proj_name:
162 print "TODO: Send Signal - Open project "+ proj_name 162 print "TODO: Send Signal - Open project "+ proj_name
163 else: 163 else:
164 dlg = wx.FileDialog(self, message="Open project...", 164 dlg = wx.FileDialog(self, message="Open project...",
165 - defaultDir=os.getcwd(), 165 + defaultDir=os.getcwd(),
166 defaultFile="", wildcard=WILDCARD_OPEN, 166 defaultFile="", wildcard=WILDCARD_OPEN,
167 style=wx.OPEN|wx.CHANGE_DIR) 167 style=wx.OPEN|wx.CHANGE_DIR)
168 dlg.SetFilterIndex(3) 168 dlg.SetFilterIndex(3)
169 -  
170 - # Show the dialog and retrieve the user response. If it is the OK response, 169 +
  170 + # Show the dialog and retrieve the user response. If it is the OK response,
171 # process the data. 171 # process the data.
172 if dlg.ShowModal() == wx.ID_OK: 172 if dlg.ShowModal() == wx.ID_OK:
173 # This returns a Python list of files that were selected. 173 # This returns a Python list of files that were selected.
@@ -175,29 +175,29 @@ class InnerTaskPanel(wx.Panel): @@ -175,29 +175,29 @@ class InnerTaskPanel(wx.Panel):
175 proj_name = dlg.GetFilename() 175 proj_name = dlg.GetFilename()
176 print "TODO: Send Signal - Open project "+ proj_path 176 print "TODO: Send Signal - Open project "+ proj_path
177 print "TODO: Send Signal - Change frame title "+ proj_name 177 print "TODO: Send Signal - Change frame title "+ proj_name
178 - 178 +
179 # Destroy the dialog. Don't do this until you are done with it! 179 # Destroy the dialog. Don't do this until you are done with it!
180 # BAD things can happen otherwise! 180 # BAD things can happen otherwise!
181 dlg.Destroy() 181 dlg.Destroy()
182 - 182 +
183 if evt: 183 if evt:
184 evt.Skip() 184 evt.Skip()
185 - 185 +
186 def OnButton(self, evt): 186 def OnButton(self, evt):
187 id = evt.GetId() 187 id = evt.GetId()
188 - 188 +
189 if id == BTN_IMPORT_LOCAL: 189 if id == BTN_IMPORT_LOCAL:
190 self.OnLinkImport() 190 self.OnLinkImport()
191 elif id == BTN_IMPORT_PACS: 191 elif id == BTN_IMPORT_PACS:
192 self.OnLinkImportPACS() 192 self.OnLinkImportPACS()
193 else: #elif id == BTN_OPEN_PROJECT: 193 else: #elif id == BTN_OPEN_PROJECT:
194 self.OnLinkOpenProject() 194 self.OnLinkOpenProject()
195 - 195 +
196 def TestLoadProjects(self): 196 def TestLoadProjects(self):
197 self.LoadProject("test1.iv3") 197 self.LoadProject("test1.iv3")
198 self.LoadProject("test2.iv3") 198 self.LoadProject("test2.iv3")
199 self.LoadProject("test3.iv3") 199 self.LoadProject("test3.iv3")
200 - 200 +
201 def LoadProject(self, proj_name="Unnamed"): 201 def LoadProject(self, proj_name="Unnamed"):
202 """ 202 """
203 Load into user interface name of project into import task panel. 203 Load into user interface name of project into import task panel.
@@ -206,13 +206,13 @@ class InnerTaskPanel(wx.Panel): @@ -206,13 +206,13 @@ class InnerTaskPanel(wx.Panel):
206 """ 206 """
207 # TODO: What todo when it is called more than 3 times? 207 # TODO: What todo when it is called more than 3 times?
208 # TODO: Load from config file last 3 recent projects 208 # TODO: Load from config file last 3 recent projects
209 - 209 +
210 if (self.proj_count < 3): 210 if (self.proj_count < 3):
211 self.proj_count += 1 211 self.proj_count += 1
212 - 212 +
213 # Create name to be plot on GUI 213 # Create name to be plot on GUI
214 label = " "+str(self.proj_count)+". "+proj_name 214 label = " "+str(self.proj_count)+". "+proj_name
215 - 215 +
216 # Create corresponding hyperlink 216 # Create corresponding hyperlink
217 proj_link = hl.HyperLinkCtrl(self, -1, label) 217 proj_link = hl.HyperLinkCtrl(self, -1, label)
218 proj_link.SetUnderlines(False, False, False) 218 proj_link.SetUnderlines(False, False, False)
@@ -221,34 +221,33 @@ class InnerTaskPanel(wx.Panel): @@ -221,34 +221,33 @@ class InnerTaskPanel(wx.Panel):
221 proj_link.UpdateLink() 221 proj_link.UpdateLink()
222 proj_link.Bind(hl.EVT_HYPERLINK_LEFT, 222 proj_link.Bind(hl.EVT_HYPERLINK_LEFT,
223 lambda e: self.OnLinkOpenProject(e, proj_name)) 223 lambda e: self.OnLinkOpenProject(e, proj_name))
224 - 224 +
225 # Add to existing frame 225 # Add to existing frame
226 self.sizer.Add(proj_link, 1, wx.GROW | wx.EXPAND | wx.ALL, 2) 226 self.sizer.Add(proj_link, 1, wx.GROW | wx.EXPAND | wx.ALL, 2)
227 self.Update() 227 self.Update()
228 228
229 # Add hyperlink to floating hyperlinks list 229 # Add hyperlink to floating hyperlinks list
230 - self.float_hyper_list.append(proj_link)  
231 - 230 + self.float_hyper_list.append(proj_link)
  231 +
232 def UnloadProjects(self): 232 def UnloadProjects(self):
233 """ 233 """
234 Unload all projects from interface into import task panel. 234 Unload all projects from interface into import task panel.
235 This will be called when the current project is closed. 235 This will be called when the current project is closed.
236 """ 236 """
237 - 237 +
238 # Remove each project from sizer 238 # Remove each project from sizer
239 for i in xrange(0, self.proj_count): 239 for i in xrange(0, self.proj_count):
240 self.sizer.Remove(self.float_hyper_list[i]) 240 self.sizer.Remove(self.float_hyper_list[i])
241 - 241 +
242 # Delete hyperlinks 242 # Delete hyperlinks
243 for hyper in self.float_hyper_list: 243 for hyper in self.float_hyper_list:
244 hyper.Destroy() 244 hyper.Destroy()
245 del(hyper) 245 del(hyper)
246 - 246 +
247 # Update GUI 247 # Update GUI
248 self.sizer.Layout() 248 self.sizer.Layout()
249 self.Update() 249 self.Update()
250 - 250 +
251 # Now we set projects loaded to 0 251 # Now we set projects loaded to 0
252 self.proj_count = 0 252 self.proj_count = 0
253 self.float_hyper_list = [] 253 self.float_hyper_list = []
254 -  
255 \ No newline at end of file 254 \ No newline at end of file
invesalius/gui/task_slice.py
@@ -44,20 +44,20 @@ MASK_LIST = [] @@ -44,20 +44,20 @@ MASK_LIST = []
44 class TaskPanel(wx.Panel): 44 class TaskPanel(wx.Panel):
45 def __init__(self, parent): 45 def __init__(self, parent):
46 wx.Panel.__init__(self, parent) 46 wx.Panel.__init__(self, parent)
47 - 47 +
48 inner_panel = InnerTaskPanel(self) 48 inner_panel = InnerTaskPanel(self)
49 49
50 sizer = wx.BoxSizer(wx.HORIZONTAL) 50 sizer = wx.BoxSizer(wx.HORIZONTAL)
51 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | 51 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT |
52 wx.LEFT, 7) 52 wx.LEFT, 7)
53 sizer.Fit(self) 53 sizer.Fit(self)
54 -  
55 - 54 +
  55 +
56 self.SetSizer(sizer) 56 self.SetSizer(sizer)
57 self.Update() 57 self.Update()
58 self.SetAutoLayout(1) 58 self.SetAutoLayout(1)
59 59
60 -class InnerTaskPanel(wx.Panel): 60 +class InnerTaskPanel(wx.Panel):
61 def __init__(self, parent): 61 def __init__(self, parent):
62 wx.Panel.__init__(self, parent) 62 wx.Panel.__init__(self, parent)
63 default_colour = self.GetBackgroundColour() 63 default_colour = self.GetBackgroundColour()
@@ -68,10 +68,10 @@ class InnerTaskPanel(wx.Panel): @@ -68,10 +68,10 @@ class InnerTaskPanel(wx.Panel):
68 BMP_ADD = wx.Bitmap("../icons/object_add.png", wx.BITMAP_TYPE_PNG) 68 BMP_ADD = wx.Bitmap("../icons/object_add.png", wx.BITMAP_TYPE_PNG)
69 BMP_ADD.SetWidth(25) 69 BMP_ADD.SetWidth(25)
70 BMP_ADD.SetHeight(25) 70 BMP_ADD.SetHeight(25)
71 - 71 +
72 # Button for creating new surface 72 # Button for creating new surface
73 button_new_mask = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\ 73 button_new_mask = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\
74 - pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_NOBG) 74 + pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT)
75 self.Bind(wx.EVT_BUTTON, self.OnButton) 75 self.Bind(wx.EVT_BUTTON, self.OnButton)
76 76
77 77
@@ -100,7 +100,7 @@ class InnerTaskPanel(wx.Panel): @@ -100,7 +100,7 @@ class InnerTaskPanel(wx.Panel):
100 button_next = wx.Button(self, -1, "Create 3D surface") 100 button_next = wx.Button(self, -1, "Create 3D surface")
101 button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) 101 button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
102 button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask) 102 button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask)
103 - 103 +
104 # Add line sizers into main sizer 104 # Add line sizers into main sizer
105 main_sizer = wx.BoxSizer(wx.VERTICAL) 105 main_sizer = wx.BoxSizer(wx.VERTICAL)
106 main_sizer.Add(line_new, 0,wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) 106 main_sizer.Add(line_new, 0,wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
@@ -108,66 +108,66 @@ class InnerTaskPanel(wx.Panel): @@ -108,66 +108,66 @@ class InnerTaskPanel(wx.Panel):
108 main_sizer.Add(button_next, 0, 108 main_sizer.Add(button_next, 0,
109 wx.ALIGN_RIGHT|wx.RIGHT|wx.LEFT|wx.BOTTOM, 5) 109 wx.ALIGN_RIGHT|wx.RIGHT|wx.LEFT|wx.BOTTOM, 5)
110 main_sizer.Fit(self) 110 main_sizer.Fit(self)
111 - 111 +
112 self.SetSizer(main_sizer) 112 self.SetSizer(main_sizer)
113 self.Update() 113 self.Update()
114 self.SetAutoLayout(1) 114 self.SetAutoLayout(1)
115 115
116 self.sizer = main_sizer 116 self.sizer = main_sizer
117 - 117 +
118 def OnButton(self, evt): 118 def OnButton(self, evt):
119 id = evt.GetId() 119 id = evt.GetId()
120 if id == BTN_NEW: 120 if id == BTN_NEW:
121 self.OnLinkNewMask() 121 self.OnLinkNewMask()
122 - 122 +
123 def OnButtonNextTask(self, evt): 123 def OnButtonNextTask(self, evt):
124 - ps.Publisher().sendMessage('Create surface from index', 124 + ps.Publisher().sendMessage('Create surface from index',
125 self.GetMaskSelected()) 125 self.GetMaskSelected())
126 - 126 +
127 def OnLinkNewMask(self, evt=None): 127 def OnLinkNewMask(self, evt=None):
128 dlg = wx.TextEntryDialog(self, 'Name of new mask:', 128 dlg = wx.TextEntryDialog(self, 'Name of new mask:',
129 'InVesalius 3.0 - New mask') 129 'InVesalius 3.0 - New mask')
130 dlg.CenterOnScreen() 130 dlg.CenterOnScreen()
131 default_mask_name = const.MASK_NAME_PATTERN %(mask.Mask.general_index+2) 131 default_mask_name = const.MASK_NAME_PATTERN %(mask.Mask.general_index+2)
132 dlg.SetValue(default_mask_name) 132 dlg.SetValue(default_mask_name)
133 - 133 +
134 if dlg.ShowModal() == wx.ID_OK: 134 if dlg.ShowModal() == wx.ID_OK:
135 print "TODO: Send Signal - New mask" 135 print "TODO: Send Signal - New mask"
136 mask_name = dlg.GetValue() 136 mask_name = dlg.GetValue()
137 ps.Publisher().sendMessage('Create new mask', mask_name) 137 ps.Publisher().sendMessage('Create new mask', mask_name)
138 if evt: 138 if evt:
139 evt.Skip() 139 evt.Skip()
140 - 140 +
141 def GetMaskSelected(self): 141 def GetMaskSelected(self):
142 return self.fold_panel.GetMaskSelected() 142 return self.fold_panel.GetMaskSelected()
143 - 143 +
144 class FoldPanel(wx.Panel): 144 class FoldPanel(wx.Panel):
145 def __init__(self, parent): 145 def __init__(self, parent):
146 wx.Panel.__init__(self, parent, size=(50,50)) 146 wx.Panel.__init__(self, parent, size=(50,50))
147 self.SetBackgroundColour(wx.Colour(0,255,0)) 147 self.SetBackgroundColour(wx.Colour(0,255,0))
148 - 148 +
149 inner_panel = InnerFoldPanel(self) 149 inner_panel = InnerFoldPanel(self)
150 -  
151 - sizer = wx.BoxSizer(wx.VERTICAL) 150 +
  151 + sizer = wx.BoxSizer(wx.VERTICAL)
152 sizer.Add(inner_panel, 1, wx.EXPAND|wx.GROW, 2) 152 sizer.Add(inner_panel, 1, wx.EXPAND|wx.GROW, 2)
153 sizer.Fit(self) 153 sizer.Fit(self)
154 - 154 +
155 self.SetSizer(sizer) 155 self.SetSizer(sizer)
156 self.Update() 156 self.Update()
157 self.SetAutoLayout(1) 157 self.SetAutoLayout(1)
158 - 158 +
159 self.inner_panel = inner_panel 159 self.inner_panel = inner_panel
160 - 160 +
161 def GetMaskSelected(self): 161 def GetMaskSelected(self):
162 x = self.inner_panel.GetMaskSelected() 162 x = self.inner_panel.GetMaskSelected()
163 return self.inner_panel.GetMaskSelected() 163 return self.inner_panel.GetMaskSelected()
164 - 164 +
165 class InnerFoldPanel(wx.Panel): 165 class InnerFoldPanel(wx.Panel):
166 def __init__(self, parent): 166 def __init__(self, parent):
167 wx.Panel.__init__(self, parent) 167 wx.Panel.__init__(self, parent)
168 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255)) 168 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255))
169 #self.SetBackgroundColour(wx.Colour(0,0,0)) 169 #self.SetBackgroundColour(wx.Colour(0,0,0))
170 - 170 +
171 # Fold panel and its style settings 171 # Fold panel and its style settings
172 # FIXME: If we dont insert a value in size or if we set wx.DefaultSize, 172 # FIXME: If we dont insert a value in size or if we set wx.DefaultSize,
173 # the fold_panel doesnt show. This means that, for some reason, Sizer 173 # the fold_panel doesnt show. This means that, for some reason, Sizer
@@ -189,7 +189,7 @@ class InnerFoldPanel(wx.Panel): @@ -189,7 +189,7 @@ class InnerFoldPanel(wx.Panel):
189 fold_panel.AddFoldPanelWindow(item, self.mask_prop_panel, Spacing= 0, 189 fold_panel.AddFoldPanelWindow(item, self.mask_prop_panel, Spacing= 0,
190 leftSpacing=0, rightSpacing=0) 190 leftSpacing=0, rightSpacing=0)
191 fold_panel.Expand(fold_panel.GetFoldPanel(0)) 191 fold_panel.Expand(fold_panel.GetFoldPanel(0))
192 - 192 +
193 # Fold 2 - Advanced edition tools 193 # Fold 2 - Advanced edition tools
194 item = fold_panel.AddFoldPanel("Advanced edition tools", collapsed=True) 194 item = fold_panel.AddFoldPanel("Advanced edition tools", collapsed=True)
195 fold_panel.ApplyCaptionStyle(item, style) 195 fold_panel.ApplyCaptionStyle(item, style)
@@ -200,11 +200,11 @@ class InnerFoldPanel(wx.Panel): @@ -200,11 +200,11 @@ class InnerFoldPanel(wx.Panel):
200 # Panel sizer to expand fold panel 200 # Panel sizer to expand fold panel
201 sizer = wx.BoxSizer(wx.VERTICAL) 201 sizer = wx.BoxSizer(wx.VERTICAL)
202 sizer.Add(fold_panel, 1, wx.GROW|wx.EXPAND) 202 sizer.Add(fold_panel, 1, wx.GROW|wx.EXPAND)
203 - sizer.Fit(self) 203 + sizer.Fit(self)
204 self.SetSizer(sizer) 204 self.SetSizer(sizer)
205 self.Update() 205 self.Update()
206 self.SetAutoLayout(1) 206 self.SetAutoLayout(1)
207 - 207 +
208 def GetMaskSelected(self): 208 def GetMaskSelected(self):
209 x= self.mask_prop_panel.GetMaskSelected() 209 x= self.mask_prop_panel.GetMaskSelected()
210 return self.mask_prop_panel.GetMaskSelected() 210 return self.mask_prop_panel.GetMaskSelected()
@@ -213,7 +213,7 @@ class MaskProperties(wx.Panel): @@ -213,7 +213,7 @@ class MaskProperties(wx.Panel):
213 def __init__(self, parent): 213 def __init__(self, parent):
214 wx.Panel.__init__(self, parent, size=(50,240)) 214 wx.Panel.__init__(self, parent, size=(50,240))
215 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255)) 215 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255))
216 - 216 +
217 ## LINE 1 217 ## LINE 1
218 218
219 # Combo related to mask naem 219 # Combo related to mask naem
@@ -222,16 +222,16 @@ class MaskProperties(wx.Panel): @@ -222,16 +222,16 @@ class MaskProperties(wx.Panel):
222 combo_mask_name.SetSelection(0) # wx.CB_SORT 222 combo_mask_name.SetSelection(0) # wx.CB_SORT
223 combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) 223 combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
224 self.combo_mask_name = combo_mask_name 224 self.combo_mask_name = combo_mask_name
225 - 225 +
226 # Mask colour 226 # Mask colour
227 button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22)) 227 button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22))
228 self.button_colour = button_colour 228 self.button_colour = button_colour
229 - 229 +
230 # Sizer which represents the first line 230 # Sizer which represents the first line
231 line1 = wx.BoxSizer(wx.HORIZONTAL) 231 line1 = wx.BoxSizer(wx.HORIZONTAL)
232 line1.Add(combo_mask_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) 232 line1.Add(combo_mask_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2)
233 - line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2)  
234 - 233 + line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2)
  234 +
235 ## LINE 2 235 ## LINE 2
236 text_thresh = wx.StaticText(self, -1, 236 text_thresh = wx.StaticText(self, -1,
237 "Set predefined or manual threshold:") 237 "Set predefined or manual threshold:")
@@ -245,10 +245,10 @@ class MaskProperties(wx.Panel): @@ -245,10 +245,10 @@ class MaskProperties(wx.Panel):
245 self.combo_thresh = combo_thresh 245 self.combo_thresh = combo_thresh
246 246
247 ## LINE 4 247 ## LINE 4
248 - gradient = grad.GradientSlider(self, -1, -5000, 5000, 0, 5000, 248 + gradient = grad.GradientSlider(self, -1, -5000, 5000, 0, 5000,
249 (0, 255, 0, 100)) 249 (0, 255, 0, 100))
250 self.gradient = gradient 250 self.gradient = gradient
251 - 251 +
252 # Add all lines into main sizer 252 # Add all lines into main sizer
253 sizer = wx.BoxSizer(wx.VERTICAL) 253 sizer = wx.BoxSizer(wx.VERTICAL)
254 sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) 254 sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
@@ -256,13 +256,13 @@ class MaskProperties(wx.Panel): @@ -256,13 +256,13 @@ class MaskProperties(wx.Panel):
256 sizer.Add(combo_thresh, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) 256 sizer.Add(combo_thresh, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
257 sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6) 257 sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6)
258 sizer.Fit(self) 258 sizer.Fit(self)
259 - 259 +
260 self.SetSizer(sizer) 260 self.SetSizer(sizer)
261 self.Update() 261 self.Update()
262 self.SetAutoLayout(1) 262 self.SetAutoLayout(1)
263 - 263 +
264 # Non GUI stuff 264 # Non GUI stuff
265 - 265 +
266 proj = Project() 266 proj = Project()
267 self.threshold_modes = proj.threshold_modes 267 self.threshold_modes = proj.threshold_modes
268 self.bind_evt_gradient = True 268 self.bind_evt_gradient = True
@@ -280,7 +280,7 @@ class MaskProperties(wx.Panel): @@ -280,7 +280,7 @@ class MaskProperties(wx.Panel):
280 'Set threshold values in gradient') 280 'Set threshold values in gradient')
281 ps.Publisher().subscribe(self.SelectMaskName, 'Select mask name in combo') 281 ps.Publisher().subscribe(self.SelectMaskName, 'Select mask name in combo')
282 ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name') 282 ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name')
283 - 283 +
284 def __bind_events_wx(self): 284 def __bind_events_wx(self):
285 self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnSlideChanged, self.gradient) 285 self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnSlideChanged, self.gradient)
286 self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh) 286 self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh)
@@ -290,7 +290,7 @@ class MaskProperties(wx.Panel): @@ -290,7 +290,7 @@ class MaskProperties(wx.Panel):
290 def SelectMaskName(self, pubsub_evt): 290 def SelectMaskName(self, pubsub_evt):
291 index = pubsub_evt.data 291 index = pubsub_evt.data
292 self.combo_mask_name.SetSelection(index) 292 self.combo_mask_name.SetSelection(index)
293 - 293 +
294 def ChangeMaskName(self, pubsub_evt): 294 def ChangeMaskName(self, pubsub_evt):
295 index, name = pubsub_evt.data 295 index, name = pubsub_evt.data
296 self.combo_mask_name.SetString(index, name) 296 self.combo_mask_name.SetString(index, name)
@@ -302,7 +302,7 @@ class MaskProperties(wx.Panel): @@ -302,7 +302,7 @@ class MaskProperties(wx.Panel):
302 self.gradient.SetMinValue(thresh_min) 302 self.gradient.SetMinValue(thresh_min)
303 self.gradient.SetMaxValue(thresh_max) 303 self.gradient.SetMaxValue(thresh_max)
304 self.bind_evt_gradient = True 304 self.bind_evt_gradient = True
305 - 305 +
306 def SetItemsColour(self, evt_pubsub): 306 def SetItemsColour(self, evt_pubsub):
307 colour = evt_pubsub.data 307 colour = evt_pubsub.data
308 self.gradient.SetColour(colour) 308 self.gradient.SetColour(colour)
@@ -329,7 +329,7 @@ class MaskProperties(wx.Panel): @@ -329,7 +329,7 @@ class MaskProperties(wx.Panel):
329 (thresh_min, thresh_max) = self.threshold_modes[thresh_modes_names[default_thresh]] 329 (thresh_min, thresh_max) = self.threshold_modes[thresh_modes_names[default_thresh]]
330 self.gradient.SetMinValue(thresh_min) 330 self.gradient.SetMinValue(thresh_min)
331 self.gradient.SetMaxValue(thresh_max) 331 self.gradient.SetMaxValue(thresh_max)
332 - 332 +
333 def SetThresholdBounds(self, pubsub_evt): 333 def SetThresholdBounds(self, pubsub_evt):
334 thresh_min = pubsub_evt.data[0] 334 thresh_min = pubsub_evt.data[0]
335 thresh_max = pubsub_evt.data[1] 335 thresh_max = pubsub_evt.data[1]
@@ -362,13 +362,13 @@ class EditionTools(wx.Panel): @@ -362,13 +362,13 @@ class EditionTools(wx.Panel):
362 def __init__(self, parent): 362 def __init__(self, parent):
363 wx.Panel.__init__(self, parent, size=(50,240)) 363 wx.Panel.__init__(self, parent, size=(50,240))
364 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255)) 364 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255))
365 - 365 +
366 ## LINE 1 366 ## LINE 1
367 text1 = wx.StaticText(self, -1, "Choose brush type, size or operation:") 367 text1 = wx.StaticText(self, -1, "Choose brush type, size or operation:")
368 - 368 +
369 ## LINE 2 369 ## LINE 2
370 menu = wx.Menu() 370 menu = wx.Menu()
371 - 371 +
372 CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG) 372 CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG)
373 item = wx.MenuItem(menu, MENU_BRUSH_CIRCLE, "Circle") 373 item = wx.MenuItem(menu, MENU_BRUSH_CIRCLE, "Circle")
374 item.SetBitmap(CIRCLE_BMP) 374 item.SetBitmap(CIRCLE_BMP)
@@ -378,12 +378,12 @@ class EditionTools(wx.Panel): @@ -378,12 +378,12 @@ class EditionTools(wx.Panel):
378 item2.SetBitmap(SQUARE_BMP) 378 item2.SetBitmap(SQUARE_BMP)
379 379
380 menu.AppendItem(item) 380 menu.AppendItem(item)
381 - menu.AppendItem(item2)  
382 - 381 + menu.AppendItem(item2)
  382 +
383 bmp_brush_format = {const.BRUSH_CIRCLE: CIRCLE_BMP, 383 bmp_brush_format = {const.BRUSH_CIRCLE: CIRCLE_BMP,
384 const.BRUSH_SQUARE: SQUARE_BMP} 384 const.BRUSH_SQUARE: SQUARE_BMP}
385 selected_bmp = bmp_brush_format[const.DEFAULT_BRUSH_FORMAT] 385 selected_bmp = bmp_brush_format[const.DEFAULT_BRUSH_FORMAT]
386 - 386 +
387 btn_brush_format = pbtn.PlateButton(self, wx.ID_ANY,"", selected_bmp, 387 btn_brush_format = pbtn.PlateButton(self, wx.ID_ANY,"", selected_bmp,
388 style=pbtn.PB_STYLE_SQUARE) 388 style=pbtn.PB_STYLE_SQUARE)
389 btn_brush_format.SetMenu(menu) 389 btn_brush_format.SetMenu(menu)
@@ -412,7 +412,7 @@ class EditionTools(wx.Panel): @@ -412,7 +412,7 @@ class EditionTools(wx.Panel):
412 text_thresh = wx.StaticText(self, -1, "Brush threshold range:") 412 text_thresh = wx.StaticText(self, -1, "Brush threshold range:")
413 413
414 ## LINE 4 414 ## LINE 4
415 - gradient_thresh = grad.GradientSlider(self, -1, 0, 5000, 0, 5000, 415 + gradient_thresh = grad.GradientSlider(self, -1, 0, 5000, 0, 5000,
416 (0, 0, 255, 100)) 416 (0, 0, 255, 100))
417 self.gradient_thresh = gradient_thresh 417 self.gradient_thresh = gradient_thresh
418 self.bind_evt_gradient = True 418 self.bind_evt_gradient = True
@@ -425,12 +425,12 @@ class EditionTools(wx.Panel): @@ -425,12 +425,12 @@ class EditionTools(wx.Panel):
425 sizer.Add(gradient_thresh, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT| 425 sizer.Add(gradient_thresh, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|
426 wx.BOTTOM, 6) 426 wx.BOTTOM, 6)
427 sizer.Fit(self) 427 sizer.Fit(self)
428 - 428 +
429 self.SetSizer(sizer) 429 self.SetSizer(sizer)
430 self.Update() 430 self.Update()
431 self.SetAutoLayout(1) 431 self.SetAutoLayout(1)
432 432
433 - self.__bind_events() 433 + self.__bind_events()
434 self.__bind_events_wx() 434 self.__bind_events_wx()
435 435
436 436
@@ -439,7 +439,7 @@ class EditionTools(wx.Panel): @@ -439,7 +439,7 @@ class EditionTools(wx.Panel):
439 self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnGradientChanged, 439 self.Bind(grad.EVT_THRESHOLD_CHANGE, self.OnGradientChanged,
440 self.gradient_thresh) 440 self.gradient_thresh)
441 self.combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp) 441 self.combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp)
442 - 442 +
443 def __bind_events(self): 443 def __bind_events(self):
444 ps.Publisher().subscribe(self.SetThresholdBounds, 444 ps.Publisher().subscribe(self.SetThresholdBounds,
445 'Update threshold limits') 445 'Update threshold limits')
@@ -449,19 +449,19 @@ class EditionTools(wx.Panel): @@ -449,19 +449,19 @@ class EditionTools(wx.Panel):
449 def ChangeMaskColour(self, pubsub_evt): 449 def ChangeMaskColour(self, pubsub_evt):
450 colour = pubsub_evt.data 450 colour = pubsub_evt.data
451 self.gradient_thresh.SetColour(colour) 451 self.gradient_thresh.SetColour(colour)
452 - 452 +
453 def SetGradientColour(self, pubsub_evt): 453 def SetGradientColour(self, pubsub_evt):
454 vtk_colour = pubsub_evt.data[3] 454 vtk_colour = pubsub_evt.data[3]
455 wx_colour = [c*255 for c in vtk_colour] 455 wx_colour = [c*255 for c in vtk_colour]
456 self.gradient_thresh.SetColour(wx_colour) 456 self.gradient_thresh.SetColour(wx_colour)
457 - 457 +
458 def SetThresholdValues(self, pubsub_evt): 458 def SetThresholdValues(self, pubsub_evt):
459 thresh_min, thresh_max = pubsub_evt.data 459 thresh_min, thresh_max = pubsub_evt.data
460 self.bind_evt_gradient = False 460 self.bind_evt_gradient = False
461 self.gradient_thresh.SetMinValue(thresh_min) 461 self.gradient_thresh.SetMinValue(thresh_min)
462 self.gradient_thresh.SetMaxValue(thresh_max) 462 self.gradient_thresh.SetMaxValue(thresh_max)
463 self.bind_evt_gradient = True 463 self.bind_evt_gradient = True
464 - 464 +
465 def SetThresholdBounds(self, pubsub_evt): 465 def SetThresholdBounds(self, pubsub_evt):
466 thresh_min = pubsub_evt.data[0] 466 thresh_min = pubsub_evt.data[0]
467 thresh_max = pubsub_evt.data[1] 467 thresh_max = pubsub_evt.data[1]
@@ -469,14 +469,14 @@ class EditionTools(wx.Panel): @@ -469,14 +469,14 @@ class EditionTools(wx.Panel):
469 self.gradient_thresh.SetMaxRange(thresh_max) 469 self.gradient_thresh.SetMaxRange(thresh_max)
470 self.gradient_thresh.SetMinValue(thresh_min) 470 self.gradient_thresh.SetMinValue(thresh_min)
471 self.gradient_thresh.SetMaxValue(thresh_max) 471 self.gradient_thresh.SetMaxValue(thresh_max)
472 - 472 +
473 def OnGradientChanged(self, evt): 473 def OnGradientChanged(self, evt):
474 thresh_min = self.gradient_thresh.GetMinValue() 474 thresh_min = self.gradient_thresh.GetMinValue()
475 thresh_max = self.gradient_thresh.GetMaxValue() 475 thresh_max = self.gradient_thresh.GetMaxValue()
476 if self.bind_evt_gradient: 476 if self.bind_evt_gradient:
477 ps.Publisher().sendMessage('Set edition threshold values', 477 ps.Publisher().sendMessage('Set edition threshold values',
478 (thresh_min, thresh_max)) 478 (thresh_min, thresh_max))
479 - 479 +
480 def OnMenu(self, evt): 480 def OnMenu(self, evt):
481 SQUARE_BMP = wx.Bitmap("../icons/brush_square.jpg", wx.BITMAP_TYPE_JPEG) 481 SQUARE_BMP = wx.Bitmap("../icons/brush_square.jpg", wx.BITMAP_TYPE_JPEG)
482 CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG) 482 CIRCLE_BMP = wx.Bitmap("../icons/brush_circle.jpg", wx.BITMAP_TYPE_JPEG)
@@ -487,7 +487,7 @@ class EditionTools(wx.Panel): @@ -487,7 +487,7 @@ class EditionTools(wx.Panel):
487 MENU_BRUSH_SQUARE: SQUARE_BMP} 487 MENU_BRUSH_SQUARE: SQUARE_BMP}
488 488
489 self.btn_brush_format.SetBitmap(bitmap[evt.GetId()]) 489 self.btn_brush_format.SetBitmap(bitmap[evt.GetId()])
490 - 490 +
491 ps.Publisher().sendMessage('Set brush format', brush[evt.GetId()]) 491 ps.Publisher().sendMessage('Set brush format', brush[evt.GetId()])
492 492
493 def OnBrushSize(self, evt): 493 def OnBrushSize(self, evt):
@@ -496,9 +496,9 @@ class EditionTools(wx.Panel): @@ -496,9 +496,9 @@ class EditionTools(wx.Panel):
496 # in the text ctrl - so we are capturing only changes on text 496 # in the text ctrl - so we are capturing only changes on text
497 # Strangelly this is being called twice 497 # Strangelly this is being called twice
498 ps.Publisher().sendMessage('Set edition brush size',self.spin.GetValue()) 498 ps.Publisher().sendMessage('Set edition brush size',self.spin.GetValue())
499 - 499 +
500 def OnComboBrushOp(self, evt): 500 def OnComboBrushOp(self, evt):
501 brush_op_id = evt.GetSelection() 501 brush_op_id = evt.GetSelection()
502 ps.Publisher().sendMessage('Set edition operation', brush_op_id) 502 ps.Publisher().sendMessage('Set edition operation', brush_op_id)
503 - 503 +
504 504
invesalius/gui/task_surface.py
@@ -42,14 +42,14 @@ OP_LIST = [&quot;Draw&quot;, &quot;Erase&quot;, &quot;Threshold&quot;] @@ -42,14 +42,14 @@ OP_LIST = [&quot;Draw&quot;, &quot;Erase&quot;, &quot;Threshold&quot;]
42 class TaskPanel(wx.Panel): 42 class TaskPanel(wx.Panel):
43 def __init__(self, parent): 43 def __init__(self, parent):
44 wx.Panel.__init__(self, parent) 44 wx.Panel.__init__(self, parent)
45 - 45 +
46 inner_panel = InnerTaskPanel(self) 46 inner_panel = InnerTaskPanel(self)
47 47
48 sizer = wx.BoxSizer(wx.HORIZONTAL) 48 sizer = wx.BoxSizer(wx.HORIZONTAL)
49 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | 49 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT |
50 wx.LEFT, 7) 50 wx.LEFT, 7)
51 sizer.Fit(self) 51 sizer.Fit(self)
52 - 52 +
53 self.SetSizer(sizer) 53 self.SetSizer(sizer)
54 self.Update() 54 self.Update()
55 self.SetAutoLayout(1) 55 self.SetAutoLayout(1)
@@ -60,7 +60,7 @@ class TaskPanel(wx.Panel): @@ -60,7 +60,7 @@ class TaskPanel(wx.Panel):
60 # Contour - slider 60 # Contour - slider
61 # enable / disable Fill holes 61 # enable / disable Fill holes
62 62
63 -class InnerTaskPanel(wx.Panel): 63 +class InnerTaskPanel(wx.Panel):
64 def __init__(self, parent): 64 def __init__(self, parent):
65 wx.Panel.__init__(self, parent) 65 wx.Panel.__init__(self, parent)
66 default_colour = self.GetBackgroundColour() 66 default_colour = self.GetBackgroundColour()
@@ -71,10 +71,10 @@ class InnerTaskPanel(wx.Panel): @@ -71,10 +71,10 @@ class InnerTaskPanel(wx.Panel):
71 BMP_ADD = wx.Bitmap("../icons/object_add.png", wx.BITMAP_TYPE_PNG) 71 BMP_ADD = wx.Bitmap("../icons/object_add.png", wx.BITMAP_TYPE_PNG)
72 BMP_ADD.SetWidth(25) 72 BMP_ADD.SetWidth(25)
73 BMP_ADD.SetHeight(25) 73 BMP_ADD.SetHeight(25)
74 - 74 +
75 # Button for creating new surface 75 # Button for creating new surface
76 button_new_surface = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\ 76 button_new_surface = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\
77 - pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_NOBG) 77 + pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT)
78 self.Bind(wx.EVT_BUTTON, self.OnButton) 78 self.Bind(wx.EVT_BUTTON, self.OnButton)
79 79
80 # Fixed hyperlink items 80 # Fixed hyperlink items
@@ -100,20 +100,20 @@ class InnerTaskPanel(wx.Panel): @@ -100,20 +100,20 @@ class InnerTaskPanel(wx.Panel):
100 button_next = wx.Button(self, -1, "Next step") 100 button_next = wx.Button(self, -1, "Next step")
101 button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) 101 button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
102 #button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask) 102 #button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask)
103 - 103 +
104 # Add line sizers into main sizer 104 # Add line sizers into main sizer
105 main_sizer = wx.BoxSizer(wx.VERTICAL) 105 main_sizer = wx.BoxSizer(wx.VERTICAL)
106 main_sizer.Add(line_new, 0,wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) 106 main_sizer.Add(line_new, 0,wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
107 main_sizer.Add(fold_panel, 1, wx.GROW|wx.EXPAND|wx.ALL, 5) 107 main_sizer.Add(fold_panel, 1, wx.GROW|wx.EXPAND|wx.ALL, 5)
108 main_sizer.Add(button_next, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.BOTTOM, 5) 108 main_sizer.Add(button_next, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.BOTTOM, 5)
109 main_sizer.Fit(self) 109 main_sizer.Fit(self)
110 - 110 +
111 self.SetSizer(main_sizer) 111 self.SetSizer(main_sizer)
112 self.Update() 112 self.Update()
113 self.SetAutoLayout(1) 113 self.SetAutoLayout(1)
114 114
115 self.sizer = main_sizer 115 self.sizer = main_sizer
116 - 116 +
117 def OnButton(self, evt): 117 def OnButton(self, evt):
118 id = evt.GetId() 118 id = evt.GetId()
119 if id == BTN_NEW: 119 if id == BTN_NEW:
@@ -123,7 +123,7 @@ class InnerTaskPanel(wx.Panel): @@ -123,7 +123,7 @@ class InnerTaskPanel(wx.Panel):
123 self.OnLinkNewSurface() 123 self.OnLinkNewSurface()
124 if evt: 124 if evt:
125 evt.Skip() 125 evt.Skip()
126 - 126 +
127 def OnLinkNewSurface(self, evt=None): 127 def OnLinkNewSurface(self, evt=None):
128 dlg = NewSurfaceDialog(self, -1, 'InVesalius 3.0 - New surface') 128 dlg = NewSurfaceDialog(self, -1, 'InVesalius 3.0 - New surface')
129 if dlg.ShowModal() == wx.ID_OK: 129 if dlg.ShowModal() == wx.ID_OK:
@@ -131,10 +131,10 @@ class InnerTaskPanel(wx.Panel): @@ -131,10 +131,10 @@ class InnerTaskPanel(wx.Panel):
131 dlg.Destroy() 131 dlg.Destroy()
132 if evt: 132 if evt:
133 evt.Skip() 133 evt.Skip()
134 - 134 +
135 class NewSurfaceDialog(wx.Dialog): 135 class NewSurfaceDialog(wx.Dialog):
136 def __init__(self, parent, ID, title, size=wx.DefaultSize, 136 def __init__(self, parent, ID, title, size=wx.DefaultSize,
137 - pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, 137 + pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE,
138 useMetal=False): 138 useMetal=False):
139 139
140 # Instead of calling wx.Dialog.__init__ we precreate the dialog 140 # Instead of calling wx.Dialog.__init__ we precreate the dialog
@@ -158,7 +158,7 @@ class NewSurfaceDialog(wx.Dialog): @@ -158,7 +158,7 @@ class NewSurfaceDialog(wx.Dialog):
158 158
159 # Now continue with the normal construction of the dialog 159 # Now continue with the normal construction of the dialog
160 # contents 160 # contents
161 - 161 +
162 # Label related to mask name 162 # Label related to mask name
163 label_mask = wx.StaticText(self, -1, "Select mask to be used for creating 3D surface:") 163 label_mask = wx.StaticText(self, -1, "Select mask to be used for creating 3D surface:")
164 164
@@ -176,7 +176,7 @@ class NewSurfaceDialog(wx.Dialog): @@ -176,7 +176,7 @@ class NewSurfaceDialog(wx.Dialog):
176 text.SetHelpText("Name the new surface to be created") 176 text.SetHelpText("Name the new surface to be created")
177 text.SetValue("Default 3D") 177 text.SetValue("Default 3D")
178 self.text = text 178 self.text = text
179 - 179 +
180 sizer = wx.BoxSizer(wx.VERTICAL) 180 sizer = wx.BoxSizer(wx.VERTICAL)
181 sizer.Add(label_mask, 0, wx.ALL|wx.GROW|wx.EXPAND, 5) 181 sizer.Add(label_mask, 0, wx.ALL|wx.GROW|wx.EXPAND, 5)
182 sizer.Add(combo_surface_name, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 10) 182 sizer.Add(combo_surface_name, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 10)
@@ -184,11 +184,11 @@ class NewSurfaceDialog(wx.Dialog): @@ -184,11 +184,11 @@ class NewSurfaceDialog(wx.Dialog):
184 sizer.Add(text, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT, 10) 184 sizer.Add(text, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT, 10)
185 185
186 btnsizer = wx.StdDialogButtonSizer() 186 btnsizer = wx.StdDialogButtonSizer()
187 - 187 +
188 #if wx.Platform != "__WXMSW__": 188 #if wx.Platform != "__WXMSW__":
189 # btn = wx.ContextHelpButton(self) 189 # btn = wx.ContextHelpButton(self)
190 # btnsizer.AddButton(btn) 190 # btnsizer.AddButton(btn)
191 - 191 +
192 btn = wx.Button(self, wx.ID_OK) 192 btn = wx.Button(self, wx.ID_OK)
193 btn.SetDefault() 193 btn.SetDefault()
194 btnsizer.AddButton(btn) 194 btnsizer.AddButton(btn)
@@ -204,28 +204,28 @@ class NewSurfaceDialog(wx.Dialog): @@ -204,28 +204,28 @@ class NewSurfaceDialog(wx.Dialog):
204 204
205 def GetValue(self): 205 def GetValue(self):
206 return self.text.GetValue() +"| mask: "+ MASK_LIST[self.combo_surface_name.GetSelection()] 206 return self.text.GetValue() +"| mask: "+ MASK_LIST[self.combo_surface_name.GetSelection()]
207 - 207 +
208 class FoldPanel(wx.Panel): 208 class FoldPanel(wx.Panel):
209 def __init__(self, parent): 209 def __init__(self, parent):
210 wx.Panel.__init__(self, parent, size=(50,50)) 210 wx.Panel.__init__(self, parent, size=(50,50))
211 self.SetBackgroundColour(wx.Colour(0,255,0)) 211 self.SetBackgroundColour(wx.Colour(0,255,0))
212 - 212 +
213 inner_panel = InnerFoldPanel(self) 213 inner_panel = InnerFoldPanel(self)
214 -  
215 - sizer = wx.BoxSizer(wx.VERTICAL) 214 +
  215 + sizer = wx.BoxSizer(wx.VERTICAL)
216 sizer.Add(inner_panel, 1, wx.EXPAND|wx.GROW, 2) 216 sizer.Add(inner_panel, 1, wx.EXPAND|wx.GROW, 2)
217 sizer.Fit(self) 217 sizer.Fit(self)
218 - 218 +
219 self.SetSizer(sizer) 219 self.SetSizer(sizer)
220 self.Update() 220 self.Update()
221 self.SetAutoLayout(1) 221 self.SetAutoLayout(1)
222 - 222 +
223 class InnerFoldPanel(wx.Panel): 223 class InnerFoldPanel(wx.Panel):
224 def __init__(self, parent): 224 def __init__(self, parent):
225 wx.Panel.__init__(self, parent) 225 wx.Panel.__init__(self, parent)
226 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255)) 226 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255))
227 #self.SetBackgroundColour(wx.Colour(0,0,0)) 227 #self.SetBackgroundColour(wx.Colour(0,0,0))
228 - 228 +
229 # Fold panel and its style settings 229 # Fold panel and its style settings
230 # FIXME: If we dont insert a value in size or if we set wx.DefaultSize, 230 # FIXME: If we dont insert a value in size or if we set wx.DefaultSize,
231 # the fold_panel doesnt show. This means that, for some reason, Sizer 231 # the fold_panel doesnt show. This means that, for some reason, Sizer
@@ -246,7 +246,7 @@ class InnerFoldPanel(wx.Panel): @@ -246,7 +246,7 @@ class InnerFoldPanel(wx.Panel):
246 fold_panel.AddFoldPanelWindow(item, SurfaceProperties(item), Spacing= 0, 246 fold_panel.AddFoldPanelWindow(item, SurfaceProperties(item), Spacing= 0,
247 leftSpacing=0, rightSpacing=0) 247 leftSpacing=0, rightSpacing=0)
248 fold_panel.Expand(fold_panel.GetFoldPanel(0)) 248 fold_panel.Expand(fold_panel.GetFoldPanel(0))
249 - 249 +
250 # Fold 2 - Surface quality 250 # Fold 2 - Surface quality
251 item = fold_panel.AddFoldPanel("Surface quality", collapsed=True) 251 item = fold_panel.AddFoldPanel("Surface quality", collapsed=True)
252 fold_panel.ApplyCaptionStyle(item, style) 252 fold_panel.ApplyCaptionStyle(item, style)
@@ -258,7 +258,7 @@ class InnerFoldPanel(wx.Panel): @@ -258,7 +258,7 @@ class InnerFoldPanel(wx.Panel):
258 sizer = wx.BoxSizer(wx.VERTICAL) 258 sizer = wx.BoxSizer(wx.VERTICAL)
259 sizer.Add(fold_panel, 1, wx.GROW|wx.EXPAND) 259 sizer.Add(fold_panel, 1, wx.GROW|wx.EXPAND)
260 sizer.Fit(self) 260 sizer.Fit(self)
261 - 261 +
262 self.SetSizer(sizer) 262 self.SetSizer(sizer)
263 self.Update() 263 self.Update()
264 self.SetAutoLayout(1) 264 self.SetAutoLayout(1)
@@ -267,9 +267,9 @@ class SurfaceProperties(wx.Panel): @@ -267,9 +267,9 @@ class SurfaceProperties(wx.Panel):
267 def __init__(self, parent): 267 def __init__(self, parent):
268 wx.Panel.__init__(self, parent, size=(50,240)) 268 wx.Panel.__init__(self, parent, size=(50,240))
269 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255)) 269 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255))
270 - 270 +
271 ## LINE 1 271 ## LINE 1
272 - 272 +
273 # Combo related to mask naem 273 # Combo related to mask naem
274 combo_surface_name = wx.ComboBox(self, -1, "", choices= SURFACE_LIST, 274 combo_surface_name = wx.ComboBox(self, -1, "", choices= SURFACE_LIST,
275 style=wx.CB_DROPDOWN|wx.CB_READONLY) 275 style=wx.CB_DROPDOWN|wx.CB_READONLY)
@@ -277,56 +277,56 @@ class SurfaceProperties(wx.Panel): @@ -277,56 +277,56 @@ class SurfaceProperties(wx.Panel):
277 combo_surface_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) 277 combo_surface_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
278 combo_surface_name.Bind(wx.EVT_COMBOBOX, self.OnComboName) 278 combo_surface_name.Bind(wx.EVT_COMBOBOX, self.OnComboName)
279 self.combo_surface_name = combo_surface_name 279 self.combo_surface_name = combo_surface_name
280 - 280 +
281 # Mask colour 281 # Mask colour
282 button_colour= csel.ColourSelect(self, -1,colour=(0,0,255),size=(-1,22)) 282 button_colour= csel.ColourSelect(self, -1,colour=(0,0,255),size=(-1,22))
283 button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) 283 button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour)
284 self.button_colour = button_colour 284 self.button_colour = button_colour
285 - 285 +
286 # Sizer which represents the first line 286 # Sizer which represents the first line
287 line1 = wx.BoxSizer(wx.HORIZONTAL) 287 line1 = wx.BoxSizer(wx.HORIZONTAL)
288 line1.Add(combo_surface_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) 288 line1.Add(combo_surface_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2)
289 - line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2)  
290 -  
291 - 289 + line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2)
  290 +
  291 +
292 ## LINE 2 292 ## LINE 2
293 - 293 +
294 text_transparency = wx.StaticText(self, -1, "Transparency:") 294 text_transparency = wx.StaticText(self, -1, "Transparency:")
295 - 295 +
296 slider_transparency = wx.Slider(self, -1, 0, MIN_TRANSPARENCY, 296 slider_transparency = wx.Slider(self, -1, 0, MIN_TRANSPARENCY,
297 - MAX_TRANSPARENCY, 297 + MAX_TRANSPARENCY,
298 style=wx.SL_HORIZONTAL)#|wx.SL_AUTOTICKS) 298 style=wx.SL_HORIZONTAL)#|wx.SL_AUTOTICKS)
299 slider_transparency.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) 299 slider_transparency.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
300 slider_transparency.Bind(wx.EVT_SLIDER, self.OnTransparency) 300 slider_transparency.Bind(wx.EVT_SLIDER, self.OnTransparency)
301 self.slider_transparency = slider_transparency 301 self.slider_transparency = slider_transparency
302 -  
303 - 302 +
  303 +
304 ## MIX LINE 2 AND 3 304 ## MIX LINE 2 AND 3
305 flag_link = wx.EXPAND|wx.GROW|wx.RIGHT 305 flag_link = wx.EXPAND|wx.GROW|wx.RIGHT
306 flag_slider = wx.EXPAND | wx.GROW| wx.LEFT|wx.TOP 306 flag_slider = wx.EXPAND | wx.GROW| wx.LEFT|wx.TOP
307 flag_combo = wx.EXPAND | wx.GROW| wx.LEFT 307 flag_combo = wx.EXPAND | wx.GROW| wx.LEFT
308 - 308 +
309 fixed_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=2, vgap=4) 309 fixed_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=2, vgap=4)
310 fixed_sizer.AddMany([ (text_transparency, 0, flag_link, 0), 310 fixed_sizer.AddMany([ (text_transparency, 0, flag_link, 0),
311 (slider_transparency, 1, flag_slider,4)]) 311 (slider_transparency, 1, flag_slider,4)])
312 - 312 +
313 # LINE 4 313 # LINE 4
314 #cb = wx.CheckBox(self, -1, "Fill largest surface holes") 314 #cb = wx.CheckBox(self, -1, "Fill largest surface holes")
315 #cb.SetValue(True) 315 #cb.SetValue(True)
316 - 316 +
317 # Add all lines into main sizer 317 # Add all lines into main sizer
318 sizer = wx.BoxSizer(wx.VERTICAL) 318 sizer = wx.BoxSizer(wx.VERTICAL)
319 sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) 319 sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
320 sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) 320 sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
321 #sizer.Add(cb, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP|wx.BOTTOM, 5) 321 #sizer.Add(cb, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP|wx.BOTTOM, 5)
322 sizer.Fit(self) 322 sizer.Fit(self)
323 - 323 +
324 self.SetSizer(sizer) 324 self.SetSizer(sizer)
325 self.Update() 325 self.Update()
326 self.SetAutoLayout(1) 326 self.SetAutoLayout(1)
327 - 327 +
328 self.__bind_events() 328 self.__bind_events()
329 - 329 +
330 def __bind_events(self): 330 def __bind_events(self):
331 ps.Publisher().subscribe(self.InsertNewSurface, 331 ps.Publisher().subscribe(self.InsertNewSurface,
332 'Update surface info in GUI') 332 'Update surface info in GUI')
@@ -344,10 +344,10 @@ class SurfaceProperties(wx.Panel): @@ -344,10 +344,10 @@ class SurfaceProperties(wx.Panel):
344 colour = [value*255 for value in pubsub_evt.data[2]] 344 colour = [value*255 for value in pubsub_evt.data[2]]
345 transparency = 100*pubsub_evt.data[4] 345 transparency = 100*pubsub_evt.data[4]
346 index = self.combo_surface_name.Append(name) 346 index = self.combo_surface_name.Append(name)
347 - self.combo_surface_name.SetSelection(index) 347 + self.combo_surface_name.SetSelection(index)
348 self.button_colour.SetColour(colour) 348 self.button_colour.SetColour(colour)
349 self.slider_transparency.SetValue(transparency) 349 self.slider_transparency.SetValue(transparency)
350 - 350 +
351 def OnComboName(self, evt): 351 def OnComboName(self, evt):
352 print "TODO: Send Signal - Change 3D surface selected: %s" % (evt.GetString()) 352 print "TODO: Send Signal - Change 3D surface selected: %s" % (evt.GetString())
353 353
@@ -373,19 +373,19 @@ class QualityAdjustment(wx.Panel): @@ -373,19 +373,19 @@ class QualityAdjustment(wx.Panel):
373 def __init__(self, parent): 373 def __init__(self, parent):
374 wx.Panel.__init__(self, parent, size=(50,240)) 374 wx.Panel.__init__(self, parent, size=(50,240))
375 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255)) 375 self.SetBackgroundColour(wx.Colour(221, 221, 221, 255))
376 - 376 +
377 # LINE 1 377 # LINE 1
378 combo_quality = wx.ComboBox(self, -1, "", choices= QUALITY_LIST, 378 combo_quality = wx.ComboBox(self, -1, "", choices= QUALITY_LIST,
379 style=wx.CB_DROPDOWN|wx.CB_READONLY) 379 style=wx.CB_DROPDOWN|wx.CB_READONLY)
380 combo_quality.SetSelection(3) 380 combo_quality.SetSelection(3)
381 combo_quality.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) 381 combo_quality.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
382 - #combo_quality.Bind(wx.EVT_COMBOBOX, self.OnComboQuality)  
383 - 382 + #combo_quality.Bind(wx.EVT_COMBOBOX, self.OnComboQuality)
  383 +
384 # LINE 2 384 # LINE 2
385 check_decimate = wx.CheckBox(self, -1, "") 385 check_decimate = wx.CheckBox(self, -1, "")
386 - 386 +
387 text_decimate = wx.StaticText(self, -1, "Decimate resolution:") 387 text_decimate = wx.StaticText(self, -1, "Decimate resolution:")
388 - 388 +
389 spin_decimate = wx.SpinCtrl(self, -1, "", (30, 50)) 389 spin_decimate = wx.SpinCtrl(self, -1, "", (30, 50))
390 spin_decimate.SetRange(1,100) 390 spin_decimate.SetRange(1,100)
391 spin_decimate.SetValue(30) 391 spin_decimate.SetValue(30)
@@ -393,18 +393,18 @@ class QualityAdjustment(wx.Panel): @@ -393,18 +393,18 @@ class QualityAdjustment(wx.Panel):
393 393
394 # LINE 3 394 # LINE 3
395 check_smooth = wx.CheckBox(self, -1, "") 395 check_smooth = wx.CheckBox(self, -1, "")
396 - 396 +
397 text_smooth = wx.StaticText(self, -1, "Smooth iterations:") 397 text_smooth = wx.StaticText(self, -1, "Smooth iterations:")
398 - 398 +
399 spin_smooth = wx.SpinCtrl(self, -1, "", (30, 50)) 399 spin_smooth = wx.SpinCtrl(self, -1, "", (30, 50))
400 spin_smooth.SetRange(1,100) 400 spin_smooth.SetRange(1,100)
401 spin_smooth.SetValue(0) 401 spin_smooth.SetValue(0)
402 - 402 +
403 # MIXED LINE 2 AND 3 403 # MIXED LINE 2 AND 3
404 flag_link = wx.EXPAND|wx.GROW|wx.RIGHT|wx.LEFT 404 flag_link = wx.EXPAND|wx.GROW|wx.RIGHT|wx.LEFT
405 flag_slider = wx.EXPAND | wx.GROW| wx.LEFT|wx.TOP 405 flag_slider = wx.EXPAND | wx.GROW| wx.LEFT|wx.TOP
406 flag_combo = wx.EXPAND | wx.GROW| wx.LEFT 406 flag_combo = wx.EXPAND | wx.GROW| wx.LEFT
407 - 407 +
408 fixed_sizer = wx.FlexGridSizer(rows=2, cols=3, hgap=2, vgap=0) 408 fixed_sizer = wx.FlexGridSizer(rows=2, cols=3, hgap=2, vgap=0)
409 fixed_sizer.AddMany([ (check_decimate, 0, flag_combo, 2), 409 fixed_sizer.AddMany([ (check_decimate, 0, flag_combo, 2),
410 (text_decimate, 0, flag_slider, 7), 410 (text_decimate, 0, flag_slider, 7),
@@ -413,19 +413,18 @@ class QualityAdjustment(wx.Panel): @@ -413,19 +413,18 @@ class QualityAdjustment(wx.Panel):
413 (text_smooth, 0, flag_slider, 7), 413 (text_smooth, 0, flag_slider, 7),
414 (spin_smooth, 1, flag_link, 14)]) 414 (spin_smooth, 1, flag_link, 14)])
415 fixed_sizer.AddGrowableCol(2) 415 fixed_sizer.AddGrowableCol(2)
416 - 416 +
417 sizer = wx.BoxSizer(wx.VERTICAL) 417 sizer = wx.BoxSizer(wx.VERTICAL)
418 sizer.Add(combo_quality, 1, wx.EXPAND|wx.GROW|wx.LEFT|wx.RIGHT|wx.TOP, 5) 418 sizer.Add(combo_quality, 1, wx.EXPAND|wx.GROW|wx.LEFT|wx.RIGHT|wx.TOP, 5)
419 sizer.Add(fixed_sizer, 0, wx.LEFT|wx.RIGHT, 5) 419 sizer.Add(fixed_sizer, 0, wx.LEFT|wx.RIGHT, 5)
420 sizer.Fit(self) 420 sizer.Fit(self)
421 - 421 +
422 self.SetSizer(sizer) 422 self.SetSizer(sizer)
423 self.Update() 423 self.Update()
424 self.SetAutoLayout(1) 424 self.SetAutoLayout(1)
425 - 425 +
426 def OnComboQuality(self, evt): 426 def OnComboQuality(self, evt):
427 print "TODO: Send Signal - Change surface quality: %s" % (evt.GetString()) 427 print "TODO: Send Signal - Change surface quality: %s" % (evt.GetString())
428 - 428 +
429 def OnDecimate(self, evt): 429 def OnDecimate(self, evt):
430 print "TODO: Send Signal - Decimate: %s" % float(self.spin.GetValue())/100 430 print "TODO: Send Signal - Decimate: %s" % float(self.spin.GetValue())/100
431 -  
432 \ No newline at end of file 431 \ No newline at end of file
invesalius/gui/task_tools.py
@@ -29,19 +29,19 @@ ID_BTN_ANNOTATION = wx.NewId() @@ -29,19 +29,19 @@ ID_BTN_ANNOTATION = wx.NewId()
29 class TaskPanel(wx.Panel): 29 class TaskPanel(wx.Panel):
30 def __init__(self, parent): 30 def __init__(self, parent):
31 wx.Panel.__init__(self, parent) 31 wx.Panel.__init__(self, parent)
32 - 32 +
33 inner_panel = InnerTaskPanel(self) 33 inner_panel = InnerTaskPanel(self)
34 - 34 +
35 sizer = wx.BoxSizer(wx.HORIZONTAL) 35 sizer = wx.BoxSizer(wx.HORIZONTAL)
36 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT | 36 sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW | wx.BOTTOM | wx.RIGHT |
37 wx.LEFT, 7) 37 wx.LEFT, 7)
38 sizer.Fit(self) 38 sizer.Fit(self)
39 - 39 +
40 self.SetSizer(sizer) 40 self.SetSizer(sizer)
41 self.Update() 41 self.Update()
42 self.SetAutoLayout(1) 42 self.SetAutoLayout(1)
43 -  
44 -class InnerTaskPanel(wx.Panel): 43 +
  44 +class InnerTaskPanel(wx.Panel):
45 def __init__(self, parent): 45 def __init__(self, parent):
46 wx.Panel.__init__(self, parent) 46 wx.Panel.__init__(self, parent)
47 self.SetBackgroundColour(wx.Colour(255,255,255)) 47 self.SetBackgroundColour(wx.Colour(255,255,255))
@@ -49,7 +49,7 @@ class InnerTaskPanel(wx.Panel): @@ -49,7 +49,7 @@ class InnerTaskPanel(wx.Panel):
49 49
50 # Counter for projects loaded in current GUI 50 # Counter for projects loaded in current GUI
51 self.proj_count = 0 51 self.proj_count = 0
52 - 52 +
53 # Floating items (to be inserted) 53 # Floating items (to be inserted)
54 self.float_hyper_list = [] 54 self.float_hyper_list = []
55 55
@@ -66,7 +66,7 @@ class InnerTaskPanel(wx.Panel): @@ -66,7 +66,7 @@ class InnerTaskPanel(wx.Panel):
66 txt_annotation.AutoBrowse(False) 66 txt_annotation.AutoBrowse(False)
67 txt_annotation.UpdateLink() 67 txt_annotation.UpdateLink()
68 txt_annotation.Bind(hl.EVT_HYPERLINK_LEFT, self.OnTextAnnotation) 68 txt_annotation.Bind(hl.EVT_HYPERLINK_LEFT, self.OnTextAnnotation)
69 - 69 +
70 # Image(s) for buttons 70 # Image(s) for buttons
71 BMP_ANNOTATE = wx.Bitmap("../icons/annotation.png", wx.BITMAP_TYPE_PNG) 71 BMP_ANNOTATE = wx.Bitmap("../icons/annotation.png", wx.BITMAP_TYPE_PNG)
72 BMP_ANGLE = wx.Bitmap("../icons/measure_angle.jpg", wx.BITMAP_TYPE_JPEG) 72 BMP_ANGLE = wx.Bitmap("../icons/measure_angle.jpg", wx.BITMAP_TYPE_JPEG)
@@ -77,16 +77,16 @@ class InnerTaskPanel(wx.Panel): @@ -77,16 +77,16 @@ class InnerTaskPanel(wx.Panel):
77 BMP_ANGLE.SetHeight(25) 77 BMP_ANGLE.SetHeight(25)
78 BMP_DISTANCE.SetWidth(25) 78 BMP_DISTANCE.SetWidth(25)
79 BMP_DISTANCE.SetHeight(25) 79 BMP_DISTANCE.SetHeight(25)
80 - 80 +
81 # Buttons related to hyperlinks 81 # Buttons related to hyperlinks
82 - button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_NOBG  
83 - 82 + button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT
  83 +
84 button_measure_linear = pbtn.PlateButton(self, ID_BTN_MEASURE_LINEAR, "", 84 button_measure_linear = pbtn.PlateButton(self, ID_BTN_MEASURE_LINEAR, "",
85 BMP_DISTANCE, style=button_style) 85 BMP_DISTANCE, style=button_style)
86 - button_measure_angular = pbtn.PlateButton(self, ID_BTN_MEASURE_ANGULAR, "", 86 + button_measure_angular = pbtn.PlateButton(self, ID_BTN_MEASURE_ANGULAR, "",
87 BMP_ANGLE, style=button_style) 87 BMP_ANGLE, style=button_style)
88 88
89 - button_annotation = pbtn.PlateButton(self, ID_BTN_ANNOTATION, "", 89 + button_annotation = pbtn.PlateButton(self, ID_BTN_ANNOTATION, "",
90 BMP_ANNOTATE, style=button_style) 90 BMP_ANNOTATE, style=button_style)
91 91
92 # When using PlaneButton, it is necessary to bind events from parent win 92 # When using PlaneButton, it is necessary to bind events from parent win
@@ -103,35 +103,34 @@ class InnerTaskPanel(wx.Panel): @@ -103,35 +103,34 @@ class InnerTaskPanel(wx.Panel):
103 sizer.Add(txt_annotation, pos=(1,0),flag=wx.GROW|wx.EXPAND) 103 sizer.Add(txt_annotation, pos=(1,0),flag=wx.GROW|wx.EXPAND)
104 sizer.Add(button_annotation, pos=(1,2),span=(2,1), flag=wx.GROW|wx.EXPAND) 104 sizer.Add(button_annotation, pos=(1,2),span=(2,1), flag=wx.GROW|wx.EXPAND)
105 sizer.AddGrowableCol(0) 105 sizer.AddGrowableCol(0)
106 - 106 +
107 # Add line sizers into main sizer 107 # Add line sizers into main sizer
108 main_sizer = wx.BoxSizer(wx.VERTICAL) 108 main_sizer = wx.BoxSizer(wx.VERTICAL)
109 main_sizer.Add(sizer, 0, wx.GROW|wx.EXPAND) 109 main_sizer.Add(sizer, 0, wx.GROW|wx.EXPAND)
110 main_sizer.Fit(self) 110 main_sizer.Fit(self)
111 -  
112 - # Update main sizer and panel layout 111 +
  112 + # Update main sizer and panel layout
113 self.SetSizer(sizer) 113 self.SetSizer(sizer)
114 self.Fit() 114 self.Fit()
115 self.sizer = main_sizer 115 self.sizer = main_sizer
116 116
117 def OnTextAnnotation(self, evt=None): 117 def OnTextAnnotation(self, evt=None):
118 print "TODO: Send Signal - Add text annotation (both 2d and 3d)" 118 print "TODO: Send Signal - Add text annotation (both 2d and 3d)"
119 - 119 +
120 def OnLinkLinearMeasure(self): 120 def OnLinkLinearMeasure(self):
121 print "TODO: Send Signal - Add linear measure (both 2d and 3d)" 121 print "TODO: Send Signal - Add linear measure (both 2d and 3d)"
122 122
123 def OnLinkAngularMeasure(self): 123 def OnLinkAngularMeasure(self):
124 print "TODO: Send Signal - Add angular measure (both 2d and 3d)" 124 print "TODO: Send Signal - Add angular measure (both 2d and 3d)"
125 - 125 +
126 def OnButton(self, evt): 126 def OnButton(self, evt):
127 id = evt.GetId() 127 id = evt.GetId()
128 - 128 +
129 if id == ID_BTN_MEASURE_LINEAR: 129 if id == ID_BTN_MEASURE_LINEAR:
130 self.OnLinkLinearMeasure() 130 self.OnLinkLinearMeasure()
131 elif id == ID_BTN_MEASURE_ANGULAR: 131 elif id == ID_BTN_MEASURE_ANGULAR:
132 self.OnLinkAngularMeasure() 132 self.OnLinkAngularMeasure()
133 else: # elif id == ID_BTN_ANNOTATION: 133 else: # elif id == ID_BTN_ANNOTATION:
134 self.OnTextAnnotation() 134 self.OnTextAnnotation()
135 -  
136 135
137 -  
138 \ No newline at end of file 136 \ No newline at end of file
  137 +