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