tests/wiimote/wxglade_hmi@wxglade_hmi/pyfile.xml
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 25 May 2018 17:23:15 +0300
changeset 2166 5ce6d08ff2c7
parent 1157 72d14a74c643
permissions -rw-r--r--
make clipboard open minimal time as wxPython documentation recommends

https://wxpython.org/Phoenix/docs/html/wx.Clipboard.html#wx.Clipboard.GetData

"Call wx.Clipboard.Open to get ownership of the clipboard. If this
operation returns True, you now own the clipboard. Call
wx.Clipboard.SetData to put data on the clipboard, or
wx.Clipboard.GetData to retrieve data from the clipboard. Call
wx.Clipboard.Close to close the clipboard and relinquish ownership.
You should keep the clipboard open only momentarily."

Maybe it makes situation with pretty annoying error 'clipboard already
open' a little bit better.

traceback:
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/BeremizIDE.py", line 955, in OnSaveProjectMenu
self.RefreshAfterSave()
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/BeremizIDE.py", line 946, in RefreshAfterSave
self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/IDEFrame.py", line 926, in _Refresh
self.RefreshFunctions[element]()
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/BeremizIDE.py", line 766, in RefreshEditMenu
IDEFrame.RefreshEditMenu(self)
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/IDEFrame.py", line 1185, in RefreshEditMenu
if self.GetCopyBuffer() is not None:
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/IDEFrame.py", line 956, in GetCopyBuffer
if wx.TheClipboard.Open():
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_misc.py", line 5793, in Open
return _misc_.Clipboard_Open(*args, **kwargs)
<class 'wx._core.PyAssertionError'>: C++ assertion "!m_open" failed at ../src/gtk/clipbrd.cpp(598) in Open(): clipboard already open
1157
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     2
<PyFile>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     3
  <variables/>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     4
  <globals>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     5
<![CDATA[
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     6
from threading import Thread
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     7
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     8
def OnConnectButton(self, event):
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     9
  def OnWiiConnected(mac_addr):
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    10
    self.label_2.SetLabel(
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    11
      "Wiimote %s connected"%mac_addr 
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    12
      if mac_addr else 
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    13
      "Wiimote connection failed !")
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    14
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    15
  def WiiConnected(mac_addr):
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    16
    wx.CallAfter(OnWiiConnected,mac_addr)
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    17
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    18
  Thread(target = Connect_Wiimote, args = (WiiConnected,)).start()
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    19
  self.label_2.SetLabel("Press wiimote 1+2")
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    20
  event.Skip()
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    21
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    22
def OnDisconnectButton(self, event):
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    23
  Disconnect_Wiimote()
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    24
  self.label_2.SetLabel("Wiimote disconnected")
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    25
  event.Skip()
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    26
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    27
]]>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    28
  </globals>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    29
  <init>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    30
<![CDATA[
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    31
]]>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    32
  </init>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    33
  <cleanup>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    34
<![CDATA[
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    35
]]>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    36
  </cleanup>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    37
  <start>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    38
<![CDATA[
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    39
]]>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    40
  </start>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    41
  <stop>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    42
<![CDATA[
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    43
]]>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    44
  </stop>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    45
</PyFile>