Thread: [PythonReports-users] Images
Brought to you by:
a1s
From: Werner F. B. <wer...@fr...> - 2013-01-02 15:42:43
|
Hi, In my application the user can store images (e.g. wine labels, recipe preparation etc), the images are stored in the file system in a user defined folder and the application just stores the file name. On my recipe report I like to show the image of the "Recipe finished" image if it exists. I was hoping to use a function "getImagePath(THIS.id, 'imgtype') and it comes back with the appropriate full path to the image, in the case of the recipe report it would find the image showing the "finished" stage of the recipe. Looking at the image element I don't see how I could do this, if it is possible could you give me some tips. Werner |
From: alexander s. <al...@go...> - 2013-01-02 16:07:49
|
Werner F. Bruhin wrote, at 02.01.2013 17:44: > > In my application the user can store images (e.g. wine labels, recipe > preparation etc), the images are stored in the file system in a user > defined folder and the application just stores the file name. > > On my recipe report I like to show the image of the "Recipe finished" > image if it exists. > > I was hoping to use a function "getImagePath(THIS.id, 'imgtype') and it > comes back with the appropriate full path to the image, in the case of > the recipe report it would find the image showing the "finished" stage > of the recipe. > > Looking at the image element I don't see how I could do this, if it is > possible could you give me some tips. Sorry, at present there is no way to dynamically compute image file path or bitmap data. That is quite a flaw in the template language. I will have to think of a syntax for such things. So far I've got several ideas, but all of them are either ugly or not backward compatible. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-01-02 16:47:34
|
Hi Alex, On 02/01/2013 17:06, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 02.01.2013 17:44: >> In my application the user can store images (e.g. wine labels, recipe >> preparation etc), the images are stored in the file system in a user >> defined folder and the application just stores the file name. >> >> On my recipe report I like to show the image of the "Recipe finished" >> image if it exists. >> >> I was hoping to use a function "getImagePath(THIS.id, 'imgtype') and it >> comes back with the appropriate full path to the image, in the case of >> the recipe report it would find the image showing the "finished" stage >> of the recipe. >> >> Looking at the image element I don't see how I could do this, if it is >> possible could you give me some tips. > Sorry, at present there is no way to dynamically compute image file path > or bitmap data. Not the end of the world, but would definitely be very very nice if you can come up with something. > > That is quite a flaw in the template language. I will have to think of > a syntax for such things. So far I've got several ideas, but all of > them are either ugly or not backward compatible. Is backward compatibility for something like this that important? Could you create a "dynamic image" element which is ignored by older versions? If you do something can you please allow the program to define what image type is used. Werner |
From: alexander s. <al...@go...> - 2013-01-02 18:39:58
|
Werner F. Bruhin wrote, at 02.01.2013 18:48: >>> >>> Looking at the image element I don't see how I could do this, if it is >>> possible could you give me some tips. >> Sorry, at present there is no way to dynamically compute image file path >> or bitmap data. > Not the end of the world, but would definitely be very very nice if you > can come up with something. As a workaround, you could create a side-effect function that puts image files to a constant path, and then call this function via field or variable expression. Set embed="true" in image element. That is a terribly dirty hack, but for now it seems to be the only solution. >> That is quite a flaw in the template language. I will have to think of >> a syntax for such things. So far I've got several ideas, but all of >> them are either ugly or not backward compatible. > Is backward compatibility for something like this that important? There are people that use PythonReports for many years and I do not want to break all their existing templates if I can avoid that. > Could you create a "dynamic image" element which is ignored by older > versions? > > If you do something can you please allow the program to define what > image type is used. I think I will do it like this: For all body elements, box, and style elements all attributes will be allowed to contain an expression to evaluate in context of current data item. If attribute value is an expression rather than constant, it must be prefixed with equal sign. E.g.: <image file="=picture['file']" type="=picture['type']" /> For data elements, I will add attribute 'expr'; same as with fields, expression evaluation results will take precedence over literal data. This change will surely slow down report building for existing templates. Comments, anyone? Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-01-02 18:51:20
|
On 02/01/2013 19:38, alexander smishlajev wrote: > Werner F. Bruhin wrote, at 02.01.2013 18:48: >>>> Looking at the image element I don't see how I could do this, if it is >>>> possible could you give me some tips. >>> Sorry, at present there is no way to dynamically compute image file path >>> or bitmap data. >> Not the end of the world, but would definitely be very very nice if you >> can come up with something. > As a workaround, you could create a side-effect function that puts image > files to a constant path, and then call this function via field or > variable expression. Set embed="true" in image element. > > That is a terribly dirty hack, but for now it seems to be the only solution. > >>> That is quite a flaw in the template language. I will have to think of >>> a syntax for such things. So far I've got several ideas, but all of >>> them are either ugly or not backward compatible. >> Is backward compatibility for something like this that important? > There are people that use PythonReports for many years and I do not want > to break all their existing templates if I can avoid that. I call that "forward compatibility", in other words templates created in previous versions will work on future version, but a template created in a newer version will not certainly work or will miss something when run on an older version. > >> Could you create a "dynamic image" element which is ignored by older >> versions? >> >> If you do something can you please allow the program to define what >> image type is used. > I think I will do it like this: > > For all body elements, box, and style elements all attributes will be > allowed to contain an expression to evaluate in context of current data > item. If attribute value is an expression rather than constant, it must > be prefixed with equal sign. E.g.: > > <image file="=picture['file']" type="=picture['type']" /> > > For data elements, I will add attribute 'expr'; same as with fields, > expression evaluation results will take precedence over literal data. > > This change will surely slow down report building for existing templates. Maybe restrict/reduce the change to just "image element" if expect to big slow down. Werner |
From: Werner F. B. <wer...@fr...> - 2013-02-10 13:10:05
|
Hi Alex, This time to the list. On 09/02/2013 16:22, alexander smishlajev wrote: ... > I have added the 'expr' attribute to the 'data' element. Hope that > will cover your needs. Not sure, gave it a try but can't get it to work. My getRecipeImage method returns a PIL.Image instance - what should it return? It also looks like data.expr is NOT saved to the template file, i.e. if I save an reopen it the expression is not there. Can you please give me a little pointer on how to use it. When trying the above I see the following exception - probably because I don't use it correctly. Traceback (most recent call last): File "c:\Python27\lib\site-packages\PythonReports\editor\mainmenu.py", line 131, in OnPreview self.app.pyr_editor_env.report_preview() File "c:\Python27\lib\site-packages\PythonReports\editor\environment.py", line 263, in report_preview _printout = self.report_build() File "c:\Python27\lib\site-packages\PythonReports\editor\environment.py", line 245, in report_build return Builder(_template).run(_data) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 1459, in run self._build(_data_iter, _callback) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 1475, in _build self.fill_title() File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 1634, in fill_title self.start_group(_group) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 1852, in start_group self.add_section(self.build_section(_title)) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 2067, in build_section _section = Section(self, template, _context) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 469, in __init__ self.build(context) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 741, in build _element.image = self.builder.image(_item) File "c:\Python27\lib\site-packages\PythonReports\builder.py", line 1313, in image _image = self.image_driver_factory.nullimage() File "c:\Python27\lib\site-packages\PythonReports\drivers.py", line 157, in nullimage return cls.fromdata(PIXEL) TypeError: fromdata() takes at least 3 arguments (2 given) Thanks Werner |
From: Werner F. B. <wer...@fr...> - 2013-02-10 13:27:30
|
Hi Alex, expr gets saved, I just didn't check _enable, but now I get the following exception, when I have the following for 'image': <image embed="false" type="png"> <box height="30" width="75" x="405" y="35" /> <data expr="ru.getRecipeImage(THIS.id)"></data> </image> I keep digging through the doc etc, a pointer would obviously be very welcome. Werner AttributeError: 'NoneType' object has no attribute 'strip' File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 555, in <module> dlg.ShowModal() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_windows.py", line 805, in ShowModal return _windows_.Dialog_ShowModal(*args, **kwargs) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 434, in OnLeftUp self.Notify() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 864, in Notify self.GetEventHandler().ProcessEvent(evt) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_core.py", line 4154, in ProcessEvent return _core_.EvtHandler_ProcessEvent(*args, **kwargs) File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 375, in doReportDesign env.report_open(self.getReportFile()) File "c:\Python27\Lib\site-packages\PythonReports\editor\environment.py", line 201, in report_open templateloader.load_template(_template, _report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 23, in load_template load_report(template.getroot(), report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 42, in load_report load_groups(_xml_layout, report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 92, in load_groups load_group(_xml_group, report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 107, in load_group load_section_pair(xml_group, _report_group, (te.Title.tag, te.Summary.tag)) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 113, in load_section_pair section_pair.get_first()) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 126, in load_one_of_pair load_section(xml_section, report_section) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 135, in load_section load_shapes(xml_section, report_section) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 170, in load_shapes SHAPES_LINK[_section_child.tag]) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 191, in load_shape load_one_validator(_xml_data, _shape, te.Data) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 222, in load_one_validator XmlBody(xml_elmnt.text.strip())) |
From: Werner F. B. <wer...@fr...> - 2013-02-10 20:09:27
|
On 10/02/2013 18:16, alexander smishlajev wrote: > On 10.02.2013 15:29, Werner F. Bruhin wrote: >> >> expr gets saved > > I guess you are talking about template designer. Sorry, I didn't > think of checking that. I have modified only report building and > checked PDF formatting. > >> I keep digging through the doc etc, a pointer would obviously be very >> welcome. > > The data returnded from expr is image data - same as would be returned > by reading an image file. Hhm, unless I still do something wrong - quit likely, here is what I get: Changed things to: def getRecipeImagePNG(recid): """ Return a PIL.Image instance of the first image found of type "Recipe finished" (fk_exttype_id=4), or an empty image :param str `recid`: the recipe id :return: Image full path or None """ if recid: app = wx.GetApp() ds = app.ds imgF = app.getDirLocations()[5] with no_autoflush(ds): extfiler = ds.query(db.Extfiler).filter_by(fk_recipe_id = recid, fk_exttype_id = 4).first() if extfiler: img = Image.open(os.path.join(imgF, extfiler.filename)) else: # return a blank one if none is found bDir = os.path.join(wx.GetApp().baseDir, "images") bImg = os.path.join(bDir, "blankImage.jpg") img = Image.open(bImg) buf= StringIO.StringIO() img.save(buf, format= 'PNG') temp = buf.getvalue() return temp The image element is: <image type="png"> <box height="30" width="75" x="374" y="50" /> <data> expr="ru.getRecipeImagePNG(THIS.id)"</data> </image> But I get this traceback: IOError: cannot identify image file File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 555, in <module> dlg.ShowModal() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_windows.py", line 805, in ShowModal return _windows_.Dialog_ShowModal(*args, **kwargs) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 434, in OnLeftUp self.Notify() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 864, in Notify self.GetEventHandler().ProcessEvent(evt) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_core.py", line 4154, in ProcessEvent return _core_.EvtHandler_ProcessEvent(*args, **kwargs) File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 345, in doReportPreview env.report_preview() File "c:\Python27\Lib\site-packages\PythonReports\editor\environment.py", line 263, in report_preview _printout = self.report_build() File "c:\Python27\Lib\site-packages\PythonReports\editor\environment.py", line 245, in report_build return Builder(_template).run(_data) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 1459, in run self._build(_data_iter, _callback) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 1475, in _build self.fill_title() File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 1634, in fill_title self.start_group(_group) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 1852, in start_group self.add_section(self.build_section(_title)) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 2067, in build_section _section = Section(self, template, _context) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 469, in __init__ self.build(context) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 741, in build _element.image = self.builder.image(_item) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 1321, in image img_type=_type) File "c:\Python27\Lib\site-packages\PythonReports\PILDrivers.py", line 92, in fromdata _rv._image = Image.open(StringIO(data)) File "c:\Python27\Lib\site-packages\PIL\Image.py", line 1980, in open raise IOError("cannot identify image file") And "data" in fromdata at line 92 is my expression string instead of the image data, as if the expression is never "run". data u'expr="ru.getRecipeImagePNG(THIS.id)"' Hope I am clear and not doing something stupid. Anyhow it is late, I will look at this again tomorrow. Werner |
From: alexander s. <al...@go...> - 2013-02-11 07:32:51
|
On 10.02.2013 22:10, Werner F. Bruhin wrote: > > buf= StringIO.StringIO() > img.save(buf, format= 'PNG') > temp = buf.getvalue() > return temp This should be Ok. > The image element is: > > <image type="png"> > <box height="30" width="75" x="374" y="50" /> > <data> expr="ru.getRecipeImagePNG(THIS.id)"</data> > </image> > > But I get this traceback: > File "c:\Python27\Lib\site-packages\PythonReports\PILDrivers.py", line > 92, in fromdata > _rv._image = Image.open(StringIO(data)) > File "c:\Python27\Lib\site-packages\PIL\Image.py", line 1980, in open > raise IOError("cannot identify image file") > > And "data" in fromdata at line 92 is my expression string instead of the > image data, as if the expression is never "run". > > data > u'expr="ru.getRecipeImagePNG(THIS.id)"' But of course! Try <data expr="ru.getRecipeImagePNG(THIS.id)" /> Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-02-11 07:52:33
|
On 11/02/2013 07:49, alexander smishlajev wrote: > On 10.02.2013 22:10, Werner F. Bruhin wrote: >> buf= StringIO.StringIO() >> img.save(buf, format= 'PNG') >> temp = buf.getvalue() >> return temp > This should be Ok. > >> The image element is: >> >> <image type="png"> >> <box height="30" width="75" x="374" y="50" /> >> <data> expr="ru.getRecipeImagePNG(THIS.id)"</data> >> </image> >> >> But I get this traceback: >> File "c:\Python27\Lib\site-packages\PythonReports\PILDrivers.py", line >> 92, in fromdata >> _rv._image = Image.open(StringIO(data)) >> File "c:\Python27\Lib\site-packages\PIL\Image.py", line 1980, in open >> raise IOError("cannot identify image file") >> >> And "data" in fromdata at line 92 is my expression string instead of the >> image data, as if the expression is never "run". >> >> data >> u'expr="ru.getRecipeImagePNG(THIS.id)"' > But of course! Try <data expr="ru.getRecipeImagePNG(THIS.id)" /> Sorry, to confuse you, the file contains: <image type="png"> <box height="30" width="75" x="374" y="50" /> <data> expr="ru.getRecipeImagePNG(THIS.id)"</data> </image> When I run it through the debugger (WingIDE) I see at line 92 of fromdata in PILDrivers that the param "data" contains: u'expr="ru.getRecipeImagePNG(THIS.id)"' As if the expression has never been evaluated (correct term), i.e. my getRecipeImagePNG method is never called. Werner |
From: alexander s. <al...@go...> - 2013-02-11 08:08:36
|
On 11.02.2013 9:54, Werner F. Bruhin wrote: >> >> Try <data expr="ru.getRecipeImagePNG(THIS.id)" /> > > Sorry, to confuse you, the file contains: > > <image type="png"> > <box height="30" width="75" x="374" y="50" /> > <data> expr="ru.getRecipeImagePNG(THIS.id)"</data> > </image> > > When I run it through the debugger (WingIDE) I see at line 92 of fromdata in PILDrivers that the > param "data" contains: > > u'expr="ru.getRecipeImagePNG(THIS.id)"' > > As if the expression has never been evaluated (correct term) Indeed it is not evaluated. It shouldn't be, with your template contents. Please change the <data> line to <data expr="ru.getRecipeImagePNG(THIS.id)" /> Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-02-11 09:02:21
|
On 11/02/2013 09:05, alexander smishlajev wrote: ... > Indeed it is not evaluated. It shouldn't be, with your template > contents. Please change the <data> line to <data > expr="ru.getRecipeImagePNG(THIS.id)" /> Explains why I like to use the designer. I have this for my image: <image type="png"> <box height="30" width="75" x="374" y="50" /> <data expr="ru.getRecipeImagePNG(THIS.id)" /> </image> And I see this exception, not that my breakpoint in the getRecipeImagePNG is still never hit. AttributeError: 'NoneType' object has no attribute 'strip' File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 555, in <module> dlg.ShowModal() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_windows.py", line 805, in ShowModal return _windows_.Dialog_ShowModal(*args, **kwargs) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 434, in OnLeftUp self.Notify() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 864, in Notify self.GetEventHandler().ProcessEvent(evt) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_core.py", line 4154, in ProcessEvent return _core_.EvtHandler_ProcessEvent(*args, **kwargs) File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 340, in doReportPreview env.report_open(self.getReportFile()) File "c:\Python27\Lib\site-packages\PythonReports\editor\environment.py", line 201, in report_open templateloader.load_template(_template, _report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 23, in load_template load_report(template.getroot(), report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 42, in load_report load_groups(_xml_layout, report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 92, in load_groups load_group(_xml_group, report) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 107, in load_group load_section_pair(xml_group, _report_group, (te.Title.tag, te.Summary.tag)) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 113, in load_section_pair section_pair.get_first()) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 126, in load_one_of_pair load_section(xml_section, report_section) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 135, in load_section load_shapes(xml_section, report_section) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 170, in load_shapes SHAPES_LINK[_section_child.tag]) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 191, in load_shape load_one_validator(_xml_data, _shape, te.Data) File "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", line 222, in load_one_validator XmlBody(xml_elmnt.text.strip())) Best regards Werner |
From: alexander s. <al...@go...> - 2013-02-11 09:11:48
|
On 11.02.2013 11:03, Werner F. Bruhin wrote: > >> Indeed it is not evaluated. It shouldn't be, with your template >> contents. Please change the <data> line to <data >> expr="ru.getRecipeImagePNG(THIS.id)" /> > > Explains why I like to use the designer. Matter of preference. I find it much easier to understand in XML. > And I see this exception, not that my breakpoint in the > getRecipeImagePNG is still never hit. > > AttributeError: 'NoneType' object has no attribute 'strip' > "c:\Python27\Lib\site-packages\PythonReports\editor\templateloader.py", > line 222, in load_one_validator > XmlBody(xml_elmnt.text.strip())) Could you try a fresh checkout? I hope I have fixed this error. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-02-11 09:23:43
|
On 11/02/2013 10:10, alexander smishlajev wrote: > On 11.02.2013 11:03, Werner F. Bruhin wrote: >>> Indeed it is not evaluated. It shouldn't be, with your template >>> contents. Please change the <data> line to <data >>> expr="ru.getRecipeImagePNG(THIS.id)" /> >> Explains why I like to use the designer. > Matter of preference. I find it much easier to understand in XML. I am lousy in remembering syntax. My method is being called now - great, once per recipe, 3 for the test. But then I get this exception: NameError: global name 'Data' is not defined File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 555, in <module> dlg.ShowModal() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_windows.py", line 805, in ShowModal return _windows_.Dialog_ShowModal(*args, **kwargs) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 434, in OnLeftUp self.Notify() File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 864, in Notify self.GetEventHandler().ProcessEvent(evt) File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_core.py", line 4154, in ProcessEvent return _core_.EvtHandler_ProcessEvent(*args, **kwargs) File "c:\dev\twcbv4\twcbsrc\controllers\dreports.py", line 345, in doReportPreview env.report_preview() File "c:\Python27\Lib\site-packages\PythonReports\editor\environment.py", line 263, in report_preview _printout = self.report_build() File "c:\Python27\Lib\site-packages\PythonReports\editor\environment.py", line 245, in report_build return Builder(_template).run(_data) File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 1461, in run return self.build_printout() File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line 2363, in build_printout Data.make_element(_root, data=_image.getdata(), Best regards and thanks for the quick turn around and the help on this. Werner |
From: alexander s. <al...@go...> - 2013-02-11 09:31:00
|
On 11.02.2013 11:25, Werner F. Bruhin wrote: > > NameError: global name 'Data' is not defined > File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line > 1461, in run > return self.build_printout() > File "c:\Python27\Lib\site-packages\PythonReports\builder.py", line > 2363, in build_printout > Data.make_element(_root, data=_image.getdata(), Sorry, this one slipped through. I have checked in a fix. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-02-11 09:35:39
|
Hi Alex, line 213 in wxPrint.drawImage needs to change to: _data = prp.Data.get_data(_data) line 92 in wxPrint.__init__: self.imgdata = dict([(_element.get("name"), prp.Data.get_data(_element)) and line 2363 in Builder.build_printout prp.Data.make_element(_root, data=_image.getdata(), I.e. in all change "Data" to "prp.Data" If you prefer I can create you a patch later today. At this point the image shows and the editor opens with out problems. Thanks a lot for this, and PythonReports in general. Werner |
From: alexander s. <al...@go...> - 2013-02-11 09:43:38
|
On 11.02.2013 11:37, Werner F. Bruhin wrote: > > line 213 in wxPrint.drawImage needs to change to: > _data = prp.Data.get_data(_data) > > line 92 in wxPrint.__init__: > self.imgdata = dict([(_element.get("name"), > prp.Data.get_data(_element)) > > and line 2363 in Builder.build_printout > prp.Data.make_element(_root, data=_image.getdata(), Did it. Thank you very much. Best wishes, alex. |