def __init__(self, parent): if wx.Platform == '__WXGTK__': wx.PyPanel.__init__(self, parent, -1, style=wx.RAISED_BORDER | wx.WANTS_CHARS) else: wx.PyPanel.__init__(self, parent, -1, style=wx.WANTS_CHARS) self.bg = wx.Colour(115, 180, 215) # Top sizer sizer = wx.BoxSizer(wx.VERTICAL) # Use toolbook or foldpanelbar depending of preferences if g.conf.toolPanelType == 'TB': self.tp = wx.Toolbook(self, -1, style=wx.BK_TOP) sizer.Add(self.tp, 1, wx.EXPAND) # Image list thumbSize = g.conf.toolThumbSize il = wx.ImageList(thumbSize, thumbSize, True) # Default Id 0 il.Add(images.ToolPanel_Default.GetImage().Scale( thumbSize, thumbSize).ConvertToBitmap()) self.il = il self.tp.AssignImageList(il) elif g.conf.toolPanelType == 'FPB': self.tp = fpb.FoldPanelBar(self, -1, wx.DefaultPosition, wx.DefaultSize, agwStyle=fpb.FPB_VERTICAL) sizer.Add(self.tp, 1, wx.EXPAND) self.panels = [] for name in Manager.panelNames: panelData = Manager.getPanelData(name) if not panelData: continue try: im = Manager.panelImages[name] imageId = il.Add( im.Scale(thumbSize, thumbSize).ConvertToBitmap()) except: imageId = 0 panel = self.AddPanel(name) self.panels.append(panel) for pos, span, comp, bmp in panelData: self.AddButton(panel, pos, span, comp.id, bmp, comp.klass) panel.Fit() if g.conf.toolPanelType == 'TB': self.tp.AddPage(panel, '', imageId=imageId) else: p = self.tp.AddFoldPanel(name, collapsed=False) p.SetBackgroundColour(self.bg) panel.Reparent(p) p.AddWindow(panel, fpb.FPB_ALIGN_WIDTH) self.tp.Fit() self.SetSizer(sizer) # Allow to be resized in horizontal direction only # Events # wx.EVT_KEY_DOWN(self, self.OnKeyDown) # wx.EVT_KEY_UP(self, self.OnKeyUp) self.drag = None
def DoCreateResource(self): TRACE('DoCreateResource: %s', self.GetClass()) if self.GetClass() == 'foldpanel': n = self.GetParamNode('object') if n: old_ins = self._isInside self._isInside = False bar = self._w item = self.CreateResFromNode(n, bar, None) self._isInside = old_ins wnd = item if wnd: item = bar.AddFoldPanel( self.GetText('label'), collapsed=self.GetBool('collapsed')) bar.AddFoldPanelWindow(item, wnd) return wnd else: w = fpb.FoldPanelBar(self.GetParentAsWindow(), self.GetID(), self.GetPosition(), self.GetSize(), self.GetStyle(), self.GetStyle('exstyle')) self.SetupWindow(w) self._w = w old_ins = self._isInside self._isInside = True self.CreateChildren(w, True) self._isInside = old_ins return w
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))
def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, size=(400,300), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) self.SetIcon(GetMondrianIcon()) self.SetMenuBar(self.CreateMenuBar()) self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) self.statusbar.SetStatusWidths([-4, -3]) self.statusbar.SetStatusText("Andrea Gavana @ 23 Mar 2005", 0) self.statusbar.SetStatusText("Welcome to wxPython!", 1) pnl = fpb.FoldPanelBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, fpb.FPB_DEFAULT_STYLE | fpb.FPB_VERTICAL) item = pnl.AddFoldPanel("Test Me", collapsed=False) button1 = wx.Button(item, wx.ID_ANY, "Collapse Me") pnl.AddFoldPanelWindow(item, button1, fpb.FPB_ALIGN_LEFT) pnl.AddFoldPanelSeparator(item) button1.Bind(wx.EVT_BUTTON, self.OnCollapseMe) item = pnl.AddFoldPanel("Test Me Too!", collapsed=True) button2 = wx.Button(item, wx.ID_ANY, "Expand First One") pnl.AddFoldPanelWindow(item, button2, fpb.FPB_ALIGN_LEFT) pnl.AddFoldPanelSeparator(item) button2.Bind(wx.EVT_BUTTON, self.OnExpandMe) newfoldpanel = FoldTestPanel(item, wx.ID_ANY) pnl.AddFoldPanelWindow(item, newfoldpanel) pnl.AddFoldPanelSeparator(item) pnl.AddFoldPanelWindow(item, wx.TextCtrl(item, wx.ID_ANY, "Comment"), fpb.FPB_ALIGN_LEFT, fpb.FPB_DEFAULT_SPACING, 20) item = pnl.AddFoldPanel("Some Opinions ...", collapsed=False) pnl.AddFoldPanelWindow(item, wx.CheckBox(item, wx.ID_ANY, "I Like This")) pnl.AddFoldPanelWindow(item, wx.CheckBox(item, wx.ID_ANY, "And Also This")) pnl.AddFoldPanelWindow(item, wx.CheckBox(item, wx.ID_ANY, "And Gimme This Too")) pnl.AddFoldPanelSeparator(item) pnl.AddFoldPanelWindow(item, wx.CheckBox(item, wx.ID_ANY, "Check This Too If You Like")) pnl.AddFoldPanelWindow(item, wx.CheckBox(item, wx.ID_ANY, "What About This")) item = pnl.AddFoldPanel("Choose One ...", collapsed=False) pnl.AddFoldPanelWindow(item, wx.StaticText(item, wx.ID_ANY, "Enter Your Comment")) pnl.AddFoldPanelWindow(item, wx.TextCtrl(item, wx.ID_ANY, "Comment"), fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 20, 20) self.pnl = pnl
def __init__(self, parent): wx.Panel.__init__(self, parent, size=(150, -1)) fold_panel = fpb.FoldPanelBar(self, -1, style=FPB_DEFAULT_STYLE, agwStyle=fpb.FPB_COLLAPSE_TO_BOTTOM) self.fold_panel = fold_panel self.enable_items = [] self.overwrite = False gbs = wx.GridBagSizer(5, 5) gbs.AddGrowableCol(0, 1) self.gbs = gbs sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(gbs, 1, wx.GROW | wx.EXPAND) self.SetSizer(sizer) image_list = wx.ImageList(16, 16) image_list.Add(GetExpandedIconBitmap()) image_list.Add(GetCollapsedIconBitmap()) # Fold 1 - Data item = fold_panel.AddFoldPanel(_("Data"), collapsed=False, foldIcons=image_list) style = fold_panel.GetCaptionStyle(item) col = style.GetFirstColour() self.enable_items.append(item) #npanel = wx.Panel(self, -1) self.npanel = nb.NotebookPanel(item) self.__calc_best_size(self.npanel) fold_panel.AddFoldPanelWindow( item, self.npanel, #fpb.FPB_ALIGN_WIDTH, #Spacing= 0, leftSpacing=0, rightSpacing=0) gbs.AddGrowableRow(0, 1) gbs.Add(fold_panel, (0, 0), flag=wx.EXPAND) gbs.Layout() item.ResizePanel() sizer.Fit(self) self.Fit() self.SetStateProjectClose() self.__bind_events()
def __init__(self, parent): wx.Panel.__init__( self, parent, pos=wx.Point(5, 5), # size=wx.Size(280, 700)) size=wx.Size(280, 420)) fold_panel = fpb.FoldPanelBar(self, -1, wx.DefaultPosition, self.GetSize(), FPB_DEFAULT_STYLE, fpb.FPB_COLLAPSE_TO_BOTTOM) self.enable_items = [] self.overwrite = False sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(fold_panel, 1, wx.GROW | wx.EXPAND) self.SetSizer(sizer) image_list = wx.ImageList(16, 16) image_list.Add(GetExpandedIconBitmap()) image_list.Add(GetCollapsedIconBitmap()) # Fold 1 - Data item = fold_panel.AddFoldPanel(_("Data"), collapsed=False, foldIcons=image_list) style = fold_panel.GetCaptionStyle(item) col = style.GetFirstColour() self.enable_items.append(item) fold_panel.AddFoldPanelWindow( item, nb.NotebookPanel(item), #Spacing= 0, leftSpacing=0, rightSpacing=0) fold_panel.Expand(fold_panel.GetFoldPanel(0)) # Fold 2 - Tools # Measures # Text Annotations #item = fold_panel.AddFoldPanel(_("Tools"), collapsed=False, # foldIcons=image_list) #style = fold_panel.GetCaptionStyle(item) #col = style.GetFirstColour() #elf.enable_items.append(item) # #fold_panel.AddFoldPanelWindow(item, tools.TaskPanel(item), Spacing= 0, # leftSpacing=0, rightSpacing=0) #fold_panel.Expand(fold_panel.GetFoldPanel(1)) self.SetStateProjectClose() self.__bind_events()
def BuildFoldPanel(self, obj): self.renderPanel.WaitLongTimeOp(True) self.DestroyFoldPanel() self.fpb = fpbar.FoldPanelBar(self, size=self.GetClientSize()) for node in self.shader.childNodes: if node.nodeType == Node.ELEMENT_NODE and node.nodeName == 'param': name = node.attributes['name'].value label = node.attributes['label'].value type = node.attributes['type'].value fp = self.fpb.AddFoldPanel(label, collapsed=True, foldIcons=self.imageList) if type == 'Int': self.ctrlList[name] = IntParamCtrl(self.fpb, fp, node, obj) elif type == 'Float': self.ctrlList[name] = FloatParamCtrl( self.fpb, fp, node, obj) elif type == 'Bool': self.ctrlList[name] = BoolParamCtrl( self.fpb, fp, node, obj) elif type == 'Enum': self.ctrlList[name] = EnumParamCtrl( self.fpb, fp, node, obj) elif type == 'Vector': self.ctrlList[name] = VectorParamCtrl( self.fpb, fp, node, obj) elif type == 'Color': self.ctrlList[name] = ColorParamCtrl( self.fpb, fp, node, obj) elif type == 'EnvelopeCurve': self.ctrlList[name] = CurveParamCtrl( self.fpb, fp, node, obj, self.renderPanel) elif type == 'ColorEnvelopeCurve': self.ctrlList[name] = ColorCurveParamCtrl( self.fpb, fp, node, obj, self.renderPanel) elif type == 'Texture' or type == 'BumpTexture' or type == 'CubeTexture': self.ctrlList[name] = TextureParamCtrl( self.fpb, fp, node, obj, self.renderPanel) self.renderPanel.WaitLongTimeOp(False)
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()
def CreateFoldBar(self, vertical=True): if vertical: self.SetSize((500, 600)) else: self.SetSize((700, 300)) newstyle = (vertical and [fpb.FPB_VERTICAL] or [fpb.FPB_HORIZONTAL])[0] bar = fpb.FoldPanelBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, fpb.FPB_DEFAULT_STYLE | newstyle, fpb.FPB_COLLAPSE_TO_BOTTOM) item = bar.AddFoldPanel("Test me", collapsed=False) button1 = wx.Button(item, wx.ID_ANY, "Collapse Me") button1.Bind(wx.EVT_BUTTON, self.OnCollapseMe) bar.AddFoldPanelWindow(item, button1, fpb.FPB_ALIGN_LEFT) item = bar.AddFoldPanel("Test me too!", collapsed=True) button2 = wx.Button(item, wx.ID_ANY, "Expand First One") button2.Bind(wx.EVT_BUTTON, self.OnExpandMe) bar.AddFoldPanelWindow(item, button2) bar.AddFoldPanelSeparator(item) newfoldpanel = FoldTestPanel(item, wx.ID_ANY) bar.AddFoldPanelWindow(item, newfoldpanel) bar.AddFoldPanelSeparator(item) bar.AddFoldPanelWindow(item, wx.TextCtrl(item, wx.ID_ANY, "Comment"), fpb.FPB_ALIGN_LEFT, fpb.FPB_DEFAULT_SPACING, 20) item = bar.AddFoldPanel("Some Opinions ...", collapsed=False) bar.AddFoldPanelWindow(item, wx.CheckBox(item, wx.ID_ANY, "I Like This")) if vertical: # do not add this for horizontal for better presentation bar.AddFoldPanelWindow( item, wx.CheckBox(item, wx.ID_ANY, "And also this")) bar.AddFoldPanelWindow( item, wx.CheckBox(item, wx.ID_ANY, "And gimme this too")) bar.AddFoldPanelSeparator(item) bar.AddFoldPanelWindow( item, wx.CheckBox(item, wx.ID_ANY, "Check this too if you like")) if vertical: # do not add this for horizontal for better presentation bar.AddFoldPanelWindow( item, wx.CheckBox(item, wx.ID_ANY, "What about this")) item = bar.AddFoldPanel("Choose one ...", collapsed=False) bar.AddFoldPanelWindow( item, wx.StaticText(item, wx.ID_ANY, "Enter your comment")) bar.AddFoldPanelWindow(item, wx.TextCtrl(item, wx.ID_ANY, "Comment"), fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 20) if hasattr(self, "pnl"): self.pnl.Destroy() self.pnl = bar size = self.GetClientSize() self.pnl.SetDimensions(0, 0, size.GetWidth(), size.GetHeight())
def ReCreateFoldPanel(self, fpb_flags): # delete earlier panel self._leftWindow1.DestroyChildren() # recreate the foldpanelbar self._pnl = fpb.FoldPanelBar(self._leftWindow1, -1, wx.DefaultPosition, wx.Size(-1, -1), fpb.FPB_DEFAULT_STYLE, fpb_flags) Images = wx.ImageList(16, 16) Images.Add(GetExpandedIconBitmap()) Images.Add(GetCollapsedIconBitmap()) item = self._pnl.AddFoldPanel("Caption Colours", collapsed=False, foldIcons=Images) self._pnl.AddFoldPanelWindow( item, wx.StaticText(item, -1, "Adjust The First Colour"), fpb.FPB_ALIGN_WIDTH, 5, 20) # RED color spin control self._rslider1 = wx.Slider(item, -1, 0, 0, 255) self._pnl.AddFoldPanelWindow(item, self._rslider1, fpb.FPB_ALIGN_WIDTH, 2, 20) # GREEN color spin control self._gslider1 = wx.Slider(item, -1, 0, 0, 255) self._pnl.AddFoldPanelWindow(item, self._gslider1, fpb.FPB_ALIGN_WIDTH, 0, 20) # BLUE color spin control self._bslider1 = wx.Slider(item, -1, 0, 0, 255) self._pnl.AddFoldPanelWindow(item, self._bslider1, fpb.FPB_ALIGN_WIDTH, 0, 20) self._pnl.AddFoldPanelSeparator(item) self._pnl.AddFoldPanelWindow( item, wx.StaticText(item, -1, "Adjust The Second Colour"), fpb.FPB_ALIGN_WIDTH, 5, 20) # RED color spin control self._rslider2 = wx.Slider(item, -1, 0, 0, 255) self._pnl.AddFoldPanelWindow(item, self._rslider2, fpb.FPB_ALIGN_WIDTH, 2, 20) # GREEN color spin control self._gslider2 = wx.Slider(item, -1, 0, 0, 255) self._pnl.AddFoldPanelWindow(item, self._gslider2, fpb.FPB_ALIGN_WIDTH, 0, 20) # BLUE color spin control self._bslider2 = wx.Slider(item, -1, 0, 0, 255) self._pnl.AddFoldPanelWindow(item, self._bslider2, fpb.FPB_ALIGN_WIDTH, 0, 20) self._pnl.AddFoldPanelSeparator(item) button1 = wx.Button(item, wx.ID_ANY, "Apply To All") button1.Bind(wx.EVT_BUTTON, self.OnExpandMe) self._pnl.AddFoldPanelWindow(item, button1) # read back current gradients and set the sliders # for the colour which is now taken as default style = self._pnl.GetCaptionStyle(item) col = style.GetFirstColour() self._rslider1.SetValue(col.Red()) self._gslider1.SetValue(col.Green()) self._bslider1.SetValue(col.Blue()) col = style.GetSecondColour() self._rslider2.SetValue(col.Red()) self._gslider2.SetValue(col.Green()) self._bslider2.SetValue(col.Blue()) # put down some caption styles from which the user can # select to show how the current or all caption bars will look like item = self._pnl.AddFoldPanel("Caption Style", False, foldIcons=Images) self.ID_USE_VGRADIENT = wx.NewId() self.ID_USE_HGRADIENT = wx.NewId() self.ID_USE_SINGLE = wx.NewId() self.ID_USE_RECTANGLE = wx.NewId() self.ID_USE_FILLED_RECTANGLE = wx.NewId() currStyle = wx.RadioButton(item, self.ID_USE_VGRADIENT, "&Vertical Gradient") self._pnl.AddFoldPanelWindow(item, currStyle, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) currStyle.SetValue(True) radio1 = wx.RadioButton(item, self.ID_USE_HGRADIENT, "&Horizontal Gradient") radio2 = wx.RadioButton(item, self.ID_USE_SINGLE, "&Single Colour") radio3 = wx.RadioButton(item, self.ID_USE_RECTANGLE, "&Rectangle Box") radio4 = wx.RadioButton(item, self.ID_USE_FILLED_RECTANGLE, "&Filled Rectangle Box") currStyle.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) radio1.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) radio2.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) radio3.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) radio4.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) self._pnl.AddFoldPanelWindow(item, radio1, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) self._pnl.AddFoldPanelWindow(item, radio2, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) self._pnl.AddFoldPanelWindow(item, radio3, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) self._pnl.AddFoldPanelWindow(item, radio4, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) self._pnl.AddFoldPanelSeparator(item) self._single = wx.CheckBox(item, -1, "&Only This Caption") self._pnl.AddFoldPanelWindow(item, self._single, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) # one more panel to finish it cs = fpb.CaptionBarStyle() cs.SetCaptionStyle(fpb.CAPTIONBAR_RECTANGLE) item = self._pnl.AddFoldPanel("Misc Stuff", collapsed=True, foldIcons=Images, cbstyle=cs) button2 = wx.Button(item, wx.NewId(), "Collapse All") self._pnl.AddFoldPanelWindow(item, button2) self._pnl.AddFoldPanelWindow( item, wx.StaticText(item, -1, "Enter Some Comments"), fpb.FPB_ALIGN_WIDTH, 5, 20) self._pnl.AddFoldPanelWindow(item, wx.TextCtrl(item, -1, "Comments"), fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) button2.Bind(wx.EVT_BUTTON, self.OnCollapseMe) self.radiocontrols = [currStyle, radio1, radio2, radio3, radio4] self._leftWindow1.SizeWindows()
def __init__(self, parent): wx.Panel.__init__(self, parent) fold_panel = fpb.FoldPanelBar(self, -1, wx.DefaultPosition, wx.DefaultSize, FPB_DEFAULT_STYLE, fpb.FPB_SINGLE_FOLD) image_list = wx.ImageList(16, 16) image_list.Add(GetExpandedIconBitmap()) image_list.Add(GetCollapsedIconBitmap()) self.enable_items = [] self.overwrite = False session = ses.Session() print "session mode: ", session.mode if int(session.mode) == const.MODE_RP: tasks = [(_("Load data"), importer.TaskPanel), (_("Select region of interest"), slice_.TaskPanel), (_("Configure 3D surface"), surface.TaskPanel), (_("Export data"), exporter.TaskPanel)] elif int(session.mode) == const.MODE_NAVIGATOR: tasks = [(_("Load data"), importer.TaskPanel), (_("Select region of interest"), slice_.TaskPanel), (_("Configure 3D surface"), surface.TaskPanel), (_("Export data"), exporter.TaskPanel), (_("Navigation system"), navigator.TaskPanel)] for i in xrange(len(tasks)): (name, panel) = tasks[i] # Create panel item = fold_panel.AddFoldPanel("%d. %s" % (i + 1, name), collapsed=True, foldIcons=image_list) style = fold_panel.GetCaptionStyle(item) col = style.GetFirstColour() # Add panel to FoldPanel fold_panel.AddFoldPanelWindow( item, panel(item), #Spacing= 0, leftSpacing=0, rightSpacing=0) # All items, except the first one, should be disabled if. # no data has been imported initially. if i != 0: self.enable_items.append(item) # If it is related to mask, this value should be kept # It is used as reference to set mouse cursor related to # slice editor. if name == _("Select region of interest"): self.__id_slice = item.GetId() elif name == _("Configure 3D surface"): self.__id_surface = item.GetId() fold_panel.Expand(fold_panel.GetFoldPanel(0)) self.fold_panel = fold_panel sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(fold_panel, 1, wx.GROW | wx.EXPAND) self.SetSizerAndFit(sizer) self.SetStateProjectClose() self.__bind_events()
def __init__(self, parent): wx.Panel.__init__(self, parent) default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR) self.SetBackgroundColour(default_colour) self.__bind_events() # 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. displaySize = wx.DisplaySize() if displaySize[1] > 768: fold_panel = fpb.FoldPanelBar(self, -1, wx.DefaultPosition, (10, 350), 0, fpb.FPB_SINGLE_FOLD) else: 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)) self.checktrigger = 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)