Forum: Ruby-Gnome 2 Busy application and mouse cursor

Posted by Vincent Carmona (vinc-mai)
on 2009-12-02 23:56
Hi everyone.

I use a Gtk::Window for my application and I would like to change the
cursor during loading (the graphical interface is showed, the program is
running but resources are used to intialize the program). Usually in gtk
during initialization, the cursor is set to a rotating image instead of
an arrow to show that program is busy. How can I achieve this?

I take a look at Gdk::Cursor but I did not saw a simple method to do it.

Vincent Carmona
Posted by Dobai-Pataky Bálint (Guest)
on 2009-12-03 08:24
(Received via mailing list)
this is how i do it:
mainwindow.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
Posted by Simon Arnaud (Guest)
on 2009-12-03 11:48
(Received via mailing list)
I also wondered a long time before I found.

I got it when I realized a cursor is attached to a GDK::Window, not a 
GTK.
And that GDK::Window is just a rectangular area on the screen.

So, the flow is :
1) Get the area where you want to change the cursor (GTK::Widget#window)
2) Change the cursor in this area (GDK::Window#cursor=)

Hope it helps.

Simon
Posted by Vincent Carmona (vinc-mai)
on 2009-12-04 20:50
Thanks for your replies. I was looking for a way to get the GDK::Window 
and for the Gdk::Cursor::WATCH constant. I did not see this constant on 
the hiki.
I will implement this feature on my apllication.

P.S. : I am currently writting an audio player based on ruby/gtk2 and 
ruby/gst. I have just change the status to beta. Can I ask for 
beta-tester on this list?

Simon Arnaud wrote:
> I also wondered a long time before I found.
> 
> I got it when I realized a cursor is attached to a GDK::Window, not a 
> GTK.
> And that GDK::Window is just a rectangular area on the screen.
> 
> So, the flow is :
> 1) Get the area where you want to change the cursor (GTK::Widget#window)
> 2) Change the cursor in this area (GDK::Window#cursor=)
> 
> Hope it helps.
> 
> Simon

Dobai-Pataky Bálint wrote:
> this is how i do it:
> mainwindow.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
Posted by Dobai-Pataky Bálint (Guest)
on 2009-12-05 21:22
(Received via mailing list)
i'll give it a hit if you send us the download address.
Posted by Vincent Carmona (vinc-mai)
on 2009-12-06 18:20
ZiK is an audio player based on ruby/gtk2 and ruby/gst.
The official website can be found at http://zik.rubyforge.org/. The 
project is hosted by rubyforge : http://rubyforge.org/projects/zik/.

Dobai-Pataky Bálint wrote:
> i'll give it a hit if you send us the download address.
Posted by Dobai-Pataky Bálint (Guest)
on 2009-12-06 21:03
(Received via mailing list)
hi
i like it.
just reported some stug on rubyforge.

thanks
Posted by Vincent Carmona (vinc-mai)
on 2009-12-07 09:49
Thanks for your interesd on ZiK. I have answered to ypur reports on 
rubyforge. Can you explain this two points :
scroll event handling on the trayicon,
padding of widgets in the preferences window/browser,playlist.

As I am not fluent in english I am nnot I understand wht you mean.


Dobai-Pataky Bálint wrote:
> hi
> i like it.
> just reported some stug on rubyforge.
> 
> thanks
Posted by Simon Arnaud (Guest)
on 2009-12-08 11:57
(Received via mailing list)
Hi

2009/12/7 Vincent Carmona <ruby-forum-incoming@andreas-s.net>

> Thanks for your interesd on ZiK. I have answered to ypur reports on
> rubyforge. Can you explain this two points :
> scroll event handling on the trayicon,
>

I think he means :
Do something when I scroll the mouse wheel, while the mouse is over the 
tray
icon.
Maybe next/prev song, or play faster/slower.

I tried very fast.
I crash when I try to access the preferences, but I think it's because I 
did
not install it. I just cloned and ruby main.rb. It seems you are loading
libs with a path configured somewhere, which is bad, imo.

Also, I don't know why, but taglib is taglib2 if installed through gems.
Maybe contact the author to fix this.

Good work otherwise, even if I'm not looking for a new music player. I'm
happy to know there will be something to look at if I ever need GST in 
ruby
:).

cheers

Simon
Posted by Vincent Carmona (vinc-mai)
on 2009-12-08 15:46
Hi.

Simon Arnaud wrote:
> I think he means :
> Do something when I scroll the mouse wheel, while the mouse is over the 
> tray
> icon.
> Maybe next/prev song, or play faster/slower.

Next/prev song on scroll event seems nice but I do not no how to deal 
with events and Gtk::StatusIcon. It seems you cannot add a 
Gtk::StatusIcon to a Gtk::EventBox.

require 'gtk2'
si=Gtk::StatusIcon.new
eb=Gtk::EventBox.new
eb.add(si)
GLib-GObject-WARNING **:invalid cast from `GtkStatusIcon' to `GtkWidget'
Gtk-CRITICAL **:gtk_widget_freeze_child_notify: assertion `GTK_IS_WIDGET 
(widget)' failed
Gtk-CRITICAL **:gtk_container_add: assertion `GTK_IS_WIDGET (widget)' 
failed
Gtk-CRITICAL **:gtk_widget_thaw_child_notify: assertion `GTK_IS_WIDGET 
(widget)' failed

> I tried very fast.
> I crash when I try to access the preferences, but I think it's because I 
> did
> not install it. I just cloned and ruby main.rb. It seems you are loading
> libs with a path configured somewhere, which is bad, imo.

libs are loaded by :
require 'lib'
but ZiK files (other than ZiK.rb/main.rb) are loaded by adding Data_dir 
to $:.
In main.rb Data_dir is defined by File.dirname(__FILE__). Maybe there is 
something to do here.
In installed ZiK, Data_dir was redefined by installation.
Is there a better way (a more rubysh one) of doing things?
I use ./main.rb (instead ofruby main.rb) and everything works smooth.

> Also, I don't know why, but taglib is taglib2 if installed through gems.
> Maybe contact the author to fix this.

I do not use gems. I install all package from my distributions. I will 
have to learn how to use gems before checking this and create a gem 
release of ZiK.
The library used by ZiK can be found at 
http://www.hakubi.us/ruby-taglib/.

> Good work otherwise, even if I'm not looking for a new music player. I'm
> happy to know there will be something to look at if I ever need GST in 
> ruby
> :).

Thanks.
Posted by Simon Arnaud (Guest)
on 2009-12-08 16:42
(Received via mailing list)
2009/12/8 Vincent Carmona <ruby-forum-incoming@andreas-s.net>

> (widget)' failed
> Gtk-CRITICAL **:gtk_container_add: assertion `GTK_IS_WIDGET (widget)'
> failed
> Gtk-CRITICAL **:gtk_widget_thaw_child_notify: assertion `GTK_IS_WIDGET
> (widget)' failed
>

I really don't know how to do it :). I was just clarifying.

Latest gtk has a signal for that, dunno if it is in ruby-gnome2.
http://library.gnome.org/devel/gtk/stable/GtkStatusIcon.html


> libs are loaded by :
> require 'lib'
> but ZiK files (other than ZiK.rb/main.rb) are loaded by adding Data_dir
> to $:.
> In main.rb Data_dir is defined by File.dirname(__FILE__). Maybe there is
> something to do here.
> In installed ZiK, Data_dir was redefined by installation.
> Is there a better way (a more rubysh one) of doing things?
> I use ./main.rb (instead ofruby main.rb) and everything works smooth.
>

You might want to look at :
http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices


>  I do not use gems. I install all package from my distributions. I will
> have to learn how to use gems before checking this and create a gem
> release of ZiK.
> The library used by ZiK can be found at
> http://www.hakubi.us/ruby-taglib/.


I know where to find it :).
I was just saying that it is shipped as 'taglib' on my distribution 
(Debian
sid), et as 'taglib2' through gems. Both are the same lib, I don't know 
why
the gem is shipped as 'taglib2'. The author has not been working on it 
since
2006 it seems, so he may not be working on it anymore.
Posted by Vincent Carmona (vinc-mai)
on 2009-12-08 17:09
The crash with preferences dialog was a bug! Thanks for the report. It 
should be fix in the last commit.

Simon Arnaud wrote:
> I really don't know how to do it :). I was just clarifying.
> 
> Latest gtk has a signal for that, dunno if it is in ruby-gnome2.
> http://library.gnome.org/devel/gtk/stable/GtkStatusIcon.html

Thanks for the clarification. This signal is not implemented ruby/gtk 
0.17. I will try 0.19 later.

> You might want to look at :
> http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices

Thanks for the link. I will try to change my practises.


> I know where to find it :).
> I was just saying that it is shipped as 'taglib' on my distribution 
> (Debian
> sid), et as 'taglib2' through gems. Both are the same lib, I don't know 
> why
> the gem is shipped as 'taglib2'. The author has not been working on it 
> since
> 2006 it seems, so he may not be working on it anymore.

I add the link just to be sure we were talking about the same lib. Can 
you mail me the address of the gem packager? You can find mine in 
main.rb.
Posted by Vincent Carmona (vinc-mai)
on 2009-12-28 16:37
Dobai-Pataky Bálint wrote:
> hi
> i like it.
> just reported some stug on rubyforge.
> 
> thanks

Hi.

The ZiK 0.12 was released. I think it closes features request you add on 
rubyforge. 
http://rubyforge.org/tracker/index.php?func=detail&aid=27519&group_id=5494&atid=21259
Can you give it a try and tell me if features you missed are 
implemented?

Vincent.
Posted by Dobai-Pataky Bálint (Guest)
on 2009-12-29 11:09
(Received via mailing list)
thanks,
i will
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.