dabo Commit
Revision 5577
Date: 2009-12-29 10:05:07 -0800 (Tue, 29 Dec 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5577

Changed:
U   trunk/dabo/ui/uiwx/__init__.py

Log:
Added the convenience methods dabo.ui.copyToClipboard() and 
dabo.ui.getFromClipboard(). They work with both text and bitmap types.


Diff:
Modified: trunk/dabo/ui/uiwx/__init__.py
===================================================================
--- trunk/dabo/ui/uiwx/__init__.py      2009-12-29 18:03:01 UTC (rev 5576)
+++ trunk/dabo/ui/uiwx/__init__.py      2009-12-29 18:05:07 UTC (rev 5577)
@@ -1159,6 +1159,29 @@
        return srcFile
 
 
+def copyToClipboard(val):
+       uiApp.copyToClipboard(val)
+
+
+def getFromClipboard():
+       data = wx.TextDataObject()
+       cb = wx.TheClipboard
+       cb.Open()
+       success = cb.GetData(data)
+       cb.Close()
+       if success:
+               return data.GetText()
+       else:
+               # See if it's bitmap data
+               data = wx.BitmapDataObject()
+               cb.Open()
+               success = cb.GetData(data)
+               cb.Close()
+               if success:
+                       return data.GetBitmap()
+               else:
+                       return None
+
 def _checkForRawXML(srcFile):
        isRawXML = srcFile.strip().startswith("<")
        if not isRawXML:



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to