def new_view(self, location=None): s = self.settings if location: for view in self.views: if view.document.location == location: self.switch_current_view(view, False) # We don't currently support multiple views on the same # document, so exit out of the method # TODO: should we reload? return document = load_document(location, self.settings) else: title = self.get_next_title() document = Document(encoding=s.file_encoding, linesep=s.linesep, tab_size=s.tab_size, title=title) view = GTKView(self, document) self.views.append(view) # Switch the view. switch_current_view will rebuild the tree to reflect # the selected view self.switch_current_view(view, True) #if view.document.is_modified: # dialog = GtkWarnModifiedDialog(self) # dialog.show() return view
def new_view(self, location=None): if location: document = load_document(location, self.settings) else: s = self.settings document = Document(encoding=s.encoding, linesep=s.linesep, tab_size=s.tab_size, title="Untitled") view = FakeView(self, document) self.views.append(view) return view
def new_view(self, location=None): if location: document = load_document(location, self.settings) else: title = self.get_next_title() s = self.settings document = Document(encoding=s.file_encoding, linesep=s.linesep, tab_size=s.tab_size, title=title) view = UrwidView(self, document) self.views.append(view) # set the current view self.view = view self.queue_redraw() return view