hi,
ruby -e "require 'gtk2';p \"gtk:#{Gtk::VERSION.inspect},
binding:#{Gtk::BINDING_VERSION.inspect}\""
on a gentoo(ruby 1.8.6 (2008-03-03 patchlevel 114) [x86_64-linux]):
"gtk:[2, 12, 11], binding:[0, 16, 0]"
on the XP(ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]):
"gtk:[2, 10, 6], binding:[0, 15, 0]" (strange it was installed by
ruby-gnome2-0.16.0-1-i386-mswin32.exe)
anyways, my problem is with printing on windows:
on the gentoo the following presents the dialog, but on the XP it just
stops responding, and hangs forever, no output.
ruby -e "require
'gtk2';Gtk::PrintOperation.new.run(Gtk::PrintOperation::ACTION_PRINT_DIALOG)"
do i miss something?
is it supported?
is there something i could do to make it work?
thanks in advice,
balint
on 01.08.2008 20:53
on 01.08.2008 21:28
ruby -e "require 'gtk2';Gtk::PrintOperation.run_page_setup_dialog" also does not work. but ruby -e "require 'gtk2';p Gtk::PrintOperation.new.status" #<Gtk::PrintOperation::Status initial> and ruby -e "require 'gtk2';p Gtk::PrintOperation.new.job_name" "-e job #1" works. is it just the dialog?
on 02.08.2008 14:40
Kou, can you please confirm this situation? is it not implemented, or am i doing something wrong? thanks in advice
on 03.08.2008 02:27
Hi, In <48945575.80000@gmail.com> "Re: [ruby-gnome2-devel-en] PrintOperation on windows" on Sat, 02 Aug 2008 15:39:17 +0300, Dobai-Pataky Bálint <dpblnt@gmail.com> wrote: > Kou, can you please confirm this situation? is it not implemented, or am i > doing something wrong? I'm sorry but I don't have a Windows environment... Could you try with the current GTK+? * Download the current GTK+: http://www.gtk.org/download-windows.html: http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.11.zip * Move the GTK+ bundled with Ruby-GNOME2: C:\\ruby\lib\GTK -> C:\\ruby\lib\GTK-Ruby-GNOME2 * Extract the current GTK+ to C:\\ruby\lib\GTK Thanks, -- kou
on 04.08.2008 21:12
hi, i tested the dialog, it's the same :( is there anything else i should try? thanks balint
on 05.08.2008 14:10
Hi, In <48975468.8070607@gmail.com> "Re: [ruby-gnome2-devel-en] PrintOperation on windows" on Mon, 04 Aug 2008 22:11:36 +0300, Dobai-Pataky Bálint <dpblnt@gmail.com> wrote: > i tested the dialog, it's the same :( > is there anything else i should try? If you have a GTK+ build environment (and you can write C) on Windows, please try the same code in C. If you can reproduce the problem in C, it's a GTK+ problem. Otherwise, it's a Ruby/GTK+ (or Ruby/GLib) problem. Can you do it? If you can't write C, I will be able to write it. Thanks, -- kou
on 05.08.2008 14:12
Hi, In <20080805.211038.75173118738902898.kou@cozmixng.org> "Re: [ruby-gnome2-devel-en] PrintOperation on windows" on Tue, 05 Aug 2008 21:10:38 +0900 (JST), Kouhei Sutou <kou@cozmixng.org> wrote: > > i tested the dialog, it's the same :( > > is there anything else i should try? > > If you have a GTK+ build environment (and you can write C) > on Windows, please try the same code in C. If you can > reproduce the problem in C, it's a GTK+ problem. Otherwise, > it's a Ruby/GTK+ (or Ruby/GLib) problem. Can you do it? If > you can't write C, I will be able to write it. Or I will be able to build a test program binary on my Debian GNU/Linux environment. (cross compile) Thanks, -- kou
on 07.08.2008 12:22
Kouhei Sutou wrote: >> If you have a GTK+ build environment (and you can write C) >> on Windows, please try the same code in C. If you can >> reproduce the problem in C, it's a GTK+ problem. Otherwise, >> it's a Ruby/GTK+ (or Ruby/GLib) problem. Can you do it? If >> you can't write C, I will be able to write it. >> > > Or I will be able to build a test program binary on > my Debian GNU/Linux environment. (cross compile) > please do so, i tried MSvisualC2008, but with no luck, yet.
on 07.08.2008 13:22
Hi, In <489ACCC2.8000403@gmail.com> "Re: [ruby-gnome2-devel-en] PrintOperation on windows" on Thu, 07 Aug 2008 13:21:54 +0300, Dobai-Pataky Bálint <dpblnt@gmail.com> wrote: > Or I will be able to build a test program binary on > my Debian GNU/Linux environment. (cross compile) > > please do so, i tried MSvisualC2008, but with no luck, yet. Here is a test program built from the following code: http://ruby-gnome2.sourceforge.jp/gtk-print.exe #include <gtk/gtk.h> int main(int argc, char **argv) { GtkPrintOperation *operation; GtkPrintOperationResult result; GError *error = NULL; gtk_init(&argc, &argv); operation = gtk_print_operation_new(); result = gtk_print_operation_run(operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, &error); if (error) { g_warning("%d:%s", error->code, error->message); g_error_free(error); } else { g_print("RESULT: %d\n", result); } return 0; } Thanks, kou
on 07.08.2008 13:31
Hi, 2008/8/7 Kouhei Sutou <kou@cozmixng.org>: >> Or I will be able to build a test program binary on >> my Debian GNU/Linux environment. (cross compile) >> >> please do so, i tried MSvisualC2008, but with no luck, yet. > > Here is a test program built from the following code: > http://ruby-gnome2.sourceforge.jp/gtk-print.exe BTW, did you run a "Printing" sample from gtk-demo.exe? Thanks, -- kou
on 07.08.2008 20:22
Kouhei Sutou wrote: >> please do so, i tried MSvisualC2008, but with no luck, yet. > GtkPrintOperation *operation; > if (error) { > Thanks, > kou > this is the error: but i have c:\ruby\lib\GTK\bin\libglib-2.0-0.dll ops, it runs if i copied it to c:\ruby\lib\GTK\bin\ it presents the nice printer chooser. thanks
on 07.08.2008 20:26
Kouhei Sutou wrote: >> Here is a test program built from the following code: >> http://ruby-gnome2.sourceforge.jp/gtk-print.exe >> > > BTW, did you run a "Printing" sample from gtk-demo.exe? > yes, it presents the printer chooser, i did not go further. now i tried, and was able to setup a new printer from it, and was able to print to file from it. so i think that works as your gtk-print.exe in the ruby-gtk2-demo there is no printing. thank you
on 09.08.2008 08:06
Hi, In <489B3E21.7020601@gmail.com> "Re: [ruby-gnome2-devel-en] PrintOperation on windows" on Thu, 07 Aug 2008 21:25:37 +0300, Dobai-Pataky Bálint <dpblnt@gmail.com> wrote: > BTW, did you run a "Printing" sample from gtk-demo.exe? > > yes, it presents the printer chooser, i did not go further. > now i tried, and was able to setup a new printer from it, and was able to print > to file from it. so i think that works as your gtk-print.exe > in the ruby-gtk2-demo there is no printing. Here is a "Printing" sample in Ruby. Please put it to gtk/sample/gtk-demo/ directory, run main.rb and try "Printing" sample. Thanks, -- kou -- # Copyright (c) 2008 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. =begin = Printing Gtk::PrintOperation offers a simple API to support printing in a cross-platform way. =end require 'common' module Demo class Printing < BasicWindow Data = Struct.new(:font_size, :lines_per_page, :lines, :n_pages) HEADER_HEIGHT = 10 * 72 / 25.4 HEADER_GAP = 3 * 72 / 25.4 def initialize super('Printing') button = Gtk::Button.new("Print...") button.signal_connect("clicked") do begin run_print_operation rescue dialog = Gtk::MessageDialog.new(self, :destroy_with_parent, :error, :close, $!.message) dialog.signal_connect("response") do dialog.destroy true end dialog.show end true end add(button) end private def run_print_operation operation = Gtk::PrintOperation.new data = Data.new data.font_size = 12.0 operation.signal_connect("begin-print") do |_operation, context| on_begin_print(_operation, context, data) end operation.signal_connect("draw-page") do |_operation, context, page_number| on_draw_page(_operation, context, page_number, data) end operation.signal_connect("end-print") do |_operation, context| on_end_print(_operation, context, data) end operation.use_full_page = false operation.unit = :points operation.run(:print_dialog, self) end def on_begin_print(operation, context, data) height = context.height - HEADER_HEIGHT - HEADER_GAP data.lines_per_page = (height / data.font_size).floor data.lines = File.readlines(__FILE__) data.n_pages = (data.lines.size - 1) / data.lines_per_page + 1 operation.set_n_pages(data.n_pages) end def on_draw_page(operation, context, page_number, data) cr = context.cairo_context width = context.width cr.rectangle(0, 0, width, HEADER_HEIGHT) cr.set_source_rgb(0.8, 0.8, 0.8) cr.fill_preserve cr.set_source_rgb(0, 0, 0) cr.line_width = 1 cr.stroke layout = context.create_pango_layout layout.font_description = Pango::FontDescription.new("sans 14") layout.text = File.basename(__FILE__) text_width, text_height = layout.pixel_size if (text_width > width) layout.width = width layout.ellipsize = :start text_width, text_height = layout.pixel_size end cr.move_to((width - text_width) / 2, (HEADER_HEIGHT - text_height) / 2) cr.show_pango_layout(layout) layout.text = "#{page_number + 1}/#{data.n_pages}" layout.width = -1 text_width, text_height = layout.pixel_size cr.move_to(width - text_width - 4, (HEADER_HEIGHT - text_height) / 2) cr.show_pango_layout(layout) layout = context.create_pango_layout description = Pango::FontDescription.new("monosapce") description.size = data.font_size * Pango::SCALE layout.font_description = description cr.move_to(0, HEADER_HEIGHT + HEADER_GAP) start_line = page_number * data.lines_per_page data.lines[start_line, data.lines_per_page].each do |line| layout.text = line cr.show_pango_layout(layout) cr.rel_move_to(0, data.font_size) end end def on_end_print(operation, context, data) end end end
on 10.08.2008 10:32
Kouhei Sutou wrote: >> now i tried, and was able to setup a new printer from it, and was able to print > kou > "not a Gtk::MessageDialog::ButtonType" error i get in line 26 i tried replacing the buttons parameter with Gtk::MessageDialog::ButtonsType::CLOSE, and with 2, but no luck, same error. so i replaced the dialog part with a "p $!.message" and if i press the print button now i see: "not a Gtk::PaperSize::Unit" this line generates the error, around line number 60 operation.unit = :points so i removed that line, i wanna see any printings now, don't care if it's not calculated correctly. but than: "not a Gtk::PrintOperation::Action" in line 63 by the line: operation.run(:print_dialog,self) so i replace :print_dialog with 0 and we get to the begining of the problem. it hangs, and does not present the dialog.
on 13.08.2008 14:10
Dobai-Pataky Bálint wrote: > "not a Gtk::MessageDialog::ButtonType" error i get in line 26 > i tried replacing the buttons parameter with > Gtk::MessageDialog::ButtonsType::CLOSE, and with 2, but no luck, same > error. > so i replaced the dialog part with a "p $!.message" > and if i press the print button now i see: "not a Gtk::PaperSize::Unit" There was a patch applied by Kou in latest trunk. Can you check if this works? Best Regards, Joachim Glauche
on 13.08.2008 17:13
Joachim Glauche wrote: > > There was a patch applied by Kou in latest trunk. Can you check if this > works? > > Best Regards, > Joachim Glauche > no, i did not. i can currently compile it on linux. if you guide me in compiling it on windows, i'll do it. thanks, balint
on 14.08.2008 12:52
Dobai-Pataky Bálint wrote: > no, i did not. > i can currently compile it on linux. > if you guide me in compiling it on windows, i'll do it. This wiki entry can help you: http://ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view&p=compile_mingw&key=win32 If you use MinGW this should work at least on the machine on which it is compiled.
on 16.08.2008 11:10
Joachim Glauche wrote: > If you use MinGW this should work at least on the machine on which it is > compiled. > i followed th link. built everything up to ruby-glib2, which failed with rbglib_maincontext.c:166: error: syntax error before "rb_thread_t" rbglib_maincontext.c: In function `source_prepare_add_poll': rbglib_maincontext.c:168: error: `thread' undeclared (first use in this function ) rbglib_maincontext.c:168: error: (Each undeclared identifier is reported only on ce rbglib_maincontext.c:168: error: for each function it appears in.) rbglib_maincontext.c:170: error: `source' undeclared (first use in this function ) rbglib_maincontext.c: In function `source_prepare_setup_poll_fd': rbglib_maincontext.c:199: error: `rb_thread_t' undeclared (first use in this fun ction) rbglib_maincontext.c:199: error: syntax error before "thread" rbglib_maincontext.c:207: error: `thread' undeclared (first use in this function ) rbglib_maincontext.c:207: error: `rb_curr_thread' undeclared (first use in this function) rbglib_maincontext.c:211: error: `THREAD_RUNNABLE' undeclared (first use in this function) rbglib_maincontext.c:214: error: `THREAD_KILLED' undeclared (first use in this f unction) make[1]: *** [rbglib_maincontext.o] Error 1 make[1]: Leaving directory `/home/balint/rg2/glib/src' make: *** [all] Error 2 should i try other version than ruby-1.8.5? thanks
on 16.08.2008 13:11
Dobai-Pataky Bálint wrote: >> This wiki entry can help you: > this function ) > this function ) > should i try other version than ruby-1.8.5? > thanks > built with 1.8.7-p71
on 16.08.2008 15:22
someone please update the rg2 wiki on installing on windows: i ran into rcairo not configuring: ~/rcairo-1.6.3 $ ruby extconf.rb && make && make install checking for GCC... yes checking for cairo version (>= 1.2.0)... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. ~/rcairo-1.6.3 $pkg-config.exe --cflags gtk+-2.0 Package pixman-1 was not found in the pkg-config search path. Perhaps you should add the directory containing `pixman-1.pc' to the PKG_CONFIG_PATH environment variable Package 'pixman-1', required by 'cairo', not found this link helped me out: http://www.nabble.com/pixman-1-was-not-found-in-the-pkg-config-td16842574.html i've built http://cairographics.org/releases/pixman-0.10.0.tar.gz with the following: ./configure --prefix=/MinGW && make && make install then in the rcairo source: export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/C/MinGW/lib/pkgconfig/" $ pkg-config.exe --cflags gtk+-2.0 -mms-bitfields -Ic:/GTK/include/gtk-2.0 -Ic:/GTK/lib/gtk-2.0/include -Ic:/GTK/include/atk-1.0 -Ic:/GTK/include/cairo -Ic:/GTK/include/pango-1.0 -Ic:/GTK/include/glib-2.0 -Ic:/GTK/lib/glib-2.0/include -Ic:/GTK/include/freetype2 but than i ran into: ~/rcairo-1.6.3 $ make gcc -I. -I. -Ic:/MinGW/lib/ruby/1.8/i386-mingw32 -I. -DRUBY_CAIRO_PLATFORM_WIN32 -DRB_CAIRO_COMPILATION -g -O2 -Wall -I/target/include/cairo -I/target/include/freetype2 -I/target/include -I/target/include/libpng12 -I/MinGW/include/pixman-1 -mms-bitfields -c C:/msys/1.0/home/balint/rcairo-1.6.3/src/rb_cairo_context.c -osrc/rb_cairo_context.o In file included from C:/msys/1.0/home/balint/rcairo-1.6.3/src/rb_cairo_context.c:15: C:/msys/1.0/home/balint/rcairo-1.6.3/src/rb_cairo.h:19:19: cairo.h: No such file or directory In file included from C:/msys/1.0/home/balint/rcairo-1.6.3/src/rb_cairo_context.c:15: C:/msys/1.0/home/balint/rcairo-1.6.3/src/rb_cairo.h:162: error: syntax error before '*' token C:/msys/1.0/home/balint/rcairo-1.6.3/src/rb_cairo.h:162: warning: type defaults to `int' in declaration of `rb_cairo_context_from_ruby_object' so i extracted include/cairo/*h from cairo-dev-1.6.4-2.zip into MinGW/include/ and make of rcairo finished make install succeeded for making rg2 modules(like pango,gdkpixbuf, and finally gtk and atk) i have to export 2 variables: export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/C/MinGW/lib/pkgconfig/" export CAIRO_PATH=/home/balint/rcairo-1.6.3/ testing: require 'gtk2' Gtk::PrintOperation.run_page_setup_dialog presents the dialog. :) so my question: how do i deploy this mess onto other windows machines? zip/unzip everything? or should i wait for a windows release of rg2, which includes the working PrintOperation? thanks for your help
on 16.08.2008 15:58
Hi, In <48A6D46D.1000105@gmail.com> "Re: [ruby-gnome2-devel-en] PrintOperation on windows" on Sat, 16 Aug 2008 16:21:49 +0300, Dobai-Pataky Bálint <dpblnt@gmail.com> wrote: > Package pixman-1 was not found in the pkg-config search path. > Perhaps you should add the directory containing `pixman-1.pc' > to the PKG_CONFIG_PATH environment variable > Package 'pixman-1', required by 'cairo', not found You can use GTK+ package on gtk.org: http://www.gtk.org/download-windows.html http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.11.zip And you can use PKG_CONFIG_PATH environment variable and --with-override-variables option: $ PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/C/GTK/lib/pkgconfig/" ruby extconf.rb --with-override-variables=prefix=c:/GTK Thanks, -- kou