def __init__(self, pathname): Observable.__init__(self) self.pathname = pathname self.kernelname = None self.cells = [] self.active_cell = None self.busy_cells = set() self.modified_cells = set() self.kernel_state = None self.result_factory = ServiceLocator.get_result_factory() self.save_state = 'saved' try: self.last_saved = datetime.datetime.fromtimestamp(os.path.getmtime(pathname)) except FileNotFoundError: self.last_saved = datetime.datetime.fromtimestamp(0) # set source language for syntax highlighting self.source_language_manager = GtkSource.LanguageManager() self.source_language_manager.set_search_path((os.path.dirname(__file__) + '/../resources/gtksourceview/language-specs',)) self.source_language_code = self.source_language_manager.get_language('sage') self.source_language_markdown = self.source_language_manager.get_language('markdown') self.source_style_scheme_manager = GtkSource.StyleSchemeManager() self.source_style_scheme_manager.set_search_path((os.path.dirname(__file__) + '/../resources/gtksourceview/styles',)) self.source_style_scheme = self.source_style_scheme_manager.get_scheme('sage') self.cursor_position = {'cell': None, 'cell_position': None, 'cell_size': None, 'position': None} self.list_item = list_item_model.NotebookListItem(self) self.view = notebook_viewgtk.NotebookView() self.presenter = notebook_presenter.NotebookPresenter(self, self.view) self.controller = notebook_controller.NotebookController(self, self.view) self.evaluator = notebook_evaluator.NotebookEvaluator(self) self.headerbar_controls = headerbar_controls.HeaderbarControls(self)
def __init__(self, notebook): Observable.__init__(self) self.kernel = None self.notebook = notebook self.continue_fetching = True self.result_factory = ServiceLocator.get_result_factory() self.fetch_func_id = GObject.timeout_add(50, self.fetch_results)
def __init__(self, notebook): GtkSource.Buffer.__init__(self) Observable.__init__(self) self.notebook = notebook self.notebook_position = None self.set_modified(False) self.set_highlight_matching_brackets(False)
def __init__(self, workspace): Observable.__init__(self) self.workspace = workspace self.pathname = os.path.expanduser('~') + '/.porto' self.items = dict() self.presenter = ro_presenter.RecentlyOpenedNotebooksListPresenter( workspace, self) self.controller = ro_controller.RecentlyOpenedNotebooksListController( workspace, self)
def __init__(self, workspace): Observable.__init__(self) self.workspace = workspace self.sb_items = dict() self.hb_items = dict() self.sb_view = onb_view.OpenNotebooksListView() self.hb_view = onb_view.OpenNotebooksListView() self.presenter = onb_presenter.OpenNotebooksListPresenter( workspace, self, self.sb_view, self.hb_view) self.controller = onb_controller.OpenNotebooksListController( workspace, self.sb_view, self.hb_view)
def __init__(self, notebook): Observable.__init__(self) self.notebook = notebook self.kernelspecs = ServiceLocator.get_kernelspecs() self.sb_view = nbli_view.OpenNotebookListViewItem( notebook, notebook.get_last_saved()) self.hb_view = nbli_view.OpenNotebookListViewItem( notebook, notebook.get_last_saved()) self.presenter = nbli_presenter.NotebookListItemPresenter( notebook, self, self.sb_view, self.hb_view) self.controller = nbli_controller.NotebookListItemController( notebook, self, self.sb_view, self.hb_view) self.set_kernel(notebook.get_kernelname())
def __init__(self, workspace): Observable.__init__(self) self.workspace = workspace self.main_window = ServiceLocator.get_main_window() self.window_mode = None self.activate_welcome_page_mode() self.main_window.paned.set_position(self.workspace.sidebar_position) if self.workspace.show_sidebar: self.on_show_sidebar() else: self.on_hide_sidebar() self.workspace.register_observer(self)
def __init__(self): Observable.__init__(self) self.recently_opened_notebooks = ro_notebooks_list.RecentlyOpenedNotebooksList(self) self.open_notebooks_list = open_notebooks_list.OpenNotebooksList(self) self.open_notebooks = dict() self.active_notebook = None self.settings = ServiceLocator.get_settings() self.show_sidebar = self.settings.get_value('window_state', 'sidebar_visible') self.sidebar_position = self.settings.get_value('window_state', 'paned_position') self.presenter = workspace_presenter.WorkspacePresenter(self) self.controller = workspace_controller.WorkspaceController(self) self.headerbar = headerbar_model.Headerbar(self) self.shortcuts = shortcuts.Shortcuts(self) self.set_pretty_print(self.settings.get_value('preferences', 'pretty_print'))
def __init__(self, stream_type='stdout'): Gtk.HBox.__init__(self) Observable.__init__(self) self.get_style_context().add_class('resultview') self.innerwrap = Gtk.HBox() self.innerwrap.set_margin_left(9) self.innerwrap.set_margin_right(9) self.scrolled_window = Gtk.ScrolledWindow() self.scrolled_window.set_margin_top(11) self.scrolled_window.set_margin_bottom(9) self.scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) self.centerbox = Gtk.HBox() self.scrolled_window.add(self.centerbox) self.scrolled_window.set_size_request(750, -1) self.innerwrap.set_center_widget(self.scrolled_window) self.set_center_widget(self.innerwrap) self.set_hexpand(True) self.get_style_context().add_class('resultstreamview') self.result_text = '' self.stream_type = stream_type self.label = Gtk.Label() self.label.set_single_line_mode(False) self.label.set_line_wrap_mode(Pango.WrapMode.CHAR) self.label.set_line_wrap(True) self.label.set_selectable(True) self.label.set_justify(Gtk.Justification.LEFT) self.label.set_xalign(0) self.label.set_markup('') self.size_box = Gtk.VBox() self.size_box.pack_start(self.label, False, False, 0) self.centerbox.pack_start(self.size_box, False, False, 0)
def __init__(self, workspace): Observable.__init__(self) self.workspace = workspace self.presenter = headerbar_presenter.HeaderbarPresenter(workspace) self.controller = headerbar_controller.HeaderbarController(workspace)
def __init__(self): Observable.__init__(self) self.result = None