def __DoLayout(self):
        """Layout and setup the results screen ui"""
        ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT)
        if wx.Platform == '__WXGTK__':
            ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        ctrlbar.AddStretchSpacer()

        # Cancel Button
        cbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_STOP), wx.ART_MENU)
        if cbmp.IsNull() or not cbmp.IsOk():
            cbmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR,
                                            wx.ART_MENU, (16, 16))
        cancel = eclib.PlateButton(ctrlbar, wx.ID_CANCEL, _("Cancel"),
                                      cbmp, style=eclib.PB_STYLE_NOBG)
        self._cancelb = cancel
        ctrlbar.AddControl(cancel, wx.ALIGN_RIGHT)

        # Clear Button
        cbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        if cbmp.IsNull() or not cbmp.IsOk():
            cbmp = None
        clear = eclib.PlateButton(ctrlbar, wx.ID_CLEAR, _("Clear"),
                                     cbmp, style=eclib.PB_STYLE_NOBG)
        self._clearb = clear
        ctrlbar.AddControl(clear, wx.ALIGN_RIGHT)

        ctrlbar.SetVMargin(1, 1)
        self.SetControlBar(ctrlbar)
        self.SetWindow(self._list)
Ejemplo n.º 2
0
    def __init__(self, parent, mod, pdata, bmp=None, enabled=False):
        """Create the PanelBoxItem
        @param parent: L{PanelBox}
        @param mod: module
        @param pdata: PluginData

        """
        super(PBPluginItem, self).__init__(parent)

        # Attributes
        self._module = mod
        self._pdata = pdata
        self._bmp = bmp
        self._title = wx.StaticText(self, label=self._pdata.GetName())
        self._version = wx.StaticText(self, label=self._pdata.GetVersion())
        self._desc = wx.StaticText(self, label=self._pdata.GetDescription())
        self._auth = wx.StaticText(self, label=_("Author: %s") % self._pdata.GetAuthor())
        self._enabled = wx.CheckBox(self, label=_("Enable"))
        self._enabled.SetValue(enabled)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        self._uninstall = eclib.PlateButton(self, label=_("Uninstall"), bmp=bmp,
                                            style=eclib.PB_STYLE_NOBG)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU)
        self._config = eclib.PlateButton(self,
                                         label=_("Configure"), bmp=bmp,
                                         style=eclib.PB_STYLE_NOBG)
        self._config.Enable(enabled)

        # Setup
        if not hasattr(mod, 'GetConfigObject'):
            self._config.Hide()

        ipath = self.GetInstallPath()
        if ipath:
            if not os.access(ipath, os.R_OK|os.W_OK):
                self._uninstall.Show(False)
        else:
            util.Log("[pluginmgr][warn] cant find plugin path for %s" % \
                     self._pdata.GetName())
            self._uninstall.Show(False) # Should not happen

        font = self._title.GetFont()
        font.SetWeight(wx.FONTWEIGHT_BOLD)
        self._title.SetFont(font)
        self._version.SetFont(font)

        if wx.Platform == '__WXMAC__':
            for ctrl in (self._desc, self._auth, self._enabled,
                         self._config, self._uninstall):
                ctrl.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        # Layout
        self.__DoLayout()

        # Event Handlers
        self.Bind(wx.EVT_CHECKBOX, self.OnCheck)
        self.Bind(wx.EVT_BUTTON, self.OnConfigButton, self._config)
        self.Bind(wx.EVT_BUTTON, self.OnUninstallButton, self._uninstall)
Ejemplo n.º 3
0
    def __DoLayout(self):
        """Layout the window"""
        #-- Setup ControlBar --#
        ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT)
        if wx.Platform == '__WXGTK__':
            ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        # Preferences
        prefbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU)
        pref = eclib.PlateButton(ctrlbar, ID_SETTINGS, '', prefbmp,
                                 style=eclib.PB_STYLE_NOBG)
        pref.SetToolTipString(_("Settings"))
        ctrlbar.AddControl(pref, wx.ALIGN_LEFT)

        # Exe
        ctrlbar.AddControl(wx.StaticText(ctrlbar, label=_("exec") + ":"),
                           wx.ALIGN_LEFT)
        exe = wx.Choice(ctrlbar, ID_EXECUTABLE)
        exe.SetToolTipString(_("Program Executable Command"))
        ctrlbar.AddControl(exe, wx.ALIGN_LEFT)

        # Script Label
        ctrlbar.AddControl((5, 5), wx.ALIGN_LEFT)
        self._chFiles = wx.Choice(ctrlbar, choices=[''])
        ctrlbar.AddControl(self._chFiles, wx.ALIGN_LEFT)

        # Args
        ctrlbar.AddControl((5, 5), wx.ALIGN_LEFT)
        ctrlbar.AddControl(wx.StaticText(ctrlbar, label=_("args") + ":"),
                           wx.ALIGN_LEFT)
        args = wx.TextCtrl(ctrlbar, ID_ARGS)
        args.SetToolTipString(_("Script Arguments"))
        ctrlbar.AddControl(args, wx.ALIGN_LEFT)

        # Spacer
        ctrlbar.AddStretchSpacer()
        
        # Run Button
        rbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_BIN_FILE), wx.ART_MENU)
        if rbmp.IsNull() or not rbmp.IsOk():
            rbmp = None
        run = eclib.PlateButton(ctrlbar, ID_RUN, _("Run"), rbmp,
                                style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddControl(run, wx.ALIGN_RIGHT)

        # Clear Button
        cbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        if cbmp.IsNull() or not cbmp.IsOk():
            cbmp = None
        clear = eclib.PlateButton(ctrlbar, wx.ID_CLEAR, _("Clear"),
                                  cbmp, style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddControl(clear, wx.ALIGN_RIGHT)
        ctrlbar.SetVMargin(1, 1)
        self.SetControlBar(ctrlbar)

        self.SetWindow(self._buffer)
Ejemplo n.º 4
0
    def __init__(self, parent):
        """Initialize the window"""
        super(ShelfWindow, self).__init__(parent)

        # Attributes
        # Parent is ed_shelf.EdShelfBook
        self._mw = ed_basewin.FindMainWindow(self)
        self._log = wx.GetApp().GetLog()
        self._listCtrl = CheckResultsList(self,
                                          style=wx.LC_REPORT|wx.BORDER_NONE)
        self._jobtimer = wx.Timer(self)
        self._checker = None
        self._curfile = u""
        self._hasrun = False

        # Setup
        self._listCtrl.set_mainwindow(self._mw)
        ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT)
        ctrlbar.SetVMargin(2, 2)
        if wx.Platform == '__WXGTK__':
            ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)
        rbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU)
        if rbmp.IsNull() or not rbmp.IsOk():
            rbmp = None
        self.cfgbtn = eclib.PlateButton(ctrlbar, wx.ID_ANY, bmp=rbmp,
                                        style=eclib.PB_STYLE_NOBG)
        self.cfgbtn.SetToolTipString(_("Configure"))
        ctrlbar.AddControl(self.cfgbtn, wx.ALIGN_LEFT)
        self._lbl = wx.StaticText(ctrlbar)
        ctrlbar.AddControl(self._lbl)
        ctrlbar.AddStretchSpacer()
        rbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_BIN_FILE), wx.ART_MENU)
        if rbmp.IsNull() or not rbmp.IsOk():
            rbmp = None
        self.runbtn = eclib.PlateButton(ctrlbar, wx.ID_ANY, _("Lint"), rbmp,
                                        style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddControl(self.runbtn, wx.ALIGN_RIGHT)

        # Layout
        self.SetWindow(self._listCtrl)
        self.SetControlBar(ctrlbar, wx.TOP)

        # Event Handlers
        self.Bind(wx.EVT_TIMER, self.OnJobTimer, self._jobtimer)
        self.Bind(wx.EVT_BUTTON, self.OnShowConfig, self.cfgbtn)
        self.Bind(wx.EVT_BUTTON, self.OnRunLint, self.runbtn)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self)

        # Editra Message Handlers
        ed_msg.Subscribe(self.OnFileLoad, ed_msg.EDMSG_FILE_OPENED)
        ed_msg.Subscribe(self.OnFileSave, ed_msg.EDMSG_FILE_SAVED)
        ed_msg.Subscribe(self.OnPageChanged, ed_msg.EDMSG_UI_NB_CHANGED)
        ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED)
Ejemplo n.º 5
0
    def __init__(self, parent):
        CommandBarBase.__init__(self, parent)

        # Attributes
        self.SetControl(
            ed_search.EdSearchCtrl(self, wx.ID_ANY, menulen=5, size=(180, -1)))
        self._sctrl = self.ctrl.GetSearchController()

        # Setup
        f_lbl = wx.StaticText(self, label=_("Find") + u": ")
        t_bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DOWN), wx.ART_MENU)
        next_btn = eclib.PlateButton(self,
                                     ID_SEARCH_NEXT,
                                     _("Next"),
                                     t_bmp,
                                     style=eclib.PB_STYLE_NOBG)
        self.AddControl(f_lbl, wx.ALIGN_LEFT)
        self.AddControl(self.ctrl, wx.ALIGN_LEFT)
        self.AddControl(next_btn, wx.ALIGN_LEFT)

        t_bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_UP), wx.ART_MENU)
        pre_btn = eclib.PlateButton(self,
                                    ID_SEARCH_PRE,
                                    _("Previous"),
                                    t_bmp,
                                    style=eclib.PB_STYLE_NOBG)
        self.AddControl(pre_btn, wx.ALIGN_LEFT)

        match_case = wx.CheckBox(self, ID_MATCH_CASE, _("Match Case"))
        match_case.SetValue(self.ctrl.IsMatchCase())
        self.AddControl(match_case, wx.ALIGN_LEFT)

        regex_cb = wx.CheckBox(self, ID_REGEX, _("Regular Expression"))
        regex_cb.SetValue(self.ctrl.IsRegEx())
        self.AddControl(regex_cb, wx.ALIGN_LEFT)

        # HACK: workaround bug in mac control that resets size to
        #       that of the default variant after any text has been
        #       typed in it. Note it reports the best size as the default
        #       variant and causes layout issues. wxBUG
        if wx.Platform == '__WXMAC__':
            self.ctrl.SetSizeHints(180, 16, 180, 16)

        # Event Handlers
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheck)
        ed_msg.Subscribe(self.OnThemeChange, ed_msg.EDMSG_THEME_CHANGED)
        self._sctrl.RegisterClient(self)
Ejemplo n.º 6
0
    def __init__(self, parent):
        eclib.ControlBar.__init__(self,
                                  parent,
                                  style=eclib.CTRLBAR_STYLE_GRADIENT)

        if wx.Platform == '__WXGTK__':
            self.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        self.SetVMargin(2, 2)

        # Attributes
        self._parent = parent
        self._menu = None
        self._menu_enabled = True
        self.ctrl = None
        self.close_b = eclib.PlateButton(self,
                                         ID_CLOSE_BUTTON,
                                         bmp=XButton.GetBitmap(),
                                         style=eclib.PB_STYLE_NOBG)

        # Setup
        self.AddControl(self.close_b, wx.ALIGN_LEFT)

        # Event Handlers
        self.Bind(wx.EVT_BUTTON, self.OnClose, self.close_b)
        self.Bind(wx.EVT_CONTEXT_MENU, self.OnContext)
        self.Bind(wx.EVT_MENU, self.OnContextMenu)
Ejemplo n.º 7
0
    def __init__(self, parent):
        super(BookmarkWindow, self).__init__(parent)

        # Attributes
        self._list = BookmarkList(self)

        #Setup
        self.SetWindow(self._list)
        ctrlbar = self.CreateControlBar(wx.TOP)
        ctrlbar.SetVMargin(0, 0)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        self._delbtn = eclib.PlateButton(ctrlbar, label=_("Delete"), bmp=bmp,
                                         style=eclib.PB_STYLE_NOBG)
        self._delbtn.SetToolTipString(_("Delete Bookmark"))
        ctrlbar.AddStretchSpacer()
        ctrlbar.AddControl(self._delbtn, wx.ALIGN_RIGHT)

        # Message Handlers
        ed_msg.Subscribe(self.OnBookmark, ed_msg.EDMSG_UI_STC_BOOKMARK)

        # Event Handlers
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivate, self._list)
        self.Bind(wx.EVT_BUTTON, self.OnDelBm, self._delbtn)
        self.Bind(wx.EVT_UPDATE_UI,
                  lambda evt: evt.Enable(bool(len(self._list.GetSelections()))),
                  self._delbtn)
    def layout(self, taskbtndesc=None, taskfn=None, timerfn=None):
        """Layout the shelf window"""
        if taskfn:
            rbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_BIN_FILE),
                                            wx.ART_MENU)
            if rbmp.IsNull() or not rbmp.IsOk():
                rbmp = None
            self.taskbtn = eclib.PlateButton(self.ctrlbar,
                                             wx.ID_ANY,
                                             _(taskbtndesc),
                                             rbmp,
                                             style=eclib.PB_STYLE_NOBG)
            self.ctrlbar.AddControl(self.taskbtn, wx.ALIGN_RIGHT)
            self.Bind(wx.EVT_BUTTON, taskfn, self.taskbtn)

        # Layout
        self.SetWindow(self._listCtrl)
        self.SetControlBar(self.ctrlbar, wx.TOP)

        # Event Handlers
        self.Bind(wx.EVT_BUTTON, self.OnShowConfig, self.cfgbtn)
        if timerfn:
            self.Bind(wx.EVT_TIMER, timerfn, self._jobtimer)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self)

        # Editra Message Handlers
        ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED)
        ed_msg.Subscribe(self.OnFontChanged, ed_msg.EDMSG_DSP_FONT)
Ejemplo n.º 9
0
    def AddPlateButton(self,
                       lbl=u"",
                       bmp=-1,
                       align=wx.ALIGN_LEFT,
                       cbarpos=wx.TOP):
        """Add an eclib.PlateButton to the ControlBar specified by
        cbarpos.
        @keyword lbl: Button Label
        @keyword bmp: Bitmap or EditraArtProvider ID
        @keyword align: button alignment
        @keyword cbarpos: ControlBar position
        @return: PlateButton instance

        """
        ctrlbar = self.GetControlBar(cbarpos)
        assert ctrlbar is not None, "No ControlBar at cbarpos"
        if not isinstance(bmp, wx.Bitmap):
            assert isinstance(bmp, int)
            bmp = wx.ArtProvider.GetBitmap(str(bmp), wx.ART_MENU)
        if bmp.IsNull() or not bmp.IsOk():
            bmp = None
        btn = eclib.PlateButton(ctrlbar,
                                wx.ID_ANY,
                                lbl,
                                bmp,
                                style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddControl(btn, align)
        return btn
Ejemplo n.º 10
0
    def __DoLayout(self):
        """Layout the log viewer window"""
        # Setup ControlBar
        ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT)
        if wx.Platform == '__WXGTK__':
            ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        # View Choice
        self._srcfilter = wx.Choice(ctrlbar, wx.ID_ANY, choices=[])
        ctrlbar.AddControl(
            wx.StaticText(ctrlbar, label=_("Show output from") + ":"))
        ctrlbar.AddControl(self._srcfilter)

        # Clear Button
        ctrlbar.AddStretchSpacer()
        cbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        if cbmp.IsNull() or not cbmp.IsOk():
            cbmp = None
        clear = eclib.PlateButton(ctrlbar,
                                  wx.ID_CLEAR,
                                  _("Clear"),
                                  cbmp,
                                  style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddControl(clear, wx.ALIGN_RIGHT)
        ctrlbar.SetVMargin(1, 1)
        self.SetControlBar(ctrlbar)
Ejemplo n.º 11
0
    def __init__(self, parent):
        super(StyleEditorBox, self).__init__(parent)

        # Attributes
        self._prevTheme = None
        ctrlbar = self.CreateControlBar(wx.TOP)
        ss_lst = util.GetResourceFiles(u'styles', get_all=True, title=False)
        ss_lst = [sheet for sheet in ss_lst if not sheet.startswith('.')]
        self._style_ch = wx.Choice(ctrlbar,
                                   ed_glob.ID_PREF_SYNTHEME,
                                   choices=sorted(ss_lst))
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_ADD), wx.ART_MENU)
        if not bmp.IsOk():
            bmp = None
        self._addbtn = eclib.PlateButton(ctrlbar,
                                         label=_("New"),
                                         bmp=bmp,
                                         style=eclib.PB_STYLE_NOBG)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_REMOVE), wx.ART_MENU)
        if not bmp.IsOk():
            bmp = None
        self._delbtn = eclib.PlateButton(ctrlbar,
                                         label=_("Remove"),
                                         bmp=bmp,
                                         style=eclib.PB_STYLE_NOBG)

        # Setup
        ss_lbl = wx.StaticText(ctrlbar, label=_("Style Theme") + u": ")
        ctrlbar.AddControl(ss_lbl, wx.ALIGN_LEFT)
        self.StyleTheme = Profile_Get('SYNTHEME', 'str')
        ctrlbar.AddControl(self._style_ch, wx.ALIGN_LEFT)
        ctrlbar.AddControl(self._addbtn, wx.ALIGN_LEFT)
        self._addbtn.SetToolTipString(_("Create a new style theme"))
        ctrlbar.AddControl(self._delbtn, wx.ALIGN_LEFT)
        self._delbtn.SetToolTipString(_("Remove Style"))
        self.SetWindow(StyleEditorPanel(self))

        # Events
        self.Bind(wx.EVT_CHOICE, self.OnThemeChoice, self._style_ch)
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_UPDATE_UI,
                  lambda evt: evt.Enable(not self.IsSystemStyleSheet()),
                  self._delbtn)
Ejemplo n.º 12
0
    def __init__(self, parent):
        super(BrowserMenuBar,
              self).__init__(parent, style=eclib.CTRLBAR_STYLE_GRADIENT)

        if wx.Platform == '__WXGTK__':
            self.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        # Attributes
        self._saved = ed_menu.EdMenu()
        self._rmpath = ed_menu.EdMenu()
        self._ids = list()  # List of ids of menu items
        self._rids = list()  # List of remove menu item ids

        # Build Menus
        menu = ed_menu.EdMenu()
        menu.Append(ID_MARK_PATH, _("Save Selected Paths"))
        menu.AppendMenu(ID_OPEN_MARK, _("Jump to Saved Path"), self._saved)
        menu.AppendSeparator()
        menu.AppendMenu(ID_REMOVE_MARK, _("Remove Saved Path"), self._rmpath)

        # Button
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU)
        self.prefb = eclib.PlateButton(self,
                                       bmp=bmp,
                                       style=eclib.PB_STYLE_NOBG)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_ADD_BM), wx.ART_MENU)
        self.menub = eclib.PlateButton(self,
                                       bmp=bmp,
                                       style=eclib.PB_STYLE_NOBG)
        self.menub.SetToolTipString(_("Pathmarks"))
        self.menub.SetMenu(menu)

        # Layout bar
        self.AddControl(self.prefb, wx.ALIGN_LEFT)
        self.AddControl(self.menub, wx.ALIGN_LEFT)

        # Event Handlers
        ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED)
        self.Bind(wx.EVT_BUTTON, self.OnPref, self.prefb)
        self.Bind(wx.EVT_BUTTON, lambda evt: self.menub.ShowMenu(), self.menub)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self)
Ejemplo n.º 13
0
    def __init__(self,
                 parent,
                 mod,
                 bmp=None,
                 title=u'Plugin Name',
                 version=u'0.0',
                 desc=u'Description',
                 auth='John Doe',
                 enabled=False):
        """Create the PanelBoxItem
        @param parent: L{PanelBox}

        """
        eclib.PanelBoxItemBase.__init__(self, parent)

        # Attributes
        self._module = mod
        self._bmp = bmp
        self._title = wx.StaticText(self, label=title)
        self._version = wx.StaticText(self, label=version)
        self._desc = wx.StaticText(self, label=desc)
        self._auth = wx.StaticText(self, label=_("Author: %s") % auth)
        self._enabled = wx.CheckBox(self, label=_("Enable"))
        self._enabled.SetValue(enabled)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU)
        self._config = eclib.PlateButton(self,
                                         label=_("Configure"),
                                         bmp=bmp,
                                         style=eclib.PB_STYLE_NOBG)
        self._config.Enable(enabled)

        # Setup
        if not hasattr(mod, 'GetConfigObject'):
            self._config.Hide()
        font = self._title.GetFont()
        font.SetWeight(wx.FONTWEIGHT_BOLD)
        self._title.SetFont(font)
        self._version.SetFont(font)

        if wx.Platform == '__WXMAC__':
            self._desc.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            self._auth.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            self._enabled.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            self._config.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        # Layout
        self.__DoLayout()

        # Event Handlers
        self.Bind(wx.EVT_CHECKBOX, self.OnCheck)
        self.Bind(wx.EVT_BUTTON, self.OnButton)
Ejemplo n.º 14
0
    def __init__(self, parent):
        super(FBConfigPanel, self).__init__(parent)

        # Attributes
        self._sb = wx.StaticBox(self, label=_("Actions"))
        self._sbs = wx.StaticBoxSizer(self._sb, wx.VERTICAL)
        self._sync_cb = wx.CheckBox(self,
                                    label=_("Synch tree with tab selection"),
                                    name=FB_SYNC_OPT)
        self._vsb = wx.StaticBox(self, label=_("View"))
        self._vsbs = wx.StaticBoxSizer(self._vsb, wx.VERTICAL)
        self._vhf_cb = wx.CheckBox(self,
                                   label=_("Show Hidden Files"),
                                   name=FB_SHF_OPT)
        self._fsb = wx.StaticBox(self, label=_("Filters"), name=FB_FILTER_OPT)
        self._fsbs = wx.StaticBoxSizer(self._fsb, wx.VERTICAL)
        self._filters = wx.ListBox(self, size=(-1, 100), style=wx.LB_SORT)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_ADD), wx.ART_MENU)
        self._addb = eclib.PlateButton(self, bmp=bmp)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_REMOVE), wx.ART_MENU)
        self._rmb = eclib.PlateButton(self, bmp=bmp)

        # Setup
        self.__DoLayout()
        self._sync_cb.Value = GetFBOption(FB_SYNC_OPT, True)
        self._vhf_cb.Value = GetFBOption(FB_SHF_OPT, False)
        self._filters.Items = GetFBOption(FB_FILTER_OPT, FB_DEFAULT_FILTERS)
        self._filters.ToolTip = wx.ToolTip(
            _("List of files patterns to exclude "
              "from view\nThe use of wildcards "
              "(*) are permitted."))
        self._addb.ToolTip = wx.ToolTip(_("Add filter"))
        self._rmb.ToolTip = wx.ToolTip(_("Remove selected filter"))

        # Event Handlers
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheck, self._sync_cb)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheck, self._vhf_cb)
    def __init__(self, parent):
        super(GeneralConfigPanel, self).__init__(parent)

        # Attributes
        self._python_path_combo = wx.Choice(self)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_ADD), wx.ART_MENU)
        self._add_path = eclib.PlateButton(self, bmp=bmp)
        self._add_path.ToolTip = wx.ToolTip(_("Add python executable"))
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_REMOVE), wx.ART_MENU)
        self._rm_path = eclib.PlateButton(self, bmp=bmp)
        self._rm_path.ToolTip = wx.ToolTip(
            _("Remove selected python executable"))
        self._check_on_save_cb = wx.CheckBox(
            self, label=_("Check for syntax errors on save"))
        self._load_proj_cb = wx.CheckBox(self, label=_("Load Last Project"))

        # Setup
        self.__DoLayout()

        # Event Handlers
        self.Bind(wx.EVT_CHOICE, self.OnComboSelect, self._python_path_combo)
        self.Bind(wx.EVT_BUTTON, self.OnAddPyExe, self._add_path)
        self.Bind(wx.EVT_BUTTON, self.OnRemovePyExe, self._rm_path)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheckBox, self._check_on_save_cb)
Ejemplo n.º 16
0
    def __init__(self, parent):
        eclib.ControlBar.__init__(self,
                                  parent,
                                  style=eclib.CTRLBAR_STYLE_GRADIENT)

        if wx.Platform == '__WXGTK__':
            self.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        # Attributes
        self._saved = ed_menu.EdMenu()
        self._rmpath = ed_menu.EdMenu()
        self._ids = list()  # List of ids of menu items
        self._rids = list()  # List of remove menu item ids

        key = u'Ctrl'
        if wx.Platform == '__WXMAC__':
            key = u'Cmd'

        tt = wx.ToolTip(
            _("To open multiple files at once %s+Click to select "
              "the desired files/folders then hit Enter to open "
              "them all at once") % key)
        self.SetToolTip(tt)

        # Build Menus
        menu = ed_menu.EdMenu()
        menu.Append(ID_MARK_PATH, _("Save Selected Paths"))
        menu.AppendMenu(ID_OPEN_MARK, _("Jump to Saved Path"), self._saved)
        menu.AppendSeparator()
        menu.AppendMenu(ID_REMOVE_MARK, _("Remove Saved Path"), self._rmpath)

        # Button
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_ADD_BM), wx.ART_MENU)
        self.menub = eclib.PlateButton(self,
                                       bmp=bmp,
                                       style=eclib.PB_STYLE_NOBG)
        self.menub.SetToolTipString(_("Pathmarks"))
        self.menub.SetMenu(menu)

        # Layout bar
        self.AddControl(self.menub, wx.ALIGN_LEFT)

        # Event Handlers
        ed_msg.Subscribe(self.OnThemeChanged, ed_msg.EDMSG_THEME_CHANGED)
        self.Bind(wx.EVT_BUTTON, lambda evt: self.menub.ShowMenu(), self.menub)
Ejemplo n.º 17
0
    def __DoLayout(self):
        """Layout the log viewer window"""
        # Setup ControlBar
        ctrlbar = self.CreateControlBar(wx.TOP)

        # View Choice
        self._srcfilter = wx.Choice(ctrlbar, wx.ID_ANY, choices=[])
        ctrlbar.AddControl(wx.StaticText(ctrlbar,
                                         label=_("Show output from") + ":"))
        ctrlbar.AddControl(self._srcfilter)

        # Clear Button
        ctrlbar.AddStretchSpacer()
        cbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        if cbmp.IsNull() or not cbmp.IsOk():
            cbmp = None
        clear = eclib.PlateButton(ctrlbar, wx.ID_CLEAR, _("Clear"),
                                  cbmp, style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddControl(clear, wx.ALIGN_RIGHT)
        ctrlbar.SetVMargin(0, 0)
Ejemplo n.º 18
0
    def AddPlateButton(self, lbl=u"", bmp=-1, align=wx.ALIGN_LEFT):
        """Add an eclib.PlateButton 
        @keyword lbl: Button Label
        @keyword bmp: Bitmap or EditraArtProvider ID
        @keyword align: button alignment
        @return: PlateButton instance

        """
        if not isinstance(bmp, wx.Bitmap):
            assert isinstance(bmp, int)
            bmp = wx.ArtProvider.GetBitmap(str(bmp), wx.ART_MENU)
        if bmp.IsNull() or not bmp.IsOk():
            bmp = None
        btn = eclib.PlateButton(self,
                                wx.ID_ANY,
                                lbl,
                                bmp,
                                style=eclib.PB_STYLE_NOBG)
        self.AddControl(btn, align)
        return btn
Ejemplo n.º 19
0
    def __DoLayout(self):
        """Layout the control box"""
        ctrlbar = eclib.ControlBar(self, style=eclib.CTRLBAR_STYLE_GRADIENT)
        if wx.Platform == '__WXGTK__':
            ctrlbar.SetWindowStyle(eclib.CTRLBAR_STYLE_DEFAULT)

        self._choice = wx.Choice(ctrlbar, wx.ID_ANY, choices=self._styles)

        ctrlbar.AddControl(
            wx.StaticText(ctrlbar, label=_("Color Scheme") + u":"),
            wx.ALIGN_LEFT)
        ctrlbar.AddControl(self._choice, wx.ALIGN_LEFT)

        cbmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
        self._clear = eclib.PlateButton(ctrlbar,
                                        label=_("Clear"),
                                        bmp=cbmp,
                                        style=eclib.PB_STYLE_NOBG)
        ctrlbar.AddStretchSpacer()
        ctrlbar.AddControl(self._clear, wx.ALIGN_RIGHT)

        self.SetControlBar(ctrlbar)
        self.SetWindow(self._shell)
Ejemplo n.º 20
0
    def __init__(self, parent):
        CommandBarBase.__init__(self, parent)

        # Attributes
        self.SetControl(
            ed_search.EdSearchCtrl(self, wx.ID_ANY, menulen=5, size=(180, -1)))
        self._sctrl = self.ctrl.GetSearchController()

        # Setup
        f_lbl = wx.StaticText(self, label=_("Find") + u": ")
        t_bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DOWN), wx.ART_MENU)
        next_btn = eclib.PlateButton(self,
                                     ID_SEARCH_NEXT,
                                     _("Next"),
                                     t_bmp,
                                     style=eclib.PB_STYLE_NOBG,
                                     name="NextBtn")
        self.AddControl(f_lbl, wx.ALIGN_LEFT)
        self.AddControl(self.ctrl, wx.ALIGN_LEFT)
        self.AddControl(next_btn, wx.ALIGN_LEFT)

        t_bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_UP), wx.ART_MENU)
        pre_btn = eclib.PlateButton(self,
                                    ID_SEARCH_PRE,
                                    _("Previous"),
                                    t_bmp,
                                    style=eclib.PB_STYLE_NOBG,
                                    name="PreBtn")
        self.AddControl(pre_btn, wx.ALIGN_LEFT)

        t_bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_FIND), wx.ART_MENU)
        fa_btn = eclib.PlateButton(self,
                                   ID_FIND_ALL,
                                   _("Find All"),
                                   t_bmp,
                                   style=eclib.PB_STYLE_NOBG,
                                   name="FindAllBtn")
        self.AddControl(fa_btn)
        fa_btn.Show(False)  # Hide this button by default

        match_case = wx.CheckBox(self,
                                 ID_MATCH_CASE,
                                 _("Match Case"),
                                 name="MatchCase")
        match_case.SetValue(self.ctrl.IsMatchCase())
        self.AddControl(match_case, wx.ALIGN_LEFT)
        match_case.Show(False)  # Hide by default

        ww_cb = wx.CheckBox(self,
                            ID_WHOLE_WORD,
                            _("Whole Word"),
                            name="WholeWord")
        ww_cb.SetValue(self.ctrl.IsWholeWord())
        self.AddControl(ww_cb, wx.ALIGN_LEFT)

        regex_cb = wx.CheckBox(self,
                               ID_REGEX,
                               _("Regular Expression"),
                               name="RegEx")
        regex_cb.SetValue(self.ctrl.IsRegEx())
        self.AddControl(regex_cb, wx.ALIGN_LEFT)

        # HACK: workaround bug in mac control that resets size to
        #       that of the default variant after any text has been
        #       typed in it. Note it reports the best size as the default
        #       variant and causes layout issues. wxBUG
        if wx.Platform == '__WXMAC__':
            self.ctrl.SetSizeHints(180, 16, 180, 16)

        # Event Handlers
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_CHECKBOX, self.OnCheck)
        ed_msg.Subscribe(self.OnThemeChange, ed_msg.EDMSG_THEME_CHANGED)
        self._sctrl.RegisterClient(self)

        # Set user customizable layout
        state = Profile_Get('CTRLBAR', default=dict())
        cfg = state.get(self.GetConfigKey(), dict())
        self.SetControlStates(cfg)
Ejemplo n.º 21
0
    def __LayoutPanel(self, panel, label, exstyle=False):
        """Puts a set of controls in the panel
        @param panel: panel to layout
        @param label: panels title
        @keyword exstyle: Set the PB_STYLE_NOBG or not

        """
        # Bitmaps (32x32) and (16x16)
        devil = Devil.GetBitmap()  # 32x32
        monkey = Monkey.GetBitmap()  # 32x32
        address = Address.GetBitmap()  # 16x16
        folder = Home.GetBitmap()
        bookmark = Book.GetBitmap()  # 16x16

        vsizer = wx.BoxSizer(wx.VERTICAL)
        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer1.Add((15, 15))
        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer2.Add((15, 15))
        hsizer3 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer3.Add((15, 15))
        hsizer4 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer4.Add((15, 15))

        # Button Styles
        default = eclib.PB_STYLE_DEFAULT
        toggle = default | eclib.PB_STYLE_TOGGLE
        square = eclib.PB_STYLE_SQUARE
        sqgrad = eclib.PB_STYLE_SQUARE | eclib.PB_STYLE_GRADIENT
        gradient = eclib.PB_STYLE_GRADIENT

        # Create a number of different PlateButtons
        # Each button is created in the below loop by using the data set in this
        # lists tuple
        #        (bmp,   label,                Style,   Variant, Menu, Color, Enable)
        btype = [
            (None, "Normal PlateButton", default, None, None, None, True),
            (devil, "Normal w/Bitmap", default, None, None, None, True),
            (devil, "Disabled", default, None, None, None, False),
            (None, "Normal w/Menu", default, None, True, None, True),
            (folder, "Home Folder", default, None, True, None, True),
            # Row 2
            (None, "Square PlateButton", square, None, None, None, True),
            (address, "Square/Bitmap", square, None, None, None, True),
            (monkey, "Square/Gradient", sqgrad, None, None, None, True),
            (address, "Square/Small", square, wx.WINDOW_VARIANT_SMALL, True,
             None, True),
            (address, "Small Bitmap", default, wx.WINDOW_VARIANT_SMALL, None,
             wx.Colour(33, 33, 33), True),
            # Row 3
            (devil, "Custom Color", default, None, None, wx.RED, True),
            (monkey, "Gradient Highlight", gradient, None, None, None, True),
            (monkey, "Custom Gradient", gradient, None, None,
             wx.Colour(245, 55, 245), True),
            (devil, "", default, None, None, None, True),
            (bookmark, "", default, None, True, None, True),
            (monkey, "", square, None, None, None, True),
            # Row 4 Toggle buttons
            (None, "Toggle PlateButton", toggle, None, None, None, True),
            (devil, "Toggle w/Bitmap", toggle, None, None, None, True),
            (devil, "Toggle Disabled", toggle, None, None, None, False),
            (None, "Toggle w/Menu", toggle, None, True, None, True),
            (folder, "Toggle Home Folder", toggle, None, True, None, True),
        ]

        # Make and layout three rows of buttons in the panel
        for btn in btype:
            if exstyle:
                # With this style flag set the button can appear transparent on
                # on top of a background that is not solid in color, such as the
                # gradient panel in this demo.
                #
                # Note: This flag only has affect on wxMSW and should only be
                #       set when the background is not a solid color. On wxMac
                #       it is a no-op as this type of transparency is achieved
                #       without any help needed. On wxGtk it doesn't hurt to
                #       set but also unfortunatly doesn't help at all.
                bstyle = btn[2] | eclib.PB_STYLE_NOBG
            else:
                bstyle = btn[2]

            if btype.index(btn) < 5:
                tsizer = hsizer1
            elif btype.index(btn) < 10:
                tsizer = hsizer2
            elif btype.index(btn) < 16:
                tsizer = hsizer3
            else:
                tsizer = hsizer4

            tbtn = eclib.PlateButton(panel,
                                     wx.ID_ANY,
                                     btn[1],
                                     btn[0],
                                     style=bstyle)

            # Set a custom window size variant?
            if btn[3] is not None:
                tbtn.SetWindowVariant(btn[3])

            # Make a menu for the button?
            if btn[4] is not None:
                menu = wx.Menu()
                if btn[0] is not None and btn[0] == folder:
                    for fname in os.listdir(wx.GetHomeDir()):
                        if not fname.startswith('.'):
                            menu.Append(wx.NewId(), fname)
                elif btn[0] is not None and btn[0] == bookmark:
                    for url in [
                            'http://wxpython.org', 'http://slashdot.org',
                            'http://editra.org', 'http://xkcd.com'
                    ]:
                        menu.Append(wx.NewId(), url,
                                    "Open %s in your browser" % url)
                else:
                    menu.Append(wx.NewId(), "Menu Item 1")
                    menu.Append(wx.NewId(), "Menu Item 2")
                    menu.Append(wx.NewId(), "Menu Item 3")
                tbtn.SetMenu(menu)

            # Set a custom colour?
            if btn[5] is not None:
                tbtn.SetPressColor(btn[5])

            # Enable/Disable button state
            tbtn.Enable(btn[6])

            tsizer.AddMany([(tbtn, 0, wx.ALIGN_CENTER), ((10, 10))])

        txt_sz = wx.BoxSizer(wx.HORIZONTAL)
        txt_sz.AddMany([((5, 5)),
                        (wx.StaticText(panel, label=label), 0, wx.ALIGN_LEFT)])
        vsizer.AddMany([((10, 10)), (txt_sz, 0, wx.ALIGN_LEFT), ((10, 10)),
                        (hsizer1, 0, wx.EXPAND), ((10, 10)),
                        (hsizer2, 0, wx.EXPAND), ((10, 10)),
                        (hsizer3, 0, wx.EXPAND), ((10, 10)),
                        (hsizer4, 0, wx.EXPAND), ((10, 10))])
        panel.SetSizer(vsizer)