dabo Commit
Revision 5573
Date: 2009-12-29 10:01:43 -0800 (Tue, 29 Dec 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5573
Changed:
U trunk/dabo/ui/uiwx/dImage.py
Log:
Made some changes designed to better support images as data-bound controls.
Also allowed for the image's Picture property to accept a wx.Bitmap as the
image source, as that's what is returned from the clipboard methods.
Diff:
Modified: trunk/dabo/ui/uiwx/dImage.py
===================================================================
--- trunk/dabo/ui/uiwx/dImage.py 2009-12-29 14:32:11 UTC (rev 5572)
+++ trunk/dabo/ui/uiwx/dImage.py 2009-12-29 18:01:43 UTC (rev 5573)
@@ -192,8 +192,13 @@
def _setPic(self, val):
if isinstance(val, wx.Image):
# An image stored as a stream is being used
- self.__image = val
+ self.__image = self.__val = val
self._picture = "(stream)"
+ elif isinstance(val, wx.Bitmap):
+ # a raw bitmap is being supplied
+ self._bmp = val
+ self.__image = self.__val = val.ConvertToImage()
+ self._picture = "(stream)"
else:
pathExists = os.path.exists(val)
if not val:
@@ -201,7 +206,7 @@
self._picture = ""
self._rotation = 0
self._bmp = wx.EmptyBitmap(1, 1, 1)
- self.__image = wx.EmptyImage(1, 1)
# self._bmp.ConvertToImage()
+ self.__image = self.__val = wx.EmptyImage(1, 1)
# self._bmp.ConvertToImage()
self._showPic()
return
elif not pathExists:
@@ -265,12 +270,10 @@
def _getValue(self):
- return self.__val
- try:
- ret = self.__imageData
- except AttributeError:
- ret = self.__imageData = u""
- return ret
+ if self._Image.IsOk():
+ return self._Image.GetData()
+ else:
+ return None
def _setValue(self, val):
if self._constructed():
_______________________________________________
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]