[GRASS-dev] [GRASS GIS] #1554: wxGUI Cartographic Composer: preview broken on Windows

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:19 wenzeslaus]:
> Replying to [comment:18 hamish]:
> > Along the line to make it more obvious: how about if the initial
preview document loaded a dummy graphic which had a picture of the green
triangle button circled and an arrow pointing NW saying "click up there to
generate preview".
> > ?
> >
> Good idea. Generally, we should try to add some hints this and there in
the GUI to guide user what to do, what does this and that mean.

I added a message (r55118) which is shown in the statusbar when switching
to preview tab. It might be enough? Feel free to improve the message if it
sounds strange.

Anna

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by hamish):

Replying to [comment:20 annakrat]:
> I added a message (r55118) which is shown in the statusbar when
> switching to preview tab. It might be enough? Feel free to
> improve the message if it sounds strange.

yes, that works very nicely, thank you. the text is right next to the tab
you click so you're already looking at it.

The message doesn't sound strange, just concise. I think it's fine.

cheers,
Hamish

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:12 martinl]:
> I noticed also a small bug, labels are not centered and they are in one
line (draft mode, see attachment:wxpsmap0.png).

Fixed in r55141 (and r55182).

Anna

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by wenzeslaus):

'''Summary'''

Preview works now; info about generating preview is in the status bar, so
solved too; as well as not centered labels.

Problem highly related to or part of this ticked:

''OSGeo4W doesn't provide gs package. We have two options - to add new
package for gs or provide it within grass package.''

Another problem:

''I have added raster and line vector map. In the preview only vector map
is rendered. Previewing raster seems to be broken (the maps have same
extent). See attachment:wxpsmap1.png''

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by neteler):

Replying to [comment:23 wenzeslaus]:
...
> ''OSGeo4W doesn't provide gs package. We have two options - to add new
package for gs or provide it within grass package.''

A package outside of GRASS would be likely cleaner.

Related; http://ghostscript.com/pipermail/gs-
devel/2013-January/009382.html

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by neteler):

Rather than crashing with "... gs failed", how about
trapping this and opening a message with the hint to visit
http://trac.osgeo.org/grass/wiki/CompileOnWindows#Ghostscript

?

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:25 neteler]:
> Rather than crashing with "... gs failed", how about
> trapping this and opening a message with the hint to visit
> http://trac.osgeo.org/grass/wiki/CompileOnWindows#Ghostscript
> ?

Sure, done in r55713-5. Can anyone confirm that the instructions work?

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by hellik):

Replying to [comment:26 annakrat]:
>
>Can anyone confirm that the instructions work?

instructions followd I get error message (see attached
mc_12042013_150414.png)

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:27 hellik]:
> Replying to [comment:26 annakrat]:
> >
> >Can anyone confirm that the instructions work?
>
> instructions followd I get error message (see attached
mc_12042013_150414.png)

oh, sorry, I was sure that the previous fixes were already applied to 64
but obviously not. Please try r55716 tomorrow.

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by hellik):

Replying to [comment:28 annakrat]:
>
> oh, sorry, I was sure that the previous fixes were already applied to 64
but obviously not. Please try r55716 tomorrow.

tested with the nightly build.

it fails gracefully now, if gs isn't in path. thanks.

the instructions to put gs in gswin32c.exe and gsdll32.dll to
c:\OSGeo4W\bin\ works also.

just another little thing, see attached screenshots composer, preview,
pdf.

just added elevation and lakes from the nc-sample data set (composer.png).
in the preview only the vector is displayed (preview.png). after exporting
a ps and converting it to a pdf, raster and vector are there correctly.

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by martinl):

Replying to [comment:24 neteler]:
> Replying to [comment:23 wenzeslaus]:
> ...
> > ''OSGeo4W doesn't provide gs package. We have two options - to add new
package for gs or provide it within grass package.''
>
> A package outside of GRASS would be likely cleaner.
>
> Related; http://ghostscript.com/pipermail/gs-
devel/2013-January/009382.html

New package added to OSGeo4W framework (1). GRASS dependences updated.
Testing welcomed.

(1) http://trac.osgeo.org/osgeo4w/wiki/pkg-gs

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by martinl):

Replying to [comment:29 hellik]:
> just added elevation and lakes from the nc-sample data set
(composer.png). in the preview only the vector is displayed (preview.png).
after exporting a ps and converting it to a pdf, raster and vector are
there correctly.

I can confirm this issue. Could be that pkg-gs (1) is incomplete?

(1) http://trac.osgeo.org/osgeo4w/wiki/pkg-gs

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by hamish):

Hi,

just tested in a wingrass nightly build, preview fails with unable to find
the ps2pdf program.

(see also earlier comment:6)

Hamish

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:32 hamish]:
> Hi,
>
> just tested in a wingrass nightly build, preview fails with unable to
find the ps2pdf program.

Really preview? It fails when creating pdf file (Export to PDF). ps2pdf
seems to be missing, we could add it there or maybe call gs directly?

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by hamish):

Replying to [comment:33 annakrat]:
> Replying to [comment:32 hamish]:
> > just tested in a wingrass nightly build, preview fails with unable to
> > find the ps2pdf program.
>
> Really preview? It fails when creating pdf file (Export to PDF).

right. at creating the pdf, sorry.
in the preview tab pressing the green '>' button makes a page, but it is
all
white except for the map box frame in the preview window. Saving to
PostScript makes a nice file on the disk, all's correct there, just the
preview image is missing.

pressing the PDF button comes back with a pop-up window "ps2pdf exited
with return code 1".

> ps2pdf seems to be missing, we could add it there or maybe call gs
directly?

right, no ps2pdf in \extrabin.

On Debian, ps2pdf comes with the ghostscript package, it's just a shell
script which just calls:
{{{
ps2pdfwr -dCompatibilityLevel=1.4
}}}

And `ps2pdfwr` is another shell/wrapper script which calls `gs`. It boils
down to:

{{{
gs -P- -dSAFER -dCompatibilityLevel=1.4 -q -P- -dNOPAUSE -dBATCH \
    -sDEVICE=pdfwrite -sstdout=%stderr -sOutputFile=elevation.pdf \
    -P- -dSAFER -dCompatibilityLevel=1.4 -c .setpdfwrite -f \
    elevation.ps
}}}

just replace elevation.pdf and elevation.ps with %s, and `gs` for
`gswin32c`.

I was a little worried about the %stderr option, but I just tried the
above on the wingrass dosbox command line and it worked! I've a nice pdf
now.

Perhaps hardcode the above long command into an if(wingrass) part of the
composer code, or maybe cleaner to write a little ps2pdf.bat or ps2pdf.pyw
(.pyw to avoid a dosbox popping up; we know python is there..) script to
do it?

minor cosmetics:
  * "Generating PostScript..." and "Generating PDF..." never go away after
it's done. Can we clear the status bar after the file is closed?

  * I also notice when you add a mapframe with a raster in wingrass the
text in the green rectangle on the draft mode page shows as "MAP
FRAMEraster: mapname"; the newline in the string is rendered as an
unknown char instead of a newline.

thanks,
Hamish

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by hamish):

oh, and we might want to offer draft/print quality option for ps2pdf, see
http://grasswiki.osgeo.org/wiki/Ps.map_scripts#Converting_PostScript_to_PDF

the default for gs is to reduce to 72dpi which is fine for on the computer
monitor and presentations, but not so good for printing hardcopies. it
might be worth considering making the high quality version the default
(the file size is bigger, but it doesn't scale as hugely you might expect,
more like 75% qual JPEG -> 90% qual JPEG).

`-dPDFSETTINGS=/prepress -r1200`

that would need to be added twice, near the -dCompatibilityLevel= options,
from `ps2pdfwr`:

{{{
# We have to include the options twice because -I only takes effect if it
# appears before other options.
}}}

(but we are not using -I, so perhaps it doesn't matter and the early `-P-
-dSAFER -dCompatibilityLevel=1.4` can be removed)

Hamish

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by martinl):

Replying to [comment:34 hamish]:
> pressing the PDF button comes back with a pop-up window "ps2pdf exited
with return code 1".
>
> > ps2pdf seems to be missing, we could add it there or maybe call gs
directly?
>
> right, no ps2pdf in \extrabin.
>
> On Debian, ps2pdf comes with the ghostscript package, it's just a shell
script which just calls:

I have added `ps2pdf` script to osgeo4w `gs` package (1). Testing
welcomed.

(1) http://trac.osgeo.org/osgeo4w/wiki/pkg-gs

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by martinl):

Replying to [comment:36 martinl]:
> I have added `ps2pdf` script to osgeo4w `gs` package (1). Testing
welcomed.
>
> (1) http://trac.osgeo.org/osgeo4w/wiki/pkg-gs

Quick test: `ps2pdf` works from cmd, cartographic composer fails with
`Cannot open this file: _.at`

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:37 martinl]:
> Replying to [comment:36 martinl]:
> > I have added `ps2pdf` script to osgeo4w `gs` package (1). Testing
welcomed.
> >
> > (1) http://trac.osgeo.org/osgeo4w/wiki/pkg-gs
>
> Quick test: `ps2pdf` works from cmd, cartographic composer fails with
`Cannot open this file: _.at`

and it complains about missing gssetgs.bat (in terminal)

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

#1554: wxGUI Cartographic Composer: preview broken on Windows
----------------------------------------------------+-----------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: wxGUI | Version: unspecified
Keywords: cartographic composer, psmap, wingrass | Platform: MSWindows XP
      Cpu: Unspecified |
----------------------------------------------------+-----------------------

Comment(by annakrat):

Replying to [comment:34 hamish]:
> minor cosmetics:
> * "Generating PostScript..." and "Generating PDF..." never go away
after it's done. Can we clear the status bar after the file is closed?
>

I added statusbar messages after exporting PS and PDF files.

> * I also notice when you add a mapframe with a raster in wingrass the
text in the green rectangle on the draft mode page shows as "MAP
FRAMEraster: mapname"; the newline in the string is rendered as an
unknown char instead of a newline.
>
this should be fixed already (see comment:22)

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