Exemplo n.º 1
0
    def _create_terminal(self):

        if self._terminal is not None:  # already set up
            return

        if hasattr(self, '_terminal_exception'):  # already failed to set up
            return

        self._terminal_button = QtWidgets.QToolButton(self._ui)
        self._terminal_button.setToolTip("Toggle IPython Prompt")
        i = get_icon('IPythonConsole')
        self._terminal_button.setIcon(i)
        self._terminal_button.setIconSize(QtCore.QSize(25, 25))

        self._layer_widget.ui.button_row.addWidget(self._terminal_button)

        try:
            widget = glue_terminal(data_collection=self._data,
                                   dc=self._data,
                                   hub=self._hub,
                                   session=self.session,
                                   application=self,
                                   **vars(env))
        except IPythonTerminalError as exc:
            self._terminal = None
            self._terminal_button.setEnabled(False)
            self._terminal_button.setToolTip(str(exc))
            self._terminal_exception = str(exc)
            return

        self._terminal_button.clicked.connect(self._toggle_terminal)
        self._terminal = self.add_widget(widget)
        self._hide_terminal()
Exemplo n.º 2
0
    def _create_terminal(self):
        if self._terminal is not None:  # already set up
            return

        if hasattr(self, '_terminal_exception'):  # already failed to set up
            return

        self._terminal_button = QtGui.QToolButton(self._ui)
        self._terminal_button.setToolTip("Toggle IPython Prompt")
        i = get_icon('IPythonConsole')
        self._terminal_button.setIcon(i)
        self._terminal_button.setIconSize(QtCore.QSize(25, 25))

        self._layer_widget.ui.button_row.addWidget(self._terminal_button)

        try:
            from glue.app.qt.terminal import glue_terminal
            widget = glue_terminal(data_collection=self._data,
                                   dc=self._data,
                                   hub=self._hub,
                                   session=self.session,
                                   application=self,
                                   **vars(env))
            self._terminal_button.clicked.connect(self._toggle_terminal)
        except Exception as e:  # pylint: disable=W0703
            import traceback
            self._terminal_exception = traceback.format_exc()
            self._setup_terminal_error_dialog(e)
            return

        self._terminal = self.add_widget(widget, label='IPython')
        self._hide_terminal()
Exemplo n.º 3
0
    def _create_terminal(self):
        if self._terminal is not None:  # already set up
            return

        if hasattr(self, '_terminal_exception'):  # already failed to set up
            return

        self._terminal_button = QtWidgets.QToolButton(self._ui)
        self._terminal_button.setToolTip("Toggle IPython Prompt")
        i = get_icon('IPythonConsole')
        self._terminal_button.setIcon(i)
        self._terminal_button.setIconSize(QtCore.QSize(25, 25))

        self._layer_widget.ui.button_row.addWidget(self._terminal_button)

        try:
            from glue.app.qt.terminal import glue_terminal
            widget = glue_terminal(data_collection=self._data,
                                   dc=self._data,
                                   hub=self._hub,
                                   session=self.session,
                                   application=self,
                                   **vars(env))
            self._terminal_button.clicked.connect(self._toggle_terminal)
        except Exception as e:  # pylint: disable=W0703
            import traceback
            self._terminal_exception = traceback.format_exc()
            self._setup_terminal_error_dialog(e)
            return

        self._terminal = self.add_widget(widget, label='IPython')
        self._hide_terminal()
Exemplo n.º 4
0
    def _create_terminal(self):

        if self._terminal is not None:  # already set up
            return

        if hasattr(self, '_terminal_exception'):  # already failed to set up
            return

        self._terminal_button = QtWidgets.QToolButton(self._ui)
        self._terminal_button.setToolTip("Toggle IPython Prompt")
        i = get_icon('IPythonConsole')
        self._terminal_button.setIcon(i)
        self._terminal_button.setIconSize(QtCore.QSize(25, 25))

        self._layer_widget.ui.button_row.addWidget(self._terminal_button)

        try:
            widget = glue_terminal(data_collection=self._data,
                                   dc=self._data,
                                   hub=self._hub,
                                   session=self.session,
                                   application=self,
                                   **vars(env))
        except IPythonTerminalError as exc:
            self._terminal = None
            self._terminal_button.setEnabled(False)
            self._terminal_button.setToolTip(str(exc))
            self._terminal_exception = str(exc)
            return

        self._terminal_button.clicked.connect(self._toggle_terminal)
        self._terminal = self.add_widget(widget)
        self._hide_terminal()
Exemplo n.º 5
0
    def _create_terminal(self):

        if self._terminal is not None:  # already set up
            return

        widget = glue_terminal(data_collection=self._data,
                               dc=self._data,
                               hub=self._hub,
                               session=self.session,
                               application=self,
                               **vars(env))

        self._terminal = self.add_widget(widget)
        self._terminal.closed.connect(self._on_terminal_close)
        self._hide_terminal()
Exemplo n.º 6
0
    def _create_terminal(self):

        if self._terminal is not None:  # already set up
            return

        try:
            widget = glue_terminal(data_collection=self._data,
                                   dc=self._data,
                                   hub=self._hub,
                                   session=self.session,
                                   application=self,
                                   **vars(env))
        except IPythonTerminalError:
            self._button_ipython.setEnabled(False)
        else:
            self._terminal = self.add_widget(widget)
            self._terminal.closed.connect(self._on_terminal_close)
            self._hide_terminal()
Exemplo n.º 7
0
    def _create_terminal(self):

        if self._terminal is not None:  # already set up
            return

        try:
            widget = glue_terminal(data_collection=self._data,
                                   dc=self._data,
                                   hub=self._hub,
                                   session=self.session,
                                   application=self,
                                   **vars(env))
        except IPythonTerminalError:
            self._button_ipython.setEnabled(False)
        else:
            self._terminal = self.add_widget(widget)
            self._terminal.closed.connect(self._on_terminal_close)
            self._hide_terminal()