Exemple #1
0
 def __init__(self, bmptype, label, preferences):
     if preferences:
         self.bmp = spBitmap(bmptype, 32, theme=preferences.get_theme())
     else:
         self.bmp = spBitmap(bmptype, 32, theme=None)
     self.label = label
     self.preferences = preferences
Exemple #2
0
    def _set_notebook(self):
        """Create the notebook and set images."""

        self._notebook = wx.Notebook(self,
                                     style=wx.NB_TOP | wx.CLIP_CHILDREN
                                     | wx.NB_MULTILINE | wx.NB_NOPAGETHEME
                                     | wx.NO_BORDER)
        self._notebook.SetBackgroundColour(
            self._prefsIO.GetValue('M_BG_COLOUR'))
        self._notebook.SetForegroundColour(
            self._prefsIO.GetValue('M_FG_COLOUR'))
        self._notebook.SetFont(self._prefsIO.GetValue('M_FONT'))

        # assign images to the notebook
        il = wx.ImageList(16, 16)
        idx1 = il.Add(
            spBitmap(EMPTY_ICON,
                     16,
                     theme=self._prefsIO.GetValue('M_ICON_THEME')))
        idx2 = il.Add(
            spBitmap(NON_EMPTY_ICON,
                     16,
                     theme=self._prefsIO.GetValue('M_ICON_THEME')))
        self._notebook.AssignImageList(il)
        self._notebookimages = {EMPTY_ICON: idx1, NON_EMPTY_ICON: idx2}
    def SetColour(self, colour):
        """Sets the indicator color (red, green or blue)."""

        (r,g,b) = colour.Red(), colour.Green(), colour.Blue()
        if r >= g and r >= b:
            bmp = spBitmap( RULER_RED )
        elif g >= r and g >= b:
            bmp = spBitmap( RULER_GREEN )
        else:
            bmp = spBitmap( RULER_BLUE )
        self._img = wx.ImageFromBitmap(bmp)
 def on_link(self, evt):
     self.linked = not self.linked
     if self.linked:
         b = spBitmap(LINK_ICON,
                      size=24,
                      theme=self._prefsIO.GetValue('M_ICON_THEME'))
     else:
         b = spBitmap(UNLINK_ICON,
                      size=24,
                      theme=self._prefsIO.GetValue('M_ICON_THEME'))
     self.link_btn.SetBitmapLabel(b)
Exemple #5
0
    def __init__(self, parent, prefsIO):
        """ Create a new instance. """

        wx.Panel.__init__(self, parent, style=wx.NO_BORDER)
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # members
        self._prefsIO = prefsIO
        self._display = None
        self._trsctrl = None
        self._buttons = {}
        self._search = None

        # create the buttons bar
        theme = self._prefsIO.GetValue('M_ICON_THEME')
        bgcolour = self._prefsIO.GetValue('M_BG_COLOUR')
        tbsize = self._prefsIO.GetValue('M_TOOLBAR_ICONSIZE')
        self._buttons['tiercheck'] = CreateButton(self,
                                                  spBitmap(
                                                      TIER_CHECK_DISABLED,
                                                      tbsize, theme),
                                                  self.onTierCheck,
                                                  sizer,
                                                  colour=bgcolour)
        self._buttons['tierinfo'] = CreateButton(self,
                                                 spBitmap(
                                                     TIER_INFO_DISABLED,
                                                     tbsize, theme),
                                                 self.onTierInfo,
                                                 sizer,
                                                 colour=bgcolour)
        self._buttons['search'] = CreateButton(self,
                                               spBitmap(
                                                   TIER_SEARCH_DISABLED,
                                                   tbsize, theme),
                                               self.onSearch,
                                               sizer,
                                               colour=bgcolour)

        # sizer
        sizer.Add(self._buttons['tiercheck'], 1, flag=wx.ALL, border=2)
        sizer.Add(self._buttons['tierinfo'], 1, flag=wx.ALL, border=2)
        sizer.Add(self._buttons['search'], 1, flag=wx.ALL, border=2)

        self.Bind(spEVT_SEARCHED, self.onSearched)
        self.SetBackgroundColour(self._prefsIO.GetValue('M_BG_COLOUR'))

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        self.Layout()
    def __init__(self, parent, prefsIO):
        """Constructor."""

        wx.Panel.__init__(self, parent, style=wx.NO_BORDER)
        gbs = wx.GridBagSizer(hgap=5, vgap=5)

        # members
        self._prefsIO = prefsIO
        self._buttons = {}
        self._display = None
        self._scrollcoef = 75.0 # Time scroll (percentage)
        self._zoomcoef   = 50.0 # Time zoom (percentage)

        # create the buttons
        theme = self._prefsIO.GetValue('M_ICON_THEME')
        bgcolour = self._prefsIO.GetValue('M_BG_COLOUR')
        tbsize = self._prefsIO.GetValue('M_TOOLBAR_ICONSIZE')
        self._buttons['gostart'] = CreateButton(self, spBitmap(NAV_GO_START_ICON, tbsize, theme),    self.onGoStart, gbs, colour=bgcolour)
        self._buttons['goback']  = CreateButton(self, spBitmap(NAV_GO_PREVIOUS_ICON, tbsize, theme), self.onGoBack,  gbs, colour=bgcolour)
        self._buttons['gonext']  = CreateButton(self, spBitmap(NAV_GO_NEXT_ICON, tbsize, theme),     self.onGoNext,  gbs, colour=bgcolour)
        self._buttons['goend']   = CreateButton(self, spBitmap(NAV_GO_END_ICON, tbsize, theme),      self.onGoEnd,   gbs, colour=bgcolour)
        self._buttons['fitsel']  = CreateButton(self, spBitmap(NAV_FIT_SELECTION_ICON, tbsize, theme), self.onFitSelection, gbs, colour=bgcolour)

        self._buttons['hzoom']    = CreateButton(self, spBitmap(NAV_PERIOD_ZOOM_ICON, tbsize, theme),    self.onPeriodZoom, gbs, colour=bgcolour)
        self._buttons['hzoomin']  = CreateButton(self, spBitmap(NAV_PERIOD_ZOOM_IN_ICON, tbsize, theme), self.onPeriodZoomIn, gbs, colour=bgcolour)
        self._buttons['hzoomout'] = CreateButton(self, spBitmap(NAV_PERIOD_ZOOM_OUT_ICON, tbsize, theme),self.onPeriodZoomOut,gbs, colour=bgcolour)
        self._buttons['vzoomin']  = CreateButton(self, spBitmap(NAV_VIEW_ZOOM_IN_ICON, tbsize, theme),   self.onViewZoomIn,   gbs, colour=bgcolour)
        self._buttons['vzoomout'] = CreateButton(self, spBitmap(NAV_VIEW_ZOOM_OUT_ICON, tbsize, theme),  self.onViewZoomOut,  gbs, colour=bgcolour)

        # button placement in the sizer
        gbs.Add(self._buttons['gostart'],(0,0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['goback'], (0,1), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['gonext'], (0,2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['goend'],  (0,3), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['fitsel'], (0,4), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)

        gbs.Add(self._buttons['hzoom'],   (0,5), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['hzoomin'], (0,6), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['hzoomout'],(0,7), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)

        gbs.Add(self._buttons['vzoomin'], (0,8), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
        gbs.Add(self._buttons['vzoomout'],(0,9), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)

        self.SetBackgroundColour(self._prefsIO.GetValue('M_BG_COLOUR'))

        self.SetSizer(gbs)
        self.SetAutoLayout(True)
        self.Layout()
Exemple #7
0
    def CreateButton(self, parent, icon, text, tooltip="", btnid=None):
        """
        Create a button and return it.

        :param icon: (str) Path to the icon file name.
        :param text: (str) Short text to print into the button.
        :param tooltip: (str) Long text to show when mouse is entering into the button.
        :param btnid: (wx.ID) A unique ID assigned to the button.

        """
        if btnid is None:
            btnid = wx.NewId()

        bmp = spBitmap(icon,
                       size=self.preferences.GetValue('M_BUTTON_ICONSIZE'),
                       theme=self.preferences.GetValue('M_ICON_THEME'))

        btn = CreateGenButton(parent,
                              btnid,
                              bmp,
                              text=text,
                              tooltip=tooltip,
                              colour=None)
        btn.SetBackgroundColour(self.preferences.GetValue('M_BG_COLOUR'))
        btn.SetForegroundColour(self.preferences.GetValue('M_FG_COLOUR'))
        btn.SetFont(self.preferences.GetValue('M_FONT'))

        return btn
Exemple #8
0
    def _create_content(self):
        label = wx.StaticText(self, label="Search for:", pos=wx.DefaultPosition, size=wx.DefaultSize)
        label.SetBackgroundColour(self.preferences.GetValue('M_BG_COLOUR'))
        label.SetForegroundColour(self.preferences.GetValue('M_FG_COLOUR'))

        self.text = wx.TextCtrl(self, size=(150, -1), validator=TextValidator())
        self.text.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
        self.text.SetForegroundColour(wx.Colour(128, 128, 128))
        self.text.SetValue(DEFAULT_LABEL)
        self.text.Bind(wx.EVT_TEXT, self.OnTextChanged)
        self.text.Bind(wx.EVT_SET_FOCUS, self.OnTextClick)

        self.broom = wx.BitmapButton(self, bitmap=spBitmap(BROOM_ICON, 16, theme=self.preferences.GetValue('M_ICON_THEME')), style=wx.NO_BORDER)
        self.broom.Bind(wx.EVT_BUTTON, self.OnTextErase)

        self.pattern_layout = wx.BoxSizer(wx.HORIZONTAL)
        self.pattern_layout.Add(label, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, border=5)
        self.pattern_layout.Add(self.text, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
        self.pattern_layout.Add(self.broom, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=5)

        self.tp = TierPanel(self, self._trs)
        self.lp = LabelPanel(self)
        self.sh_layout = wx.BoxSizer(wx.HORIZONTAL)
        self.sh_layout.Add(self.lp, 1, wx.EXPAND | wx.LEFT,  0)
        self.sh_layout.Add(self.tp, 2, wx.EXPAND | wx.RIGHT, 0)

        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.pattern_layout, 0, wx.EXPAND|wx.ALL, border=5)
        vbox.Add(self.sh_layout,
                 1,
                 flag=wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL,
                 border=5)

        return vbox
Exemple #9
0
    def __init__(self, parent, preferences):
        """Create a new AudioRoamer instance.

        :param parent (wxWindow)
        :param preferences (Preferences)

        """
        wx.Panel.__init__(self, parent)
        self._prefs = preferences
        self._filename = None

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        FONT = self._prefs.GetValue('M_FONT')
        bmproamer = spBitmap(AUDIOROAMER_APP_ICON,
                             theme=self._prefs.GetValue('M_ICON_THEME'))
        self.roamerButton = CreateGenButton(
            self,
            ID_DIALOG_AUDIOROAMER,
            bmproamer,
            text=" Want more? ",
            tooltip="More information, manage channels, framerate, etc.",
            colour=wx.Colour(220, 120, 180),
            font=FONT)
        self.Bind(wx.EVT_BUTTON, self.OnAudioRoamer, self.roamerButton,
                  ID_DIALOG_AUDIOROAMER)

        sizer.Add(self.roamerButton)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        self.Layout()
Exemple #10
0
    def __add_file(self, label, value, opt_type):
        """
        Add a TextCtrl to the panel.

        :param label: (string) the description of the value
        :param value: (string) the current value

        """
        st = wx.StaticText(self, -1, label)
        self.__apply_preferences(st)

        filetext = wx.TextCtrl(self, -1, size=(300, -1))
        filetext.SetValue(value)
        self.__apply_preferences(filetext)

        filebtn = wx.BitmapButton(self, bitmap=spBitmap(TREE_FOLDER_OPEN, 16, theme=self._preferences.GetValue('M_ICON_THEME')), style=wx.NO_BORDER)
        if opt_type == "filepath":
            filebtn.Bind(wx.EVT_BUTTON, self.__on_text_filepath)
        else:
            filebtn.Bind(wx.EVT_BUTTON, self.__on_text_filename)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(filetext, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(filebtn, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=5)

        self.GetSizer().Add(st, 0, wx.BOTTOM, 8)
        self.GetSizer().Add(sizer, 0, wx.BOTTOM, 8)

        self.file_buttons[filebtn] = filetext
        self._items.append(filetext)
    def CreateTitle(self, title_icon=APP_ICON, title_text="It's coffee time!"):
        """Create a layout including a nice bold-title with an icon.

        :param title_icon: (str) Name of the icon.
        :param title_text: (str) The title
        :returns: wx.Panel of a customized header title

        """
        panel = wx.Panel(self, -1)
        panel.SetBackgroundColour(self.preferences.GetValue('M_BG_COLOUR'))

        bitmap = spBitmap(title_icon, self.preferences.GetValue('M_BUTTON_ICONSIZE'), theme=self.preferences.GetValue('M_ICON_THEME'))
        sBmp = wx.StaticBitmap(panel, wx.ID_ANY, bitmap)

        paneltext = wx.Panel(self, -1, style=wx.NO_BORDER)
        paneltext.SetBackgroundColour(self.preferences.GetValue('M_BG_COLOUR'))
        sizertext = wx.BoxSizer()
        text = wx.StaticText(paneltext, label=title_text, style=wx.ALIGN_CENTER)
        text.SetFont(self.preferences.GetValue('M_HEADER_FONT'))
        text.SetBackgroundColour(self.preferences.GetValue('M_BG_COLOUR'))
        text.SetForegroundColour(self.preferences.GetValue('M_FG_COLOUR'))
        sizertext.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
        paneltext.SetSizer(sizertext)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(sBmp, proportion=0, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=4)
        sizer.Add(paneltext, proportion=1, flag=wx.EXPAND | wx.ALL, border=4)
        panel.SetSizer(sizer)
        panel.SetAutoLayout(True)

        return panel
    def __create_content(self):
        """Annotation and language choices."""

        self.steplist_panel = wx.Panel(self)
        self.steplist_panel.SetBackgroundColour(
            self._prefsIO.GetValue('M_BG_COLOUR'))
        sbox = wx.BoxSizer(wx.VERTICAL)
        for i in range(len(self.parameters.get_steplist())):
            p = sppasStepPanel(self.steplist_panel, self.parameters,
                               self._prefsIO, i)
            p.Bind(EVT_STEP_EVENT, self.on_check_changed)
            p.Bind(EVT_LANG_EVENT, self.on_lang_changed)
            self.step_panels.append(p)
            self.activated.append(False)
            sbox.Add(p, 1, wx.EXPAND | wx.ALL, border=4)
        self.steplist_panel.SetSizer(sbox)

        lnk_bmp = spBitmap(LINK_ICON,
                           theme=self._prefsIO.GetValue('M_ICON_THEME'))
        self.link_btn = CreateGenButton(
            self,
            LINK_ID,
            lnk_bmp,
            tooltip="Link/Unlink language selection.",
            colour=self._prefsIO.GetValue('M_BG_COLOUR'),
            font=self._prefsIO.GetValue('M_FONT'))
        self.Bind(wx.EVT_BUTTON, self.on_link, self.link_btn, LINK_ID)
        self.on_link(None)

        _box = wx.BoxSizer(wx.HORIZONTAL)
        _box.Add(self.steplist_panel, 1, wx.EXPAND | wx.TOP, 4)
        _box.Add(self.link_btn, 0, wx.RIGHT | wx.EXPAND, 4)
        return _box
    def __init__(self, parent, preferences=None, title=""):
        """
        Constructor.

        :param parent: a wx window.
        :param preferences: (Preferences) a set of properties.
        :param title: String to append to the title of the dialog frame.

        """
        wx.Dialog.__init__(self, parent, -1, title=FRAME_TITLE+title, style=DIALOG_STYLE)

        if preferences is None:
            preferences = sppas.src.ui.wxgui.structs.prefs.Preferences()
        self.preferences = preferences

        # menu and toolbar
        self.toolbar = None
        self.btncreator = ButtonCreator(self.preferences)

        # icon
        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(spBitmap(APP_ICON))
        self.SetIcon(_icon)

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

        self.SetAutoLayout(True)
Exemple #14
0
 def _init_infos(self):
     wx.GetApp().SetAppName("trsinfo")
     # icon
     _icon = wx.EmptyIcon()
     _icon.CopyFromBitmap(spBitmap(APP_ICON))
     self.SetIcon(_icon)
     # colors
     self.SetBackgroundColour(self.preferences.GetValue('M_BG_COLOUR'))
     self.SetForegroundColour(self.preferences.GetValue('M_FG_COLOUR'))
     self.SetFont(self.preferences.GetValue('M_FONT'))
    def __init__(self, parent, preferences):
        """Constructor.

        :param parent:
        :param preferences:

        """
        wx.lib.scrolledpanel.ScrolledPanel.__init__(self,
                                                    parent,
                                                    -1,
                                                    size=wx.DefaultSize,
                                                    style=wx.NO_BORDER)
        self.SetBackgroundColour(preferences.GetValue('M_BG_COLOUR'))

        # Members
        self.activated = []
        self.step_panels = []
        self.linked = False
        self.parameters = sppasParam()
        self._prefsIO = preferences
        self.parameters.set_output_format(
            self._prefsIO.GetValue('M_OUTPUT_EXT'))

        _contentbox = self.__create_content()

        # Button to annotate
        runBmp = spBitmap(ANNOTATE_ICON,
                          self._prefsIO.GetValue('M_BUTTON_ICONSIZE'),
                          self._prefsIO.GetValue('M_ICON_THEME'))
        self._brun = CreateGenButton(
            self,
            RUN_ID,
            runBmp,
            text="  " + _("Perform annotations") + "  ",
            tooltip=_("Automatically annotate selected files"),
            colour=wx.Colour(220, 100, 80),
            font=self._prefsIO.GetValue('M_FONT'))

        _vbox = wx.BoxSizer(wx.VERTICAL)
        _vbox.Add(_contentbox, proportion=1, flag=wx.EXPAND | wx.ALL, border=0)
        _vbox.Add(self._brun,
                  proportion=0,
                  flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                  | wx.ALIGN_CENTER_HORIZONTAL,
                  border=20)
        self.Bind(wx.EVT_BUTTON, self.on_sppas_run, self._brun, RUN_ID)
        self.SetSizer(_vbox)
        self.SetupScrolling(scroll_x=True, scroll_y=True)
        self.SetMinSize(wx.Size(MIN_PANEL_W, MIN_PANEL_H))

        self.log_report = sppasLogFile()
Exemple #16
0
    def __create_button(self, bmp):
        """Create a button and add it to the sizer.
        
        :param bmp: a picture file name

        """
        btn = platebtn.PlateButton(self._navPanel, -1,
                                   bmp=spBitmap(bmp,
                                                24,
                                                theme=self._prefsIO.GetValue('M_ICON_THEME')))
        btn.SetInitialSize()
        btn.SetPressColor(wx.LIGHT_GREY)
        btn.Enable(True)
        return btn
Exemple #17
0
 def _create_close_button(self):
     bmp = spBitmap(CANCEL_ICON,
                    theme=self.preferences.GetValue('M_ICON_THEME'))
     color = self.preferences.GetValue('M_BG_COLOUR')
     self.btn_close = CreateGenButton(self,
                                      wx.ID_CLOSE,
                                      bmp,
                                      text=" Close",
                                      tooltip="Close this frame",
                                      colour=color)
     self.btn_close.SetFont(self.preferences.GetValue('M_FONT'))
     self.btn_close.SetDefault()
     self.btn_close.SetFocus()
     self.SetAffirmativeId(wx.ID_CLOSE)
Exemple #18
0
    def __init__(self, parent, bmpsize, bmpname, prefsIO):
        wx.Panel.__init__(self, parent)
        self.SetBackgroundColour( parent.GetBackgroundColour() )

        bitmap = spBitmap( bmpname, size=bmpsize, theme=prefsIO.GetValue('M_ICON_THEME') )
        sBmp = wx.StaticBitmap(self, wx.ID_ANY, bitmap)
        sBmp.SetBackgroundColour( parent.GetBackgroundColour() )

        sizer = wx.BoxSizer()
        sizer.Add(sBmp, proportion=1, flag=wx.ALL|wx.ALIGN_CENTER, border=0)
        self.SetSizerAndFit(sizer)

        sBmp.Bind(wx.EVT_LEFT_UP,      self.ProcessEvent)
        sBmp.Bind(wx.EVT_ENTER_WINDOW, self.ProcessEvent)
    def __init__(self, parent, id=wx.ID_ANY, value=0):
        """Constructor."""

        self._parent = parent
        if id == wx.ID_ANY:
            id = wx.NewId()

        self._id = id
        self._colour = None

        self._img = wx.ImageFromBitmap( spBitmap( RULER_BLUE ) )
        self.RotateImage()

        self.SetValue(value)
Exemple #20
0
 def ActivateButtons(self, value=True):
     self.EnableButtons(False)
     if value is True:
         self._buttons['tiercheck'].SetBitmapLabel(spBitmap(TIER_CHECK))
         self._buttons['tierinfo'].SetBitmapLabel(spBitmap(TIER_INFO))
         self._buttons['search'].SetBitmapLabel(spBitmap(TIER_SEARCH))
     else:
         self._buttons['tiercheck'].SetBitmapLabel(
             spBitmap(TIER_CHECK_DISABLED))
         self._buttons['tierinfo'].SetBitmapLabel(
             spBitmap(TIER_INFO_DISABLED))
         self._buttons['search'].SetBitmapLabel(
             spBitmap(TIER_SEARCH_DISABLED))
Exemple #21
0
    def __init__(self, parent, title, preferences, btype=None, size=(640,480)):
        """
        Create a new sppasFrame.
        """
        # Create the frame and set properties
        wx.Frame.__init__(self, parent, -1, FRAME_TITLE, size=size)
        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap( spBitmap(APP_ICON) )
        self.SetIcon(_icon)

        # Create the main panel and the main sizer
        self.panel = wx.Panel(self)
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        # Create the SPPAS specific header at the top of the panel
        spHeaderPanel(btype, title, parent.preferences).Draw(self.panel, self.sizer)

        self.panel.SetSizer(self.sizer)
        self.Centre()
Exemple #22
0
 def _create_title_label(self):
     self.title_layout = wx.BoxSizer(wx.HORIZONTAL)
     bmp = wx.BitmapButton(
         self,
         bitmap=spBitmap(INFO_ICON,
                         32,
                         theme=self.preferences.GetValue('M_ICON_THEME')),
         style=wx.NO_BORDER)
     font = self.preferences.GetValue('M_FONT')
     font.SetWeight(wx.BOLD)
     font.SetPointSize(font.GetPointSize() + 2)
     self.title_label = wx.StaticText(self,
                                      label="Transcription file properties",
                                      style=wx.ALIGN_CENTER)
     self.title_label.SetFont(font)
     self.title_layout.Add(bmp,
                           flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT,
                           border=5)
     self.title_layout.Add(self.title_label,
                           flag=wx.EXPAND | wx.ALL
                           | wx.wx.ALIGN_CENTER_VERTICAL,
                           border=5)
Exemple #23
0
    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'))
Exemple #24
0
    def __create_sizer(self):

        gbs = wx.GridBagSizer(hgap=5, vgap=5)

        # ---------- Background color

        txt_bg = wx.StaticText(self, -1, "Background color: ")
        gbs.Add(txt_bg, (0, 0),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        self.btn_color_bg = wx.BitmapButton(
            self, -1,
            spBitmap(BG_COLOR_ICON,
                     24,
                     theme=self.preferences.GetValue('M_ICON_THEME')))
        self.btn_color_bg.Bind(wx.EVT_BUTTON, self.onColorDlg,
                               self.btn_color_bg)
        gbs.Add(self.btn_color_bg, (0, 1),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        # ---------- Foreground color

        txt_fg = wx.StaticText(self, -1, "Foreground color: ")
        gbs.Add(txt_fg, (1, 0),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        self.btn_color_fg = wx.BitmapButton(
            self, -1,
            spBitmap(FG_COLOR_ICON,
                     24,
                     theme=self.preferences.GetValue('M_ICON_THEME')))
        self.btn_color_fg.Bind(wx.EVT_BUTTON, self.onColorDlg,
                               self.btn_color_fg)
        gbs.Add(self.btn_color_fg, (1, 1),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        # ---------- Font

        txt_font = wx.StaticText(self, -1, "Font: ")
        gbs.Add(txt_font, (2, 0),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        btn_font = wx.BitmapButton(self, -1, spBitmap(FONT_ICON,
                                                      24,
                                                      theme=None))
        self.Bind(wx.EVT_BUTTON, self.onSelectFont, btn_font)
        gbs.Add(btn_font, (2, 1),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        # ---------- Sample text

        self.sampleText = stattext.GenStaticText(
            self, -1, u"  This is a sample text.?!§+={}[]#&$€%éèàù")
        self.sampleText.SetFont(self.preferences.GetValue('M_FONT'))
        self.sampleText.SetBackgroundColour(
            self.preferences.GetValue('M_BG_COLOUR'))
        self.sampleText.SetForegroundColour(
            self.preferences.GetValue('M_FG_COLOUR'))

        gbs.Add(self.sampleText, (3, 0), (1, 2),
                flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        # ---------- tips

        txt_tips = wx.StaticText(self, -1, "Show tips at start-up: ")
        gbs.Add(txt_tips, (4, 0),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        btn_tips = wx.CheckBox(self, -1, "")
        btn_tips.SetValue(self.preferences.GetValue('M_TIPS'))
        self.Bind(wx.EVT_CHECKBOX, self.onTipsChecked, btn_tips)
        gbs.Add(btn_tips, (4, 1),
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                border=5)

        # ----------

        gbs.AddGrowableCol(1)

        return gbs
Exemple #25
0
    def _create_filestree(self):
        """ Create the tree to store file names. """

        t = wx.TreeCtrl(self,
                        1,
                        wx.DefaultPosition, (-1, -1),
                        style=wx.TR_MULTIPLE | wx.TR_HIDE_ROOT
                        | wx.TR_HAS_BUTTONS | wx.NO_BORDER)
        t.SetBackgroundColour(self._prefsIO.GetValue('M_BG_COLOUR'))
        t.SetForegroundColour(self._prefsIO.GetValue('M_FG_COLOUR'))
        t.SetFont(self._prefsIO.GetValue('M_FONT'))

        t.AddRoot('')

        iconsize = self._prefsIO.GetValue('M_TREE_ICONSIZE')
        theme = self._prefsIO.GetValue('M_ICON_THEME')
        il = wx.ImageList(iconsize, iconsize)

        self.rootidx = il.Add(spBitmap(TREE_ROOT, iconsize, theme))
        self.fldridx = il.Add(spBitmap(TREE_FOLDER_CLOSE, iconsize, theme))
        self.fldropenidx = il.Add(spBitmap(TREE_FOLDER_OPEN, iconsize, theme))
        self.wavfileidx = il.Add(spBitmap(MIME_WAV, iconsize, theme))
        self.txtfileidx = il.Add(spBitmap(MIME_ASCII, iconsize, theme))
        self.csvfileidx = il.Add(spBitmap(MIME_ASCII, iconsize, theme))
        self.ptierfileidx = il.Add(spBitmap(MIME_PITCHTIER, iconsize, theme))
        self.tgridfileidx = il.Add(spBitmap(MIME_TEXTGRID, iconsize, theme))
        self.trsfileidx = il.Add(spBitmap(MIME_TRS, iconsize, theme))
        self.eaffileidx = il.Add(spBitmap(MIME_EAF, iconsize, theme))
        self.xrafileidx = il.Add(spBitmap(MIME_XRA, iconsize, theme))
        self.mrkfileidx = il.Add(spBitmap(MIME_MRK, iconsize, theme))
        self.subfileidx = il.Add(spBitmap(MIME_SUBTITLES, iconsize, theme))
        self.anvilfileidx = il.Add(spBitmap(MIME_ANVIL, iconsize, theme))
        self.antxfileidx = il.Add(spBitmap(MIME_ANTX, iconsize, theme))
        self.xtransfileidx = il.Add(spBitmap(MIME_XTRANS, iconsize, theme))
        self.aupfileidx = il.Add(spBitmap(MIME_AUP, iconsize, theme))

        t.AssignImageList(il)

        return t
Exemple #26
0
    def _init_buttons(self):
        """
        Initialize members for audio button creations.

        """
        self._buttons = {}
        self._dict_buttons_enable = {}
        self._dict_buttons_disable = {}

        __theme = self._prefs.GetValue('M_ICON_THEME')
        _tbsize = self._prefs.GetValue('M_TOOLBAR_ICONSIZE')
        self.BMP_PLAYER_INFO            = spBitmap(PLAYER_INFO,           _tbsize, theme=__theme)
        self.BMP_PLAYER_INFO_DISABLED   = spBitmap(PLAYER_INFO_DISABLED,  _tbsize, theme=__theme)
        self.BMP_PLAYER_EJECT           = spBitmap(PLAYER_EJECT,          _tbsize, theme=__theme)
        self.BMP_PLAYER_EJECT_DISABLED  = spBitmap(PLAYER_EJECT_DISABLED, _tbsize, theme=__theme)
        self.BMP_PLAYER_NEXT            = spBitmap(PLAYER_NEXT,           _tbsize, theme=__theme)
        self.BMP_PLAYER_NEXT_DISABLED   = spBitmap(PLAYER_NEXT_DISABLED,  _tbsize, theme=__theme)
        self.BMP_PLAYER_REWIND          = spBitmap(PLAYER_REWIND,         _tbsize, theme=__theme)
        self.BMP_PLAYER_REWIND_DISABLED = spBitmap(PLAYER_REWIND_DISABLED,_tbsize, theme=__theme)
        self.BMP_PLAYER_PLAY            = spBitmap(PLAYER_PLAY,           _tbsize, theme=__theme)
        self.BMP_PLAYER_PLAY_DISABLED   = spBitmap(PLAYER_PLAY_DISABLED,  _tbsize, theme=__theme)
        self.BMP_PLAYER_REPLAY          = spBitmap(PLAYER_REPLAY,         _tbsize, theme=__theme)
        self.BMP_PLAYER_REPLAY_DISABLED = spBitmap(PLAYER_REPLAY_DISABLED,_tbsize, theme=__theme)
        self.BMP_PLAYER_PAUSE           = spBitmap(PLAYER_PAUSE,          _tbsize, theme=__theme)
        self.BMP_PLAYER_PAUSE_DISABLED  = spBitmap(PLAYER_PAUSE_DISABLED, _tbsize, theme=__theme)
        self.BMP_PLAYER_STOP            = spBitmap(PLAYER_STOP,           _tbsize, theme=__theme)
        self.BMP_PLAYER_STOP_DISABLED   = spBitmap(PLAYER_STOP_DISABLED,  _tbsize, theme=__theme)
Exemple #27
0
    def create(self):
        sizer = wx.BoxSizer(wx.VERTICAL)

        # Logo
        if len(self.logo) > 0:
            bitmap = spBitmap(self.logo, size=48)
            logo_bmp = wx.StaticBitmap(self, wx.ID_ANY, bitmap)
            sizer.Add(logo_bmp,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=8)

        # Program name
        if len(self.program) > 0:
            text_program_version = wx.StaticText(
                self, -1, self.program + " " + sppas.__version__)
            self.__apply_preferences(text_program_version)
            font = self._preferences.GetValue('M_FONT')
            font_size = font.GetPointSize()
            font.SetPointSize(font_size + 4)
            font.SetWeight(wx.BOLD)
            text_program_version.SetFont(font)
            sizer.Add(text_program_version,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=2)

        # Description
        if len(self.brief) > 0:
            text_descr = wx.StaticText(self, -1, self.brief)
            self.__apply_preferences(text_descr)
            sizer.Add(text_descr,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=2)

        # Copyright
        if len(self.copyright) > 0:
            text_copy = wx.StaticText(self, -1, self.copyright)
            self.__apply_preferences(text_copy)
            font = self._preferences.GetValue('M_FONT')
            font.SetWeight(wx.BOLD)
            text_copy.SetFont(font)
            sizer.Add(text_copy,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=2)

        # URL
        if len(self.url) > 0:
            text_url = wx.StaticText(self, -1, self.url)
            self.__apply_preferences(text_url)
            text_url.SetForegroundColour(wx.Colour(80, 100, 220))
            text_url.Bind(wx.EVT_LEFT_UP, self.on_link)
            sizer.Add(text_url,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=2)

        # License
        if len(self.license) > 0:
            text_license = wx.StaticText(self, -1, self.license)
            self.__apply_preferences(text_license)
            sizer.Add(text_license,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=2)

        # License text content
        if len(self.license_text) > 0:
            text_gpl = wx.StaticText(self, -1, self.license_text)
            self.__apply_preferences(text_gpl)
            sizer.Add(text_gpl,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL,
                      border=2)

        self.SetSizerAndFit(sizer)
        self.SetupScrolling(scroll_x=True, scroll_y=True)
 def ActivateButtons(self, value=True):
     self.EnableButtons(False)
     if value is True:
         self._buttons['tiercheck'].SetBitmapLabel(spBitmap(TIER_CHECK))
     else:
         self._buttons['tiercheck'].SetBitmapLabel(spBitmap(TIER_CHECK_DISABLED))