Skip to content

Commit

Permalink
BUG: Fix linux clipboard QApplication() creation
Browse files Browse the repository at this point in the history
closes pandas-dev#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 <[email protected]>

Closes pandas-dev#14815 from pankajp/patch-2 and squashes the following commits:

40d70f9 [Pankaj Pandey] BUG: Fix linux clipboard QApplication() creation
  • Loading branch information
pankajp authored and jreback committed Mar 20, 2017
1 parent bd24926 commit b1e29db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
3 changes: 2 additions & 1 deletion pandas/util/clipboard/clipboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b1e29db

Please sign in to comment.