Package: jupyter-qtconsole
Version: 4.2.1-3
Severity: normal

Dear Maintainer,

Clicking on the "Print" menu item of QtConsole interface leads to a
crash with the following error:
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/qtconsole/console_widget.py",
> line 747, in print_ printer = QtGui.QPrinter()
> AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QPrinter'

Since it is apparently due to referring to obsolete module organization
when loading python modules to support printing, the follwing patch
seems to fix the issue:

--- /usr/lib/python3/dist-packages/qtconsole/console_widget.py.bak
2017-01-23 12:02:59.704432492 +0100
+++ /usr/lib/python3/dist-packages/qtconsole/console_widget.py
2017-01-23 12:11:55.789095501 +0100 @@ -12,6 +12,7 @@ import webbrowser
from qtconsole.qt import QtCore, QtGui +from PyQt5 import QtPrintSupport
 
 from traitlets.config.configurable import LoggingConfigurable
 from qtconsole.rich_text import HtmlExporter
@@ -744,8 +745,8 @@
         """ Print the contents of the ConsoleWidget to the specified
QPrinter. """
         if (not printer):
-            printer = QtGui.QPrinter()
-            if(QtGui.QPrintDialog(printer).exec_() !=
QtGui.QDialog.Accepted):
+            printer = QtPrintSupport.QPrinter()
+            if(QtPrintSupport.QPrintDialog(printer).exec() !=
QtGui.QDialog.Accepted): return self._control.print_(printer)


After applying such changes, test runs to print to a PDF file have been
successful.

Regards,

J.-S. Kroll-Rabotin


-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages jupyter-qtconsole depends on:
ii  jupyter-core       4.2.1-1
ii  python3-qtconsole  4.2.1-3
pn  python3:any        <none>

jupyter-qtconsole recommends no packages.

jupyter-qtconsole suggests no packages.

-- no debconf information

Attachment: pgpnZlImk_Rn2.pgp
Description: Signature digitale OpenPGP

_______________________________________________
Python-modules-team mailing list
Python-modules-team@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team

Reply via email to