Exemplo n.º 1
0
    def __init__(self, parent, id_, data, size=wx.DefaultSize):
        super(ConfigDialog, self).__init__(parent, id_, _("Projects Configuration"), 
                                           size=size, style=wx.DEFAULT_DIALOG_STYLE|wx.CLOSE_BOX)

        # Set title bar icon win/gtk
        util.SetWindowIcon(self)

        # Attributes
        panel = wx.Panel(self, size=(1, 5))
        self._notebook = ConfigNotebook(panel, wx.ID_ANY, data)
        self._data = data

        # Layout
        psizer = wx.BoxSizer(wx.HORIZONTAL)
        psizer.AddMany([((10, 10)), (self._notebook, 1, wx.EXPAND), ((10, 10))])
        pvsizer = wx.BoxSizer(wx.VERTICAL)
        pvsizer.AddMany([((10, 10)), (psizer, 1, wx.EXPAND), ((10, 10))])
        panel.SetSizer(pvsizer)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.EXPAND)

        self.SetSizer(sizer)
        self.SetInitialSize()
        self.CenterOnParent()

        # Event Handlers
        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemplo n.º 2
0
    def __init__(self, parent, title, node, data):
        super(HistoryWindow, self).__init__(parent,
                                            title=title,
                                            style=wx.DEFAULT_DIALOG_STYLE)

        # Set Frame Icon
        if wx.Platform == '__WXMAC__':
            self._accel = wx.AcceleratorTable([(wx.ACCEL_CMD, ord('W'),
                                                wx.ID_CLOSE)])
        else:
            self._accel = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('W'),
                                                wx.ID_CLOSE)])
        self.SetAcceleratorTable(self._accel)
        util.SetWindowIcon(self)

        # Attributes
        statbar = eclib.ProgressStatusBar(self)
        statbar.SetStatusWidths([-1, 125])
        self.SetStatusBar(statbar)
        self._ctrls = HistoryPane(self, node, data)

        # Layout
        self._DoLayout()
        self.SetInitialSize()
        self.SetAutoLayout(True)

        # Event Handlers
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
        self.Bind(wx.EVT_MENU, lambda evt: self.Close(), id=wx.ID_CLOSE)
Exemplo n.º 3
0
    def __init__(self,
                 parent,
                 fid,
                 title,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE):
        """Creates the dialog, does not call Show()"""
        wx.Frame.__init__(self, parent, fid, title, pos, size, style)
        util.SetWindowIcon(self)

        # Attributes
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetStatusBar(pstatbar.ProgressStatusBar(self, style=wx.SB_FLAT))
        self._nb = PluginPages(self)

        # Layout Dialog
        sizer.Add(self._nb, 1, wx.EXPAND)
        self._title = title
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        self.SetMinSize(size)

        # Event Handlers
        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemplo n.º 4
0
    def __init__(self,
                 parent,
                 fid,
                 title,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_DIALOG_STYLE):
        """Creates the dialog, does not call Show()"""
        wx.Frame.__init__(self, parent, fid, title, pos, size, style)
        util.SetWindowIcon(self)

        if wx.Platform == '__WXMAC__' and Profile_Get('METAL', 'bool', False):
            self.SetExtraStyle(wx.FRAME_EX_METAL)

        # Attributes
        self._sizer = wx.BoxSizer(wx.VERTICAL)
        self._sb = DownloadStatusBar(self)
        self.SetStatusBar(self._sb)
        self._nb = PluginPages(self)

        # Layout Dialog
        self._sizer.Add(self._nb, 1, wx.EXPAND)
        self._title = title
        self.SetSizer(self._sizer)
        self.SetAutoLayout(True)

        # Event Handlers
        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemplo n.º 5
0
    def __init__(self, parent, id=wx.ID_ANY, title=u'', size=wx.DefaultSize):
        wx.Frame.__init__(self,
                          parent,
                          title=title,
                          size=size,
                          style=wx.DEFAULT_FRAME_STYLE)
        util.SetWindowIcon(self)

        # Attributes
        bstyle = eclib.SEGBOOK_STYLE_NO_DIVIDERS | eclib.SEGBOOK_STYLE_LABELS
        self._nb = eclib.SegmentBook(self, style=bstyle)
        self._cfg_pg = ConfigPanel(self._nb, style=wx.BORDER_SUNKEN)
        self._dl_pg = DownloadPanel(self._nb)
        self._inst_pg = InstallPanel(self._nb)
        self._imglst = list()

        # Setup
        self._imglst.append(MakeThemeTool(ed_glob.ID_PREF))
        self._imglst.append(MakeThemeTool(ed_glob.ID_WEB))
        self._imglst.append(MakeThemeTool(ed_glob.ID_PACKAGE))
        bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_TOOLBAR, (32, 32))
        self._imglst.append(bmp)
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_TOOLBAR,
                                       (32, 32))
        self._imglst.append(bmp)
        self._nb.SetImageList(self._imglst)
        self._nb.SetUsePyImageList(True)

        self._nb.AddPage(self._cfg_pg, _("Configure"), img_id=IMG_CONFIG)
        self._nb.AddPage(self._dl_pg, _("Download"), img_id=IMG_DOWNLOAD)
        self._nb.AddPage(self._inst_pg, _("Install"), img_id=IMG_INSTALL)

        # Check for plugins with error conditions and if any are found
        # Add the error page.
        pmgr = wx.GetApp().GetPluginManager()
        if len(pmgr.GetIncompatible()):
            self._nb.AddPage(ConfigPanel(self._nb,
                                         style=wx.BORDER_SUNKEN,
                                         mode=MODE_ERROR),
                             _("Errors"),
                             img_id=IMG_ERROR)

        # Layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self._nb, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetStatusBar(eclib.ProgressStatusBar(self, style=wx.SB_FLAT))
        self.SetInitialSize(size)

        # Event Handlers
        self.Bind(eclib.EVT_SB_PAGE_CHANGING, self.OnPageChanging)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemplo n.º 6
0
    def __init__(self, parent, id=wx.ID_ANY, title=u"",
                 pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE, name=u"EdBaseFrame"):
        super(EdBaseFrame, self).__init__(parent, id, title, pos,
                                          size, style, name)

        # Setup
        util.SetWindowIcon(self)

        # Register with App
        wx.GetApp().RegisterWindow(repr(self), self)

        # Event Handlers
        self.Bind(wx.EVT_CLOSE, self.OnClose)
Exemplo n.º 7
0
    def __init__(self, parent, id=wx.ID_ANY, title=u'', size=wx.DefaultSize):
        super(PluginDialog, self).__init__(parent,
                                           title=title,
                                           size=size,
                                           style=wx.DEFAULT_FRAME_STYLE)
        util.SetWindowIcon(self)

        # Attributes
        bstyle = eclib.SEGBOOK_STYLE_NO_DIVIDERS | eclib.SEGBOOK_STYLE_LABELS
        self._nb = eclib.SegmentBook(self, style=bstyle)
        self._cfg_pg = ConfigPanel(self._nb, style=wx.BORDER_SUNKEN)
        self._dl_pg = DownloadPanel(self._nb)
        self._inst_pg = InstallPanel(self._nb)
        self._imglst = list()

        # Setup
        self.__InitImageList()

        self._nb.AddPage(self._cfg_pg, _("Configure"), img_id=IMG_CONFIG)
        self._nb.AddPage(self._dl_pg, _("Download"), img_id=IMG_DOWNLOAD)
        self._nb.AddPage(self._inst_pg, _("Install"), img_id=IMG_INSTALL)

        # Check for plugins with error conditions and if any are found
        # Add the error page.
        pmgr = wx.GetApp().GetPluginManager()
        if len(pmgr.GetIncompatible()):
            self._nb.AddPage(ConfigPanel(self._nb,
                                         style=wx.NO_BORDER,
                                         mode=MODE_ERROR),
                             _("Errors"),
                             img_id=IMG_ERROR)

        # Layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self._nb, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetStatusBar(eclib.ProgressStatusBar(self, style=wx.SB_FLAT))
        self.SetInitialSize(size)

        # Event Handlers
        self.Bind(eclib.EVT_SB_PAGE_CHANGING, self.OnPageChanging)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self)

        # Message Handlers
        ed_msg.Subscribe(self.OnThemeChange, ed_msg.EDMSG_THEME_CHANGED)
Exemplo n.º 8
0
    def __init__(self, parent, ftype=0):
        """Create the ConfigDialog
        @param parent: The parent window
        @keyword: The filetype to set

        """
        wx.Frame.__init__(self, parent, title=_("Launch Configuration"))

        # Layout
        util.SetWindowIcon(self)
        self.__DoLayout()

        # Event Handlers
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Register with app
        wx.GetApp().RegisterWindow(repr(self), self)
Exemplo n.º 9
0
    def __init__(self, parent, id_, wsize, title):
        """Initialiaze the Frame and Event Handlers.
        @param wsize: Windows initial size
        @param title: Windows Title

        """
        wx.Frame.__init__(self, parent, id_, title, size=wsize,
                          style=wx.DEFAULT_FRAME_STYLE)

        self._mgr = wx.aui.AuiManager(flags=wx.aui.AUI_MGR_DEFAULT | \
                                      wx.aui.AUI_MGR_TRANSPARENT_DRAG | \
                                      wx.aui.AUI_MGR_TRANSPARENT_HINT)
        self._mgr.SetManagedWindow(self)
        viewmgr.PerspectiveManager.__init__(self, self._mgr, \
                                            CONFIG['CACHE_DIR'])

        # Setup app icon and title
        self.SetTitle()
        util.SetWindowIcon(self)

        # Attributes
        self.LOG = wx.GetApp().GetLog()
        self._exiting = False
        self._handlers = dict(menu=list(), ui=list())

        #---- Sizers to hold subapplets ----#
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        #---- Setup File History ----#
        self.filehistory = wx.FileHistory(_PGET('FHIST_LVL', 'int', 5))

        #---- Status bar on bottom of window ----#
        self.SetStatusBar(ed_statbar.EdStatBar(self))

        #---- End Statusbar Setup ----#

        #---- Notebook that contains the editting buffers ----#
        edit_pane = wx.Panel(self)
        self.nb = ed_pages.EdPages(edit_pane, wx.ID_ANY)
        edit_pane.nb = self.nb
        self.sizer.Add(self.nb, 1, wx.EXPAND)
        edit_pane.SetSizer(self.sizer)
        self._mgr.AddPane(edit_pane, wx.aui.AuiPaneInfo(). \
                          Name("EditPane").Center().Layer(1).Dockable(False). \
                          CloseButton(False).MaximizeButton(False). \
                          CaptionVisible(False))

        #---- Command Bar ----#
        self._cmdbar = ed_cmdbar.CommandBar(edit_pane, ID_COMMAND_BAR)
        self._cmdbar.Hide()

        #---- Setup Toolbar ----#
        self.SetToolBar(ed_toolbar.EdToolBar(self))
        self.GetToolBar().Show(_PGET('TOOLBAR'))
        #---- End Toolbar Setup ----#

        #---- Menus ----#
        menbar = ed_menu.EdMenuBar()

        # Todo this should not be hard coded
        menbar.GetMenuByName("view").InsertMenu(5, ID_PERSPECTIVES,
                             _("Perspectives"), self.GetPerspectiveControls())

        ## Setup additional menu items
        self.filehistory.UseMenu(menbar.GetMenuByName("filehistory"))
        menbar.GetMenuByName("settings").AppendMenu(ID_LEXER, _("Lexers"),
                                                    syntax.GenLexerMenu(),
                                              _("Manually Set a Lexer/Syntax"))

        # On mac, do this to make help menu appear in correct location
        # Note it must be done before setting the menu bar and after the
        # menus have been created.
        if wx.Platform == '__WXMAC__':
            wx.GetApp().SetMacHelpMenuTitleName(_("&Help"))

        #---- Menu Bar ----#
        self.SetMenuBar(menbar)

        #---- Actions to take on menu events ----#

        # Collect Menu Event handler pairs
        self._handlers['menu'].extend([# File Menu
                                       (ID_NEW, self.OnNew),
                                       (ID_OPEN, self.OnOpen),
                                       (ID_CLOSE, self.OnClosePage),
                                       (ID_CLOSEALL, self.OnClosePage),
                                       (ID_SAVE, self.OnSave),
                                       (ID_SAVEAS, self.OnSaveAs),
                                       (ID_SAVEALL, self.OnSave),
                                       (ID_SAVE_PROFILE, self.OnSaveProfile),
                                       (ID_LOAD_PROFILE, self.OnLoadProfile),
                                       (ID_EXIT, wx.GetApp().OnExit),
                                       (ID_PRINT, self.OnPrint),
                                       (ID_PRINT_PRE, self.OnPrint),
                                       (ID_PRINT_SU, self.OnPrint),

                                       # Edit Menu
                                       (ID_FIND,
                                        self.nb.FindService.OnShowFindDlg),
                                       (ID_FIND_REPLACE,
                                        self.nb.FindService.OnShowFindDlg),
                                       (ID_QUICK_FIND, self.OnCommandBar),
                                       (ID_PREF, OnPreferences),

                                       # View Menu
                                       (ID_GOTO_LINE, self.OnCommandBar),
                                       (ID_GOTO_MBRACE, self.DispatchToControl),
                                       (ID_VIEW_TOOL, self.OnViewTb),

                                       # Format Menu
                                       (ID_FONT, self.OnFont),

                                       # Tool Menu
                                       (ID_COMMAND, self.OnCommandBar),
                                       (ID_STYLE_EDIT, self.OnStyleEdit),
                                       (ID_PLUGMGR, self.OnPluginMgr),

                                       # Help Menu
                                       (ID_ABOUT, OnAbout),
                                       (ID_HOMEPAGE, self.OnHelp),
                                       (ID_DOCUMENTATION, self.OnHelp),
                                       (ID_TRANSLATE, self.OnHelp),
                                       (ID_CONTACT, self.OnHelp)])

        self._handlers['menu'].extend([(l_id, self.DispatchToControl)
                                       for l_id in syntax.SyntaxIds()])

        # Extra menu handlers (need to work these into above system yet)
        self.Bind(wx.EVT_MENU, self.DispatchToControl)
        self.Bind(wx.EVT_MENU, self.OnGenerate)
        self.Bind(wx.EVT_MENU_RANGE, self.OnFileHistory,
                  id=wx.ID_FILE1, id2=wx.ID_FILE9)

        # Update UI Handlers
        self._handlers['ui'].extend([# Edit Menu
                                     (ID_COPY, self.OnUpdateClipboardUI),
                                     (ID_CUT, self.OnUpdateClipboardUI),
                                     (ID_PASTE, self.OnUpdateClipboardUI),
                                     (ID_UNDO, self.OnUpdateClipboardUI),
                                     (ID_REDO, self.OnUpdateClipboardUI),
                                     # Format Menu
                                     (ID_INDENT, self.OnUpdateFormatUI),
                                     (ID_USE_SOFTTABS, self.OnUpdateFormatUI),
                                     (ID_TO_UPPER, self.OnUpdateFormatUI),
                                     (ID_TO_LOWER, self.OnUpdateFormatUI),
                                     (ID_WORD_WRAP, self.OnUpdateFormatUI),
                                     (ID_EOL_MAC, self.OnUpdateFormatUI),
                                     (ID_EOL_WIN, self.OnUpdateFormatUI),
                                     (ID_EOL_UNIX, self.OnUpdateFormatUI),
                                     # Settings Menu
                                     (ID_AUTOCOMP, self.OnUpdateSettingsUI),
                                     (ID_AUTOINDENT, self.OnUpdateSettingsUI),
                                     (ID_SYNTAX, self.OnUpdateSettingsUI),
                                     (ID_FOLDING, self.OnUpdateSettingsUI),
                                     (ID_BRACKETHL, self.OnUpdateSettingsUI),
                                     # View Menu
                                     (ID_ZOOM_NORMAL, self.OnUpdateViewUI),
                                     (ID_ZOOM_IN, self.OnUpdateViewUI),
                                     (ID_ZOOM_OUT, self.OnUpdateViewUI),
                                     (ID_GOTO_MBRACE, self.OnUpdateViewUI),
                                     (ID_HLCARET_LINE, self.OnUpdateViewUI),
                                     (ID_VIEW_TOOL, self.OnUpdateViewUI),
                                     (ID_SHOW_WS, self.OnUpdateViewUI),
                                     (ID_SHOW_EDGE, self.OnUpdateViewUI),
                                     (ID_SHOW_EOL, self.OnUpdateViewUI),
                                     (ID_SHOW_LN, self.OnUpdateViewUI),
                                     (ID_INDENT_GUIDES, self.OnUpdateViewUI)
                                    ])

        # Lexer Menu
        self._handlers['ui'].extend([(l_id, self.OnUpdateLexerUI)
                                     for l_id in syntax.SyntaxIds()])

        # Perspectives
        self._handlers['ui'].extend(self.GetPersectiveHandlers())

        #---- End Menu Setup ----#

        #---- Other Event Handlers ----#
        # Frame
        self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(ed_event.EVT_STATUS, self.OnStatus)

        # Find Dialog
        self.Bind(wx.EVT_FIND, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_NEXT, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_REPLACE, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_REPLACE_ALL, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_CLOSE, self.nb.FindService.OnFindClose)

        #---- End other event actions ----#

        #---- Final Setup Calls ----#
        self.LoadFileHistory(_PGET('FHIST_LVL', fmt='int'))

        # Call add on plugins
        self.LOG("[ed_main][info] Loading MainWindow Plugins")
        plgmgr = wx.GetApp().GetPluginManager()
        addons = MainWindowAddOn(plgmgr)
        addons.Init(self)
        self._handlers['menu'].extend(addons.GetEventHandlers())
        self._handlers['ui'].extend(addons.GetEventHandlers(ui_evt=True))
        self._shelf = iface.Shelf(plgmgr)
        self._shelf.Init(self)
        self._handlers['ui'].extend(self._shelf.GetUiHandlers())
        self.LOG("[ed_main][info] Loading Generator plugins")
        generator.Generator(plgmgr).InstallMenu(menbar.GetMenuByName("tools"))

        # Set Perspective
        self.SetPerspective(_PGET('DEFAULT_VIEW'))
        self._mgr.Update()
Exemplo n.º 10
0
    def __init__(self,
                 parent,
                 id_,
                 title,
                 style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX):
        """Creates a standalone window that is used for downloading
        updates for the editor.
        @param parent: Parent Window of the dialog
        @param title: Title of dialog

        """
        wx.Frame.__init__(self, parent, id_, title, style=style)
        util.SetWindowIcon(self)

        #---- Attributes/Objects ----#
        self.LOG = wx.GetApp().GetLog()
        panel = wx.Panel(self)
        self._progress = UpdateProgress(panel, self.ID_PROGRESS_BAR)
        fname = self._progress.GetCurrFileName()
        floc = self._progress.GetDownloadLocation()
        dl_file = wx.StaticText(panel, label=_("Downloading: %s") % fname)
        dl_loc = wx.StaticText(panel, wx.ID_ANY,
                               _("Downloading To: %s") % floc)
        self._cancel_bt = wx.Button(panel, wx.ID_CANCEL, _("Cancel"))
        self._timer = wx.Timer(self, id=self.ID_TIMER)
        self._proghist = list()

        #---- Layout ----#
        self.CreateStatusBar(2)
        self._sizer = wx.GridBagSizer()
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_WEB), wx.ART_TOOLBAR)
        mdc = wx.MemoryDC(bmp)
        tmp_bmp = wx.Image(ed_glob.CONFIG['SYSPIX_DIR'] + u"editra.png",
                           wx.BITMAP_TYPE_PNG)
        tmp_bmp.Rescale(20, 20, wx.IMAGE_QUALITY_HIGH)
        mdc.DrawBitmap(tmp_bmp.ConvertToBitmap(), 11, 11)
        mdc.SelectObject(wx.NullBitmap)
        bmp = wx.StaticBitmap(panel, wx.ID_ANY, bmp)
        self._sizer.AddMany([(bmp, (1, 1), (3, 2)), (dl_file, (1, 4), (1, 4)),
                             (dl_loc, (2, 4), (1, 4)),
                             ((15, 15), (3, 5), (1, 1))])
        self._sizer.Add(self._progress, (4, 1), (1, 10), wx.EXPAND)

        bsizer = wx.BoxSizer(wx.HORIZONTAL)
        bsizer.AddStretchSpacer()
        bsizer.Add(self._cancel_bt, 0, wx.ALIGN_CENTER_HORIZONTAL)
        bsizer.AddStretchSpacer()

        self._sizer.Add(bsizer, (6, 1), (1, 10), wx.EXPAND)
        self._sizer.Add((5, 5), (7, 1))
        self._sizer.Add((5, 5), (7, 11))
        panel.SetSizer(self._sizer)
        mwsz = wx.BoxSizer(wx.HORIZONTAL)
        mwsz.Add(panel, 1, wx.EXPAND)
        self.SetSizer(mwsz)
        self.SetInitialSize()

        self.SetStatusWidths([-1, 100])
        self.SetStatusText(_("Downloading") + u"...", self.SB_INFO)

        #---- Bind Events ----#
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_TIMER, self.OnUpdate, id=self.ID_TIMER)
Exemplo n.º 11
0
    def __init__(self, parent, id_, wsize, title):
        """Initialiaze the Frame and Event Handlers.
        @param wsize: Windows initial size
        @param title: Windows Title

        """
        wx.Frame.__init__(self,
                          parent,
                          id_,
                          title,
                          size=wsize,
                          style=wx.DEFAULT_FRAME_STYLE)

        self._mgr = wx.aui.AuiManager(flags=wx.aui.AUI_MGR_DEFAULT | \
                                      wx.aui.AUI_MGR_TRANSPARENT_DRAG | \
                                      wx.aui.AUI_MGR_TRANSPARENT_HINT)
        self._mgr.SetManagedWindow(self)
        viewmgr.PerspectiveManager.__init__(self, self._mgr, \
                                            CONFIG['CACHE_DIR'])

        # Setup app icon and title
        self.SetTitle()
        util.SetWindowIcon(self)

        # Check if user wants Metal Style under OS X
        # NOTE: soon to be deprecated
        if wx.Platform == '__WXMAC__' and _PGET('METAL'):
            self.SetExtraStyle(wx.FRAME_EX_METAL)

        # Attributes
        self.LOG = wx.GetApp().GetLog()
        self._handlers = dict(menu=list(), ui=list())

        #---- Sizers to hold subapplets ----#
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        #---- Setup File History ----#
        self.filehistory = wx.FileHistory(_PGET('FHIST_LVL', 'int', 5))

        #---- Status bar on bottom of window ----#
        self.CreateStatusBar(3, style=wx.ST_SIZEGRIP)
        self.SetStatusWidths([-1, 120, 155])
        #---- End Statusbar Setup ----#

        #---- Notebook that contains the editting buffers ----#
        edit_pane = wx.Panel(self)
        self.nb = ed_pages.EdPages(edit_pane, wx.ID_ANY)
        edit_pane.nb = self.nb
        self.sizer.Add(self.nb, 1, wx.EXPAND)
        edit_pane.SetSizer(self.sizer)
        self._mgr.AddPane(edit_pane, wx.aui.AuiPaneInfo(). \
                          Name("EditPane").Center().Layer(1).Dockable(False). \
                          CloseButton(False).MaximizeButton(False). \
                          CaptionVisible(False))

        #---- Command Bar ----#
        self._cmdbar = ed_cmdbar.CommandBar(edit_pane, ID_COMMAND_BAR)
        self._cmdbar.Hide()

        #---- Setup Toolbar ----#
        self.SetToolBar(ed_toolbar.EdToolBar(self))
        if not _PGET('TOOLBAR'):
            self.GetToolBar().Hide()
        #---- End Toolbar Setup ----#

        #---- Menus ----#
        menbar = ed_menu.EdMenuBar()
        self._menus = dict(file=menbar.GetMenuByName("file"),
                           edit=menbar.GetMenuByName("edit"),
                           view=menbar.GetMenuByName("view"),
                           viewedit=menbar.GetMenuByName("viewedit"),
                           format=menbar.GetMenuByName("format"),
                           settings=menbar.GetMenuByName("settings"),
                           tools=menbar.GetMenuByName("tools"),
                           lineformat=menbar.GetMenuByName("lineformat"),
                           language=syntax.GenLexerMenu())

        # Todo this should not be hard coded
        self._menus['view'].InsertMenu(5, ID_PERSPECTIVES, _("Perspectives"),
                                       self.GetPerspectiveControls())

        ## Setup additional menu items
        self.filehistory.UseMenu(menbar.GetMenuByName("filehistory"))
        self._menus['settings'].AppendMenu(ID_LEXER, _("Lexers"),
                                           self._menus['language'],
                                           _("Manually Set a Lexer/Syntax"))

        # On mac, do this to make help menu appear in correct location
        # Note it must be done before setting the menu bar and after the
        # menus have been created.
        if wx.Platform == '__WXMAC__':
            wx.GetApp().SetMacHelpMenuTitleName(_("Help"))

        #---- Menu Bar ----#
        self.SetMenuBar(menbar)

        #---- Actions to take on menu events ----#
        self.Bind(wx.EVT_MENU_OPEN, self.UpdateMenu)
        if wx.Platform == '__WXGTK__':
            self.Bind(wx.EVT_MENU_HIGHLIGHT, \
                      self.OnMenuHighlight, id=ID_LEXER)
            self.Bind(wx.EVT_MENU_HIGHLIGHT, \
                      self.OnMenuHighlight, id=ID_EOL_MODE)

        # Collect Menu Event handler pairs
        self._handlers['menu'].extend([  # File Menu
            (ID_NEW, self.OnNew),
            (ID_OPEN, self.OnOpen),
            (ID_CLOSE, self.OnClosePage),
            (ID_CLOSE_WINDOW, self.OnClose),
            (ID_CLOSEALL, self.OnClosePage),
            (ID_SAVE, self.OnSave),
            (ID_SAVEAS, self.OnSaveAs),
            (ID_SAVEALL, self.OnSave),
            (ID_SAVE_PROFILE, self.OnSaveProfile),
            (ID_LOAD_PROFILE, self.OnLoadProfile),
            (ID_EXIT, wx.GetApp().OnExit),
            (ID_PRINT, self.OnPrint),
            (ID_PRINT_PRE, self.OnPrint),
            (ID_PRINT_SU, self.OnPrint),

            # Edit Menu
            (ID_FIND, self.nb.FindService.OnShowFindDlg),
            (ID_FIND_REPLACE, self.nb.FindService.OnShowFindDlg),
            (ID_QUICK_FIND, self.OnCommandBar),
            (ID_PREF, self.OnPreferences),

            # View Menu
            (ID_GOTO_LINE, self.OnCommandBar),
            (ID_VIEW_TOOL, self.OnViewTb),

            # Format Menu
            (ID_FONT, self.OnFont),

            # Tool Menu
            (ID_COMMAND, self.OnCommandBar),
            (ID_STYLE_EDIT, self.OnStyleEdit),
            (ID_PLUGMGR, self.OnPluginMgr),

            # Help Menu
            (ID_ABOUT, self.OnAbout),
            (ID_HOMEPAGE, self.OnHelp),
            (ID_DOCUMENTATION, self.OnHelp),
            (ID_CONTACT, self.OnHelp)
        ])

        self._handlers['menu'].extend([(l_id, self.DispatchToControl)
                                       for l_id in syntax.SyntaxIds()])

        # Extra menu handlers (need to work these into above system yet
        self.Bind(wx.EVT_MENU, self.DispatchToControl)
        self.Bind(wx.EVT_MENU, self.OnGenerate)
        self.Bind(wx.EVT_MENU_RANGE,
                  self.OnFileHistory,
                  id=wx.ID_FILE1,
                  id2=wx.ID_FILE9)

        #---- End Menu Setup ----#

        #---- Other Event Handlers ----#
        # Frame
        self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(ed_event.EVT_STATUS, self.OnStatus)

        # Find Dialog
        self.Bind(wx.EVT_FIND, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_NEXT, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_REPLACE, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_REPLACE_ALL, self.nb.FindService.OnFind)
        self.Bind(wx.EVT_FIND_CLOSE, self.nb.FindService.OnFindClose)

        #---- End other event actions ----#

        #---- Final Setup Calls ----#
        self._exiting = False
        self.LoadFileHistory(_PGET('FHIST_LVL', fmt='int'))
        self.UpdateToolBar()

        # Call add on plugins
        self.LOG("[main][info] Loading MainWindow Plugins ")
        plgmgr = wx.GetApp().GetPluginManager()
        addons = MainWindowAddOn(plgmgr)
        addons.Init(self)
        self._handlers['menu'].extend(addons.GetEventHandlers())
        self._handlers['ui'].extend(addons.GetEventHandlers(ui_evt=True))
        self._shelf = iface.Shelf(plgmgr)
        self._shelf.Init(self)
        self.LOG("[main][info] Loading Generator plugins")
        generator.Generator(plgmgr).InstallMenu(self._menus['tools'])

        # Set Perspective
        self.SetPerspective(_PGET('DEFAULT_VIEW'))
        self._mgr.Update()