Closed GoogleCodeExporter closed 9 years ago
= Comments (cont.) =
Date: 2007-08-28 22:33
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
Per the feedback in the SWT bugzilla, I've added a call to
Display.getDefault() in all the example programs that lacked a Display.
Please try out the examples again and verify whether they work without
crashing now.
Matthew
----
Date: 2007-08-29 08:39
Sender: mikydv
Logged In: YES
user_id=1857408
Originator: NO
Changes on Paperclips.getPages( PrintJob, Printer ) cause an SWT exception
in Linux because of printer's job that is not started.
I post to you my own changes that resolve this one and the problem on
print icon's flash in the system tray in Windows.
public static PrintPiece[] getPages( PrintJob printJob, Printer printer
) {
String platform = SWT.getPlatform();
boolean carbon = platform.equals( "carbon" );
boolean gtk = platform.equals( "gtk" );
// Bug in SWT on OSX: If Printer.startJob() is not called first, the
GC will be disposed by default.
if ( carbon || gtk )
if ( !printer.startJob( "" ) )
throw new RuntimeException( "Unable to start print job" );
try {
GC gc = createConfiguredGC( printer );
try {
return getPages( printJob, printer, gc );
}
finally {
gc.dispose();
}
}
finally {
// 2007-04-30: A bug in OSX renders Printer instances useless after
a call to cancelJob(). Therefore on
// OSX we call endJob() instead of cancelJob().
if ( carbon )
printer.endJob();
else
if ( gtk )
printer.cancelJob();
}
}
I hope is appreciate to you.
----
Date: 2007-08-29 17:07
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
Your changes are in SVN as of revision 292.
----
Date: 2007-08-30 12:04
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
To return to the original issue we were talking about:
I've now tested your snippet from below with the addition of a
Display.getDefault(); both with and without the GC lines, it does not spit
out an empty page. *sigh*
public static void main(String[] args) {
Display display = Display.getDefault();
Printer printer = new Printer(Printer.getPrinterList()[1]);
printer.startJob("job");
GC gc = new GC(printer);
gc.dispose();
printer.cancelJob();
display.dispose();
}
----
Date: 2007-09-14 15:28
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
I've merged the styledtextprint branch back into the trunk, and have made
further changes (lots and lots of refactoring) there. Can you please
update to the latest source and ensure that the page feed problem is gone?
mikdyv, I'd like add you to the contributor list in the sources for your
PaperClips.getPages() fix--what name shall I use?
----
Date: 2007-09-14 16:40
Sender: mikydv
Logged In: YES
user_id=1857408
Originator: NO
I don't think that you have to consider me a contributor (I've passed you
only two lines of code). However, if you really think that I could be a
contributor, my real name is Michele De Vecchi. Thanks, I'm never been a
contributor ;-)
----
Date: 2007-09-16 07:10
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
Hm, I am sorry to report that after updating to the latest source the page
feed problem still persists.. :|
However, I've found out the following:
...
final ScrolledComposite scroll = new ScrolledComposite(composite,
SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
final PrintPreview preview = new PrintPreview(scroll, SWT.NONE);
// FIXME This is a hack.
preview.setPrinterData(Printer.getPrinterList()[1]);
...
This is an excerpt from the preview code in my application (in fact, it is
an adapted version of the preview snippet on your PaperClips project site).
Now, without the line marked as "FIXME" (which actually is a hack..), it
won't preview anything at all, it only shows a black rectangle. This might
have something to do with the fact that on my system,
Printer.getDefaultPrinterData() returns null (for which I haven't found any
reasons so far). With that line, the preview works as expected, but it also
issues the page feed..
----
Date: 2007-10-17 16:15
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
ngc, please update to the latest sources from SVN and tell me if the page
feed still happens.
Matthew
----
Date: 2007-10-18 05:54
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
Hm, the page feed is gone; instead, the application freezes when closing
the preview, and issues the following on Eclipse's stderr console:
(SWT:6767): GLib-CRITICAL **: g_io_channel_write_chars: assertion
`channel->is_writeable' failed
<repeated until the process is killed>
----
Date: 2007-10-18 15:07
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
Does this happen if you just start up the preview and immediately close
it? We're talking about Snippet7, right?
Also, please try this with SWT 3.3.1 and 3.4M2 to see if either of these
has a different behavior.
Matthew
----
Date: 2007-11-01 17:47
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
Sorry, took me a bit longer to answer as I've been busy upgrading my
system to Ubuntu Gutsy..
However; I was talking about the print preview feature in an application
I've developed for personal use, which in fact uses the code from snippet 7
(slightly modified). Snippet7 itself does not work at all on my system
(I've just tested this with Eclipse 3.4M2), when starting, it takes quite a
long time for the window to appear, then it consumes 50% CPU and stays
empty. *sigh*
----
Date: 2007-11-01 17:55
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
Try printing in Snippet7 and tell me what happens--I'm predicting a
RuntimeException that says it can't layout on page x. A full stack trace
would be helpful.
----
Date: 2007-11-15 18:12
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
Hm, no chance.. I've updated to the latest SVN source and also updated the
code for Snippet7; when starting, it still displays an empty window, while
cpu load stays at 50% permanently, until the process is killed. Could this
have sth to do with Eclipse 3.4M3?? (SWT 3418)
----
Date: 2007-11-16 04:06
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
I have no idea. Have you tried a debugger session on the PrintPreview
class? Set a breakpoint in the paint(Event) method and step into every
child method. See if any of the fields are not set or if any sanity checks
return from the paint() method prematurely.
Matthew
----
Date: 2007-11-16 04:15
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
I'm not sure if you understood my suggestion from 2007-11-01 so I'll
restate it: Try running Snippet7, and click Print, select a printer, click
OK, and see if an exception occurs. Another possible outcome is that the
document prints and the preview mysteriously appears. Let me know if
either of those are the case and we'll proceed from that point.
----
Date: 2007-11-16 06:53
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
Hm I actually have understood your suggestion, the problem is that I don't
even get any output, just a blank window. I've added a screenshot to
illustrate that; as you can see there, there is no print button and thus no
chance to try printing, unfortunately.
However, I've had a debugging session into the depths of PaperClips and
found the snippet hangs in PaperClips.getPages(PrintJob printJob, Printer
printer, GC gc), around line 313 (the while loop). For some reasons I've
not found yet, it seems to do an infinite loop there, creating an ever
growing and growing array list of pages (the iterator always seems to
report hasNext() as true), which is what causes the application 'freeze'
and the cpu load. I'll try and go even deeper into this..
File Added: Snippet7.png
----
Date: 2007-11-18 10:14
Sender: ngc2997
Logged In: YES
user_id=621901
Originator: YES
Here's another hint from today's debugging session.. when changing this
[..]
String text = "The quick brown fox jumps over the lazy dog.";
for (int i = 0; i < 50; i++)
grid.add(new TextPrint(text));
[..]
to
[..]
String text = "The quick brown fox jumps over the lazy dog.";
grid.add(new TextPrint(text));
[..]
the snippet works as expected, meaning: it displays the window, the
preview control and all buttons. Pushing the 'print' button prints the
document. However, when closing the window, the application crashes with
multiple
"(SWT:7153): GLib-CRITICAL **: g_io_channel_write_chars: assertion
`channel->is_writeable' failed"
errors in stderr.
----
Date: 2007-11-30 16:08
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
Exceptions that happen in native SWT code should be reported to SWT.
It seems that none of these GTK errors were happening in 3.2, what happens
if you run your snippet against that version?
----
Date: 2007-12-11 20:20
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
I finally broke down and installed Linux on my machine (dual boot). I'm
seeing the same GLib-CRITICAL errors as you, and found that they are caused
during the Printer disposal process. It only happens if you call
cancelJob() instead of endJob(). Unfortunately this means that I have to
go back to using endJob() since printing a blank page is a lot better than
a GTK core dump. When SWT and/or GTK resolves these issues I will update
PaperClips accordingly.
I have logged a bug with SWT regarding the GLib-CRITICAL issue, perhaps
they will be able to find a workaround:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=212594
GTK also has a bugzilla requesting the ability to cancel a print job (this
is why cancelJob() doesn't work in SWT on GTK--there's no API for it in
GTK)
http://bugzilla.gnome.org/show_bug.cgi?id=339323 "Cancel print job"
----
Date: 2007-12-11 20:48
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
As of SVN revision 365 Printer.endJob() is used instead of
Printer.cancelJob(). If you update to the latest from SVN you will get
blank pages again but no GLib-CRITICAL errors.
I will file a separate bug with SWT regarding the blank pages.
----
Date: 2007-12-13 16:51
Sender: qualidafialProject AdminAccepting Donations
Logged In: YES
user_id=168544
Originator: NO
This will not be fixed until Gnome creates an API for cancelling a print
job:
http://bugzilla.gnome.org/show_bug.cgi?id=339323 "Cancel print job"
Original comment by qualidaf...@gmail.com
on 9 Oct 2008 at 5:05
Original comment by qualidaf...@gmail.com
on 9 Oct 2008 at 7:55
Original comment by qualidaf...@gmail.com
on 13 Oct 2008 at 2:33
Original comment by qualidaf...@gmail.com
on 13 Oct 2008 at 2:33
Original comment by qualidaf...@gmail.com
on 17 Dec 2008 at 5:45
PaperClips is migrating to the Eclipse project.
This bug is now being tracked at http://bugs.eclipse.org/291862
Original comment by qualidaf...@gmail.com
on 9 Oct 2009 at 5:45
Original issue reported on code.google.com by
qualidaf...@gmail.com
on 9 Oct 2008 at 5:00