dabo Commit
Revision 6895
Date: 2011-10-12 14:51:40 -0700 (Wed, 12 Oct 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6895

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

Log:
This change to dImage lets me set Picture to a buffer, such as what I
get from my sqlite BLOB field, and the wx.Image is created and 
served up.

I still don't understand how to bind the control directly to my bizobj
and interact directly with the Value property instead of Picture.



Diff:
Modified: trunk/dabo/ui/uiwx/dImage.py
===================================================================
--- trunk/dabo/ui/uiwx/dImage.py        2011-10-12 21:13:12 UTC (rev 6894)
+++ trunk/dabo/ui/uiwx/dImage.py        2011-10-12 21:51:40 UTC (rev 6895)
@@ -1,9 +1,9 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
+import cStringIO
 import imghdr
 import os
-import tempfile
 
 import wx
 import dabo
@@ -264,6 +264,12 @@
                        self._bmp = val
                        self.__image = self.__val = val.ConvertToImage()
                        self._picture = "(stream)"
+               elif isinstance(val, buffer):
+                       val = cStringIO.StringIO(val)
+                       img = wx.EmptyImage()
+                       img.LoadStream(val)
+                       self._setPicture(img)
+                       return
                else:
                        pathExists = os.path.exists(val)
                        if not val:



_______________________________________________
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