# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1530097023 -10800
# Node ID 32445e3c9cfc07ecd4abf746f92058df8fae6473
# Parent  3220dd020675e6da25a694b3e9204a157e60da53
Catch 'clipboard already open' errors in editors

Apparently following commits have not fixed the problem completely,
because it still happens (although not so often).

changeset:   2019:b8f795bdfe9f
user:        Andrey Skvortsov <andrej.skvortzov@gmail.com>
date:        Fri May 25 17:40:29 2018 +0300
summary:     fix hangs on mouse selection in case if wxPython uses wxWidgets with GTK3+ support

changeset:   2018:5ce6d08ff2c7
user:        Andrey Skvortsov <andrej.skvortzov@gmail.com>
date:        Fri May 25 17:23:15 2018 +0300
summary:     make clipboard open minimal time as wxPython documentation recommends

diff -r 3220dd020675 -r 32445e3c9cfc IDEFrame.py
--- a/IDEFrame.py	Wed Jun 27 10:58:45 2018 +0300
+++ b/IDEFrame.py	Wed Jun 27 13:57:03 2018 +0300
@@ -944,7 +944,11 @@
         if not wx.TheClipboard.IsOpened():
             dataobj = wx.TextDataObject()
             if wx.TheClipboard.Open():
-                success = wx.TheClipboard.GetData(dataobj)
+                success = False
+                try:
+                    success = wx.TheClipboard.GetData(dataobj)
+                except wx._core.PyAssertionError:
+                    pass
                 wx.TheClipboard.Close()
                 if success:
                     data = dataobj.GetText()