예제 #1
0
파일: __main__.py 프로젝트: tonghuaWN/Porto
    def do_activate(self):
        ''' Everything starts here. '''
        
        # load settings
        self.settings = ServiceLocator.get_settings()

        # init view
        self.main_window = view.MainWindow(self)
        ServiceLocator.init_main_window(self.main_window)
        self.main_window.set_default_size(self.settings.get_value('window_state', 'width'), 
                                          self.settings.get_value('window_state', 'height'))
        if self.settings.get_value('window_state', 'is_maximized'): self.main_window.maximize()
        else: self.main_window.unmaximize()
        if self.settings.get_value('window_state', 'is_fullscreen'): self.main_window.fullscreen()
        else: self.main_window.unfullscreen()
        self.main_window.show_all()

        self.workspace = Workspace()
        kernelspecs = ServiceLocator.get_kernelspecs()
        ServiceLocator.init_dialogs(self.main_window, self.workspace, kernelspecs)

        # controllers
        self.main_window.quit_action.connect('activate', self.on_quit_action)

        # watch changes in view
        self.observe_main_window()
예제 #2
0
    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'))
예제 #3
0
    def __init__(self, workspace):
        self.workspace = workspace
        self.main_window = ServiceLocator.get_main_window()
        self.settings = ServiceLocator.get_settings()

        self.main_window.toggle_sidebar_action.connect('activate', self.toggle_sidebar)
        self.main_window.preferences_action.connect('activate', self.show_preferences_dialog)
        self.main_window.show_about_dialog_action.connect('activate', self.show_about_dialog)
        self.main_window.show_shortcuts_window_action.connect('activate', self.show_shortcuts_window)
        self.main_window.sidebar.connect('size-allocate', self.on_sidebar_size_allocate)

        self.main_window.restart_kernel_action.connect('activate', self.on_restart_kernel_action)
        self.main_window.change_kernel_action.connect('activate', self.on_change_kernel_action)
        self.main_window.save_all_action.connect('activate', self.on_save_all_action)
        self.main_window.save_as_action.connect('activate', self.on_save_as_action)
        self.main_window.delete_action.connect('activate', self.on_delete_action)
        self.main_window.close_action.connect('activate', self.on_close_action)
        self.main_window.close_all_action.connect('activate', self.on_close_all_action)
        self.main_window.open_action.connect('activate', self.on_open_action)
        self.main_window.create_action.connect('activate', self.on_create_action)

        self.settings.register_observer(self)