Commit 73a81e6b6012d163beedc1c4304981b1a9c80c11

Authored by Thiago Franco de Moraes
1 parent 5583d277

Some changes to make invesalius run as a mac app

invesalius/control.py
... ... @@ -630,4 +630,4 @@ class Controller():
630 630  
631 631 def ShowBooleanOpDialog(self, pubsub_evt):
632 632 dlg = dialogs.MaskBooleanDialog(prj.Project().mask_dict)
633   - dlg.ShowModal()
  633 + dlg.Show()
... ...
invesalius/data/cursor_actors.py
... ... @@ -312,8 +312,6 @@ class CursorCircle(CursorBase):
312 312  
313 313 y,x = numpy.ogrid[yi:yf, xi:xf]
314 314  
315   - print "AREA", x
316   -
317 315 index = (y*sy)**2 + (x*sx)**2 <= r**2
318 316 self.points = index
319 317  
... ...
invesalius/data/slice_.py
... ... @@ -370,7 +370,6 @@ class Slice(object):
370 370 # "if" is necessary because wx events are calling this before any mask
371 371 # has been created
372 372 print "__show_mask"
373   - print "self.current_mask", self.current_mask
374 373 if self.current_mask:
375 374 index, value = pubsub_evt.data
376 375 self.ShowMask(index, value)
... ... @@ -805,7 +804,6 @@ class Slice(object):
805 804 """
806 805 self.current_mask.was_edited = False
807 806 thresh_min, thresh_max = threshold_range
808   - print "Threshold"
809 807  
810 808 if self.current_mask.index == index:
811 809 # TODO: find out a better way to do threshold
... ... @@ -817,7 +815,6 @@ class Slice(object):
817 815 m[m == 1] = 255
818 816 self.current_mask.matrix[n+1, 1:, 1:] = m
819 817 else:
820   - print "Only one slice"
821 818 slice_ = self.buffer_slices[orientation].image
822 819 self.buffer_slices[orientation].mask = (255 * ((slice_ >= thresh_min) & (slice_ <= thresh_max))).astype('uint8')
823 820  
... ... @@ -873,7 +870,6 @@ class Slice(object):
873 870 #---------------------------------------------------------------------------
874 871  
875 872 def CreateSurfaceFromIndex(self, pubsub_evt):
876   - print pubsub_evt.data
877 873 surface_parameters = pubsub_evt.data
878 874  
879 875 proj = Project()
... ... @@ -1112,7 +1108,6 @@ class Slice(object):
1112 1108 else:
1113 1109 thresh_min, thresh_max = self.current_mask.threshold_range
1114 1110  
1115   - print ">>>> THreshold", thresh_min, thresh_max
1116 1111 m = (((slice_matrix >= thresh_min) & (slice_matrix <= thresh_max)) * 255)
1117 1112 m[mask == 1] = 1
1118 1113 m[mask == 2] = 2
... ... @@ -1380,8 +1375,6 @@ class Slice(object):
1380 1375 for buffer_ in self.buffer_slices.values():
1381 1376 buffer_.discard_buffer()
1382 1377  
1383   - print type(self.matrix)
1384   -
1385 1378 def OnExportMask(self, pubsub_evt):
1386 1379 pass
1387 1380 ##imagedata = self.current_mask.imagedata
... ...
invesalius/data/styles.py
... ... @@ -1381,9 +1381,6 @@ class WaterShedInteractorStyle(DefaultInteractorStyle):
1381 1381 ##tmp_image = ndimage.morphological_gradient((image - image.min()).astype('uint16'), self.config.mg_size)
1382 1382 #tmp_mask = watershed_ift(tmp_image, markers.astype('int8'), bstruct)
1383 1383  
1384   - print "mask.max >>>", tmp_mask.max()
1385   - print "mask.min >>>", tmp_mask.min()
1386   -
1387 1384 if self.viewer.overwrite_mask:
1388 1385 mask[:] = 0
1389 1386 mask[tmp_mask == 1] = 253
... ...
invesalius/data/viewer_slice.py
... ... @@ -1228,7 +1228,6 @@ class Viewer(wx.Panel):
1228 1228 "Inserting actors"
1229 1229 actors, n = pubsub_evt.data
1230 1230 pos = self.scroll.GetThumbPosition()
1231   - print actors
1232 1231 #try:
1233 1232 #renderer = self.renderers_by_slice_number[n]
1234 1233 #for actor in actors:
... ...
invesalius/gui/data_notebook.py
... ... @@ -433,7 +433,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin):
433 433 self.SetItemImage(key, 0)
434 434  
435 435 def __hide_current_mask(self, pubsub_evt):
436   - print self.mask_list_index.keys()
437 436 self.SetItemImage(self.current_index, 0)
438 437  
439 438 def __init_columns(self):
... ...
invesalius/gui/default_viewers.py
... ... @@ -457,7 +457,6 @@ class VolumeToolPanel(wx.Panel):
457 457 self.id_cutplane = None
458 458 submenu = wx.Menu()
459 459 for name in const.RAYCASTING_TOOLS:
460   - print name
461 460 id = wx.NewId()
462 461 if not(self.id_cutplane):
463 462 self.id_cutplane = id
... ...
invesalius/gui/dialogs.py
... ... @@ -1489,7 +1489,10 @@ class WatershedOptionsDialog(wx.Dialog):
1489 1489  
1490 1490 class MaskBooleanDialog(wx.Dialog):
1491 1491 def __init__(self, masks):
1492   - wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, _(u"Boolean operations"))
  1492 + pre = wx.PreDialog()
  1493 + pre.Create(wx.GetApp().GetTopWindow(), -1, _(u"Boolean operations"), style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP)
  1494 + self.PostCreate(pre)
  1495 +
1493 1496 self._init_gui(masks)
1494 1497 self.CenterOnScreen()
1495 1498  
... ...
invesalius/gui/frame.py
... ... @@ -475,7 +475,6 @@ class Frame(wx.Frame):
475 475 Publisher.sendMessage('Show import directory dialog')
476 476  
477 477 def ShowRetrieveDicomPanel(self):
478   - print "teste.............."
479 478 Publisher.sendMessage('Show retrieve dicom panel')
480 479  
481 480 def ShowOpenProject(self):
... ... @@ -506,15 +505,12 @@ class Frame(wx.Frame):
506 505 Publisher.sendMessage('Reload actual slice')
507 506  
508 507 def OnUndo(self):
509   - print "Undo"
510 508 Publisher.sendMessage('Undo edition')
511 509  
512 510 def OnRedo(self):
513   - print "Redo"
514 511 Publisher.sendMessage('Redo edition')
515 512  
516 513 def OnMaskBoolean(self):
517   - print "Mask boolean"
518 514 Publisher.sendMessage('Show boolean dialog')
519 515  
520 516 def OnCleanMask(self):
... ... @@ -1376,7 +1372,6 @@ class SliceToolBar(AuiToolBar):
1376 1372 for item in self.enable_items:
1377 1373 state = self.GetToolToggled(item)
1378 1374 if state and (item != id):
1379   - print ">>>>", item
1380 1375 self.ToggleTool(item, False)
1381 1376 #self.ToggleTool(const.SLICE_STATE_SCROLL, self.GetToolToggled(const.SLICE_STATE_CROSS))
1382 1377 #self.Update()
... ... @@ -1691,11 +1686,9 @@ class HistoryToolBar(AuiToolBar):
1691 1686 self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITH_MENU)
1692 1687  
1693 1688 def OnUndo(self, event):
1694   - print "Undo"
1695 1689 Publisher.sendMessage('Undo edition')
1696 1690  
1697 1691 def OnRedo(self, event):
1698   - print "Redo"
1699 1692 Publisher.sendMessage('Redo edition')
1700 1693  
1701 1694 def OnToggle(self, event):
... ...
invesalius/gui/task_exporter.py
... ... @@ -257,7 +257,6 @@ class InnerTaskPanel(wx.Panel):
257 257 menu.Bind(wx.EVT_MENU, self.OnMenuPicture)
258 258  
259 259 def OnMenuPicture(self, evt):
260   - print "OnMenuPicture"
261 260 id = evt.GetId()
262 261 value = dlg.ExportPicture(self.id_to_name[id])
263 262 if value:
... ... @@ -273,7 +272,6 @@ class InnerTaskPanel(wx.Panel):
273 272  
274 273 def OnLinkExportMask(self, evt=None):
275 274 project = proj.Project()
276   - print "OnLinkEportMask"
277 275 if sys.platform == 'win32':
278 276 project_name = project.name
279 277 else:
... ... @@ -290,7 +288,6 @@ class InnerTaskPanel(wx.Panel):
290 288  
291 289 if dlg.ShowModal() == wx.ID_OK:
292 290 filename = dlg.GetPath()
293   - print "filename", filename
294 291 extension = "vti"
295 292 if sys.platform != 'win32':
296 293 if filename.split(".")[-1] != extension:
... ...
invesalius/gui/task_slice.py
... ... @@ -305,7 +305,6 @@ class InnerFoldPanel(wx.Panel):
305 305 self.__bind_pubsub_evt()
306 306  
307 307 def __calc_best_size(self, panel):
308   - print "Best size", self.GetSize()
309 308 parent = panel.GetParent()
310 309 q = panel.Reparent(self)
311 310  
... ... @@ -335,8 +334,6 @@ class InnerFoldPanel(wx.Panel):
335 334 #if self.last_size is None or self.last_size.GetHeight() < size.GetHeight():
336 335 #self.SetInitialSize(size)
337 336  
338   - print "Best size", size, self.GetSize(), self.GetClientSize(), q
339   -
340 337 def __bind_evt(self):
341 338 self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption)
342 339  
... ... @@ -494,7 +491,6 @@ class MaskProperties(wx.Panel):
494 491 self.combo_thresh.Delete(i)
495 492  
496 493 def OnRemoveMasks(self, pubsub_evt):
497   - print "OnRemoveMasks"
498 494 list_index = pubsub_evt.data
499 495 for i in list_index:
500 496 self.combo_mask_name.Delete(i)
... ...
invesalius/gui/task_surface.py
... ... @@ -512,7 +512,6 @@ class SurfaceProperties(wx.Panel):
512 512 name = pubsub_evt.data[1]
513 513 colour = [value*255 for value in pubsub_evt.data[2]]
514 514 i = 0
515   - print name, index, self.surface_list
516 515 try:
517 516 i = self.surface_list.index([name, index])
518 517 overwrite = True
... ...
invesalius/gui/widgets/gradient.py
... ... @@ -475,7 +475,6 @@ class GradientCtrl(wx.Panel):
475 475 def ChangeMinValue(self, e):
476 476 # Why do I need to change slide min value if it has been changed for
477 477 # the user?
478   - print "ChangeMinValue", self.slided
479 478 if not self.slided:
480 479 self.gradient_slider.SetMinValue(int(self.spin_min.GetValue()))
481 480 self._GenerateEvent(myEVT_THRESHOLD_CHANGE)
... ... @@ -496,10 +495,8 @@ class GradientCtrl(wx.Panel):
496 495 def _GenerateEvent(self, event):
497 496 if event == myEVT_THRESHOLD_CHANGING:
498 497 self.changed = True
499   - print 'changing'
500 498 elif event == myEVT_THRESHOLD_CHANGED :
501 499 self.changed = False
502   - print 'changed'
503 500  
504 501 evt = SliderEvent(event, self.GetId(), self.min_range,
505 502 self.max_range, self.minimun, self.maximun)
... ...
invesalius/gui/widgets/slice_menu.py
... ... @@ -258,7 +258,6 @@ class SliceMenu(wx.Menu):
258 258 Publisher.sendMessage('Update slice viewer')
259 259  
260 260 elif key in PROJECTIONS_ID:
261   - print 'Key', key
262 261 pid = PROJECTIONS_ID[key]
263 262 Publisher.sendMessage('Set projection type', pid)
264 263 Publisher.sendMessage('Reload actual slice')
... ...