示例#1
0
    def _create_toolbar(self):
        """ Creates a toolbar panel. """

        # Define the size of the icons and buttons
        iconSize = (TB_ICONSIZE, TB_ICONSIZE)
        self.toolbar = wx.ToolBar( self, -1, style=wx.TB_TEXT)

        # Set the size of the buttons
        self.toolbar.SetToolBitmapSize(iconSize)
        self.toolbar.SetFont( self.preferences.GetValue('M_FONT') )

        self.toolbar.AddLabelTool(ID_ADD_LABEL, 'Label Filter',
                             spBitmap(FILTER_ADD_LABEL,TB_ICONSIZE,theme=self.preferences.GetValue('M_ICON_THEME')),
                             shortHelp="Add a filter on the content of each annotation of the tier")
        self.toolbar.AddLabelTool(ID_ADD_TIME, 'Time Filter',
                             spBitmap(FILTER_ADD_TIME,TB_ICONSIZE,theme=self.preferences.GetValue('M_ICON_THEME')),
                             shortHelp="Add a filter to fix the time to start or to end to filter")
        self.toolbar.AddLabelTool(ID_ADD_DURATION, 'Duration Filter',
                             spBitmap(FILTER_ADD_DURATION,TB_ICONSIZE,theme=self.preferences.GetValue('M_ICON_THEME')),
                             shortHelp="Add a filter on the duration of each annotations of the tier")
        self.toolbar.AddSeparator()
        self.toolbar.AddLabelTool(ID_CLEAR, 'Remove Filter',
                             spBitmap(FILTER_REMOVE,TB_ICONSIZE,theme=self.preferences.GetValue('M_ICON_THEME')),
                             shortHelp="Remove checked filters of the list")
        self.toolbar.Realize()

        # events
        eventslist = [ ID_ADD_LABEL, ID_ADD_TIME, ID_ADD_DURATION, ID_CLEAR ]
        for event in eventslist:
            wx.EVT_TOOL(self, event, self.ProcessEvent)
示例#2
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')
        self._buttons['tiercheck'] = CreateButton( self, spBitmap(TIER_CHECK_DISABLED,TB_ICONSIZE,theme),  self.onTierCheck,sizer, colour=bgcolour)
        self._buttons['tierinfo']  = CreateButton( self, spBitmap(TIER_INFO_DISABLED,TB_ICONSIZE,theme),   self.onTierInfo, sizer, colour=bgcolour)
        self._buttons['search']    = CreateButton( self, spBitmap(TIER_SEARCH_DISABLED,TB_ICONSIZE,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()
示例#3
0
 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)
示例#4
0
    def _create_toolbar(self):
        """
        Creates the default toolbar.

        """

        toolbar = self.CreateToolBar(style=wx.TB_TEXT|wx.TB_FLAT|wx.TB_DOCKABLE|wx.TB_NODIVIDER)

        toolbar.AddLabelTool(wx.ID_EXIT, 'Exit', spBitmap(EXIT_ICON, TB_ICONSIZE, theme=self._prefsIO.GetValue('M_ICON_THEME')))
        toolbar.AddSeparator()
        toolbar.AddLabelTool(wx.ID_PREFERENCES, 'Settings', spBitmap(SETTINGS_ICON, TB_ICONSIZE, theme=self._prefsIO.GetValue('M_ICON_THEME')))
        toolbar.AddLabelTool(ID_FRAME_PLUGIN, 'Plug-in', spBitmap(PLUGIN_ICON, TB_ICONSIZE, theme=self._prefsIO.GetValue('M_ICON_THEME')), shortHelp="Import a plugin")
        toolbar.AddLabelTool(wx.ID_ABOUT, 'About', spBitmap(ABOUT_ICON, TB_ICONSIZE, theme=self._prefsIO.GetValue('M_ICON_THEME')))
        toolbar.AddLabelTool(wx.ID_HELP,  'Help', spBitmap(HELP_ICON, TB_ICONSIZE, theme=self._prefsIO.GetValue('M_ICON_THEME')))

        toolbar.SetToolSeparation(5)
        self.SetToolBar(toolbar)

        # Must be AFTER SetToolBar because wx can not apply a SetForeground / SetBackground to an un-attached toolbar!
        toolbar.SetBackgroundColour(self._prefsIO.GetValue('M_BG_COLOUR'))
        toolbar.SetForegroundColour(self._prefsIO.GetValue('M_FG_COLOUR'))
        #toolbar.SetFont(self._prefsIO.GetValue('M_FONT'))
        toolbar.Realize()

        # events
        eventslist = [ wx.ID_NEW, wx.ID_EXIT, wx.ID_PREFERENCES, wx.ID_ABOUT, wx.ID_HELP, ID_FRAME_PLUGIN ]
        for event in eventslist:
            wx.EVT_TOOL(self, event, self.ProcessEvent)
示例#5
0
文件: tga.py 项目: drammock/sppas
    def _create_toolbar(self):
        self.toolbar_layout = wx.BoxSizer(wx.HORIZONTAL)
        font = self.preferences.GetValue('M_FONT')
        sep_label = wx.StaticText(self, label="Time group separators:", style=wx.ALIGN_CENTER)
        sep_label.SetFont( font )
        self.septext = wx.TextCtrl(self, -1, size=(150,24))
        self.septext.SetInsertionPoint(0)
        self.septext.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
        self.septext.SetForegroundColour(wx.Colour(128,128,128))
        self.septext.SetValue(DEFAULT_SEP)
        self.septext.Bind(wx.EVT_TEXT, self.OnTextChanged)
        self.septext.Bind(wx.EVT_SET_FOCUS, self.OnTextClick)

        broomb = wx.BitmapButton(self, bitmap=spBitmap(BROOM_ICON, 24, theme=self.preferences.GetValue('M_ICON_THEME')), style=wx.NO_BORDER)
        broomb.Bind(wx.EVT_BUTTON, self.OnTextErase)
        applyb = wx.BitmapButton(self, bitmap=spBitmap(APPLY_ICON, 24, theme=self.preferences.GetValue('M_ICON_THEME')), style=wx.NO_BORDER)
        applyb.Bind(wx.EVT_BUTTON, self.OnSeparatorChanged)

        font.SetPointSize(font.GetPointSize() - 2)
        durlist = ['Use only Midpoint value', 'Add the Radius value', 'Deduct the Radius value']
        withradiusbox = wx.RadioBox(self, -1, label="Annotation durations:", choices=durlist, majorDimension=1, style=wx.RA_SPECIFY_COLS)
        withradiusbox.SetFont( font )
        self.Bind(wx.EVT_RADIOBOX, self.OnWithRadius, withradiusbox)

        sepsizer = wx.BoxSizer(wx.HORIZONTAL)
        sepsizer.Add(sep_label,    0, flag=wx.ALL, border=5)
        sepsizer.Add(broomb,       0, flag=wx.ALL, border=5)
        sepsizer.Add(self.septext, 1, flag=wx.EXPAND|wx.ALL, border=5)
        sepsizer.Add(applyb,       0, flag=wx.ALL, border=5)

        self.toolbar_layout.Add(sepsizer, 1, flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=5)
        self.toolbar_layout.AddStretchSpacer()
        self.toolbar_layout.Add(withradiusbox, flag=wx.RIGHT, border=5)
示例#6
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
示例#7
0
    def _create_toolbar(self):
        """
        Creates the default toolbar.

        """
        toolbar = self.CreateToolBar(style=wx.TB_TEXT|wx.TB_FLAT|wx.TB_DOCKABLE|wx.TB_NODIVIDER)

        toolbar.AddLabelTool(id=wx.ID_EXIT, label="Exit", bitmap=spBitmap(EXIT_ICON,TB_ICONSIZE),bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Quit the application")
        toolbar.AddSeparator()

        toolbar.AddLabelTool(id=wx.ID_ADD,   label="Import", bitmap=spBitmap(IMPORT_EXPORT_ICON, TB_ICONSIZE), bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Import data from a file")
        toolbar.AddLabelTool(id=wx.ID_OPEN,  label="Open",   bitmap=spBitmap(OPEN_ICON, TB_ICONSIZE),  bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Open a new directory")
        toolbar.AddLabelTool(id=wx.ID_SAVE,  label="Save",   bitmap=spBitmap(SAVE_ICON, TB_ICONSIZE),  bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Save into CSV files")
        toolbar.AddLabelTool(id=wx.ID_APPLY, label="Check",  bitmap=spBitmap(CHECK_ICON, TB_ICONSIZE), bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Check the data")
        toolbar.AddLabelTool(id=ID_GENERATE, label="Export", bitmap=spBitmap(EXPORT_ICON, TB_ICONSIZE),bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Export as PDF files")
        toolbar.AddSeparator()

        toolbar.AddLabelTool(id=wx.ID_NEW,   label="Add",    bitmap=spBitmap(ADD_ICON, TB_ICONSIZE),   bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Create a new entry")
        toolbar.AddLabelTool(id=wx.ID_EDIT,  label="Edit",   bitmap=spBitmap(EDIT_ICON, TB_ICONSIZE),  bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Modify the selected entry")
        toolbar.AddLabelTool(id=wx.ID_DELETE,label="Delete", bitmap=spBitmap(DELETE_ICON, TB_ICONSIZE),bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="Delete the selected entry")
        toolbar.AddSeparator()

        toolbar.AddLabelTool(id=wx.ID_ABOUT, label="About", bitmap=spBitmap(ABOUT_ICON, TB_ICONSIZE),  bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="About this application")

        # events
        eventslist = [ wx.ID_EXIT, wx.ID_ABOUT, wx.ID_HELP, wx.ID_OPEN, wx.ID_SAVE, wx.ID_NEW, ID_GENERATE, wx.ID_APPLY, wx.ID_EDIT, wx.ID_DELETE ]
        for event in eventslist:
            wx.EVT_TOOL(self, event, self.ProcessEvent)

        toolbar.Realize()
        self.SetToolBar(toolbar)
示例#8
0
文件: tga.py 项目: brigittebigi/sppas
    def _create_toolbar(self):
        """ Simulate a toolbar."""
        font = self.preferences.GetValue('M_FONT')
        font.SetPointSize(font.GetPointSize() - 2)

        sep_label = wx.StaticText(self, label="Time group separators:", style=wx.ALIGN_CENTER)
        sep_label.SetFont( font )

        self.septext = wx.TextCtrl(self, -1, size=(150,24))
        self.septext.SetFont( font )
        self.septext.SetInsertionPoint(0)
        self.septext.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
        self.septext.SetForegroundColour(wx.Colour(128,128,128))
        self.septext.SetValue(DEFAULT_SEP)

        broomb = wx.BitmapButton(self, bitmap=spBitmap(BROOM_ICON, 24, theme=self.preferences.GetValue('M_ICON_THEME')), style=wx.NO_BORDER)
        applyb = wx.BitmapButton(self, bitmap=spBitmap(APPLY_ICON, 24, theme=self.preferences.GetValue('M_ICON_THEME')), style=wx.NO_BORDER)

        durlist = ['Use only Midpoint value', 'Add the Radius value', 'Deduct the Radius value']
        withradiusbox = wx.RadioBox(self, -1, label="Annotation durations:", choices=durlist, majorDimension=1, style=wx.RA_SPECIFY_COLS)
        withradiusbox.SetFont( font )

        self.AddToolbar( [sep_label, broomb, self.septext, applyb],[withradiusbox] )

        self.septext.Bind(wx.EVT_TEXT, self.OnTextChanged)
        self.septext.Bind(wx.EVT_SET_FOCUS, self.OnTextClick)
        self.Bind(wx.EVT_BUTTON, self.OnTextErase, broomb)
        self.Bind(wx.EVT_BUTTON, self.OnSeparatorChanged, applyb)
        self.Bind(wx.EVT_RADIOBOX, self.OnWithRadius, withradiusbox)
示例#9
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
示例#10
0
    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)
示例#11
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 }
示例#12
0
    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')

        self._buttons['gostart'] = CreateButton( self, spBitmap(NAV_GO_START_ICON,TB_ICONSIZE,theme),    self.onGoStart, gbs, colour=bgcolour)
        self._buttons['goback']  = CreateButton( self, spBitmap(NAV_GO_PREVIOUS_ICON,TB_ICONSIZE,theme), self.onGoBack,  gbs, colour=bgcolour)
        self._buttons['gonext']  = CreateButton( self, spBitmap(NAV_GO_NEXT_ICON,TB_ICONSIZE,theme),     self.onGoNext,  gbs, colour=bgcolour)
        self._buttons['goend']   = CreateButton( self, spBitmap(NAV_GO_END_ICON,TB_ICONSIZE,theme),      self.onGoEnd,   gbs, colour=bgcolour)
        self._buttons['fitsel']  = CreateButton( self, spBitmap(NAV_FIT_SELECTION_ICON,TB_ICONSIZE,theme), self.onFitSelection, gbs, colour=bgcolour)

        self._buttons['hzoom']    = CreateButton( self, spBitmap(NAV_PERIOD_ZOOM_ICON,TB_ICONSIZE,theme),    self.onPeriodZoom, gbs, colour=bgcolour)
        self._buttons['hzoomin']  = CreateButton( self, spBitmap(NAV_PERIOD_ZOOM_IN_ICON,TB_ICONSIZE,theme), self.onPeriodZoomIn, gbs, colour=bgcolour)
        self._buttons['hzoomout'] = CreateButton( self, spBitmap(NAV_PERIOD_ZOOM_OUT_ICON,TB_ICONSIZE,theme),self.onPeriodZoomOut,gbs, colour=bgcolour)
        self._buttons['vzoomin']  = CreateButton( self, spBitmap(NAV_VIEW_ZOOM_IN_ICON,TB_ICONSIZE,theme),   self.onViewZoomIn,   gbs, colour=bgcolour)
        self._buttons['vzoomout'] = CreateButton( self, spBitmap(NAV_VIEW_ZOOM_OUT_ICON,TB_ICONSIZE,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()
示例#13
0
文件: search.py 项目: drammock/sppas
    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)
示例#14
0
    def __init__(self, parent, preferences):
        """
        Constructor.
        """
        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, 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), SIZE=BUTTON_ICONSIZE, font=self._prefsIO.GetValue('M_FONT'))

        _vbox = wx.BoxSizer(wx.VERTICAL)
        _vbox.Add(_contentbox, proportion=2, flag=wx.EXPAND | wx.ALL, border=4)
        _vbox.Add(self._brun, proportion=0, flag=wx.ALL|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))
示例#15
0
 def _create_send_other_button(self):
     def on_click(evt):
         wx.MessageBox("Copy and paste this email into your favorite email client and send it from there.",
             "Other email client", wx.OK | wx.ICON_INFORMATION)
     bmp = spBitmap(MAIL_OTHER_ICON)
     self.btn_other = CreateGenButton(self,ID_OTHER, bmp, text=" Other", tooltip="Send with another email client.", colour=None)#wx.Colour(220,120,180))
     self.Bind(wx.EVT_BUTTON, on_click, self.btn_other, ID_OTHER)
示例#16
0
    def __init__(self, parent, preferences=None, title=""):
        """
        Constructor.

        @param parent is a wx window.
        @param preferences (Preferences)

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

        if preferences is None:
            preferences = 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'))
示例#17
0
 def _create_apply_button(self):
     bmp = spBitmap(APPLY_ICON, theme=self.preferences.GetValue('M_ICON_THEME'))
     color = self.preferences.GetValue('M_BG_COLOUR')
     self.btn_apply = CreateGenButton(self, wx.ID_OK, bmp, text=" Apply ", tooltip="Apply all filters and close the frame", colour=color)
     self.btn_apply.SetFont( self.preferences.GetValue('M_FONT'))
     self.btn_apply.SetDefault()
     self.btn_apply.SetFocus()
示例#18
0
    def _init_infos( self, args ):
        """
        Sets the title and the icon.

        If args contains title, get it... or use the default.

        """

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

        # Set icon
        _iconname = COMPONENT_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'))
示例#19
0
    def _create_toolbar(self):
        """ Creates a toolbar panel. """
        # Define the size of the icons and buttons
        iconSize = (TB_ICONSIZE, TB_ICONSIZE)

        toolbar = wx.ToolBar( self, -1, style=wx.TB_TEXT )
        # Set the size of the buttons
        toolbar.SetToolBitmapSize(iconSize)
        toolbar.SetFont( self._prefsIO.GetValue('M_FONT') )

        toolbar.AddLabelTool(wx.ID_SAVE,  'Save',
                             spBitmap(SAVE_FILE,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Save the selected file")
        toolbar.AddLabelTool(SAVE_AS_ID,  'Save As',
                             spBitmap(SAVE_AS_FILE,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Save as... the selected file")
        toolbar.AddLabelTool(SAVE_ALL_ID, 'Save All',
                             spBitmap(SAVE_ALL_FILE,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Save all the files")

        toolbar.AddSeparator()

        toolbar.AddLabelTool(FILTER_CHECK_ID,'Check tiers',
                             spBitmap(FILTER_CHECK,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Choose the tier(s) to check")
        toolbar.AddLabelTool(FILTER_UNCHECK_ID, 'Uncheck tiers',
                             spBitmap(FILTER_UNCHECK,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Uncheck all")
        toolbar.AddLabelTool(wx.ID_DELETE, 'Delete',
                             spBitmap(TIER_DELETE,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Delete all the checked tier(s)")
        toolbar.AddLabelTool(PREVIEW_ID,   'View',
                             spBitmap(TIER_PREVIEW,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Preview one checked tier of the selected file")

        toolbar.AddSeparator()

        toolbar.AddLabelTool(FILTER_SEL_ID, 'Single\nFilter',
                             spBitmap(FILTER_SINGLE,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Filter checked tier(s) depending on its annotations.")
        toolbar.AddLabelTool(FILTER_REL_ID, 'Relation\nFilter',
                             spBitmap(FILTER_RELATION,TB_ICONSIZE,theme=self._prefsIO.GetValue('M_ICON_THEME')),
                             shortHelp="Filter checked tier(s) depending on time-relations of its annotation with annotations of another tier.")

        toolbar.Realize()

        # events
        eventslist = [ wx.ID_SAVE, SAVE_AS_ID, SAVE_ALL_ID, wx.ID_DELETE, PREVIEW_ID, FILTER_CHECK_ID, FILTER_UNCHECK_ID, FILTER_SEL_ID, FILTER_REL_ID ]
        for event in eventslist:
            wx.EVT_TOOL(self, event, self.ProcessEvent)

        return toolbar
示例#20
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=" Cancel", tooltip="Close this frame", colour=color)
     self.btn_close.SetFont( self.preferences.GetValue('M_FONT'))
     self.btn_close.SetDefault()
     self.btn_close.SetFocus()
     self.SetEscapeId(wx.ID_CLOSE)
示例#21
0
 def _create_close_button(self):
     bmp = spBitmap(APPLY_ICON, theme=self.preferences.GetValue("M_ICON_THEME"))
     color = self.preferences.GetValue("M_BG_COLOUR")
     self.btn_close = CreateGenButton(self, wx.ID_OK, 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_OK)
示例#22
0
 def _create_cancel_button(self):
     bmp = spBitmap(CANCEL_ICON, theme=self.preferences.GetValue("M_ICON_THEME"))
     color = self.preferences.GetValue("M_BG_COLOUR")
     self.btn_cancel = CreateGenButton(
         self, wx.ID_CANCEL, bmp, text=" Cancel", tooltip="Close this frame", colour=color
     )
     self.btn_cancel.SetFont(self.preferences.GetValue("M_FONT"))
     self.SetEscapeId(wx.ID_CANCEL)
示例#23
0
 def _create_close_button(self):
     bmp = spBitmap(APPLY_ICON, theme=self.preferences.GetValue("M_ICON_THEME"))
     self.btn_close = CreateGenButton(self, wx.ID_CLOSE, bmp, text=" Close", tooltip="Close this frame", colour=None)
     self.btn_close.SetBackgroundColour(self.preferences.GetValue("M_BG_COLOUR"))
     self.btn_close.SetForegroundColour(self.preferences.GetValue("M_FG_COLOUR"))
     self.btn_close.SetFont(self.preferences.GetValue("M_FONT"))
     self.btn_close.SetDefault()
     self.Bind(wx.EVT_BUTTON, self.on_close, self.btn_close, wx.ID_CLOSE)
示例#24
0
文件: tips.py 项目: drammock/sppas
 def _create_next_button(self):
     bmp = spBitmap(FORWARD_ICON, theme=self.preferences.GetValue("M_ICON_THEME"))
     color = self.preferences.GetValue("M_BG_COLOUR")
     self.btn_next = CreateGenButton(
         self, wx.ID_FORWARD, bmp, text=" Next tip", tooltip="Show a random tip", colour=color
     )
     self.btn_next.SetFont(self.preferences.GetValue("M_FONT"))
     self.Bind(wx.EVT_BUTTON, self.onShowNextTip, self.btn_next, wx.ID_FORWARD)
示例#25
0
文件: log.py 项目: drammock/sppas
 def _create_save_button(self):
     bmp = spBitmap(SAVE_FILE, theme=self.preferences.GetValue("M_ICON_THEME"))
     color = self.preferences.GetValue("M_BG_COLOUR")
     self.btn_save = CreateGenButton(
         self, ID_SAVE, bmp, text="Save report as...", tooltip="Save the procedure outcome report", colour=color
     )
     self.btn_save.SetFont(self.preferences.GetValue("M_FONT"))
     self.Bind(wx.EVT_BUTTON, self.OnSave, self.btn_save, ID_SAVE)
示例#26
0
 def _create_title_label(self):
     self.title_layout = wx.BoxSizer(wx.HORIZONTAL)
     bmp = wx.BitmapButton(self,bitmap=spBitmap(FEEDBACK_ICON, 32), style=wx.NO_BORDER)
     font = wx.Font(HEADER_FONTSIZE, wx.MODERN, wx.NORMAL, wx.BOLD, False, u'Consolas')
     self.title_label = wx.StaticText(self, label="Email Feedback", 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, border=5)
示例#27
0
 def _create_title_label(self):
     self.title_layout = wx.BoxSizer(wx.HORIZONTAL)
     bmp = wx.BitmapButton(self, bitmap=spBitmap(PROCESS_ICON, 32), style=wx.NO_BORDER)
     font = wx.Font(HEADER_FONTSIZE, wx.MODERN, wx.NORMAL, wx.BOLD, False, u'Consolas')
     self.title_label = wx.StaticText(self, label="Processing...", style=wx.ALIGN_CENTER)
     self.title_label.SetFont( font )
     self.title_layout.Add(bmp, 0, flag=wx.TOP|wx.RIGHT|wx.ALIGN_RIGHT, border=5)
     self.title_layout.Add(self.title_label, 1, flag=wx.EXPAND|wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=5)
示例#28
0
 def _create_close_button(self):
     bmp = spBitmap(CANCEL_ICON, theme=self.preferences.GetValue('M_ICON_THEME'))
     self.btn_close = CreateGenButton(self, wx.ID_CLOSE, bmp, text=" Close", tooltip="Close this frame", colour=None)
     self.btn_close.SetBackgroundColour( self.preferences.GetValue('M_BG_COLOUR') )
     self.btn_close.SetForegroundColour( self.preferences.GetValue('M_FG_COLOUR') )
     self.btn_close.SetFont( self.preferences.GetValue('M_FONT') )
     self.btn_close.SetDefault()
     self.btn_close.SetFocus()
     self.SetAffirmativeId(wx.ID_CLOSE)
示例#29
0
 def _create_send_gmail_button(self):
     def on_click(event):
         self.controller.SendWithGmail()
     bmp = spBitmap(MAIL_GMAIL_ICON, theme=self.preferences.GetValue('M_ICON_THEME'))
     self.btn_gmail = CreateGenButton(self, ID_GMAIL, bmp, text=" Gmail", tooltip="Send with Gmail.", colour=None)#wx.Colour(220,120,180))
     self.btn_gmail.SetBackgroundColour( self.preferences.GetValue('M_BG_COLOUR') )
     self.btn_gmail.SetForegroundColour( self.preferences.GetValue('M_FG_COLOUR') )
     self.btn_gmail.SetFont( self.preferences.GetValue('M_FONT') )
     self.Bind(wx.EVT_BUTTON, on_click, self.btn_gmail, ID_GMAIL)
示例#30
0
 def _create_cancel_button(self):
     bmp = spBitmap(CANCEL_ICON, theme=self.preferences.GetValue("M_ICON_THEME"))
     self.btn_cancel = CreateGenButton(
         self, wx.ID_CANCEL, bmp, text=" Cancel", tooltip="Reset options to their default values", colour=None
     )
     self.btn_cancel.SetBackgroundColour(self.preferences.GetValue("M_BG_COLOUR"))
     self.btn_cancel.SetForegroundColour(self.preferences.GetValue("M_FG_COLOUR"))
     self.btn_restore.SetFont(self.preferences.GetValue("M_FONT"))
     self.Bind(wx.EVT_BUTTON, self.on_cancel, self.btn_cancel, wx.ID_CANCEL)