Ejemplo n.º 1
0
    def _check_prefs(self, prefs):
        """
        Check if preferences are set properly. Set new ones if required.
        Return the new version.

        """
        if prefs is None:
            prefs = Preferences(sppasTheme())
        else:
            try:
                prefs.GetValue('M_BG_COLOUR')
                prefs.GetValue('M_FG_COLOUR')
                prefs.GetValue('M_FONT')
                prefs.GetValue('M_ICON_THEME')
            except Exception:
                self._prefsIO.SetTheme(sppasTheme())
                prefs = self._prefsIO

        prefs.SetValue('SND_AUTOREPLAY', 'bool', True)
        prefs.SetValue('SND_INFO', 'bool', True)
        prefs.SetValue('SND_PLAY', 'bool', True)
        prefs.SetValue('SND_PAUSE', 'bool', True)
        prefs.SetValue('SND_STOP', 'bool', True)
        prefs.SetValue('SND_NEXT', 'bool', False)
        prefs.SetValue('SND_REWIND', 'bool', False)

        return prefs
Ejemplo n.º 2
0
    def _check_prefs(self, prefs):
        """
        Check if preferences are set properly. Set new ones if required.
        Return the new version.
        """
        if prefs is None:
            prefs = Preferences()
        else:
            try:
                bg = prefs.GetValue('M_BG_COLOUR')
                fg = prefs.GetValue('M_FG_COLOUR')
                font = prefs.GetValue('M_FONT')
            except Exception:
                self._prefsIO.SetTheme(sppasTheme())

        try:
            mult = prefs.GetValue('F_CCB_MULTIPLE')
        except Exception:
            prefs.SetValue(
                'F_CCB_MULTIPLE',
                t='bool',
                v=True,
                text=
                'Allow to check/uncheck multiple files in the file manager.')

        try:
            space = prefs.GetValue('F_SPACING')
        except Exception:
            prefs.SetValue('F_SPACING',
                           t='int',
                           v=2,
                           text='Space before each item of the file manager.')

        return prefs
Ejemplo n.º 3
0
    def __init__(self, parent, filename, trs=None, multiple=False):
        wx.Panel.__init__(self, parent, -1, size=wx.DefaultSize)

        # initialize the GUI
        self._prefs = Preferences()
        self._filename = filename
        self._dirty = False  # the transcription was changed
        self._selected = False  # the transcription is selected
        self._protected = [
        ]  # list of the tiers that are protected (can't be modified)

        if len(filename) == 0:
            self._filename = "Empty"

        boxtitle = self._create_title()
        self.tier_list = self._create_list(multiple)

        # load the Transcription
        if trs is None and len(filename) != 0:
            self.LoadFile(filename)
        else:
            self._transcription = trs
        # add Transcription information in the list
        for i in range(self._transcription.GetSize()):
            self.SetTierProperties(i)
        self._checksize()

        # events
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnListItemSelected,
                  self.tier_list)
        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnListItemSelected,
                  self.tier_list)

        # layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(boxtitle, 0, wx.EXPAND | wx.ALL, border=4)
        sizer.Add(self.tier_list, 1, wx.EXPAND | wx.ALL, border=4)

        self.SetFont(self._prefs.GetValue('M_FONT'))
        self.SetForegroundColour(self._prefs.GetValue('M_FG_COLOUR'))
        self.SetBackgroundColour(self._prefs.GetValue('M_BG_COLOUR'))
        self._boxtitle.SetForegroundColour(FG_FILE_COLOUR)

        self.SetSizerAndFit(sizer)
        self.SetAutoLayout(True)
        self.Layout()
Ejemplo n.º 4
0
    def _check_prefs(self, prefs):
        """
        Check if preferences are set properly.
        Set new ones if required.
        Return the new version.
        """
        if prefs is None:
            prefs = Preferences(sppasTheme())

        else:
            try:
                prefs.GetValue('M_BG_COLOUR')
                prefs.GetValue('M_FG_COLOUR')
                prefs.GetValue('M_FONT')
                prefs.GetValue('M_ICON_THEME')
            except Exception:
                self._prefsIO.SetTheme(sppasTheme())
        return prefs