Ejemplo n.º 1
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        self.SetBackgroundColour(default_colour)

        # Fold panel and its style settings
        # FIXME: If we dont insert a value in size or if we set wx.DefaultSize,
        # the fold_panel doesnt show. This means that, for some reason, Sizer
        # is not working properly in this panel. It might be on some child or
        # parent panel. Perhaps we need to insert the item into the sizer also...
        # Study this.
        fold_panel = fpb.FoldPanelBar(self, -1, wx.DefaultPosition,
                                      wx.DefaultSize, 0, fpb.FPB_SINGLE_FOLD)

        # Fold panel style
        style = fpb.CaptionBarStyle()
        style.SetCaptionStyle(fpb.CAPTIONBAR_GRADIENT_V)
        style.SetFirstColour(default_colour)
        style.SetSecondColour(default_colour)

        # Fold 1 - Surface properties
        item = fold_panel.AddFoldPanel(_("Surface properties"), collapsed=True)
        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      SurfaceProperties(item),
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)

        # Fold 2 - Surface tools
        item = fold_panel.AddFoldPanel(_("Advanced options"), collapsed=True)
        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      SurfaceTools(item),
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)

        #fold_panel.AddFoldPanelWindow(item, QualityAdjustment(item), Spacing= 0,
        #                              leftSpacing=0, rightSpacing=0)
        #fold_panel.Expand(fold_panel.GetFoldPanel(1))

        self.fold_panel = fold_panel
        self.__bind_evt()

        # Panel sizer to expand fold panel
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(fold_panel, 1, wx.GROW | wx.EXPAND)
        sizer.Fit(self)

        self.SetSizer(sizer)
        self.Update()
        self.SetAutoLayout(1)

        fold_panel.Expand(fold_panel.GetFoldPanel(1))
        self.ResizeFPB()
        fold_panel.Expand(fold_panel.GetFoldPanel(0))
Ejemplo n.º 2
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        self.SetBackgroundColour(default_colour)

        # Fold panel and its style settings
        # FIXME: If we dont insert a value in size or if we set wx.DefaultSize,
        # the fold_panel doesnt show. This means that, for some reason, Sizer
        # is not working properly in this panel. It might be on some child or
        # parent panel. Perhaps we need to insert the item into the sizer also...
        # Study this.

        fold_panel = fpb.FoldPanelBar(self, -1, wx.DefaultPosition, (10, 293),
                                      0, fpb.FPB_SINGLE_FOLD)

        # Fold panel style
        style = fpb.CaptionBarStyle()
        style.SetCaptionStyle(fpb.CAPTIONBAR_GRADIENT_V)
        style.SetFirstColour(default_colour)
        style.SetSecondColour(default_colour)

        # Fold 1 - Navigation panel
        item = fold_panel.AddFoldPanel(_("Neuronavigation"), collapsed=True)
        ntw = NeuronavigationPanel(item)

        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      ntw,
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)
        fold_panel.Expand(fold_panel.GetFoldPanel(0))

        # Fold 2 - Markers panel
        item = fold_panel.AddFoldPanel(_("Extra tools"), collapsed=True)
        mtw = MarkersPanel(item)

        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      mtw,
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)

        # Check box for camera update in volume rendering during navigation
        tooltip = wx.ToolTip(_("Update camera in volume"))
        checkcamera = wx.CheckBox(self, -1, _('Volume camera'))
        checkcamera.SetToolTip(tooltip)
        checkcamera.SetValue(True)
        checkcamera.Bind(wx.EVT_CHECKBOX,
                         partial(self.UpdateVolumeCamera, ctrl=checkcamera))

        # Check box for camera update in volume rendering during navigation
        tooltip = wx.ToolTip(_("Enable external trigger for creating markers"))
        checktrigger = wx.CheckBox(self, -1, _('External trigger'))
        checktrigger.SetToolTip(tooltip)
        checktrigger.SetValue(False)
        checktrigger.Bind(
            wx.EVT_CHECKBOX,
            partial(self.UpdateExternalTrigger, ctrl=checktrigger))

        if sys.platform != 'win32':
            checkcamera.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            checktrigger.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        line_sizer = wx.BoxSizer(wx.HORIZONTAL)
        line_sizer.Add(checkcamera, 0, wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Add(checktrigger, 1, wx.ALIGN_RIGHT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Fit(self)

        # Panel sizer to expand fold panel
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(fold_panel, 0, wx.GROW | wx.EXPAND)
        sizer.Add(line_sizer, 1, wx.GROW | wx.EXPAND)
        sizer.Fit(self)

        self.SetSizer(sizer)
        self.Update()
        self.SetAutoLayout(1)
Ejemplo n.º 3
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        self.SetBackgroundColour(default_colour)

        # Fold panel and its style settings
        # FIXME: If we dont insert a value in size or if we set wx.DefaultSize,
        # the fold_panel doesnt show. This means that, for some reason, Sizer
        # is not working properly in this panel. It might be on some child or
        # parent panel. Perhaps we need to insert the item into the sizer also...
        # Study this.
        #gbs = wx.GridBagSizer()

        #gbs.AddGrowableRow(0, 1)
        #gbs.AddGrowableCol(0, 1)

        #self.gbs = gbs

        self.last_size = None

        # Panel sizer to expand fold panel
        sizer = wx.BoxSizer(wx.VERTICAL)
        #sizer.Add(gbs, 1, wx.GROW|wx.EXPAND)
        self.SetSizer(sizer)

        fold_panel = fpb.FoldPanelBar(self, -1, wx.DefaultPosition,
                                      wx.DefaultSize, 0, fpb.FPB_SINGLE_FOLD)
        self.fold_panel = fold_panel

        # Fold panel style
        style = fpb.CaptionBarStyle()
        style.SetCaptionStyle(fpb.CAPTIONBAR_GRADIENT_V)
        style.SetFirstColour(default_colour)
        style.SetSecondColour(default_colour)

        # Fold 1 - Mask properties
        item = fold_panel.AddFoldPanel(_("Mask properties"), collapsed=True)
        self.mask_prop_panel = MaskProperties(item)

        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      self.mask_prop_panel,
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)

        # Fold 2 - Advanced edition tools
        item = fold_panel.AddFoldPanel(_("Manual edition"), collapsed=True)
        etw = EditionTools(item)

        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      etw,
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)
        self.__id_editor = item.GetId()
        self.last_panel_opened = None

        # Fold 3 - Watershed
        item = fold_panel.AddFoldPanel(_("Watershed"), collapsed=True)
        wtw = WatershedTool(item)

        fold_panel.ApplyCaptionStyle(item, style)
        fold_panel.AddFoldPanelWindow(item,
                                      wtw,
                                      Spacing=0,
                                      leftSpacing=0,
                                      rightSpacing=0)
        self.__id_watershed = item.GetId()

        sizer.Add(fold_panel, 1, wx.EXPAND)

        fold_panel.Expand(fold_panel.GetFoldPanel(2))
        self.ResizeFPB()
        fold_panel.Expand(fold_panel.GetFoldPanel(0))

        sizer.Layout()
        self.Fit()

        self.fold_panel = fold_panel
        self.last_style = None

        self.__bind_evt()
        self.__bind_pubsub_evt()