def _close_window(self, confirm_discard, wait_for_execution):
        if confirm_discard and not self._confirm_discard():
            return

        if wait_for_execution:
            if not self._wait_for_execution():
                return
        else:
            for editor in self.editors:
                if editor.state == NotebookFile.EXECUTING:
                    return

        # Prevent visual artifacts by hiding first
        self.window.hide()

        # Prevent reentrancy problems from having destroyed editors in self.editors
        editors = self.editors
        self.editors = []
        for editor in editors:
            editor.widget._notebook_window_editor = None
            editor.destroy()

        self.current_editor = None

        BaseWindow._close_window(self, confirm_discard, wait_for_execution)
    def _close_window(self, confirm_discard, wait_for_execution):
        if confirm_discard and not self._confirm_discard():
            return

        if wait_for_execution:
            if not self._wait_for_execution():
                return
        else:
            for editor in self.editors:
                if editor.state == NotebookFile.EXECUTING:
                    return

        # Prevent visual artifacts by hiding first
        self.window.hide()

        # Prevent reentrancy problems from having destroyed editors in self.editors
        editors = self.editors
        self.editors = []
        for editor in editors:
            editor.widget._notebook_window_editor = None
            editor.destroy()

        self.current_editor = None

        BaseWindow._close_window(self, confirm_discard, wait_for_execution)
    def __init__(self):
        BaseWindow.__init__(self, Notebook())
        self.path = None

        self.window.set_default_size(700, 800)

        self.main_vbox.show_all()
Beispiel #4
0
    def __init__(self, builder, filename):

        BaseWindow.__init__(self)
        if not WEBKIT:
            return

        try:
            fname = os.path.join(HELP_PATH, filename)
            f = open(fname)
            data = f.read()
        except IOError as msg:
            data = "Help file '{0}' could not be found\n{1}".format(fname, str(msg))

        if HelpWindow.window is None:
            HelpWindow.window = builder.get_object("help_win")
            self.configure(HelpWindow.window)
            HelpWindow.wkit = webkit.WebView()
            HelpWindow.container = builder.get_object("help_scroll")
            HelpWindow.container.add(HelpWindow.wkit)
            HelpWindow.button = builder.get_object("help_close")
            HelpWindow.button.connect("clicked", self.hide)
            HelpWindow.window.connect("destroy", self.destroy)
            HelpWindow.window.connect("delete_event", self.delete)

        HelpWindow.wkit.load_string(html_string(data), "text/html", "utf-8", "")
        HelpWindow.window.show_all()
    def update_sensitivity(self):
        BaseWindow.update_sensitivity(self)

        some_need_calculate = False
        for editor in self.editors:
            if editor.needs_calculate:
                some_need_calculate = True

        self._set_action_sensitive('calculate-all', some_need_calculate)
    def update_sensitivity(self):
        BaseWindow.update_sensitivity(self)

        some_need_calculate = False
        for editor in self.editors:
            if editor.needs_calculate:
                some_need_calculate = True

        self._set_action_sensitive('calculate-all', some_need_calculate)
    def _add_actions(self, action_group):
        BaseWindow._add_actions(self, action_group)

        action_group.add_actions([
            ('notebook-properties', gtk.STOCK_PROPERTIES, "Notebook _Properties", None,         None, self.on_notebook_properties),
            ('new-worksheet',       gtk.STOCK_NEW,        "_New Worksheet",       "<control>n", None, self.on_new_worksheet),
            ('new-library',         gtk.STOCK_NEW,        "New _Library",         "",           None, self.on_new_library),
            ('calculate-all',       gtk.STOCK_REFRESH,    "Calculate _All",       "<control><shift>Return",  None, self.on_calculate_all),
        ])
Beispiel #8
0
    def __init__(self, builder, filename):

        BaseWindow.__init__(self)
        if not WEBKIT:
            return

        try:
            fname = os.path.join(HELP_PATH, filename)
            f = open(fname)
            data = f.read()
        except IOError, msg:
            data = "Help file '%s' could not be found\n%s" % (fname, str(msg))
    def __init__(self, notebook):
        BaseWindow.__init__(self, notebook)

        self.state = application.state.get_notebook_state(notebook.folder)
        # We'll call window.set_default_size() later with an appropriate
        # default size for the BaseNotebookWindow subclass. The size set by
        # window.resize() takes precedence.
        (width, height) = self.state.get_size()
        if width != -1 and height != -1:
            self.window.resize(width, height)
        self.window.connect('configure-event', self.on_configure_event)

        self.path = notebook.folder

        self.editors = []

        self.nb_widget = gtk.Notebook()
        self.nb_widget.connect_after('switch-page', self.on_page_switched)
        self.nb_widget.connect('page-reordered', self.on_page_reordered)

        self._fill_content()

        self.main_vbox.show_all()

        self.__initial_editor = None

        open_file_paths = self.state.get_open_files()
        current_file = self.state.get_current_file()

        for path in open_file_paths:
            if not path in self.notebook.files:
                continue

            file = self.notebook.files[path]
            self.open_file(file)

        current_file_editor = None
        if current_file is not None:
            filename = os.path.join(notebook.folder, current_file)
            for editor in self.editors:
                if editor.filename == filename:
                    current_file_editor = editor

        if current_file_editor is None and len(self.editors) > 0:
            current_file_editor = self.editors[0]

        if current_file_editor is not None:
            self._make_editor_current(current_file_editor)
            current_file_editor.view.grab_focus()

        self.__update_title()
    def __init__(self, notebook):
        BaseWindow.__init__(self, notebook)

        self.state = application.state.get_notebook_state(notebook.folder)
        # We'll call window.set_default_size() later with an appropriate
        # default size for the BaseNotebookWindow subclass. The size set by
        # window.resize() takes precedence.
        (width, height) = self.state.get_size()
        if width != -1 and height != -1:
            self.window.resize(width, height)
        self.window.connect('configure-event', self.on_configure_event)

        self.path = notebook.folder

        self.editors = []

        self.nb_widget = gtk.Notebook()
        self.nb_widget.connect_after('switch-page', self.on_page_switched)
        self.nb_widget.connect('page-reordered', self.on_page_reordered)

        self._fill_content()

        self.main_vbox.show_all()

        self.__initial_editor = None

        open_file_paths = self.state.get_open_files()
        current_file = self.state.get_current_file()

        for path in open_file_paths:
            if not path in self.notebook.files:
                continue

            file = self.notebook.files[path]
            self.open_file(file)

        current_file_editor = None
        if current_file is not None:
            filename = os.path.join(notebook.folder, current_file)
            for editor in self.editors:
                if editor.filename == filename:
                    current_file_editor = editor

        if current_file_editor is None and len(self.editors) > 0:
            current_file_editor = self.editors[0]

        if current_file_editor is not None:
            self._make_editor_current(current_file_editor)
            current_file_editor.view.grab_focus()

        self.__update_title()
Beispiel #11
0
    def __init__(self, project, dbmap):
        BaseWindow.__init__(self)

        self.__dbmap = dbmap
        self.__prj = project
        self.__modlist = []

        self.__base2path = {}
        for item in self.__prj.get_register_set():
            base_path = os.path.splitext(os.path.basename(item))
            self.__base2path[base_path[0]] = item

        self.__build_interface()
        self.__build_export_maps()
        self.__populate()
    def _close_window(self, confirm_discard, wait_for_execution):
        if confirm_discard and not self.current_editor.confirm_discard():
            return

        if wait_for_execution:
            if not self.current_editor.wait_for_execution():
                return
        else:
            if self.current_editor.state == NotebookFile.EXECUTING:
                return

        # Prevent visual artifacts by hiding first
        self.window.hide()
        self.current_editor.destroy()

        BaseWindow._close_window(self, confirm_discard, wait_for_execution)
    def __init__(self, notebook):
        BaseWindow.__init__(self, notebook)

        self.state = application.state.get_notebook_state(notebook.folder)

        self.path = notebook.folder

        self.editors = []

        self.nb_widget = gtk.Notebook()
        self.nb_widget.connect_after('switch-page', self.on_page_switched)
        self.nb_widget.connect('page-reordered', self.on_page_reordered)

        self._fill_content()

        self.main_vbox.show_all()

        self.__initial_editor = None

        open_file_paths = self.state.get_open_files()
        current_file = self.state.get_current_file()

        for path in open_file_paths:
            if not path in self.notebook.files:
                continue

            file = self.notebook.files[path]
            self.open_file(file)

        current_file_editor = None
        if current_file != None:
            filename = os.path.join(notebook.folder, current_file)
            for editor in self.editors:
                if editor.filename == filename:
                    current_file_editor = editor

        if current_file_editor == None and len(self.editors) > 0:
            current_file_editor = self.editors[0]

        if current_file_editor != None:
            self._make_editor_current(current_file_editor)
            current_file_editor.view.grab_focus()

        self.__update_title()
    def _add_actions(self, action_group):
        BaseWindow._add_actions(self, action_group)

        action_group.add_actions([
            ('notebook-properties', gtk.STOCK_PROPERTIES, "Notebook Prop_erties", None,         None, self.on_notebook_properties),
            ('new-worksheet',       gtk.STOCK_NEW,        "_New Worksheet",       "<control>n", None, self.on_new_worksheet),
            ('new-library',         gtk.STOCK_NEW,        "New _Library",         "",           None, self.on_new_library),
            ('calculate-all',       gtk.STOCK_REFRESH,    "Calculate _All",       "<control><alt>Return",  None, self.on_calculate_all),
            ('switch-tab-1',        None,                 None,                   "<alt>1",     None, self.on_switch_tab),
            ('switch-tab-2',        None,                 None,                   "<alt>2",     None, self.on_switch_tab),
            ('switch-tab-3',        None,                 None,                   "<alt>3",     None, self.on_switch_tab),
            ('switch-tab-4',        None,                 None,                   "<alt>4",     None, self.on_switch_tab),
            ('switch-tab-5',        None,                 None,                   "<alt>5",     None, self.on_switch_tab),
            ('switch-tab-6',        None,                 None,                   "<alt>6",     None, self.on_switch_tab),
            ('switch-tab-7',        None,                 None,                   "<alt>7",     None, self.on_switch_tab),
            ('switch-tab-8',        None,                 None,                   "<alt>8",     None, self.on_switch_tab),
            ('switch-tab-9',        None,                 None,                   "<alt>9",     None, self.on_switch_tab),
            ('switch-tab-10',       None,                 None,                   "<alt>0",     None, self.on_switch_tab)
        ])
    def _add_actions(self, action_group):
        BaseWindow._add_actions(self, action_group)

        action_group.add_actions([
            ('notebook-properties', gtk.STOCK_PROPERTIES,
             "Notebook Prop_erties", None, None, self.on_notebook_properties),
            ('new-worksheet', gtk.STOCK_NEW, "_New Worksheet", "<control>n",
             None, self.on_new_worksheet),
            ('new-library', gtk.STOCK_NEW, "New _Library", "", None,
             self.on_new_library),
            ('calculate-all', gtk.STOCK_REFRESH, "Calculate _All",
             "<control><alt>Return", None, self.on_calculate_all),
            ('switch-tab-1', None, None, "<alt>1", None, self.on_switch_tab),
            ('switch-tab-2', None, None, "<alt>2", None, self.on_switch_tab),
            ('switch-tab-3', None, None, "<alt>3", None, self.on_switch_tab),
            ('switch-tab-4', None, None, "<alt>4", None, self.on_switch_tab),
            ('switch-tab-5', None, None, "<alt>5", None, self.on_switch_tab),
            ('switch-tab-6', None, None, "<alt>6", None, self.on_switch_tab),
            ('switch-tab-7', None, None, "<alt>7", None, self.on_switch_tab),
            ('switch-tab-8', None, None, "<alt>8", None, self.on_switch_tab),
            ('switch-tab-9', None, None, "<alt>9", None, self.on_switch_tab),
            ('switch-tab-10', None, None, "<alt>0", None, self.on_switch_tab)
        ])
Beispiel #16
0
    def __init__(self, builder, reg, regset_name, project):

        BaseWindow.__init__(self)
        if not WEBKIT:
            return

        if SummaryWindow.window is None:
            SummaryWindow.window = builder.get_object("summary_window")
            self.configure(SummaryWindow.window)
            SummaryWindow.wkit = webkit.WebView()
            SummaryWindow.container = builder.get_object('summary_scroll')
            SummaryWindow.container.add(SummaryWindow.wkit)
            SummaryWindow.button = builder.get_object('close_button')
            SummaryWindow.button.connect('clicked', self.hide)
            SummaryWindow.window.connect('destroy', self.destroy)
            SummaryWindow.window.connect('delete_event', self.delete)

        reg_info = regenerate.extras.RegisterRst(reg, regset_name, project,
                                                 show_uvm=True)

        SummaryWindow.wkit.load_string(reg_info.html_css(), "text/html",
                                       "utf-8", "")
        SummaryWindow.window.show_all()
    def _add_actions(self, action_group):
        BaseWindow._add_actions(self, action_group)

        action_group.add_actions([("save-as", gtk.STOCK_SAVE_AS, None, None, None, self.on_save_as)])
Beispiel #18
0
    def _close_window(self):
        if not self.current_editor.confirm_discard():
            return True

        BaseWindow._close_window(self)
    def _close_window(self):
        if not self._confirm_discard():
            return

        BaseWindow._close_window(self)