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)
Пример #3
0
    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)
Пример #4
0
    def _close_window(self):
        if not self._confirm_discard():
            return

        BaseWindow._close_window(self)
Пример #5
0
    def _close_window(self):
        if not self.current_editor.confirm_discard():
            return True

        BaseWindow._close_window(self)