def __init__(self, parent, prefsIO): wx.Panel.__init__(self, parent) self.preferences = prefsIO themekeys = sorted(all_themes.get_themes().keys()) currenttheme = prefsIO.GetTheme() choices = [] currentchoice = 0 for (i,choice) in enumerate(themekeys): choices.append( choice ) if currenttheme == all_themes.get_theme(choice): currentchoice = i self.radiobox = wx.RadioBox(self, label="Theme Colour scheme: ", choices=choices, majorDimension=4) # check the current theme self.radiobox.SetSelection( currentchoice ) # bind any theme change self.Bind(wx.EVT_RADIOBOX, self.radioClick, self.radiobox) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.radiobox, 1, wx.EXPAND|wx.ALL, border=5) self.SetSizer(vbox)
def repaint1(self, event): """ Theme. """ themes = [u'Default', u'Brigitte', u'Paul', u'Léa'] p = random.sample(range(0,4),1)[0] # set the theme to prefsIO self._prefsIO.SetTheme( all_themes.get_theme(themes[p]) ) # set prefsIO to the display self.displayctrl.SetPreferences( self._prefsIO )
def _init_members( self, args ): """ Override. Sets the members settings. """ ComponentFrame._init_members( self,args ) if isinstance(self._prefsIO.GetTheme(), BaseTheme): self._prefsIO.SetTheme( all_themes.get_theme(u'Default') ) self._fmtype = "ANYFILES"
def _init_prefs( self ): """ Set the Editor settings. """ self._prefsIO = Preferences_IO() # Panel: Display self._prefsIO.SetValue( 'D_TIME_MIN', t='float', v=0.0, text='Minimum time value (in seconds) of the displayed period at start-up') self._prefsIO.SetValue( 'D_TIME_MAX', t='float', v=2.0, text='Maximum time value (in seconds) of the displayed period at start-up') self._prefsIO.SetValue( 'D_TIME_ZOOM_MIN', t='float', v=0.2, text='Minimum duration (in seconds) of the displayed period') self._prefsIO.SetValue( 'D_TIME_ZOOM_MAX', t='float', v=300.0, text='Maximum duration (in seconds) of the displayed period') self._prefsIO.SetValue( 'D_H_ZOOM', t='float', v=50.0, text='Time zoom (percentage)') self._prefsIO.SetValue( 'D_SCROLL', t='float', v=75.0, text='Time scroll (percentage)') self._prefsIO.SetValue( 'D_V_ZOOM', t='float', v=10.0, text='Vertical zoom (percentage)') # Panel: Objects self._prefsIO.SetValue( 'O_PEN_WIDTH', t='int', v=1, text='') self._prefsIO.SetValue( 'O_PEN_STYLE', t='int', v=wx.SOLID, text='') self._prefsIO.SetValue( 'O_BRUSH_STYLE', t='int', v=wx.SOLID, text='') self._prefsIO.SetValue( 'O_MARGIN', t='int', v=6, text='Margins (for handles)') # Ruler self._prefsIO.SetValue( 'R_BG_COLOUR', t='wx.Colour', v=wx.Colour(255,255,255)) self._prefsIO.SetValue( 'R_FG_COLOUR', t='wx.Colour', v=wx.Colour(40,40,10)) self._prefsIO.SetValue( 'R_HANDLES_COLOUR',t='wx.Colour', v=wx.Colour(0,0,200)) self._prefsIO.SetValue( 'R_FONT', t='wx.Font', v=wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, '', wx.FONTENCODING_UTF8)) self._prefsIO.SetValue( 'R_FONT_COLOUR', t='wx.Colour', v=wx.Colour(0, 0, 200)) # Tier self._prefsIO.SetValue( 'T_BG_COLOUR', t='wx.Colour', v=wx.Colour(200,200,200), text='Tier background color') self._prefsIO.SetValue( 'T_FG_COLOUR', t='wx.Colour', v=wx.Colour(20,20,20), text='Tier foreground color') self._prefsIO.SetValue( 'T_HANDLES_COLOUR',t='wx.Colour', v=wx.Colour(200,0,0), text='Main frame handles color') self._prefsIO.SetValue( 'T_FONT', t='wx.Font', v=wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, '', wx.FONTENCODING_UTF8), text='Font for tiers') self._prefsIO.SetValue( 'T_FONT_COLOUR', t='wx.Colour', v=wx.Colour(200,0,0), text='Main frame foreground color') self._prefsIO.SetValue( 'T_HEIGHT', t='int', v=30, text='Tier height') self._prefsIO.SetValue( 'T_RADIUS_COLOUR', t='wx.Colour', v=wx.Colour(200,0,0), text='Main frame radius color for points') self._prefsIO.SetValue( 'T_LABEL_ALIGN', t='wx.ALIGN', v=wx.ALIGN_CENTRE, text='Text alignment for labels') # Wave self._prefsIO.SetValue( 'W_BG_COLOUR', t='wx.Colour', v=wx.Colour(240,240,240), text='Wave background') self._prefsIO.SetValue( 'W_FG_COLOUR', t='wx.Colour', v=wx.Colour(0,200,0), text='Wave foreground') self._prefsIO.SetValue( 'W_HANDLES_COLOUR',t='wx.Colour', v=wx.Colour(0,200,0), text='Main frame foreground color') self._prefsIO.SetValue( 'W_FONT', t='wx.Font', v=wx.Font(9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, '', wx.FONTENCODING_UTF8), text='Font for wave') self._prefsIO.SetValue( 'W_FONT_COLOUR', t='wx.Colour', v=wx.Colour(200, 0, 0)) self._prefsIO.SetValue( 'W_HEIGHT', t='int', v=120, text='Wave height') self._prefsIO.SetValue( 'W_FG_DISCO', t='bool', v=False, text='Wave disco style') self._prefsIO.SetValue( 'W_BG_GRADIENT_COLOUR', t='wx.Colour', v=wx.Colour(200,200,200), text='Wave background gradient') self._prefsIO.SetValue( 'W_AUTOSCROLL', t='bool', v=True, text='Wave auto-scrolling') self._prefsIO.SetTheme( all_themes.get_theme(u'Default') )
def radioClick(self, event): """ Set the new theme. """ theme = all_themes.get_theme( self.radiobox.GetStringSelection() ) self.preferences.SetTheme( theme )