How to use the qtconsole.qt.QtGui.QApplication function in qtconsole

To help you get started, we’ve selected a few qtconsole examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyter / qtconsole / qtconsole / frontend_widget.py View on Github external
text = self._control.textCursor().selection().toPlainText()
            if text:
                # Remove prompts.
                lines = text.splitlines()
                lines = map(self._highlighter.transform_classic_prompt, lines)
                lines = map(self._highlighter.transform_ipy_prompt, lines)
                text = '\n'.join(lines)
                # Needed to prevent errors when copying the prompt.
                # See issue 264
                try:
                    was_newline = text[-1] == '\n'
                except IndexError:
                    was_newline = False
                if was_newline:  # user doesn't need newline
                    text = text[:-1]
                QtGui.QApplication.clipboard().setText(text)
        else:
            self.log.debug("frontend widget : unknown copy target")
github jupyter / qtconsole / qtconsole / svg.py View on Github external
def svg_to_clipboard(string):
    """ Copy a SVG document to the clipboard.

    Parameters
    ----------
    string : basestring
        A Python string containing a SVG document.
    """
    if isinstance(string, unicode_type):
        string = string.encode('utf-8')

    mime_data = QtCore.QMimeData()
    mime_data.setData('image/svg+xml', string)
    QtGui.QApplication.clipboard().setMimeData(mime_data)
github jupyter / qtconsole / qtconsole / qtconsoleapp.py View on Github external
def init_qt_app(self):
        # separate from qt_elements, because it must run first
        self.app = QtGui.QApplication(['jupyter-qtconsole'])
        self.app.setApplicationName('jupyter-qtconsole')
github 3fon3fonov / exostriker / lib / Jupyter_emb_new.py View on Github external
def print_text(self, text):
        """
        Prints some plain text to the console
        """
        self._append_plain_text(text)

    def execute_command(self, command):
        """
        Execute a command in the frame of the console widget
        """
        self._execute(command, False)


if __name__ == '__main__':
    app = QtGui.QApplication([])
    widget = ConsoleWidget_embed()
    widget.show()
    app.exec_()
github SanPen / GridCal / src / GridCal / Gui / ConsoleWidget.py View on Github external
def print_text(self, text):
        """
        Prints some plain text to the console
        """
        self._append_plain_text(text)

    def execute_command(self, command):
        """
        Execute a command in the frame of the console widget
        """
        self._execute(command, False)


if __name__ == '__main__':
    app = QtGui.QApplication([])
    widget = ConsoleWidget()
    widget.show()
    app.exec_()
github jupyter / qtconsole / qtconsole / rich_jupyter_widget.py View on Github external
def _copy_image(self, name):
        """ Copies the ImageResource with 'name' to the clipboard.
        """
        image = self._get_image(name)
        QtGui.QApplication.clipboard().setImage(image)
github 3fon3fonov / exostriker / exostriker / lib / old / Jupyter_emb2.py View on Github external
kernel_manager = QtInProcessKernelManager()
    kernel_manager.start_kernel(show_banner=False)
    kernel = kernel_manager.kernel
    kernel.gui = 'qt4'

    kernel_client = kernel_manager.client()
    kernel_client.start_channels()

    ipython_widget = RichJupyterWidget()
    ipython_widget.kernel_manager = kernel_manager
    ipython_widget.kernel_client = kernel_client
    ipython_widget.show()


if __name__ == "__main__":
    app = QtGui.QApplication([])
    show()
    app.exec_()