Exemplo n.º 1
0
    def create_menu(self):
        """Creates the program menu."""
        menu = wx.MenuBar()
        menu_file = wx.Menu()
        menu.Insert(0, menu_file, "&File")
        menu_recent = self.menu_recent = wx.Menu()
        menu_file.AppendMenu(id=wx.NewId(), text="&Recent files",
            submenu=menu_recent, help="Recently opened files.")
        menu_file.AppendSeparator()
        menu_console = self.menu_console = menu_file.Append(
            id=wx.NewId(), kind=wx.ITEM_CHECK, text="Show &console\tCtrl-E",
            help="Show/hide a Python shell environment window")
        menu_inspect = self.menu_inspect = menu_file.Append(
            id=wx.NewId(), kind=wx.ITEM_CHECK, text="Show &widget inspector",
            help="Show/hide the widget inspector")

        self.file_history = wx.FileHistory(conf.MaxRecentFiles)
        self.file_history.UseMenu(menu_recent)
        for f in conf.RecentFiles[::-1]: # Backwards - FileHistory is a stack
            os.path.exists(f) and self.file_history.AddFileToHistory(f)
        wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.on_recent_file)
        menu_file.AppendSeparator()
        m_exit = menu_file.Append(-1, "E&xit\tAlt-X", "Exit")

        self.Bind(wx.EVT_MENU, self.on_showhide_console, menu_console)
        self.Bind(wx.EVT_MENU, self.on_open_widget_inspector, menu_inspect)
        self.Bind(wx.EVT_MENU, self.on_exit, m_exit)
        self.SetMenuBar(menu)
Exemplo n.º 2
0
    def create_menu(self):
        """Creates the program menu."""
        menu = wx.MenuBar()

        menu_file = wx.Menu()
        menu.Insert(0, menu_file, "&File")
        menu_recent = self.menu_recent = wx.Menu()
        menu_file.AppendMenu(id=wx.NewId(),
                             text="&Recent files",
                             submenu=menu_recent,
                             help="Recently opened files.")
        menu_file.AppendSeparator()
        menu_console = self.menu_console = menu_file.Append(
            id=wx.NewId(),
            text="Show &console\tCtrl-W",
            help="Shows/hides the console window.")
        self.Bind(wx.EVT_MENU, self.on_showhide_console, menu_console)
        menu_inspect = self.menu_inspect = menu_file.Append(
            id=wx.NewId(),
            text="Show &widget inspector",
            help="Shows/hides the widget inspector.")
        self.Bind(wx.EVT_MENU, self.on_open_widget_inspector, menu_inspect)

        self.file_history = wx.FileHistory(conf.MaxRecentFiles)
        self.file_history.UseMenu(menu_recent)
        for filename in conf.RecentFiles[::-1]:
            # Iterate backwards, as FileHistory works like a stack
            if os.path.exists(filename):
                self.file_history.AddFileToHistory(filename)
        wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.on_recent_file)
        menu_file.AppendSeparator()
        m_exit = menu_file.Append(-1, "E&xit\tAlt-X", "Exit")
        self.Bind(wx.EVT_MENU, self.on_exit, m_exit)
        self.SetMenuBar(menu)
Exemplo n.º 3
0
    def on_initialize(self, event):
        self.dir = None
        self.documentPath = None
        self.documentChanged = 0
        
        # there should probably be a menu item to 
        # raise and lower the font size
        if wx.Platform in ('__WXMAC__', '__WXGTK__'):
            font = self.components.listResults.font
            if wx.Platform == '__WXMAC__':
                font.size = 10
            elif wx.Platform == '__WXGTK__':
                font.size = 12
            self.components.listResults.font = font

        # KEA 2002-06-27
        # copied from codeEditor.py
        # wxFileHistory isn't wrapped, so use raw wxPython
        # also the file list gets appended to the File menu
        # rather than going in front of the Exit menu
        # I suspect I have to add the Exit menu after the file history
        # which means changing how the menus in resources are loaded
        # so I'll do that later
        self.fileHistory = wx.FileHistory()
        fileMenu = self.GetMenuBar().GetMenu(0)
        self.fileHistory.UseMenu(fileMenu)
        wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.OnFileHistory)

        self.sizerLayout()

        self.configPath = os.path.join(configuration.homedir, 'findfiles')
        self.loadConfig()

        path = os.path.join(self.configPath, LASTGREPFILE)
        self.loadGrepFile(path)
Exemplo n.º 4
0
    def MakeMenu(self):
        """Make a menu that can be popped up later"""
        menu = wx.Menu()
        keys = self.menuColours.keys()
        keys.sort()
        for k in keys:
            text = self.menuColours[k]
            menu.Append(k, text, kind=wx.ITEM_CHECK)
        wx.EVT_MENU_RANGE(self, 100, 200, self.OnMenuSetColour)
        wx.EVT_UPDATE_UI_RANGE(self, 100, 200, self.OnCheckMenuColours)
        menu.Break()

        for x in range(1, self.maxThickness+1):
            menu.Append(x, str(x), kind=wx.ITEM_CHECK)
        wx.EVT_MENU_RANGE(self, 1, self.maxThickness, self.OnMenuSetThickness)
        wx.EVT_UPDATE_UI_RANGE(self, 1, self.maxThickness, self.OnCheckMenuThickness)
        self.menu = menu
Exemplo n.º 5
0
    def __init__(self):
        wx.Menu.__init__(self)
        self.Append(DIVISION_MENU_SPLIT_HORIZONTALLY, "Split horizontally")
        self.Append(DIVISION_MENU_SPLIT_VERTICALLY, "Split vertically")
        self.AppendSeparator()
        self.Append(DIVISION_MENU_EDIT_LEFT_EDGE, "Edit left edge")
        self.Append(DIVISION_MENU_EDIT_TOP_EDGE, "Edit top edge")

        wx.EVT_MENU_RANGE(self, DIVISION_MENU_SPLIT_HORIZONTALLY,
                          DIVISION_MENU_EDIT_BOTTOM_EDGE, self.OnMenu)
Exemplo n.º 6
0
 def __init__(self,
              docManager,
              frame,
              id,
              title,
              pos=wx.DefaultPosition,
              size=wx.DefaultSize,
              style=wx.DEFAULT_FRAME_STYLE,
              name="DocTabbedParentFrame",
              embeddedWindows=0,
              minSize=20):
     wx.lib.pydocview.DocTabbedParentFrame.__init__(self, docManager, frame,
                                                    id, title, pos, size,
                                                    style, name,
                                                    embeddedWindows,
                                                    minSize)
     wx.EVT_MENU_RANGE(self, consts.ID_MRU_FILE1, consts.ID_MRU_FILE20,
                       self.OnMRUFile)
     self.RegisterMsg()
    def Install(self, frame, tree, panel, toolFrame, testWin):
        '''Set event handlers.'''
        self.frame = frame
        self.tree = tree
        self.panel = panel
        self.toolFrame = toolFrame
        self.testWin = testWin
        self.lastSearch = None

        self.dataElem = wx.CustomDataObject('XRCED_elem')
        self.dataNode = wx.CustomDataObject('XRCED_node')

        # Some local members
        self.inUpdateUI = self.inIdle = False
        self.clipboardHasData = False

        # Component events
        wx.EVT_MENU_RANGE(frame, Manager.firstId, Manager.lastId,
                          self.OnComponentCreate)
        wx.EVT_MENU_RANGE(frame, Manager.firstId + ID.SHIFT,
                          Manager.lastId + ID.SHIFT, self.OnComponentReplace)

        wx.EVT_MENU(frame, ID.REF, self.OnReference)
        wx.EVT_MENU(frame, ID.COMMENT, self.OnComment)

        # Other events
        frame.Bind(wx.EVT_IDLE, self.OnIdle)
        frame.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
        #        frame.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        #        wx.EVT_KEY_UP(frame, tools.OnKeyUp)
        #        wx.EVT_ICONIZE(frame, self.OnIconize)

        frame.Bind(wx.EVT_ACTIVATE, self.OnFrameActivate)
        if toolFrame:
            toolFrame.Bind(wx.EVT_ACTIVATE, self.OnFrameActivate)
        if frame.miniFrame:
            frame.miniFrame.Bind(wx.EVT_ACTIVATE, self.OnFrameActivate)

        # Menubar events
        # File
        frame.Bind(wx.EVT_MENU,
                   self.OnRecentFile,
                   id=wx.ID_FILE1,
                   id2=wx.ID_FILE9)
        wx.EVT_MENU(frame, wx.ID_NEW, self.OnNew)
        wx.EVT_MENU(frame, wx.ID_OPEN, self.OnOpen)
        wx.EVT_MENU(frame, wx.ID_SAVE, self.OnSaveOrSaveAs)
        wx.EVT_MENU(frame, wx.ID_SAVEAS, self.OnSaveOrSaveAs)
        wx.EVT_MENU(frame, frame.ID_GENERATE_PYTHON, self.OnGeneratePython)
        wx.EVT_MENU(frame, wx.ID_PREFERENCES, self.OnPrefs)
        wx.EVT_MENU(frame, wx.ID_EXIT, self.OnExit)
        if frame.miniFrame:
            wx.EVT_MENU(frame.miniFrame, wx.ID_EXIT, self.OnExit)

        # Edit
        wx.EVT_MENU(frame, wx.ID_UNDO, self.OnUndo)
        wx.EVT_MENU(frame, wx.ID_REDO, self.OnRedo)
        wx.EVT_MENU(frame, wx.ID_CUT, self.OnCut)
        wx.EVT_MENU(frame, wx.ID_COPY, self.OnCopy)
        wx.EVT_MENU(frame, wx.ID_PASTE, self.OnMenuPaste)
        wx.EVT_MENU(frame, ID.PASTE, self.OnCmdPaste)
        wx.EVT_MENU(frame, ID.PASTE_SIBLING, self.OnPasteSibling)
        wx.EVT_MENU(frame, wx.ID_DELETE, self.OnDelete)
        wx.EVT_MENU(frame, frame.ID_UNSELECT, self.OnUnselect)
        wx.EVT_MENU(frame, frame.ID_TOOL_PASTE, self.OnToolPaste)
        wx.EVT_MENU(frame, wx.ID_FIND, self.OnFind)
        wx.EVT_MENU(frame, frame.ID_FINDAGAIN, self.OnFindAgain)
        wx.EVT_MENU(frame, frame.ID_LOCATE, self.OnLocate)
        wx.EVT_MENU(frame, frame.ID_TOOL_LOCATE, self.OnLocate)
        # View
        wx.EVT_MENU(frame, frame.ID_EMBED_PANEL, self.OnEmbedPanel)
        wx.EVT_MENU(frame, frame.ID_SHOW_TOOLS, self.OnShowTools)
        wx.EVT_MENU(frame, frame.ID_TEST, self.OnTest)
        wx.EVT_MENU(frame, wx.ID_REFRESH, self.OnRefresh)
        wx.EVT_MENU(frame, frame.ID_AUTO_REFRESH, self.OnAutoRefresh)
        wx.EVT_MENU(frame, frame.ID_TEST_HIDE, self.OnTestHide)
        wx.EVT_MENU(frame, frame.ID_SHOW_XML, self.OnShowXML)
        # Move
        wx.EVT_MENU(frame, frame.ID_MOVEUP, self.OnMoveUp)
        wx.EVT_MENU(frame, frame.ID_MOVEDOWN, self.OnMoveDown)
        wx.EVT_MENU(frame, frame.ID_MOVELEFT, self.OnMoveLeft)
        wx.EVT_MENU(frame, frame.ID_MOVERIGHT, self.OnMoveRight)
        # Help
        wx.EVT_MENU(frame, wx.ID_ABOUT, self.OnHelpAbout)
        wx.EVT_MENU(frame, wx.ID_HELP_CONTENTS, self.OnHelpContents)
        wx.EVT_MENU(frame, frame.ID_README, self.OnHelpReadme)
        if get_debug():
            wx.EVT_MENU(frame, frame.ID_DEBUG_CMD, self.OnDebugCMD)

        # Pulldown menu commands
        wx.EVT_MENU(frame, ID.SUBCLASS, self.OnSubclass)
        wx.EVT_MENU(frame, ID.COLLAPSE, self.OnCollapse)
        wx.EVT_MENU(frame, ID.COLLAPSE_ALL, self.OnCollapseAll)
        wx.EVT_MENU(frame, ID.EXPAND, self.OnExpand)

        # Update events
        wx.EVT_UPDATE_UI(frame, wx.ID_SAVE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_CUT, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_COPY, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_PASTE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_DELETE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_LOCATE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_FINDAGAIN, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_TOOL_LOCATE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_TOOL_PASTE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_UNDO, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_REDO, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_TEST, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_MOVEUP, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_MOVEDOWN, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_MOVELEFT, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_MOVERIGHT, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, wx.ID_REFRESH, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, frame.ID_SHOW_XML, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, ID.COLLAPSE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, ID.EXPAND, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(frame, ID.SUBCLASS, self.OnUpdateUI)

        wx.EVT_MENU_HIGHLIGHT_ALL(self.frame, self.OnMenuHighlight)

        # XMLTree events
        tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
        tree.Bind(wx.EVT_RIGHT_DOWN, self.OnTreeRightDown)
        tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnTreeSelChanging)
        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeSelChanged)
        tree.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnTreeItemCollapsed)

        # AttributePanel events
        panel.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPanelPageChanging)
        panel.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPanelPageChanged)
        panel.pinButton.Bind(wx.EVT_BUTTON, self.OnPanelTogglePin)

        # Make important keys work when focus is in the panel frame
        self.accels = wx.AcceleratorTable([
            (wx.ACCEL_NORMAL, wx.WXK_F5, frame.ID_TEST),
            (wx.ACCEL_NORMAL, wx.WXK_F6, frame.ID_TEST_HIDE),
            (wx.ACCEL_CTRL, ord('r'), wx.ID_REFRESH),
        ])
        if frame.miniFrame:
            self.frame.miniFrame.SetAcceleratorTable(self.accels)
            # Propagate all menu commands to the frame
            self.frame.miniFrame.Bind(wx.EVT_MENU,
                                      lambda evt: frame.ProcessEvent(evt))

        # Tool panel events
        toolPanel = g.toolPanel
        toolPanel.tp.Bind(wx.EVT_TOOLBOOK_PAGE_CHANGED,
                          self.OnToolPanelPageChanged)
        wx.EVT_COMMAND_RANGE(toolPanel.tp, Manager.firstId, Manager.lastId,
                             wx.wxEVT_COMMAND_BUTTON_CLICKED,
                             self.OnComponentTool)
        if toolFrame:
            toolFrame.Bind(wx.EVT_CLOSE, self.OnCloseToolFrame)
Exemplo n.º 8
0
 def care_of_menu(self, parent):
     self.artub_frame = parent
     wx.EVT_MENU_RANGE(wx.GetApp(), parent.undoID, parent.pasteID,
                       parent.undo)
     wx.EVT_UPDATE_UI_RANGE(wx.GetApp(), parent.undoID, parent.pasteID,
                            parent.undo_update_ui)
Exemplo n.º 9
0
    def __init__(self, parent=None):
        style = wx.SYSTEM_MENU | wx.CAPTION | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
        if misc.check_wx_version(2, 5):
            style |= wx.CLOSE_BOX
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "wxGlade v%s" % common.version,
                          style=style)
        self.CreateStatusBar(1)

        if parent is None: parent = self
        common.palette = self  # to provide a reference accessible
        # by the various widget classes
        icon = wx.EmptyIcon()
        bmp = wx.Bitmap(os.path.join(common.wxglade_path, "icons/icon.xpm"),
                        wx.BITMAP_TYPE_XPM)
        icon.CopyFromBitmap(bmp)
        self.SetIcon(icon)
        self.SetBackgroundColour(
            wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE))
        menu_bar = wx.MenuBar()
        file_menu = wx.Menu(style=wx.MENU_TEAROFF)
        view_menu = wx.Menu(style=wx.MENU_TEAROFF)
        help_menu = wx.Menu(style=wx.MENU_TEAROFF)
        wx.ToolTip_SetDelay(1000)

        # load the available code generators
        common.load_code_writers()
        # load the available widgets and sizers
        core_btns, custom_btns = common.load_widgets()
        sizer_btns = common.load_sizers()

        append_item = misc.append_item
        self.TREE_ID = TREE_ID = wx.NewId()
        append_item(view_menu, TREE_ID, _("Show &Tree\tF2"))
        self.PROPS_ID = PROPS_ID = wx.NewId()
        self.RAISE_ID = RAISE_ID = wx.NewId()
        append_item(view_menu, PROPS_ID, _("Show &Properties\tF3"))
        append_item(view_menu, RAISE_ID, _("&Raise All\tF4"))
        NEW_ID = wx.NewId()
        append_item(file_menu, NEW_ID, _("&New\tCtrl+N"), wx.ART_NEW)
        NEW_FROM_TEMPLATE_ID = wx.NewId()
        append_item(file_menu, NEW_FROM_TEMPLATE_ID,
                    _("New from &Template...\tShift+Ctrl+N"))
        OPEN_ID = wx.NewId()
        append_item(file_menu, OPEN_ID, _("&Open...\tCtrl+O"),
                    wx.ART_FILE_OPEN)
        SAVE_ID = wx.NewId()
        append_item(file_menu, SAVE_ID, _("&Save\tCtrl+S"), wx.ART_FILE_SAVE)
        SAVE_AS_ID = wx.NewId()
        append_item(file_menu, SAVE_AS_ID, _("Save As...\tShift+Ctrl+S"),
                    wx.ART_FILE_SAVE_AS)
        SAVE_TEMPLATE_ID = wx.NewId()
        append_item(file_menu, SAVE_TEMPLATE_ID, _("Save As Template..."))
        file_menu.AppendSeparator()
        RELOAD_ID = wx.ID_REFRESH  #wx.NewId()
        append_item(file_menu, RELOAD_ID, _("&Refresh\tf5"))  #, wx.ART_REDO)
        GENERATE_CODE_ID = wx.NewId()
        append_item(file_menu, GENERATE_CODE_ID, _("&Generate Code\tCtrl+G"),
                    wx.ART_EXECUTABLE_FILE)

        file_menu.AppendSeparator()
        IMPORT_ID = wx.NewId()
        append_item(file_menu, IMPORT_ID, _("&Import from XRC...\tCtrl+I"))

        EXIT_ID = wx.NewId()
        file_menu.AppendSeparator()
        append_item(file_menu, EXIT_ID, _('E&xit\tCtrl+Q'), wx.ART_QUIT)
        PREFS_ID = wx.ID_PREFERENCES  #NewId()
        view_menu.AppendSeparator()
        MANAGE_TEMPLATES_ID = wx.NewId()
        append_item(view_menu, MANAGE_TEMPLATES_ID, _('Templates Manager...'))
        view_menu.AppendSeparator()
        append_item(view_menu, PREFS_ID, _('Preferences...'))
        #wx.ART_HELP_SETTINGS)
        menu_bar.Append(file_menu, _("&File"))
        menu_bar.Append(view_menu, _("&View"))
        TUT_ID = wx.NewId()
        append_item(help_menu, TUT_ID, _('Contents\tF1'), wx.ART_HELP)
        ABOUT_ID = wx.ID_ABOUT  #wx.NewId()
        append_item(help_menu, ABOUT_ID, _('About...'))  #, wx.ART_QUESTION)
        menu_bar.Append(help_menu, _('&Help'))
        parent.SetMenuBar(menu_bar)
        # Mac tweaks...
        if wx.Platform == "__WXMAC__":
            wx.App_SetMacAboutMenuItemId(ABOUT_ID)
            wx.App_SetMacPreferencesMenuItemId(PREFS_ID)
            wx.App_SetMacExitMenuItemId(EXIT_ID)
            wx.App_SetMacHelpMenuTitleName(_('&Help'))

        # file history support
        if misc.check_wx_version(2, 3, 3):
            self.file_history = wx.FileHistory(
                config.preferences.number_history)
            self.file_history.UseMenu(file_menu)
            files = config.load_history()
            files.reverse()
            for path in files:
                self.file_history.AddFileToHistory(path.strip())

            def open_from_history(event):
                if not self.ask_save(): return
                infile = self.file_history.GetHistoryFile(event.GetId() -
                                                          wx.ID_FILE1)
                # ALB 2004-10-15 try to restore possible autosave content...
                if common.check_autosaved(infile) and \
                       wx.MessageBox(_("There seems to be auto saved data for "
                                    "this file: do you want to restore it?"),
                                    _("Auto save detected"),
                                    style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                    common.restore_from_autosaved(infile)
                else:
                    common.remove_autosaved(infile)
                self._open_app(infile)

            wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9,
                              open_from_history)

        wx.EVT_MENU(self, TREE_ID, self.show_tree)
        wx.EVT_MENU(self, PROPS_ID, self.show_props_window)
        wx.EVT_MENU(self, RAISE_ID, self.raise_all)
        wx.EVT_MENU(self, NEW_ID, self.new_app)
        wx.EVT_MENU(self, NEW_FROM_TEMPLATE_ID, self.new_app_from_template)
        wx.EVT_MENU(self, OPEN_ID, self.open_app)
        wx.EVT_MENU(self, SAVE_ID, self.save_app)
        wx.EVT_MENU(self, SAVE_AS_ID, self.save_app_as)
        wx.EVT_MENU(self, SAVE_TEMPLATE_ID, self.save_app_as_template)

        def generate_code(event):
            common.app_tree.app.generate_code()

        wx.EVT_MENU(self, GENERATE_CODE_ID, generate_code)
        wx.EVT_MENU(self, EXIT_ID, lambda e: self.Close())
        wx.EVT_MENU(self, TUT_ID, self.show_tutorial)
        wx.EVT_MENU(self, ABOUT_ID, self.show_about_box)
        wx.EVT_MENU(self, PREFS_ID, self.edit_preferences)
        wx.EVT_MENU(self, MANAGE_TEMPLATES_ID, self.manage_templates)
        wx.EVT_MENU(self, IMPORT_ID, self.import_xrc)
        wx.EVT_MENU(self, RELOAD_ID, self.reload_app)

        PREVIEW_ID = wx.NewId()

        def preview(event):
            if common.app_tree.cur_widget is not None:
                p = misc.get_toplevel_widget(common.app_tree.cur_widget)
                if p is not None:
                    p.preview(None)

        wx.EVT_MENU(self, PREVIEW_ID, preview)

        self.accel_table = wx.AcceleratorTable([
            (wx.ACCEL_CTRL, ord('N'), NEW_ID),
            (wx.ACCEL_CTRL, ord('O'), OPEN_ID),
            (wx.ACCEL_CTRL, ord('S'), SAVE_ID),
            (wx.ACCEL_CTRL | wx.ACCEL_SHIFT, ord('S'), SAVE_AS_ID),
            (wx.ACCEL_CTRL, ord('G'), GENERATE_CODE_ID),
            (wx.ACCEL_CTRL, ord('I'), IMPORT_ID),
            (0, wx.WXK_F1, TUT_ID),
            (wx.ACCEL_CTRL, ord('Q'), EXIT_ID),
            (0, wx.WXK_F5, RELOAD_ID),
            (0, wx.WXK_F2, TREE_ID),
            (0, wx.WXK_F3, PROPS_ID),
            (0, wx.WXK_F4, RAISE_ID),
            (wx.ACCEL_CTRL, ord('P'), PREVIEW_ID),
        ])

        # Tutorial window
        ##         self.tut_frame = None
        # layout
        # if there are custom components, add the toggle box...
        if custom_btns:
            main_sizer = wx.BoxSizer(wx.VERTICAL)
            show_core_custom = ToggleButtonBox(
                self, -1, [_("Core components"),
                           _("Custom components")], 0)

            if misc.check_wx_version(2, 5):
                core_sizer = wx.FlexGridSizer(
                    0, config.preferences.buttons_per_row)
                custom_sizer = wx.FlexGridSizer(
                    0, config.preferences.buttons_per_row)
            else:
                core_sizer = wx.GridSizer(0,
                                          config.preferences.buttons_per_row)
                custom_sizer = wx.GridSizer(0,
                                            config.preferences.buttons_per_row)
            self.SetAutoLayout(True)
            # core components
            for b in core_btns:
                core_sizer.Add(b)
            for sb in sizer_btns:
                core_sizer.Add(sb)
            # custom components
            for b in custom_btns:
                custom_sizer.Add(b)
                if misc.check_wx_version(2, 5):
                    custom_sizer.Show(b, False)
            custom_sizer.Layout()
            main_sizer.Add(show_core_custom, 0, wx.EXPAND)
            main_sizer.Add(core_sizer, 0, wx.EXPAND)
            main_sizer.Add(custom_sizer, 0, wx.EXPAND)
            self.SetSizer(main_sizer)
            if not misc.check_wx_version(2, 5):
                main_sizer.Show(custom_sizer, False)
            #main_sizer.Show(1, False)
            main_sizer.Fit(self)
            # events to display core/custom components
            if misc.check_wx_version(2, 5):

                def on_show_core_custom(event):
                    show_core = True
                    show_custom = False
                    if event.GetValue() == 1:
                        show_core = False
                        show_custom = True
                    for b in custom_btns:
                        custom_sizer.Show(b, show_custom)
                    for b in core_btns:
                        core_sizer.Show(b, show_core)
                    for b in sizer_btns:
                        core_sizer.Show(b, show_core)
                    core_sizer.Layout()
                    custom_sizer.Layout()
                    main_sizer.Layout()
            else:

                def on_show_core_custom(event):
                    to_show = core_sizer
                    to_hide = custom_sizer
                    if event.GetValue() == 1:
                        to_show, to_hide = to_hide, to_show
                    main_sizer.Show(to_show, True)
                    main_sizer.Show(to_hide, False)
                    main_sizer.Layout()

            EVT_TOGGLE_BOX(self, show_core_custom.GetId(), on_show_core_custom)
        # ... otherwise (the common case), just add the palette of core buttons
        else:
            sizer = wx.GridSizer(0, config.preferences.buttons_per_row)
            self.SetAutoLayout(True)
            # core components
            for b in core_btns:
                sizer.Add(b)
            for sb in sizer_btns:
                sizer.Add(sb)
            self.SetSizer(sizer)
            sizer.Fit(self)

        # Properties window
        frame_style = wx.DEFAULT_FRAME_STYLE
        frame_tool_win = config.preferences.frame_tool_win
        if frame_tool_win:
            frame_style |= wx.FRAME_NO_TASKBAR | wx.FRAME_FLOAT_ON_PARENT
            frame_style &= ~wx.MINIMIZE_BOX
            if wx.Platform != '__WXGTK__': frame_style |= wx.FRAME_TOOL_WINDOW

        self.frame2 = wx.Frame(self,
                               -1,
                               _('Properties - <app>'),
                               style=frame_style)
        self.frame2.SetBackgroundColour(
            wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE))
        self.frame2.SetIcon(icon)

        sizer_tmp = wx.BoxSizer(wx.VERTICAL)
        property_panel = wxGladePropertyPanel(self.frame2, -1)

        #---- 2003-06-22 Fix for what seems to be a GTK2 bug (notebooks)
        misc.hidden_property_panel = wx.Panel(self.frame2, -1)
        sz = wx.BoxSizer(wx.VERTICAL)
        sz.Add(property_panel, 1, wx.EXPAND)
        sz.Add(misc.hidden_property_panel, 1, wx.EXPAND)
        self.frame2.SetSizer(sz)
        sz.Show(misc.hidden_property_panel, False)
        self.property_frame = self.frame2
        #--------------------------------------------------------

        property_panel.SetAutoLayout(True)
        self.hidden_frame = wx.Frame(self, -1, "")
        self.hidden_frame.Hide()
        sizer_tmp.Add(property_panel, 1, wx.EXPAND)
        self.frame2.SetAutoLayout(True)
        self.frame2.SetSizer(sizer_tmp)
        sizer_tmp = wx.BoxSizer(wx.VERTICAL)

        def hide_frame2(event):
            #menu_bar.Check(PROPS_ID, False)
            self.frame2.Hide()

        wx.EVT_CLOSE(self.frame2, hide_frame2)
        wx.EVT_CLOSE(self, self.cleanup)
        common.property_panel = property_panel
        # Tree of widgets
        self.tree_frame = wx.Frame(self,
                                   -1,
                                   _('wxGlade: Tree'),
                                   style=frame_style)
        self.tree_frame.SetIcon(icon)

        import application
        app = application.Application(common.property_panel)
        common.app_tree = WidgetTree(self.tree_frame, app)
        self.tree_frame.SetSize((300, 300))

        app.notebook.Show()
        sizer_tmp.Add(app.notebook, 1, wx.EXPAND)
        property_panel.SetSizer(sizer_tmp)
        sizer_tmp.Fit(property_panel)

        def on_tree_frame_close(event):
            #menu_bar.Check(TREE_ID, False)
            self.tree_frame.Hide()

        wx.EVT_CLOSE(self.tree_frame, on_tree_frame_close)
        # check to see if there are some remembered values
        prefs = config.preferences
        if prefs.remember_geometry:
            #print 'initializing geometry'
            try:
                x, y, w, h = prefs.get_geometry('main')
                misc.set_geometry(self, (x, y))
            except Exception, e:
                pass
            misc.set_geometry(self.frame2, prefs.get_geometry('properties'))
            misc.set_geometry(self.tree_frame, prefs.get_geometry('tree'))
Exemplo n.º 10
0
	def __init__(self):
		wx.Frame.__init__(self, parent=None,
				title=wx.GetApp().GetAppName(),
				size=(800, 600),
				style=wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL)

		wx.EVT_CLOSE(self, self.onClose)

		# List of bus interface and inotify object
		self.busItfList = []
		self.inotify = INotify()

		# Create 2 splitters
		self.splitterVert = wx.SplitterWindow(parent=self)
		self.splitterHorz = wx.SplitterWindow(parent=self.splitterVert)

		# Create TreeCtrl that will go in left pane of splitterVert
		self.treeCtrl = _ObusTreeCtrl(parent=self.splitterVert,
				id=MainFrame._ID_TREECTRL,
				style=wx.TR_DEFAULT_STYLE|wx.TR_SINGLE| wx.TR_HIDE_ROOT)
		self.treeRoot = self.treeCtrl.AddRoot("root",
				data=packTreeItemData(TREE_ITEM_KIND_ROOT, None, None))
		wx.EVT_TREE_SEL_CHANGED(self, MainFrame._ID_TREECTRL,
				self.onTreeSelChanged)
		wx.EVT_TREE_ITEM_RIGHT_CLICK(self, MainFrame._ID_TREECTRL,
				self.onTreeItemRightClick)

		# Create Panel for log that will go in bottom pane of splitterHorz
		self.pnlLog = _PnlLog(parent=self.splitterHorz)

		# Top pane of splitterHorz can be if several kind
		self.pnlInfoEmpty = _PnlInfoEmpty(self.splitterHorz)
		self.pnlInfoObjType = _PnlInfoObjType(self.splitterHorz)
		self.pnlInfoObj = _PnlInfoObj(self.splitterHorz, self.pnlLog)
		self.pnlInfoEmpty.Show(False)
		self.pnlInfoObjType.Show(False)
		self.pnlInfoObj.Show(False)
		self.pnlInfo = None

		# Setup splitter
		self.splitterVert.SplitVertically(self.treeCtrl, self.splitterHorz)
		self.splitterHorz.SplitHorizontally(self.pnlInfoEmpty, self.pnlLog)
		self.splitterVert.SetSashPosition(200)
		self.splitterHorz.SetSashPosition(300)
		self.pnlInfo = self.pnlInfoEmpty
		self.pnlInfoEmpty.Show(True)

		# Setup main menu
		menuBar = wx.MenuBar()
		menuFile = wx.Menu()
		menuFile.Append(wx.ID_EXIT, "&Quit\tAlt+F4",
				"Quit the application")
		menuHelp = wx.Menu()
		menuHelp.Append(wx.ID_ABOUT, "&About...\tAlt+F1",
				"Display informations about the program")
		menuBar.Append(menuFile, "&File")
		menuBar.Append(menuHelp, "&?")
		wx.EVT_MENU(self, wx.ID_EXIT, self.onFileQuit)
		wx.EVT_MENU(self, wx.ID_ABOUT, self.onHelpAbout)

		wx.EVT_MENU(self, MainFrame._ID_CMD_BUS_CONNECT, self.onCmdBusConnect)
		wx.EVT_MENU(self, MainFrame._ID_CMD_BUS_DISCONNECT, self.onCmdBusDisconnect)
		wx.EVT_MENU_RANGE(self, MainFrame._ID_CMD_SET_PRIMARY_FIELD,
				MainFrame._ID_CMD_SET_PRIMARY_FIELD + 65535, self.onCmdSetPrimaryField)

		# Setup MenuBar and StatusBar
		self.SetMenuBar(menuBar)
		self.SetStatusBar(wx.StatusBar(parent=self))
Exemplo n.º 11
0
    def on_initialize(self, event):
        self.initSizers()

        self.setDefaultStyles()

        # KEA 2002-05-08
        # wxFileHistory isn't wrapped, so use raw wxPython
        # the file history is not actually saved when you quit
        # or shared between windows right now
        # also the file list gets appended to the File menu
        # rather than going in front of the Exit menu
        # I suspect I have to add the Exit menu after the file history
        # which means changing how the menus in resources are loaded
        # so I'll do that later
        self.fileHistory = wx.FileHistory()
        fileMenu = self.GetMenuBar().GetMenu(0)
        self.fileHistory.UseMenu(fileMenu)
        wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.OnFileHistory)

        self.lastStatus = None
        self.lastPos = None
        #self.configPath = os.path.abspath(os.curdir)
        self.configPath = os.path.join(configuration.homedir, 'codeeditor')
        self.loadConfig()
        self.cmdLineArgs = {
            'debugmenu': False,
            'logging': False,
            'messagewatcher': False,
            'namespaceviewer': False,
            'propertyeditor': False,
            'shell': False,
            'otherargs': ''
        }
        self.lastFind = {
            'searchText': '',
            'replaceText': '',
            'wholeWordsOnly': False,
            'caseSensitive': False
        }
        self.startTitle = self.title
        if len(sys.argv) > 1:
            # accept a file argument on the command-line
            filename = os.path.abspath(sys.argv[1])
            log.info('codeEditor filename: ' + filename)
            if not os.path.exists(filename):
                filename = os.path.abspath(
                    os.path.join(self.application.startingDirectory,
                                 sys.argv[1]))
            #print filename
            if os.path.isfile(filename):
                self.openFile(filename)
                # the second argument can be a line number to jump to
                # this is experimental, but a nice feature
                # KEA 2002-05-01
                # gotoLine causes the Mac to segfault
                if (len(sys.argv) > 2):
                    try:
                        line = int(sys.argv[2])
                        self.gotoLine(line)
                    except:
                        pass
            else:
                self.newFile()
        else:
            self.newFile()

        self.printer = HtmlEasyPrinting()

        # KEA 2002-05-08
        # wxSTC defaults will eventually be settable via a dialog
        # and saved in a user config, perhaps compatible with IDLE
        # or Pythonwin
        self.components.document.SetEdgeColumn(75)

        # KEA 2002-05-08
        # the wxFindReplaceDialog is not wrapped
        # so this is an experiment to see how it works
        wx.EVT_COMMAND_FIND(self, -1, self.OnFind)
        wx.EVT_COMMAND_FIND_NEXT(self, -1, self.OnFind)
        wx.EVT_COMMAND_FIND_REPLACE(self, -1, self.OnFind)
        wx.EVT_COMMAND_FIND_REPLACE_ALL(self, -1, self.OnFind)
        wx.EVT_COMMAND_FIND_CLOSE(self, -1, self.OnFindClose)

        self.visible = True
        self.loadShell()
Exemplo n.º 12
0
    def create_menu(self, parent):
        menu_bar = wx.MenuBar()
        file_menu = wx.Menu(style=wx.MENU_TEAROFF)
        view_menu = wx.Menu(style=wx.MENU_TEAROFF)
        help_menu = wx.Menu(style=wx.MENU_TEAROFF)
        compat.wx_ToolTip_SetDelay(1000)
        compat.wx_ToolTip_SetAutoPop(30000)

        append_menu_item = misc.append_menu_item
        self.TREE_ID = TREE_ID = wx.NewId()
        append_menu_item(view_menu, TREE_ID, _("Show &Tree\tF2"))
        self.PROPS_ID = PROPS_ID = wx.NewId()
        self.RAISE_ID = RAISE_ID = wx.NewId()
        append_menu_item(view_menu, PROPS_ID, _("Show &Properties\tF3"))
        append_menu_item(view_menu, RAISE_ID, _("&Raise All\tF4"))
        NEW_ID = wx.NewId()
        append_menu_item(file_menu, NEW_ID, _("&New\tCtrl+N"), wx.ART_NEW)
        NEW_FROM_TEMPLATE_ID = wx.NewId()
        append_menu_item(file_menu, NEW_FROM_TEMPLATE_ID,
                         _("New from &Template...\tShift+Ctrl+N"))
        OPEN_ID = wx.NewId()
        append_menu_item(file_menu, OPEN_ID, _("&Open...\tCtrl+O"),
                         wx.ART_FILE_OPEN)
        SAVE_ID = wx.NewId()
        append_menu_item(file_menu, SAVE_ID, _("&Save\tCtrl+S"),
                         wx.ART_FILE_SAVE)
        SAVE_AS_ID = wx.NewId()
        append_menu_item(file_menu, SAVE_AS_ID, _("Save As...\tShift+Ctrl+S"),
                         wx.ART_FILE_SAVE_AS)
        SAVE_TEMPLATE_ID = wx.NewId()
        append_menu_item(file_menu, SAVE_TEMPLATE_ID, _("Save As Template..."))
        file_menu.AppendSeparator()

        append_menu_item(file_menu, wx.ID_REFRESH, _("&Refresh Preview\tF5"))

        GENERATE_CODE_ID = wx.NewId()
        append_menu_item(file_menu, GENERATE_CODE_ID,
                         _("&Generate Code\tCtrl+G"), wx.ART_EXECUTABLE_FILE)

        file_menu.AppendSeparator()
        IMPORT_ID = wx.NewId()
        append_menu_item(file_menu, IMPORT_ID, _("&Import from XRC..."))

        EXIT_ID = wx.NewId()
        file_menu.AppendSeparator()
        append_menu_item(file_menu, EXIT_ID, _('E&xit\tCtrl+Q'), wx.ART_QUIT)
        PREFS_ID = wx.ID_PREFERENCES
        view_menu.AppendSeparator()
        MANAGE_TEMPLATES_ID = wx.NewId()
        append_menu_item(view_menu, MANAGE_TEMPLATES_ID,
                         _('Template Manager...'))
        view_menu.AppendSeparator()
        append_menu_item(view_menu, PREFS_ID, _('Preferences...'))
        menu_bar.Append(file_menu, _("&File"))
        menu_bar.Append(view_menu, _("&View"))

        MANUAL_ID = wx.NewId()
        append_menu_item(help_menu, MANUAL_ID, _('Manual\tF1'), wx.ART_HELP)
        TUTORIAL_ID = wx.NewId()
        append_menu_item(help_menu, TUTORIAL_ID, _('Tutorial'))
        help_menu.AppendSeparator()
        ABOUT_ID = wx.ID_ABOUT
        append_menu_item(help_menu, ABOUT_ID, _('About'))
        menu_bar.Append(help_menu, _('&Help'))

        parent.SetMenuBar(menu_bar)
        # Mac tweaks...
        if wx.Platform == "__WXMAC__":
            wx.App_SetMacAboutMenuItemId(ABOUT_ID)
            wx.App_SetMacPreferencesMenuItemId(PREFS_ID)
            wx.App_SetMacExitMenuItemId(EXIT_ID)
            wx.App_SetMacHelpMenuTitleName(_('&Help'))

        # file history support
        self.file_history = wx.FileHistory(config.preferences.number_history)
        self.file_history.UseMenu(file_menu)
        files = common.load_history()
        files.reverse()
        for path in files:
            self.file_history.AddFileToHistory(path.strip())

        wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9,
                          self.open_from_history)

        wx.EVT_MENU(self, TREE_ID, self.show_tree)
        wx.EVT_MENU(self, PROPS_ID, self.show_props_window)
        wx.EVT_MENU(self, RAISE_ID, self.raise_all)
        wx.EVT_MENU(self, NEW_ID, self.new_app)
        wx.EVT_MENU(self, NEW_FROM_TEMPLATE_ID, self.new_app_from_template)
        wx.EVT_MENU(self, OPEN_ID, self.open_app)
        wx.EVT_MENU(self, SAVE_ID, self.save_app)
        wx.EVT_MENU(self, SAVE_AS_ID, self.save_app_as)
        wx.EVT_MENU(self, SAVE_TEMPLATE_ID, self.save_app_as_template)

        def generate_code(event):
            common.app_tree.app.generate_code()

        wx.EVT_MENU(self, GENERATE_CODE_ID, generate_code)
        wx.EVT_MENU(self, EXIT_ID, lambda e: self.Close())
        wx.EVT_MENU(self, MANUAL_ID, self.show_manual)
        wx.EVT_MENU(self, TUTORIAL_ID, self.show_tutorial)
        wx.EVT_MENU(self, ABOUT_ID, self.show_about_box)
        wx.EVT_MENU(self, PREFS_ID, self.edit_preferences)
        wx.EVT_MENU(self, MANAGE_TEMPLATES_ID, self.manage_templates)
        wx.EVT_MENU(self, IMPORT_ID, self.import_xrc)
        wx.EVT_MENU(self, wx.ID_REFRESH, self.preview)  # self.reload_app)

        PREVIEW_ID = wx.NewId()
        wx.EVT_MENU(self, PREVIEW_ID, self.preview)

        self.accel_table = wx.AcceleratorTable([
            (wx.ACCEL_CTRL, ord('N'), NEW_ID),
            (wx.ACCEL_CTRL, ord('O'), OPEN_ID),
            (wx.ACCEL_CTRL, ord('S'), SAVE_ID),
            (wx.ACCEL_CTRL | wx.ACCEL_SHIFT, ord('S'), SAVE_AS_ID),
            (wx.ACCEL_CTRL, ord('G'), GENERATE_CODE_ID),
            #(wx.ACCEL_CTRL, ord('I'), IMPORT_ID),
            (0, wx.WXK_F1, MANUAL_ID),
            (wx.ACCEL_CTRL, ord('Q'), EXIT_ID),
            (0, wx.WXK_F5, wx.ID_REFRESH),
            (0, wx.WXK_F2, TREE_ID),
            (0, wx.WXK_F3, PROPS_ID),
            (0, wx.WXK_F4, RAISE_ID),
            (wx.ACCEL_CTRL, ord('P'), PREVIEW_ID),
        ])
Exemplo n.º 13
0
    def __init__(self, parent, ID, title):
        wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition,
                          wx.DefaultSize)

        self.dom = None
        self.file = None
        self.sh = None
        self.modified = False
        self.config = wx.Config.Get()
        self.history = wx.FileHistory()
        self.config.SetPath("/lastrun")
        self.history.Load(self.config)
        self.config.SetPath("/")
        self.universe = None

        pan = wx.Panel(self, -1)
        ts = wx.BoxSizer(wx.VERTICAL)
        ts.Add(pan, 1, wx.EXPAND | wx.ALL)
        self.SetSizer(ts)

        filemenu = wx.Menu()
        filemenu.Append(SFROOTFRAME_NEW, _("&New"), _("New character"))
        filemenu.Append(SFROOTFRAME_LOAD, _("&Load"), _("Load character"))
        self.save = wx.MenuItem(filemenu, SFROOTFRAME_SAVE, _("&Save"),
                                _("Save character"))
        filemenu.AppendItem(self.save)
        self.saveas = wx.MenuItem(filemenu, SFROOTFRAME_SAVEAS,
                                  _("Save &As..."), _("Save character as..."))
        filemenu.AppendItem(self.saveas)
        self.close = wx.MenuItem(filemenu, SFROOTFRAME_CLOSE, _("&Close"),
                                 _("Close character"))
        filemenu.AppendItem(self.close)
        filemenu.AppendSeparator()
        self.recent = wx.Menu()
        self.history.UseMenu(self.recent)
        self.history.AddFilesToMenu()
        filemenu.AppendMenu(-1, _("&Recent files"), self.recent,
                            _("Recently opened files"))
        filemenu.AppendSeparator()
        filemenu.Append(SFROOTFRAME_QUIT, _("E&xit"), _("Quit Soulforge"))

        toolsmenu = wx.Menu()
        toolsmenu.Append(SFROOTFRAME_DIEROLLER, _("&Dieroller"),
                         _("Dieroller"))
        toolsmenu.AppendSeparator()
        toolsmenu.Append(SFROOTFRAME_OPTIONS, _("&Options"), _("Options"))

        helpmenu = wx.Menu()
        helpmenu.Append(SFROOTFRAME_ABOUT, _("&About"), _("About Soulforge"))

        menubar = wx.MenuBar()
        menubar.Append(filemenu, _("&File"))
        menubar.Append(toolsmenu, _("&Tools"))
        menubar.Append(helpmenu, _("&Help"))

        self.SetMenuBar(menubar)

        root = wx.FlexGridSizer(6, 2, 0, 0)
        root.AddGrowableCol(1, 1)
        self.namelabel = wx.StaticText(pan, -1, _("Name:"))
        root.Add(self.namelabel, 0, wx.ALIGN_CENTER_VERTICAL)
        self.name = wx.TextCtrl(pan, -1, u"", wx.DefaultPosition,
                                wx.DefaultSize, wx.TE_READONLY)
        root.Add(self.name, 1, wx.EXPAND)
        self.playerlabel = wx.StaticText(pan, -1, _("Player:"))
        root.Add(self.playerlabel, 0, wx.ALIGN_CENTER_VERTICAL)
        self.player = wx.TextCtrl(pan, -1, u"", wx.DefaultPosition,
                                  wx.DefaultSize, wx.TE_READONLY)
        root.Add(self.player, 1, wx.EXPAND)
        self.univlabel = wx.StaticText(pan, -1, _("Universe:"))
        root.Add(self.univlabel, 0, wx.ALIGN_CENTER_VERTICAL)
        self.univname = wx.TextCtrl(pan, -1, u"", wx.DefaultPosition,
                                    wx.DefaultSize, wx.TE_READONLY)
        root.Add(self.univname, 1, wx.EXPAND)
        self.filelabel = wx.StaticText(pan, -1, _("Filename:"))
        root.Add(self.filelabel, 0, wx.ALIGN_CENTER_VERTICAL)
        self.filename = wx.TextCtrl(pan, -1, u"", wx.DefaultPosition,
                                    wx.DefaultSize, wx.TE_READONLY)
        root.Add(self.filename, 1, wx.EXPAND)
        root.Add(wx.Panel(pan, -1))
        self.edit = wx.Button(pan, SFROOTFRAME_EDIT, _("Edit"))
        root.Add(self.edit, 1, wx.EXPAND)

        pan.SetSizer(root)
        pan.Fit()
        self.Centre(wx.BOTH)

        self.updategui()
        self.populatefields()

        wx.EVT_MENU(self, SFROOTFRAME_QUIT, self.onquit)
        wx.EVT_MENU(self, SFROOTFRAME_ABOUT, self.onabout)
        wx.EVT_MENU(self, SFROOTFRAME_DIEROLLER, self.ondieroller)
        wx.EVT_MENU(self, SFROOTFRAME_LOAD, self.onload)
        wx.EVT_MENU(self, SFROOTFRAME_SAVE, self.onsave)
        wx.EVT_MENU(self, SFROOTFRAME_CLOSE, self.onclose)
        wx.EVT_MENU(self, SFROOTFRAME_NEW, self.onnew)
        wx.EVT_MENU(self, SFROOTFRAME_OPTIONS, self.onoptions)
        wx.EVT_MENU(self, SFROOTFRAME_SAVEAS, self.onsaveas)
        wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.onrecent)
        wx.EVT_BUTTON(self, SFSHEET_OK, self.onsheetok)
        wx.EVT_BUTTON(self, SFROOTFRAME_EDIT, self.onedit)