Commit 04d70f660e648e03a6c818b48b5ed1e993c41e0e

Authored by Thiago Franco de Moraes
1 parent d2b69c97
Exists in master

Select surfaces were not working

Showing 1 changed file with 13 additions and 2 deletions   Show diff stats
invesalius/gui/task_surface.py
@@ -330,6 +330,7 @@ class SurfaceTools(wx.Panel): @@ -330,6 +330,7 @@ class SurfaceTools(wx.Panel):
330 330
331 # When using PlaneButton, it is necessary to bind events from parent win 331 # When using PlaneButton, it is necessary to bind events from parent win
332 self.Bind(wx.EVT_BUTTON, self.OnButton) 332 self.Bind(wx.EVT_BUTTON, self.OnButton)
  333 + self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton)
333 334
334 # Tags and grid sizer for fixed items 335 # Tags and grid sizer for fixed items
335 flag_link = wx.EXPAND|wx.GROW|wx.LEFT|wx.TOP 336 flag_link = wx.EXPAND|wx.GROW|wx.LEFT|wx.TOP
@@ -361,7 +362,8 @@ class SurfaceTools(wx.Panel): @@ -361,7 +362,8 @@ class SurfaceTools(wx.Panel):
361 self.SplitSurface() 362 self.SplitSurface()
362 363
363 def OnLinkSeed(self, evt): 364 def OnLinkSeed(self, evt):
364 - self.button_seeds.Toggle() 365 + self.button_seeds._SetState(not self.button_seeds.GetState())
  366 + self.button_seeds.Refresh()
365 self.SelectSeed() 367 self.SelectSeed()
366 368
367 def OnButton(self, evt): 369 def OnButton(self, evt):
@@ -373,6 +375,13 @@ class SurfaceTools(wx.Panel): @@ -373,6 +375,13 @@ class SurfaceTools(wx.Panel):
373 else: 375 else:
374 self.SelectSeed() 376 self.SelectSeed()
375 377
  378 + def OnToggleButton(self, evt):
  379 + id = evt.GetId()
  380 + if id == BTN_SEEDS:
  381 + self.button_seeds._SetState(self.button_seeds.IsPressed())
  382 + self.button_seeds.Refresh()
  383 + self.SelectSeed()
  384 +
376 def SelectLargest(self): 385 def SelectLargest(self):
377 Publisher.sendMessage('Create surface from largest region') 386 Publisher.sendMessage('Create surface from largest region')
378 387
@@ -380,16 +389,18 @@ class SurfaceTools(wx.Panel): @@ -380,16 +389,18 @@ class SurfaceTools(wx.Panel):
380 Publisher.sendMessage('Split surface') 389 Publisher.sendMessage('Split surface')
381 390
382 def SelectSeed(self): 391 def SelectSeed(self):
383 - if self.button_seeds.IsPressed(): 392 + if self.button_seeds.GetState() == 1:
384 self.StartSeeding() 393 self.StartSeeding()
385 else: 394 else:
386 self.EndSeeding() 395 self.EndSeeding()
387 396
388 def StartSeeding(self): 397 def StartSeeding(self):
  398 + print "Start Seeding"
389 Publisher.sendMessage('Enable style', const.VOLUME_STATE_SEED) 399 Publisher.sendMessage('Enable style', const.VOLUME_STATE_SEED)
390 Publisher.sendMessage('Create surface by seeding - start') 400 Publisher.sendMessage('Create surface by seeding - start')
391 401
392 def EndSeeding(self): 402 def EndSeeding(self):
  403 + print "End Seeding"
393 Publisher.sendMessage('Disable style', const.VOLUME_STATE_SEED) 404 Publisher.sendMessage('Disable style', const.VOLUME_STATE_SEED)
394 Publisher.sendMessage('Create surface by seeding - end') 405 Publisher.sendMessage('Create surface by seeding - end')
395 406