def __init__(self, main_file=None, parent=None, id=wx.ID_ANY, title=u"Maple IDE", pos=(50,50), size=(640,700), style=wx.DEFAULT_FRAME_STYLE, name=u"Maple IDE"): basename = os.path.basename(main_file) if main_file else None title = u'Maple IDE {0}'.format(settings.IDE_VERSION) if basename: title += u' | ' + basename wx.Frame.__init__(self, parent, id, title, pos, size, style, name) self._pages = {} # {basename: CPPStyledTextCtrl} self.modified = False # are there unsaved changes? self.__mgr = wx.aui.AuiManager(self) self.menu_bar = self._make_menu_bar() self._make_toolbar() self.CreateStatusBar() # tabbed view of current sketch # FIXME disallow closing of tabs -- might have to switch AUI # implementation self.nb = BetterAuiNotebook(self) # was trying this + SetCloseButton, but !@#$, it doesn't exist # style=wx.aui.AUI_NB_TOP | \ # wx.aui.AUI_NB_TAB_MOVE | \ # wx.aui.AUI_NB_CLOSE_ON_ALL_TABS) # subprocess (compiler/uploader) output goes here self.sub = wx.TextCtrl(self, -1, u'', wx.DefaultPosition, wx.Size(200, 150), wx.NO_BORDER | wx.TE_MULTILINE | wx.TE_READONLY) # add the panes to the manager self.__mgr.AddPane(self.nb, wx.CENTER) self.__mgr.AddPane(self.sub, wx.aui.AuiPaneInfo(). Bottom(). CaptionVisible(True). CloseButton(False). Floatable(False)) self.__mgr.Update() self.Bind(wx.EVT_CLOSE, self.OnClose) # this *must* be done after GUI setup if main_file is None: self.sketch = SB.fresh_sketch(self) else: self.sketch = Sketch(self, main_file) # the sketch setter calls CPPStyledTextCtrl.SetText, but we aren't # really modified yet, and we don't want the user to be able to # 'undo' the changes _we_ made by sticking the file contents into # our notebook's pages. self.not_really_modified() self.nb.active_page = self._pages[self.sketch.main_basename]
def OnNewSketchToolbar(self, evt): if self._query_user_save() == ABORT: return self.sketch = SB.fresh_sketch(self)
def __init__(self, main_file=None, parent=None, id=wx.ID_ANY, title=u"Maple IDE", pos=(50,50), size=(640,700), style=wx.DEFAULT_FRAME_STYLE, name=u"Maple IDE"): basename = os.path.basename(main_file) if main_file else None title = u'Maple IDE | ' + basename if basename else u'Maple IDE' wx.Frame.__init__(self, parent, id, title, pos, size, style, name) self._pages = {} # {basename: CPPStyledTextCtrl} self.modified = False # are there unsaved changes? # this thing totally takes the pain out of panel layout self.__mgr = wx.aui.AuiManager(self) # menu bar self.menu_bar = self._make_menu_bar() self.SetMenuBar(self.menu_bar) # toolbar self._make_toolbar() # status bar self.CreateStatusBar() # tabbed view of current sketch # FIXME disallow closing of tabs -- might have to switch AUI # implementation self.nb = BetterAuiNotebook(self) # was trying this + SetCloseButton, but !@#$, it doesn't exist # style=wx.aui.AUI_NB_TOP | \ # wx.aui.AUI_NB_TAB_MOVE | \ # wx.aui.AUI_NB_CLOSE_ON_ALL_TABS) # print 'dir(self.nb):' # pprint(dir(self.nb)) # subprocess (compiler/uploader) output goes here self.sub = wx.TextCtrl(self, -1, u'', wx.DefaultPosition, wx.Size(200, 150), wx.NO_BORDER | wx.TE_MULTILINE) comp_info = wx.aui.AuiPaneInfo() comp_info.Bottom() comp_info.CaptionVisible(True) comp_info.CloseButton(False) comp_info.Floatable(False) # add the panes to the manager self.__mgr.AddPane(self.nb, wx.CENTER) self.__mgr.AddPane(self.sub, info=comp_info) self.__mgr.Update() # set frame close handler self.Bind(wx.EVT_CLOSE, self.OnClose) # All set up, so initialize the sketch. THIS MUST BE DONE AFTER # THE GUI GETS SET UP. if main_file is None: self.sketch = SB.fresh_sketch(self) else: self.sketch = Sketch(self, main_file) # the sketch setter calls CPPStyledTextCtrl.SetText, but we aren't # really modified yet, and we don't want the user to be able to # 'undo' the changes _we_ made by sticking the file contents into # our notebook's pages. self.not_really_modified() self.nb.active_page = self._pages[self.sketch.main_basename]