def create_stylestoolbar(self, toolbar): "build toolbar with buttons to change styles" self.textcolour = wx.BLACK self.fontpicker = wx.FontPickerCtrl(toolbar, style=wx.FNTP_FONTDESC_AS_LABEL) self.fontpicker.Bind(wx.EVT_FONTPICKER_CHANGED, self.editor.text_font) toolbar.AddControl(self.fontpicker) self.fgcselect = csel.ColourSelect(toolbar, colour=self.textcolour) self.fgcselect.Bind(csel.EVT_COLOURSELECT, self.editor.text_color) toolbar.AddControl(self.fgcselect) bmp = wx.Bitmap(14, 14) self.fgcset = wxlb.GenBitmapButton(toolbar, bitmap=bmp, size=(22, 22)) self.changebitmapbuttoncolour(self.fgcset, self.textcolour) self.fgcset.Bind(wx.EVT_BUTTON, self.editor.set_text_color) toolbar.AddControl(self.fgcset) self.backgroundcolour = wx.WHITE self.bgcselect = csel.ColourSelect(toolbar, colour=self.backgroundcolour, size=(24, 24)) self.bgcselect.Bind(csel.EVT_COLOURSELECT, self.editor.background_color) toolbar.AddControl(self.bgcselect) bmp = wx.Bitmap(16, 16) self.bgcset = wxlb.GenBitmapButton(toolbar, bitmap=bmp, size=(24, 24)) self.changebitmapbuttoncolour(self.bgcset, self.backgroundcolour) self.bgcset.Bind(wx.EVT_BUTTON, self.editor.set_background_color) toolbar.AddControl(self.bgcset)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) self.SetAutoLayout(True) mainSizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(mainSizer) t = wx.StaticText( self, -1, "This example uses a colour selection control based on the wxButton\n" "and wxColourDialog Classes. Click Button to get Colour Values") mainSizer.Add(t, 0, wx.ALL, 3) b = wx.Button(self, -1, "Show All Colours") self.Bind(wx.EVT_BUTTON, self.OnShowAll, id=b.GetId()) mainSizer.Add(b, 0, wx.ALL, 3) buttonSizer = wx.FlexGridSizer( cols=2) # sizer to contain all the example buttons # show a button with all default values self.colourDefaults = csel.ColourSelect(self, -1) self.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour, id=self.colourDefaults.GetId()) buttonSizer.AddMany([ (wx.StaticText(self, -1, "Default Colour/Size"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), (self.colourDefaults, 0, wx.ALL, 3), ]) # build several examples of buttons with different colours and sizes buttonData = [ ("Default Size", (255, 255, 0), wx.DefaultSize, ""), ("Another Size", (255, 0, 255), (60, 20), ""), ("Another Colour", (0, 255, 0), wx.DefaultSize, ""), ("Larger Size", (0, 0, 255), (60, 60), ""), ("With a Label", (127, 0, 255), wx.DefaultSize, "Colour..."), ("Another Colour/Label", (255, 100, 130), (120, -1), "Choose Colour..."), ] self.buttonRefs = [] # for saving references to buttons # build each button and save a reference to it for name, color, size, label in buttonData: b = csel.ColourSelect(self, -1, label, color, size=size) b.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) self.buttonRefs.append((name, b)) # store reference to button buttonSizer.AddMany([ (wx.StaticText(self, -1, name), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), (b, 0, wx.ALL, 3), ]) mainSizer.Add(buttonSizer, 0, wx.ALL, 3) self.Layout()
def __init__(self, parent, title, group="Hands"): _GroupBase.__init__(self, parent, title, group) box = wx.StaticBoxSizer(wx.StaticBox(self, label=title), wx.VERTICAL) sizer = self.sizer = wx.GridBagSizer(vgap=2, hgap=6) p = wx.StaticText(self, label="Border:") sizer.Add(p, pos=(0, 0), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.bc = csel.ColourSelect(self) p.SetCustomColours(self.customcolours) sizer.Add(p, pos=(0, 1), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.bw = wx.SpinCtrl(self, min=0, max=100, value="75") sizer.Add(p, pos=(0, 2), span=(1, 2), flag=wx.ALIGN_CENTRE_VERTICAL) p = wx.StaticText(self, label="Fill:") sizer.Add(p, pos=(1, 0), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.fc = csel.ColourSelect(self) p.SetCustomColours(self.customcolours) sizer.Add(p, pos=(1, 1), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.ls = wx.StaticText(self, label="Size:") sizer.Add(p, pos=(2, 0), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.sz = wx.SpinCtrl(self, min=0, max=100, value="75") sizer.Add(p, pos=(2, 1), span=(1, 3), flag=wx.ALIGN_CENTRE_VERTICAL) box.Add(sizer) self.SetSizer(box)
def __init__(self, parent, title, group="Window"): _GroupBase.__init__(self, parent, title, group) box = wx.StaticBoxSizer(wx.StaticBox(self, label=title), wx.VERTICAL) sizer = self.sizer = wx.GridBagSizer(2, 6) p = wx.StaticText(self, label="Foreground:") sizer.Add(p, pos=(0, 0), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.fg = csel.ColourSelect(self) p.SetCustomColours(self.customcolours) sizer.Add(p, pos=(0, 1), span=(1, 3), flag=wx.ALIGN_CENTRE_VERTICAL) p = wx.StaticText(self, label="Background:") sizer.Add(p, pos=(1, 0), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.bg = csel.ColourSelect(self) p.SetCustomColours(self.customcolours) sizer.Add(p, pos=(1, 1), span=(1, 3), flag=wx.ALIGN_CENTRE_VERTICAL) p = wx.StaticText(self, label="Style:") sizer.Add(p, pos=(2, 0), flag=wx.ALIGN_CENTRE_VERTICAL) p = self.ws = wx.Choice(self, choices=_window_styles) sizer.Add(p, pos=(2, 1), span=(1, 3), flag=wx.ALIGN_CENTRE_VERTICAL) box.Add(sizer) self.SetSizer(box)
def _create_color_buttons(self): """Create color choice buttons""" button_size = (30, 30) button_style = wx.NO_BORDER try: self.linecolor_choice = \ csel.ColourSelect(self, -1, unichr(0x2500), (0, 0, 0), size=button_size, style=button_style) except UnicodeEncodeError: # ANSI wxPython installed self.linecolor_choice = \ csel.ColourSelect(self, -1, "-", (0, 0, 0), size=button_size, style=button_style) self.bgcolor_choice = \ csel.ColourSelect(self, -1, "", (255, 255, 255), size=button_size, style=button_style) self.textcolor_choice = \ csel.ColourSelect(self, -1, "A", (0, 0, 0), size=button_size, style=button_style) self.linecolor_choice.SetToolTipString(_(u"Border line color")) self.bgcolor_choice.SetToolTipString(_(u"Cell background")) self.textcolor_choice.SetToolTipString(_(u"Text color")) self.AddControl(self.linecolor_choice) self.AddControl(self.bgcolor_choice) self.AddControl(self.textcolor_choice) self.linecolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnLineColor) self.bgcolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnBGColor) self.textcolor_choice.Bind(csel.EVT_COLOURSELECT, self.OnTextColor)
def get_xy_label(self, conf): self.sbox_xy = wx.StaticBox(self, -1, L('AXES_VALUES')) sboxs_grid = wx.StaticBoxSizer(self.sbox_xy, wx.VERTICAL) _label = L('IN_X') self.x_ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.x_ch.SetValue(conf.x_axis_show) self.x_ch.Bind(wx.EVT_CHECKBOX, self.on_checked_x_axes_label) self.x_label_color = wx.StaticText(self, -1, L('COLOR_X')) _c = wx.NamedColour(conf.x_axis_color) self.x_label_color_cs = csel.ColourSelect(self, colour=_c) self.x_label_color_cs.Enable(conf.x_axis_show) _label = L('IN_Y') self.y_ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.y_ch.SetValue(conf.y_axis_show) self.y_ch.Bind(wx.EVT_CHECKBOX, self.on_checked_y_axes_label) self.y_label_color = wx.StaticText(self, -1, L('COLOR_Y')) _c = wx.NamedColour(conf.y_axis_color) self.y_label_color_cs = csel.ColourSelect(self, colour=_c) self.y_label_color_cs.Enable(conf.y_axis_show) _label = L('LABEL_STILE_LATEX_X') self.ll_ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.ll_ch.SetValue(conf.x_label_latex_show) self.x_label_des_spin = wx.StaticText(self, -1, L('LABEL_SIZE_X')) self.x_label_zize_spin = wx.SpinCtrl(self, -1, "") self.x_label_zize_spin.SetRange(1, 50) self.x_label_zize_spin.SetValue(conf.xticklabelssize) grid = wx.FlexGridSizer(cols=5) grid.Add(self.x_ch, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, ""), 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.y_ch, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, ""), 0, wx.ALIGN_LEFT | wx.ALL, 5) _style = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(self.x_label_color, 0, _style, 5) grid.Add(self.x_label_color_cs, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.y_label_color, 0, _style, 5) grid.Add(self.y_label_color_cs, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(self.ll_ch, 0, _style, 5) grid.Add(wx.StaticText(self, -1, ""), 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.x_label_des_spin, 0, _style, 5) grid.Add(self.x_label_zize_spin, 0, wx.ALIGN_LEFT | wx.ALL, 5) sboxs_grid.Add(grid, 1, wx.EXPAND | wx.ALL, 10) return sboxs_grid
def _create_field_grid(self): self.txt_name = wx.TextCtrl(self, size=(150, -1)) self.colorpicker = colourselect.ColourSelect(self) self.fontcolorpicker = colourselect.ColourSelect(self) self.parentlistbox = wx.Choice(self, wx.ID_ANY) grid = wx.FlexGridSizer(4, 2, BORDER, BORDER) self._add_ctrl_to_grid(_("Name:"), self.txt_name, grid) self._add_ctrl_to_grid(_("Color:"), self.colorpicker, grid) self._add_ctrl_to_grid(_("Font Color:"), self.fontcolorpicker, grid) self._add_ctrl_to_grid(_("Parent:"), self.parentlistbox, grid) return grid
def __init__(self, parent, symbol, *args, **kwds): wx.Panel.__init__(self, parent, *args, **kwds) self.symbol = symbol self.parent = parent #self.colorbut = wx.Button(self, -1, "") self.colorbut = csel.ColourSelect(self, -1, "", symbol["color"], size=(30, 20)) self.sizesc = wx.SpinCtrl(self, -1, "") self.sizesc.SetRange(1, 100) self.sizesc.SetValue(symbol["size"]) self.olcolorbut = csel.ColourSelect(self, -1, "", symbol["olcolor"], size=(30, 20)) self.colorbut.Bind(csel.EVT_COLOURSELECT, parent.ChangeColor) self.olcolorbut.Bind(csel.EVT_COLOURSELECT, parent.ChangeOLColor) self.sizesc.Bind(wx.EVT_SPINCTRL, parent.ChangeSize) box = wx.StaticBox(self, -1, _("Option")) bsizer = wx.StaticBoxSizer(box, wx.VERTICAL) sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.FlexGridSizer(cols=2, vgap=4, hgap=4) sizer_2.Add(wx.StaticText(self, -1, _("color") + ":"), 0, wx.ADJUST_MINSIZE | wx.ALL, 10) sizer_2.Add(self.colorbut, 0, wx.ADJUST_MINSIZE, 10) sizer_2.Add(wx.StaticText(self, -1, _("size") + ":"), 0, wx.ADJUST_MINSIZE | wx.ALL, 10) sizer_2.Add(self.sizesc, 0, wx.ADJUST_MINSIZE, 10) sizer_2.Add(wx.StaticText(self, -1, _("outline color") + ":"), 0, wx.ADJUST_MINSIZE | wx.ALL, 10) sizer_2.Add(self.olcolorbut, 0, wx.ADJUST_MINSIZE, 10) bsizer.Add(sizer_2, 1, wx.ADJUST_MINSIZE, 0) sizer_1.Add(bsizer, 1, wx.EXPAND, 0) self.SetAutoLayout(True) self.SetSizer(sizer_1) sizer_1.Fit(self) sizer_1.SetSizeHints(self) self.Layout() #加载初始配置 if 'bitmap' in self.parent.symbol: self.parent.symbol.pop('bitmap') if 'hatch' in self.parent.symbol: self.parent.symbol.pop('hatch') self.parent.RefreshPreview()
def get_spines_figure(self, a_conf): self.sbox_spf = wx.StaticBox(self, -1, L('EDGES')) sboxs_spf = wx.StaticBoxSizer(self.sbox_spf, wx.VERTICAL) grid = wx.FlexGridSizer(cols=5) # ---- color de bordes self.top_label = wx.StaticText(self, -1, L('TOP')) _c = wx.NamedColour(a_conf.color_top_spine) self.clr_top_sp = csel.ColourSelect(self, -1, L('CHOOSE_A_COLOR'), _c, size=(120, 30)) self.bottom_label = wx.StaticText(self, -1, L('BOTTOM')) _c = wx.NamedColour(a_conf.color_bottom_spine) self.clr_bottom_sp = csel.ColourSelect(self, -1, L('CHOOSE_A_COLOR'), _c, size=(120, 30)) self.left_label = wx.StaticText(self, -1, L('LEFT')) _c = wx.NamedColour(a_conf.color_left_spine) self.clr_left_sp = csel.ColourSelect(self, -1, L('CHOOSE_A_COLOR'), _c, size=(120, 30)) self.right_label = wx.StaticText(self, -1, L('RIGHT')) _c = wx.NamedColour(a_conf.color_right_spine) _l = L('CHOOSE_A_COLOR') self.clr_right_sp = csel.ColourSelect(self, -1, _l, _c, size=(120, 30)) _style = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(self.top_label, 0, _style, 5) grid.Add(self.clr_top_sp, 0, wx.EXPAND | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.bottom_label, 0, _style, 5) grid.Add(self.clr_bottom_sp, 0, wx.EXPAND | wx.ALL, 5) grid.Add(self.left_label, 0, _style, 5) grid.Add(self.clr_left_sp, 0, wx.EXPAND | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.right_label, 0, _style, 5) grid.Add(self.clr_right_sp, 0, wx.EXPAND | wx.ALL, 5) sboxs_spf.Add(grid, 0, wx.ALL, 3) return sboxs_spf
def __init__(self, parent, id, configParser, configColourVar, size, label="", pos=wx.DefaultPosition, style=0): """ """ # Call superclass constructors ConfigControl.__init__(self, parent, configParser, configColourVar) wx.FlexGridSizer.__init__(self, 1, 2) # Controls self.ctrl = cSel.ColourSelect(self.parent, id, label, self.configVar.Value, \ pos, size, callback = self._callback) colourCtrlLabel = wx.StaticText(self.parent, -1, self.configVar.setting.displayName) # ToolTips self.ctrl.SetToolTip(wx.ToolTip(self.configVar.setting.description)) colourCtrlLabel.SetToolTip( wx.ToolTip(self.configVar.setting.description)) # Add Controls to Sizer self.Add(colourCtrlLabel, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) self.Add(self.ctrl, 0, wx.ALL, 3) # Bindings self.ctrl.Bind(wx.EVT_KEY_DOWN, self.onOK)
def __init__(self, parent, type="individu", IDcategorie=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) self.parent = parent self.type = type self.IDcategorie = IDcategorie self.box_contenu_staticbox = wx.StaticBox(self, -1, u"") self.label_label = wx.StaticText(self, -1, _(u"Label :")) self.ctrl_label = wx.TextCtrl(self, -1, u"") self.ctrl_label.SetMinSize((300, -1)) self.label_visible = wx.StaticText(self, -1, _(u"Visible :")) self.ctrl_visible = wx.CheckBox(self, -1, u"") self.ctrl_visible.SetValue(True) self.label_couleur = wx.StaticText(self, -1, _(u"Couleur :")) couleur_defaut = (174, 255, 174) self.ctrl_couleur = csel.ColourSelect(self, -1, u"", couleur_defaut, size=(60, 20)) self.bouton_ok = CTRL_Bouton_image.CTRL(self, texte=_(u"Ok"), cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png")) self.bouton_annuler = CTRL_Bouton_image.CTRL(self, texte=_(u"Annuler"), cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) # Importation if self.IDcategorie != None : self.Importation()
def createControl(self, parent, value, idx, sizeX, style=wx.TE_PROCESS_ENTER): # r = value[0] * 255 # g = value[1] * 255 # b = value[2] * 255 r = value[0] g = value[1] b = value[2] self.parent = parent self.sizeX = sizeX self.idx = idx s = "(%d, %d, %d)" % (r, g, b) self.editorCtrl = csel.ColourSelect(parent, 2000, s, wx.Color(r, g, b), size=(sizeX, oiLineHeight + 3), pos=(-2, idx * oiLineHeight - 2)) self.editorCtrl.Bind(csel.EVT_COLOURSELECT, self.on_select_color, id=2000)
def __init__(self, parent, ID=-1, title=_(u"Saisie d'une nouvelle catégorie"), IDcategorie=0, IDcat_parent=0): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) # Valeurs par défaut à appliquer self.IDcategorie = IDcategorie self.IDcat_parent = IDcat_parent self.couleur = (255, 255, 255) self.nom_categorie = "" # Importation des données if self.IDcategorie != 0: self.Importation() self.SetTitle(_(u"Modification d'une catégorie")) self.panel_base = wx.Panel(self, -1) self.sizer_nom_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Nom de la catégorie")) self.sizer_couleur_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Couleur")) self.sizer_tree_staticbox = wx.StaticBox( self.panel_base, -1, _(u"Sélection de la catégorie parente")) self.treeCtrl_categories = TreeCtrlCategories(self.panel_base, self.IDcat_parent) self.text_nom = wx.TextCtrl(self.panel_base, -1, self.nom_categorie) self.bouton_aide = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Aide"), cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png")) self.bouton_ok = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Ok"), cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png")) self.bouton_annuler = CTRL_Bouton_image.CTRL( self.panel_base, texte=_(u"Annuler"), cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png")) self.bouton_couleur = csel.ColourSelect(self.panel_base, -1, "", self.couleur, size=(40, 22)) self.bouton_couleur.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) self.Bind(wx.EVT_BUTTON, self.OnBouton_aide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBouton_ok, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBouton_annuler, self.bouton_annuler) self.__set_properties() self.__do_layout() self.text_nom.SetFocus()
def __init__(self, parent, id_, color=wx.NullColor): """Create the control, it is a composite of a colourSelect and and a text control. @keyword label: the hex string value to go in the text portion """ wx.Panel.__init__(self, parent, id_) if isinstance(color, tuple): color = wx.Color(*color) # Attributes self._label = color.GetAsString(wx.C2S_HTML_SYNTAX) self._txt = wx.TextCtrl(self, value=self._label, style=wx.TE_CENTER, validator=HexValidator()) txtheight = self._txt.GetTextExtent('#000000')[1] self._txt.SetMaxSize((-1, txtheight + 4)) self._txt.SetToolTip(wx.ToolTip(_("Enter a hex color value"))) self._cbtn = csel.ColourSelect(self, colour=color, size=(20, 20)) self._DoLayout() # Event Handlers self.Bind(csel.EVT_COLOURSELECT, self.OnColour) self._txt.Bind(wx.EVT_KEY_UP, self.OnTextChange) self._txt.Bind(wx.EVT_TEXT_PASTE, self.OnTextChange) self._txt.Bind(wx.EVT_KEY_DOWN, self.OnValidateTxt)
def _init_ui(self): """Initialize UI components.""" # Add layout management self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.fgs = wx.FlexGridSizer(rows=self.n_items, cols=2, vgap=0, hgap=2) # Create items to add for _i, (key, value) in enumerate(zip(self.labels, self.colors)): self.label = wx.StaticText( self, label=str(key), style=wx.ALIGN_LEFT, ) self.colorbox = csel.ColourSelect(self, _i, "", tuple(value), style=wx.NO_BORDER, size=(20, 20)) self.Bind(csel.EVT_COLOURSELECT, self.on_color_pick, id=_i) self.fgs.Add(self.label, flag=wx.ALIGN_CENTER_VERTICAL) self.fgs.Add(self.colorbox) # Add our items to the layout manager and set the sizer. self.hbox.Add(self.fgs) self.SetSizer(self.hbox)
def __init__(self,parent,gui,data): self.parent = parent mysize=(200,max(140,min(400,(len(data)+2)*20-20))) scrolled.ScrolledPanel.__init__(self,parent,-1,size=mysize) grdSizer = wx.FlexGridSizer(len(data),2,vgap=3,hgap=5) parent.items =[] for name,typ,value in data: txt = wx.StaticText(self,-1,name) if typ == 'Text': parent.items.append(wx.TextCtrl(self,-1,str(value))) elif typ == 'Textlong': if type(value)==type([5,6]): value = '\n'.join([str(v) for v in value]) # cretaes a text with line returns parent.items.append(wx.TextCtrl(self,-1,value,style=wx.TE_MULTILINE)) elif typ=='Check': parent.items.append(wx.CheckBox(self,-1)) elif typ == 'Choice': ch = wx.Choice(self,-1,choices=value[1]) ch.SetStringSelection(value[0]) parent.items.append(ch) elif typ == 'Color': butC=csel.ColourSelect(self,-1,label='color',colour=value) parent.items.append(butC) csel.EVT_COLOURSELECT(butC, butC.GetId(), self.onSelectColour) grdSizer.AddMany([(txt,0),(parent.items[-1],0)]) self.SetSizer(grdSizer) self.SetAutoLayout(1) self.SetupScrolling()
def __init__(self, parent, log): self.log = log self.enabled = True wx.Panel.__init__(self, parent, -1) self.sizer_1_staticbox = wx.StaticBox(self, -1, "ZoomBar Options") self.zoomSpin = wx.SpinCtrl(self, -1, "3", min=1, max=5) self.colourzoom = csel.ColourSelect(self, colour=wx.Colour(97, 97, 97)) self.buttonSize = masked.NumCtrl(self, value=32, allowNegative=False, min=32, max=72) self.centerZoom = wx.CheckBox(self, -1, "Center Zoom") self.showReflections = wx.CheckBox(self, -1, "Show Reflections") self.showLabels = wx.CheckBox(self, -1, "Show Labels") self.enableButton = wx.Button(self, -1, "Disable First Button") self.zbp = ZB.ZoomBar(self, -1) standard = glob.glob(bitmapDir + "/*96.png") reflections = glob.glob(bitmapDir + "/*96Flip40.png") separatorImage = bitmapDir + "/separator.gif" separatorReflection = bitmapDir + "/separatorFlip.png" count = 0 for std, ref in zip(standard, reflections): if random.randint(0, 1) == 1 and count > 0: sep1 = wx.Bitmap(separatorImage, wx.BITMAP_TYPE_GIF) sep2 = wx.Bitmap(separatorReflection, wx.BITMAP_TYPE_PNG) self.zbp.AddSeparator(sep1, sep2) bname = os.path.split(std)[1][0:-6] self.zbp.AddButton(wx.Bitmap(std, wx.BITMAP_TYPE_PNG), wx.Bitmap(ref, wx.BITMAP_TYPE_PNG), bname) count += 1 self.zbp.ResetSize() self.SetProperties() self.DoLayout() self.Bind(wx.EVT_SPINCTRL, self.OnZoomFactor, self.zoomSpin) self.Bind(wx.EVT_CHECKBOX, self.OnCenterZoom, self.centerZoom) self.Bind(wx.EVT_CHECKBOX, self.OnShowReflections, self.showReflections) self.Bind(wx.EVT_CHECKBOX, self.OnShowLabels, self.showLabels) self.Bind(wx.EVT_BUTTON, self.OnEnable, self.enableButton) self.Bind(masked.EVT_NUM, self.OnButtonSize, self.buttonSize) self.colourzoom.Bind(csel.EVT_COLOURSELECT, self.OnZoomColour) self.Bind(ZB.EVT_ZOOMBAR, self.OnZoomBar)
def __init__(self, parent, listeActivites=[], nomActivite=None): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME) self.parent = parent self.listeActivites = listeActivites self.SetTitle(_(u"Saisie d'une étiquette")) # Label self.staticbox_label_staticbox = wx.StaticBox( self, -1, _(u"Label de l'étiquette")) self.ctrl_label = wx.TextCtrl(self, -1, "") # Couleur self.staticbox_couleur_staticbox = wx.StaticBox( self, -1, _(u"Couleur")) self.ctrl_couleur = csel.ColourSelect(self, -1, "", (255, 255, 255), size=(40, 22)) # Parent self.staticbox_parent_staticbox = wx.StaticBox( self, -1, _(u"Sélection du parent")) self.ctrl_parent = CTRL_Etiquettes.CTRL(self, listeActivites=listeActivites, nomActivite=nomActivite, activeMenu=False) self.ctrl_parent.MAJ() self.ctrl_parent.SetID(None) # Options self.staticbox_options_staticbox = wx.StaticBox( self, -1, _(u"Options")) self.ctrl_active = wx.CheckBox(self, -1, _(u"Etiquette active")) self.ctrl_active.SetValue(True) # Commandes self.bouton_aide = CTRL_Bouton_image.CTRL( self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_ok = CTRL_Bouton_image.CTRL( self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png") self.bouton_annuler = CTRL_Bouton_image.CTRL( self, id=wx.ID_CANCEL, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) wx.CallLater(1, self.ctrl_label.SetFocus)
def LayoutItems(self): self.stc = PythonSTC(self.panel, -1) try: fid = open("RulerCtrl.py", "rt") except: fid = open("agw/RulerCtrl.py", "rt") text = fid.read() fid.close() self.stc.SetValue(text) self.ruler1 = RC.RulerCtrl(self.panel, -1, orient=wx.HORIZONTAL, style=wx.SUNKEN_BORDER) self.ruler2 = RC.RulerCtrl(self.panel, -1, orient=wx.VERTICAL, style=wx.SUNKEN_BORDER) self.ruler3 = RC.RulerCtrl(self.panel, -1, orient=wx.HORIZONTAL) self.rightbottomsizer_staticbox1 = wx.StaticBox(self.panel, -1, "Options") self.rightbottomsizer_staticbox2 = wx.StaticBox(self.panel, -1, "Messages") self.rulerformat = wx.ComboBox(self.panel, -1, choices=["Integer", "Real", "Time", "LinearDB"], style=wx.CB_DROPDOWN|wx.CB_READONLY) self.flip = wx.CheckBox(self.panel, -1, "Flip") self.logscale = wx.CheckBox(self.panel, -1, "Log Scale") self.labelminor = wx.CheckBox(self.panel, -1, "Label") self.alwayslabel = wx.CheckBox(self.panel, -1, "Always Label") self.csel1 = csel.ColourSelect(self.panel, -1, "Choose...", wx.WHITE) self.csel2 = csel.ColourSelect(self.panel, -1, "Choose...", wx.BLACK) self.csel3 = csel.ColourSelect(self.panel, -1, "Choose...", wx.BLACK) self.messages = wx.TextCtrl(self.panel, -1, "Here You'll See GUI Messages\n", style=wx.TE_READONLY|wx.TE_MULTILINE) self.SetProperties() self.DoLayout() self.Bind(wx.EVT_COMBOBOX, self.OnComboFormat, self.rulerformat) self.Bind(wx.EVT_CHECKBOX, self.OnFlip, self.flip) self.Bind(wx.EVT_CHECKBOX, self.OnLogScale, self.logscale) self.Bind(wx.EVT_CHECKBOX, self.OnLabelMinor, self.labelminor) self.Bind(wx.EVT_CHECKBOX, self.OnAlwaysLabel, self.alwayslabel) self.Bind(csel.EVT_COLOURSELECT, self.OnBackgroundColour, self.csel1) self.Bind(csel.EVT_COLOURSELECT, self.OnTickColour, self.csel2) self.Bind(csel.EVT_COLOURSELECT, self.OnLabelColour, self.csel3) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(RC.EVT_INDICATOR_CHANGING, self.OnIndicatorChanging, id=103) self.Bind(RC.EVT_INDICATOR_CHANGED, self.OnIndicatorChanged, id=101, id2=104)
def makeCButton(label): btn = cs.ColourSelect(self, size=(20, 22)) lbl = wx.StaticText(self, -1, label) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(btn) sizer.Add((4, 4)) sizer.Add(lbl, 0, wx.ALIGN_CENTER_VERTICAL) return sizer, btn
def __init__(self, parent, symbol, *args, **kwds): wx.Panel.__init__(self, parent, *args, **kwds) self.symbol = symbol self.parent = parent #self.colorbut = wx.Button(self, -1, "") self.cbmap = { _("DOT"): wx.DOT, _("LONG_DASH"): wx.LONG_DASH, _("SHORT_DASH"): wx.SHORT_DASH, _("DOT_DASH"): wx.DOT_DASH, _("USER_DASH"): wx.USER_DASH, _("BDIAGONAL_HATCH"): wx.BDIAGONAL_HATCH, _("CROSSDIAG_HATCH"): wx.CROSSDIAG_HATCH, _("FDIAGONAL_HATCH"): wx.FDIAGONAL_HATCH, _("CROSS_HATCH"): wx.CROSS_HATCH, _("HORIZONTAL_HATCH"): wx.HORIZONTAL_HATCH, _("VERTICAL_HATCH"): wx.VERTICAL_HATCH } cblist = self.cbmap.keys() self.cb = wx.ComboBox(self, 500, cblist[0], (90, 50), (95, -1), cblist, wx.CB_DROPDOWN | wx.CB_READONLY) self.colorbut = csel.ColourSelect(self, -1, "", symbol["color"], size=(30, 20)) self.sizesc = wx.SpinCtrl(self, -1, "") self.sizesc.SetRange(1, 100) self.sizesc.SetValue(symbol["size"]) self.colorbut.Bind(csel.EVT_COLOURSELECT, parent.ChangeColor) self.sizesc.Bind(wx.EVT_SPINCTRL, parent.ChangeSize) self.cb.Bind(wx.EVT_COMBOBOX, self.SelectHatch) box = wx.StaticBox(self, -1, _("Option")) bsizer = wx.StaticBoxSizer(box, wx.VERTICAL) sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.FlexGridSizer(cols=2, vgap=4, hgap=4) sizer_2.Add(wx.StaticText(self, -1, _("color") + ":"), 0, wx.ADJUST_MINSIZE | wx.ALL, 10) sizer_2.Add(self.colorbut, 0, wx.ADJUST_MINSIZE, 10) sizer_2.Add(wx.StaticText(self, -1, _("Style") + ":"), 0, wx.ADJUST_MINSIZE | wx.ALL, 10) sizer_2.Add(self.cb) sizer_2.Add(wx.StaticText(self, -1, _("size") + ":"), 0, wx.ADJUST_MINSIZE | wx.ALL, 10) sizer_2.Add(self.sizesc, 0, wx.ADJUST_MINSIZE, 10) bsizer.Add(sizer_2, 1, wx.ADJUST_MINSIZE, 0) sizer_1.Add(bsizer, 1, wx.EXPAND, 0) self.SetAutoLayout(True) self.SetSizer(sizer_1) sizer_1.Fit(self) sizer_1.SetSizeHints(self) self.Layout()
def __init__(self, parent, colour=wx.NullColour): super(ColourEntry, self).__init__(parent) self._cs = CSEL.ColourSelect(self, colour=colour) self._txt = wx.TextCtrl(self, style=wx.TE_READONLY) self._Synch() self.__DoLayout() self.Bind(CSEL.EVT_COLOURSELECT, self.OnCSel)
def ElButton(self, name, pos): 'Needs a doc string' White = wx.Colour(255, 255, 255) El = wscs.ColourSelect(label=name, parent=self, colour=White, pos=pos, size=wx.Size(24, 23), style=wx.RAISED_BORDER) El.Bind(wx.EVT_BUTTON, self.OnDeleteButton)
def __init__(self, parent, IDfamille=None): wx.Dialog.__init__(self, parent, -1, name="DLG_Emetteurs", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX) self.parent = parent self.IDfamille = IDfamille # Bandeau intro = _(u"Vous pouvez éditer ici un état des prestations ou des factures pour la ou les périodes souhaitées.") titre = _(u"Edition d'un relevé des prestations") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Euro.png") # Périodes self.staticbox_periodes_staticbox = wx.StaticBox(self, -1, _(u"Périodes")) self.ctrl_periodes = OL_Releve_prestations.ListView(self, id=-1, IDfamille=self.IDfamille, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_HRULES|wx.LC_VRULES) self.bouton_ajouter = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"), wx.BITMAP_TYPE_ANY)) self.bouton_modifier = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"), wx.BITMAP_TYPE_ANY)) self.bouton_supprimer = wx.BitmapButton(self, -1, wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"), wx.BITMAP_TYPE_ANY)) # Options self.staticbox_options_staticbox = wx.StaticBox(self, -1, _(u"Options")) self.check_memoriser_parametres = wx.CheckBox(self, -1, _(u"Mémoriser les périodes")) self.check_memoriser_parametres.SetValue(True) self.checkbox_couleur = wx.CheckBox(self, -1, _(u"Couleur de fond de titre :")) self.ctrl_couleur = csel.ColourSelect(self, -1, u"", COULEUR_FOND_TITRE, size=(60, 18)) # Boutons self.bouton_aide = CTRL_Bouton_image.CTRL(self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_email = CTRL_Bouton_image.CTRL(self, texte=_(u"Envoyer par Email"), cheminImage="Images/32x32/Emails_exp.png") self.bouton_ok = CTRL_Bouton_image.CTRL(self, texte=_(u"Aperçu"), cheminImage="Images/32x32/Apercu.png") self.bouton_annuler = CTRL_Bouton_image.CTRL(self, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_CHECKBOX, self.OnCheckCouleur, self.checkbox_couleur) self.Bind(wx.EVT_BUTTON, self.OnAjouter, self.bouton_ajouter) self.Bind(wx.EVT_BUTTON, self.OnModifier, self.bouton_modifier) self.Bind(wx.EVT_BUTTON, self.OnSupprimer, self.bouton_supprimer) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonEmail, self.bouton_email) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler) self.Bind(wx.EVT_CLOSE, self.OnBoutonAnnuler) # Init contrôles couleur = UTILS_Config.GetParametre("releve_prestations_couleur", defaut=ConvertCouleurPDFpourWX(COULEUR_FOND_TITRE)) if couleur == False : couleur = ConvertCouleurPDFpourWX(COULEUR_FOND_TITRE) else : self.checkbox_couleur.SetValue(True) self.ctrl_couleur.SetColour(couleur) listePeriodes = UTILS_Config.GetParametre("releve_prestations_periodes", defaut=[]) self.ctrl_periodes.MAJ(listePeriodes)
def __init__(self, parent): wx.Panel.__init__(self, parent) # VOLUME RAYCASTING BUTTON BMP_RAYCASTING = wx.Bitmap(str(inv_paths.ICON_DIR.joinpath("volume_raycasting.png")), wx.BITMAP_TYPE_PNG) BMP_SLICE_PLANE = wx.Bitmap(str(inv_paths.ICON_DIR.joinpath("slice_plane.png")), wx.BITMAP_TYPE_PNG) BMP_3D_STEREO = wx.Bitmap(str(inv_paths.ICON_DIR.joinpath("3D_glasses.png")), wx.BITMAP_TYPE_PNG) BMP_TARGET = wx.Bitmap(str(inv_paths.ICON_DIR.joinpath("target.png")), wx.BITMAP_TYPE_PNG) BMP_3D_MASK = wx.Bitmap(str(inv_paths.ICON_DIR.joinpath("file_from_internet.png")), wx.BITMAP_TYPE_PNG) self.button_raycasting = pbtn.PlateButton(self, -1,"", BMP_RAYCASTING, style=pbtn.PB_STYLE_SQUARE, size=ICON_SIZE) self.button_stereo = pbtn.PlateButton(self, -1,"", BMP_3D_STEREO, style=pbtn.PB_STYLE_SQUARE, size=ICON_SIZE) self.button_slice_plane = pbtn.PlateButton(self, -1, "", BMP_SLICE_PLANE, style=pbtn.PB_STYLE_SQUARE, size=ICON_SIZE) self.button_target = pbtn.PlateButton(self, -1,"", BMP_TARGET, style=pbtn.PB_STYLE_SQUARE|pbtn.PB_STYLE_TOGGLE, size=ICON_SIZE) self.button_target.Enable(0) # self.button_3d_mask = pbtn.PlateButton(self, -1, "", BMP_3D_MASK, style=pbtn.PB_STYLE_SQUARE|pbtn.PB_STYLE_TOGGLE, size=ICON_SIZE) # VOLUME VIEW ANGLE BUTTON BMP_FRONT = wx.Bitmap(ID_TO_BMP[const.VOL_FRONT][1], wx.BITMAP_TYPE_PNG) self.button_view = pbtn.PlateButton(self, -1, "", BMP_FRONT, size=(32,32), style=pbtn.PB_STYLE_SQUARE) # VOLUME COLOUR BUTTON if sys.platform.startswith('linux'): size = (32,32) sp = 2 else: size = (24,24) sp = 5 self.button_colour= csel.ColourSelect(self, -1, colour=(0,0,0), size=size) # SIZER TO ORGANIZE ALL sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.button_colour, 0, wx.ALL, sp) sizer.Add(self.button_raycasting, 0, wx.TOP|wx.BOTTOM, 1) sizer.Add(self.button_view, 0, wx.TOP|wx.BOTTOM, 1) sizer.Add(self.button_slice_plane, 0, wx.TOP|wx.BOTTOM, 1) sizer.Add(self.button_stereo, 0, wx.TOP|wx.BOTTOM, 1) sizer.Add(self.button_target, 0, wx.TOP | wx.BOTTOM, 1) # sizer.Add(self.button_3d_mask, 0, wx.TOP | wx.BOTTOM, 1) self.navigation_status = False self.status_target_select = False self.status_obj_tracker = False sizer.Fit(self) self.SetSizer(sizer) self.SetAutoLayout(1) self.Update() self.Refresh() self.__init_menus() self.__bind_events() self.__bind_events_wx()
def __init__(self, parent): super(PalletPanel, self).__init__(parent) # Layout gsizer = wx.GridSizer(3, 3, 2, 2) for colour in ("red", "green", "blue", "yellow", "purple", "black", "white", "pink", "orange", "grey", "navy", "cyan"): cobj = wx.NamedColor(colour) cs = colourselect.ColourSelect(self, colour=cobj, size=(20, 20)) gsizer.Add(cs) self.SetSizer(gsizer)
def get_grid(self, conf): self.sbox_grid = wx.StaticBox(self, -1, L('GRID')) sboxs_grid = wx.StaticBoxSizer(self.sbox_grid, wx.VERTICAL) _label = L('SHOW_GRID') self.ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.ch.SetValue(conf.grid_lines) self.ch.Bind(wx.EVT_CHECKBOX, self.on_checked_grid) self.cho_label = wx.StaticText(self, -1, L('TYPE')) self.cho = wx.Choice(self, -1, choices=TYPES_GRID) self.cho.SetSelection(TYPES_GRID.index(conf.grid_lines_style)) self.cho.SetToolTipString(L('SELECT_TYPE_OF_GRID')) self.g_linewidth_label = wx.StaticText(self, -1, L('WIDTH')) self.g_linewidth = wx.SpinCtrlDouble(self, -1, "") self.g_linewidth.SetDigits(1) self.g_linewidth.SetRange(0.1, 1.0) self.g_linewidth.SetValue(conf.grid_linewidth) self.g_color_label = wx.StaticText(self, -1, L('COLOR')) _c = wx.NamedColour(conf.grid_color) self.g_color = csel.ColourSelect(self, colour=_c) self.g_color_alpha_label = wx.StaticText(self, -1, L('COLOR_ALPHA')) self.g_color_alpha = wx.SpinCtrlDouble(self, -1, "") self.g_color_alpha.SetDigits(1) self.g_color_alpha.SetRange(0.1, 1.0) self.g_color_alpha.SetValue(conf.grid_color_alpha) grid = wx.FlexGridSizer(cols=4) _style = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(self.cho_label, 0, _style, 5) grid.Add(self.cho, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(self.g_linewidth_label, 0, _style, 5) grid.Add(self.g_linewidth, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(self.g_color_label, 0, _style, 5) grid.Add(self.g_color, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(self.g_color_alpha_label, 0, _style, 5) grid.Add(self.g_color_alpha, 0, wx.ALIGN_LEFT | wx.ALL, 5) sboxs_grid.Add(self.ch, 0, wx.ALIGN_LEFT | wx.ALL, 5) sboxs_grid.Add(grid, 1, wx.EXPAND | wx.ALL, 10) self.checked_grid(conf.grid_lines) return sboxs_grid
def _createSymbologyPage(self, notebook): """Create notebook page concerning symbology settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("Symbology")) sizer = wx.BoxSizer(wx.VERTICAL) flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5) flexSizer.AddGrowableCol(0) self.symbology = {} for label, key in self._symbologyData(): textLabel = StaticText(panel, wx.ID_ANY, label) color = csel.ColourSelect( panel, id=wx.ID_ANY, colour=UserSettings.Get( group='vdigit', key='symbol', subkey=[ key, 'color']), size=( 40, 25)) isEnabled = UserSettings.Get(group='vdigit', key='symbol', subkey=[key, 'enabled']) if isEnabled is not None: enabled = wx.CheckBox(panel, id=wx.ID_ANY, label="") enabled.SetValue(isEnabled) self.symbology[key] = (enabled, color) else: enabled = (1, 1) self.symbology[key] = (None, color) flexSizer.Add( textLabel, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add( enabled, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add( color, proportion=0, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) color.SetName("GetColour") sizer.Add( flexSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) panel.SetSizer(sizer) return panel
def on_select_color(self, evt): value = evt.GetValue() self.editorCtrl.Destroy() s = "(%d, %d, %d)" % (value[0], value[1], value[2]) self.editorCtrl = csel.ColourSelect(self.parent, 2000, s, wx.Color(value[0], value[1], value[2]), size=(self.sizeX, oiLineHeight + 3), pos=(-2, self.idx * oiLineHeight - 2)) self.editorCtrl.Refresh() self.propEditor.inspectorPost(False)
def createColorEntry(self, pane): label = wx.StaticText(pane, label=_('Color used to highlight the current day')) label.SetSizerProps(valign='center') hcolor = self._settings.get(self._settingsSection, 'todaycolor') if not hcolor: # The highlight color is too dark color = wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) color = wx.Colour(int((color.Red() + 255) / 2), int((color.Green() + 255) / 2), int((color.Blue() + 255) / 2)) else: color = wx.Colour(*tuple(map(int, hcolor.split(',')))) # pylint: disable=W0141 self._highlight = csel.ColourSelect(pane, size=(100, 20)) # pylint: disable=W0201 label.SetSizerProps(valign='center') self._highlight.SetColour(color)