[GRASS-dev] [GRASS GIS] #1959: wingrass wx carto composer: Image causes traceback

#1959: wingrass wx carto composer: Image causes traceback
-----------------------------------+----------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------------------+----------------------------------------
Hi,

testing latest 6.5svn nightly wingrass build.

If you open the wxGUI cartographic composer and pick 'add map element'
then "Image" (better to call that 'map decorations'?; better to make menu
item "EPS Image" than lead user down a false path?) you get the following
PyAssertionError in the wxGUI command console:

{{{
Traceback (most recent call last):
   File "C:\Program Files\GRASS GIS 6.5.svn\Python27\lib
\site-packages\wx-2.8-msw-
unicode\wx\lib\filebrowsebutton.py", line 140, in OnChanged

self.changeCallback(evt)
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4272, in
OnDirChanged

self.OnImageSelectionChanged(None)
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4304, in
OnImageSelectionChanged

self.ClearPreview()
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4386, in
ClearPreview

mask = wx.Mask(buffer, wx.WHITE)
   File "C:\Program Files\GRASS GIS 6.5.svn\Python27\lib
\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 1212, in
__init__

_gdi_.Mask_swiginit(self,_gdi_.new_Mask(*args, **kwargs))
wx._core
.
PyAssertionError
:
C++ assertion "!bitmap.GetSelectedInto()" failed at
..\..\src\msw\bitmap.cpp(1509) in wxMask::Create(): bitmap
can't be selected in another DC
Traceback (most recent call last):
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\frame.py", line 663, in
OnAddImage

dlg = ImageDialog(self, id = id, settings =
self.instruction)
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4093, in
__init__

self.OnDirChanged(None)
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4272, in
OnDirChanged

self.OnImageSelectionChanged(None)
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4304, in
OnImageSelectionChanged

self.ClearPreview()
   File "c:\Program Files\GRASS GIS
6.5.svn\etc\wxpython\psmap\dialogs.py", line 4386, in
ClearPreview

mask = wx.Mask(buffer, wx.WHITE)
   File "C:\Program Files\GRASS GIS 6.5.svn\Python27\lib
\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 1212, in
__init__

_gdi_.Mask_swiginit(self,_gdi_.new_Mask(*args, **kwargs))
wx._core
.
PyAssertionError
:
C++ assertion "!bitmap.GetSelectedInto()" failed at
..\..\src\msw\bitmap.cpp(1509) in wxMask::Create(): bitmap
can't be selected in another DC
}}}

and no image selection gui window. On my linux it works.

thanks,
Hamish

(trac logging itself out every 5 minutes! argh)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1959&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------
Changes (by hamish):

  * keywords: cartographic composer => cartographic composer, wingrass

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1959#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------

Comment(by annakrat):

Please try r56120.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1959#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------

Comment(by annakrat):

Replying to [comment:2 annakrat]:
> Please try r56120.
OK, this works. However we have different problem now. Apart from missing
refresh of the image in the dialog (hopefully fixed in r56133), I get
'IOError: error when accessing file' when I select eps file. See this
[http://mail.python.org/pipermail/image-sig/2004-April/002722.html
question]. This is problem for the eps files like grasslogo.eps or
compass_in/exterior.eps because they don't have 'showpage' command inside
unlike the newer eps north arrows. Adding this command would probably
solve the problem, but I am not sure if it safe. EPS
[http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
specification] allows it.

Another error when drawing eps in draft mode (r56134).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1959#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------

Comment(by annakrat):

Fixes r56120, r56121 (from #1960), r56133, r56134 seems to work, applied
to 64 and 7 (r56135, r56136).

Still there is the issue with 'showpage' related to certain eps files.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1959#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------

Comment(by hamish):

Replying to [comment:4 annakrat]:

> Still there is the issue with 'showpage' related to certain eps files.

thanks for the fixes, will try them out tomorrow.

I don't really enjoy the idea of modifying base data to work around a bug
in PIL, I'd much prefer if the python people were encouraged into fixing
their own bug. The whole point of EPS is to be a page-less version of
PostScript, so adding a form feed end-of-page command to it seems like an
ugly solution to me. Nonetheless, the `eps2eps` program adds showpages to
them, and the authors of that know better than I do about it. Does it work
to just do:
{{{
   echo " showpage" >> file.eps
}}}
?

What happens within the north arrow .eps files in ps/ps.map/decorations/
doesn't much bother me since I plan to replace them with native grass
symbol versions anyway. :slight_smile: (so they render more cleanly, can be used in
the regular GUI map display with d.graph, etc.)

btw, I've been meaning to respond properly to an old email: the symbol
sections grew somewhat organically from Radim's original set, rearranging
them into more logical categories in trunk would be a nice thing.
authoring them by hand is not so bad once you get used to it. see the
IconSymbols wiki page, and sketching with some graph paper then counting
off the coordinates helps a lot.

one day we'll get svg + eps + d.graph + grass symbols + ps.map all working
nicely together; it's been on the wish-list for a long time..

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1959#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------

Comment(by hamish):

Fredrik Lundh wrote:
> I'll look into this for 1.1.5.

what version are we shipping with wingrass? (my local python-imaging on
linux is ver 1.1.7)

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1959#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1959: wingrass wx carto composer: Image causes traceback
---------------------------------------------+------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: wxGUI | Version: svn-develbranch6
Keywords: cartographic composer, wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------------------------------+------------------------------

Comment(by annakrat):

Replying to [comment:6 hamish]:
> Fredrik Lundh wrote:
> > I'll look into this for 1.1.5.
>
> what version are we shipping with wingrass? (my local python-imaging on
linux is ver 1.1.7)

1.1.7 too. It's not clear to me why it behaves differently on Windows.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1959#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>