From b1e29dba26ff86b826fe0f866182466ae42c0bc5 Mon Sep 17 00:00:00 2001 From: Pankaj Pandey Date: Mon, 20 Mar 2017 09:44:29 -0400 Subject: [PATCH] BUG: Fix linux clipboard QApplication() creation closes #14372 A Qt application cannot instantiate multiple `QApplication` instances, so we create a new `QApplication` only when the global `QApplication.instance()` is None. Author: Pankaj Pandey Closes #14815 from pankajp/patch-2 and squashes the following commits: 40d70f9 [Pankaj Pandey] BUG: Fix linux clipboard QApplication() creation --- doc/source/whatsnew/v0.20.0.txt | 2 +- pandas/util/clipboard/clipboards.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.20.0.txt b/doc/source/whatsnew/v0.20.0.txt index 680aefc4041fb..af0d0d7b04475 100644 --- a/doc/source/whatsnew/v0.20.0.txt +++ b/doc/source/whatsnew/v0.20.0.txt @@ -828,7 +828,7 @@ Bug Fixes - Bug in ``pd.read_msgpack()`` in which ``Series`` categoricals were being improperly processed (:issue:`14901`) - Bug in ``Series.ffill()`` with mixed dtypes containing tz-aware datetimes. (:issue:`14956`) - +- Bug in interactions with ``Qt`` when a ``QtApplication`` already exists (:issue:`14372`) - Bug in ``DataFrame.isin`` comparing datetimelike to empty frame (:issue:`15473`) - Bug in ``Series.where()`` and ``DataFrame.where()`` where array-like conditionals were being rejected (:issue:`15414`) diff --git a/pandas/util/clipboard/clipboards.py b/pandas/util/clipboard/clipboards.py index f73f4f191d577..bd5528334168f 100644 --- a/pandas/util/clipboard/clipboards.py +++ b/pandas/util/clipboard/clipboards.py @@ -50,7 +50,8 @@ def init_qt_clipboard(): # $DISPLAY should exist from PyQt4.QtGui import QApplication - app = QApplication([]) + # use the global instance if it exists + app = QApplication.instance() or QApplication([]) def copy_qt(text): cb = app.clipboard()