예제 #1
0
    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') )
예제 #2
0
    def _init_members(self, args):
        """Sets the members settings with default values."""

        if "prefs" in args.keys():
            self._prefsIO = args["prefs"]
        else:
            # Try to get prefs from a file, or fix default values.
            self._prefsIO = Preferences_IO(SETTINGS_FILE)
            if self._prefsIO.Read() is False:
                self._prefsIO = Preferences_IO(None)

        self._fmtype = "DATAFILES"
        if "type" in args.keys():
            self._fmtype = args['type']
예제 #3
0
    def _init_members(self, preferencesIO):
        """ Sets the members settings with default values. """

        # Data
        if preferencesIO is None:
            # Try to get prefs from a file, or fix default values.
            preferencesIO = Preferences_IO(SETTINGS_FILE)
            preferencesIO.Read()
        self.preferences = preferencesIO

        # wx: panels and sizers
        self.actions = None
        self.flp = None
        self._leftpanel = None
        self._rightpanel = None
        self._leftsizer = None
        self._rightsizer = None
예제 #4
0
파일: sppashelp.py 프로젝트: lym0302/sppas
# Logging
# ----------------------------------------------------------------------------

log_level = 1
log_file = None
try:
    setup_logging(log_level, log_file)
except Exception:
    # stdin is not available if pythonw is used instead of python, on Windows!
    log_file = os.path.join(
        os.path.dirname(os.path.dirname(os.path.dirname(PROGRAM))),
        "sppas.log")
    setup_logging(log_level, log_file)

# GUI is here:
# ----------------------------------------------------------------------------

app = wx.App(redirect=True)

# Fix preferences
prefsIO = Preferences_IO(SETTINGS_FILE)
if prefsIO.Read() is False:
    prefsIO.SetTheme(sppasTheme())

frame = HelpBrowser(None, prefsIO)
frame.Show()

app.SetTopWindow(frame)
app.MainLoop()
예제 #5
0
class ComponentFrame(wx.Frame):
    """
    :author:       Brigitte Bigi
    :organization: Laboratoire Parole et Langage, Aix-en-Provence, France
    :contact:      [email protected]
    :license:      GPL, v3
    :copyright:    Copyright (C) 2011-2017  Brigitte Bigi
    :summary:      Component main frame (base class).

    The Component base main frame. This frames is made of:
    
        - a menu
        - a toolbar
        - a panel at left, which is a file manager (with check buttons)
        - a panel at right, which contains the client.

    """
    def __init__(self, parent, idf, args={}):

        wx.Frame.__init__(self,
                          parent,
                          idf,
                          title=FRAME_TITLE + " - Component",
                          style=FRAME_STYLE)

        # Members
        self._init_members(args)

        # Create GUI
        self._init_infos(args)
        self._mainpanel = self._create_content()

        # Events of this frame
        self.Bind(wx.EVT_CLOSE, self.ProcessEvent)
        self.Bind(wx.EVT_BUTTON, self.ProcessEvent)

        # events sent by the file manager
        spEVT_FILE_WANDER(self, self.OnFileWander)

        self.SetMinSize((MIN_FRAME_W, MIN_FRAME_H))
        (w, h) = wx.GetDisplaySize()
        self.SetSize(wx.Size(w * 0.6, h * 0.6))
        self.Centre()
        self.Enable()
        self.SetFocus()

        self.Show(True)

    # ------------------------------------------------------------------------
    # Private methods to create the GUI and initialize members
    # ------------------------------------------------------------------------

    def _init_members(self, args):
        """Sets the members settings with default values."""

        if "prefs" in args.keys():
            self._prefsIO = args["prefs"]
        else:
            # Try to get prefs from a file, or fix default values.
            self._prefsIO = Preferences_IO(SETTINGS_FILE)
            if self._prefsIO.Read() is False:
                self._prefsIO = Preferences_IO(None)

        self._fmtype = "DATAFILES"
        if "type" in args.keys():
            self._fmtype = args['type']
            # expected: "DATAFILES", "SOUNDFILES", "ANYFILES"

    # ------------------------------------------------------------------------

    def _init_infos(self, args):
        """ Set the title and the icon."""

        # Set title
        _app = DEFAULT_APP_NAME
        if "title" in args.keys():
            _app = args["title"]
        self.SetTitle(_app)
        wx.GetApp().SetAppName(_app)

        # Set icon
        _iconname = COMPONENTS_ICON
        if "icon" in args.keys():
            _iconname = args["icon"]

        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(spBitmap(_iconname))
        self.SetIcon(_icon)

        # colors
        self.SetBackgroundColour(self._prefsIO.GetValue('M_BG_COLOUR'))
        self.SetForegroundColour(self._prefsIO.GetValue('M_FG_COLOUR'))
        self.SetFont(self._prefsIO.GetValue('M_FONT'))

    # ------------------------------------------------------------------------

    def _create_content(self):
        """Organize all sub-panels into a main panel and return it."""

        mainpanel = wx.Panel(self, -1, style=wx.NO_BORDER)
        mainpanel.SetBackgroundColour(self._prefsIO.GetValue('M_BG_COLOUR'))
        mainpanel.SetForegroundColour(self._prefsIO.GetValue('M_FG_COLOUR'))
        mainpanel.SetFont(self._prefsIO.GetValue('M_FONT'))

        self.menu = self._create_menu(mainpanel)
        self.toolbar = self._create_toolbar(mainpanel)
        splitpanel = self._create_splitter(mainpanel)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        vsizer.Add(self.toolbar,
                   proportion=0,
                   flag=wx.ALL | wx.EXPAND,
                   border=0)
        vsizer.Add(splitpanel, proportion=1, flag=wx.ALL | wx.EXPAND, border=0)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.menu, proportion=0, flag=wx.ALL | wx.EXPAND, border=0)
        sizer.Add(vsizer, proportion=2, flag=wx.ALL | wx.EXPAND, border=0)
        mainpanel.SetSizer(sizer)

        return mainpanel

    # ------------------------------------------------------------------------

    def _create_menu(self, parent):
        """Create the default menu and append new items."""

        menu = MainMenuPanel(parent, self._prefsIO)
        menu.AddSpacer()
        menu.AddButton(wx.ID_PREFERENCES, SETTINGS_ICON)
        menu.AddButton(wx.ID_ABOUT, ABOUT_ICON)
        menu.AddButton(wx.ID_HELP, HELP_ICON)
        return menu

    # ------------------------------------------------------------------------

    def _create_toolbar(self, parent):
        """Creates the default toolbar."""

        toolbar = MainToolbarPanel(parent, self._prefsIO)
        toolbar.AddButton(wx.ID_ADD,
                          ADD_FILE_ICON,
                          "Add files",
                          tooltip="Add files into the list.")
        toolbar.AddButton(wx.ID_REMOVE,
                          REMOVE_ICON,
                          "Remove",
                          tooltip="Remove files of the list.")
        toolbar.AddButton(ID_TB_NEWTAB,
                          TAB_NEW_ICON,
                          "New tab",
                          tooltip="Open a new page in the notebook.")
        toolbar.AddButton(ID_TB_CLOSETAB,
                          TAB_CLOSE_ICON,
                          "Close tab",
                          tooltip="Close the current page in the notebook.")
        toolbar.AddSpacer()
        return toolbar

    # ------------------------------------------------------------------------

    def _create_splitter(self, parent):
        """Create the main panel content."""

        splitpanel = SplitterPanel(parent, proportion=0.25)
        splitpanel.SetBackgroundColour(self._prefsIO.GetValue('M_BGM_COLOUR'))
        splitpanel.SetForegroundColour(self._prefsIO.GetValue('M_BGM_COLOUR'))

        self._filepanel = self.CreateFileManager(splitpanel, self._prefsIO)
        self._clientpanel = self.CreateClient(splitpanel, self._prefsIO)

        splitpanel.SetMinimumPaneSize(MIN_PANEL_W)
        splitpanel.SplitVertically(self._filepanel, self._clientpanel)

        self._filepanel.SetMinSize((MIN_PANEL_W, MIN_PANEL_H))
        self._clientpanel.SetMinSize((MIN_PANEL_W, MIN_PANEL_H))

        return splitpanel

    # ------------------------------------------------------------------------

    def _LayoutFrame(self):
        """Lays out the frame."""

        wx.LayoutAlgorithm().LayoutFrame(self, self._mainpanel)
        self._clientpanel.SendSizeEvent()
        self.Refresh()

    # ------------------------------------------------------------------------
    # Public method to create the GUI
    # ------------------------------------------------------------------------

    def CreateClient(self, parent, prefsIO):
        """
        Create the client panel and return it.
        Must be overridden.

        :param parent: (wx.Frame)
        :param prefsIO: (Preferences_IO)

        :returns: wx.Panel

        """
        raise NotImplementedError

    # ------------------------------------------------------------------------

    def CreateFileManager(self, parent, prefsIO):
        """
        Create the file manager panel and return it.
        Can be overridden.

        :param parent: (wx.Frame)
        :param prefsIO: (Preferences_IO)

        :returns: wx.Panel

        """
        return FileManager(parent, prefsIO=self._prefsIO)

    # ------------------------------------------------------------------------
    # Callbacks to any kind of event
    # ------------------------------------------------------------------------

    def ProcessEvent(self, event):
        """
        Processes an event, searching event tables and calling zero or more
        suitable event handler function(s).  Note that the ProcessEvent
        method is called from the wxPython docview framework directly since
        wxPython does not have a virtual ProcessEvent function.

        """
        ide = event.GetId()

        if ide == wx.ID_EXIT:
            self.OnExitApp(event)
            return True

        elif ide == wx.ID_CLOSE:
            self.OnClose(event)
            return True

        elif ide == wx.ID_ADD:
            self.OnAdd(event)
            return True

        elif ide == wx.ID_REMOVE:
            self.OnRemove(event)
            return True

        elif ide == ID_TB_NEWTAB:
            self.OnNewTab(event)
            return True

        elif ide == ID_TB_CLOSETAB:
            self.OnCloseTab(event)
            return True

        elif ide == wx.ID_PREFERENCES:
            self.OnSettings(event)

        elif ide == wx.ID_HELP:
            self.OnHelp(event)
            return True

        elif ide == wx.ID_ABOUT:
            ShowAboutDialog(self, self._prefsIO)
            return True

        return wx.GetApp().ProcessEvent(event)

    # ------------------------------------------------------------------------

    def OnExitApp(self, event):
        """Destroys the main frame which quits the wxPython application."""

        response = ShowYesNoQuestion(self, self._prefsIO,
                                     "Are you sure you want to quit?")
        if response == wx.ID_YES:
            if self.GetParent() is not None:
                self.GetParent().SetFocus()
                self.GetParent().Raise()
            self.Destroy()
        else:
            event.StopPropagation()

    # ------------------------------------------------------------------------

    def OnClose(self, event):
        """Close properly the client then exit."""

        closeEvent = wx.CloseEvent(wx.wxEVT_CLOSE_WINDOW, self.GetId())
        closeEvent.SetEventObject(self)
        wx.PostEvent(self._clientpanel, closeEvent)
        self.Close()

    # ------------------------------------------------------------------------
    # File management... Callbacks.
    # ------------------------------------------------------------------------

    def OnAdd(self, event):
        """Received an event to add new files."""

        if self._fmtype == "DATAFILES":
            self.AddFiles(filedialogs.OpenAnnotationFiles())

        elif self._fmtype == "SOUNDFILES":
            self.AddFiles(filedialogs.OpenSoundFiles())

        else:
            self.AddFiles(filedialogs.OpenAnyFiles())

    # ------------------------------------------------------------------------

    def OnRemove(self, event):
        """Received an event to close files."""

        evt = FileWanderEvent(filename=None, status=False)
        evt.SetEventObject(self)
        wx.PostEvent(self._filepanel, evt)

    # -------------------------------------------------------------------------
    # Client Callbacks
    # -------------------------------------------------------------------------

    def OnNewTab(self, event):
        """Add a page in the client."""

        evt = NotebookNewPageEvent()
        evt.SetEventObject(self)
        wx.PostEvent(self._clientpanel, evt)

    # -------------------------------------------------------------------------

    def OnCloseTab(self, event):
        """Close a page in the client."""

        evt = NotebookClosePageEvent()
        evt.SetEventObject(self)
        wx.PostEvent(self._clientpanel, evt)

    # -------------------------------------------------------------------------

    def OnFileAdded(self, event):
        """Add a file of the file manager."""

        self.AddFiles([event.filename])

    # -------------------------------------------------------------------------

    def OnFileClosed(self, event):
        """Remove of the file manager."""

        # Get the list of closed files and remove them of the file manager
        files = event.filenames

        for f in files:
            # Remove of the file manager
            evt = FileWanderEvent(filename=f, status=False)
            evt.SetEventObject(self)
            wx.PostEvent(self._filepanel, evt)

    # -------------------------------------------------------------------------
    # Help... Callbacks
    # -------------------------------------------------------------------------

    def OnHelp(self, evt):
        """Open the help frame."""

        ShowInformation(
            self, self._prefsIO, "The documentation is available online and "
            "the SPPAS package contains a printable version.")

    # ------------------------------------------------------------------------

    def OnSettings(self, event):
        """Open the Settings box."""

        import copy
        p = copy.deepcopy(self._prefsIO)

        prefdlg = SettingsDialog(self, p)
        res = prefdlg.ShowModal()
        if res == wx.ID_OK:
            self.SetPrefs(prefdlg.GetPreferences())
            if self.GetParent() is not None:
                try:
                    self.GetParent().SetPrefs(prefdlg.GetPreferences())
                except Exception:
                    pass
        prefdlg.Destroy()
        self._LayoutFrame()

    # -------------------------------------------------------------------------
    # Data management
    # -------------------------------------------------------------------------

    def AddFiles(self, files):
        """
        Add files into the file manager.

        :param files: (list of String)

        """
        if len(files) > 0:
            # Get the list of files to open/view
            for f in files:
                # Add in the file manager
                evt = FileWanderEvent(filename=f, status=True)
                evt.SetEventObject(self)
                wx.PostEvent(self._filepanel, evt)

            self.Refresh()

    # ------------------------------------------------------------------------

    def OnFileWander(self, event):
        """We received an event: a file was added/removed."""

        owner = event.GetEventObject()
        f = event.filename
        s = event.status

        if owner == self._filepanel:
            event.SetEventObject(self)
            wx.PostEvent(self._clientpanel, event)
        else:
            evt = FileCheckEvent(filename=f, status=s)
            evt.SetEventObject(self)
            wx.PostEvent(self._filepanel, evt)

    # -------------------------------------------------------------------------
    # Other
    # -------------------------------------------------------------------------

    def SetPrefs(self, prefs):
        """Fix new preferences."""

        self._prefsIO = prefs
        self.toolbar.SetPrefs(self._prefsIO)

        # change to the children panels
        evt = SettingsEvent(prefsIO=self._prefsIO)
        evt.SetEventObject(self)
        wx.PostEvent(self._filepanel, evt)
        wx.PostEvent(self._clientpanel, evt)
예제 #6
0
class DisplayCtrlDemo( wx.Window ):

    def __init__(self, parent, id):
        wx.Window.__init__(self, parent, id)
        self.SetBackgroundColour(wx.WHITE)

        wx.StaticText(self, -1, "Click on the following buttons to test functions:", pos=(10,10))

        self.b1 = wx.Button(self, -1, " Theme ",  (10,40))
        self.b2 = wx.Button(self, -1, " Scroll ", (110, 40))
        self.b3 = wx.Button(self, -1, " Font ",   (210, 40))

        self._init_prefs()
        self.displayctrl = DisplayCtrl(self, id=-1, pos=(10,80),  size=wx.Size(400,160), prefsIO=self._prefsIO)
        self.displayctrl.SetPeriodValues(1.0,3.0)
        self.displayctrl.SetData( wavef )
        self.displayctrl.SetData( trsf )

        self.Bind(wx.EVT_BUTTON, self.repaint1, self.b1)
        self.Bind(wx.EVT_BUTTON, self.repaint2, self.b2)
        self.Bind(wx.EVT_BUTTON, self.repaint3, self.b3)


    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 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 repaint2(self, event):
        """ Period. """
        s = float(random.sample(range(0,5), 1)[0])
        d = float(random.sample(range(1,20), 1)[0])/10.
        self.GetTopLevelParent().GetStatusBar().SetStatusText('New period: %f,%f'%(s,s+d))
        self.displayctrl.SetPeriodValues(s,s+d)


    def repaint3(self, event):
        """ Font. """
        data = wx.FontData()
        dlg = wx.FontDialog(self, data)
        if dlg.ShowModal() == wx.ID_OK:
            data   = dlg.GetFontData()
            font   = data.GetChosenFont()
            color  = data.GetColour()
            # set this new font to prefsIO
            # set prefsIO to the display
            self.displayctrl.SetPreferences( self._prefsIO )
        dlg.Destroy()