Re: [pygtk] Whole App Cursor Setting

2005-10-30 Thread pier carteri
Hi Loris,
this works for me 
--8import gtk 


m_win = gtk.Window()
m_win.set_title(Test Window)
box = gtk.VBox()
m_win.add(box)
label = gtk.Label(Just a label)
box.pack_start(label)
button = gtk.Button( and a button)
box.pack_start(button)
m_win.connect(destroy, gtk.main_quit)
m_win.show_all()

gdk_win = gtk.gdk.Window(m_win.window,

gtk.gdk.screen_width(),

gtk.gdk.screen_height(),

gtk.gdk.WINDOW_CHILD,

0,

gtk.gdk.INPUT_ONLY)
gdk_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
gdk_win.set_cursor(gdk_cursor)
gdk_win.show()
gtk.main()
--8
you can get more infos about gdk.window on
http://www.pygtk.org/pygtk2reference/gdk-class-reference.html

Regards

Pier
On 10/28/05, Loris Caren [EMAIL PROTECTED] wrote:
I'm trying to put up a watch cursor while my app is busy. I've foundhow to do it for one widget, but I really want to freeze up the wholeGUI.
http://www.daa.com.au/pipermail/pygtk/2000-October/000435.htmllooks just what I'm after. However, it seems to have suffered fromsoftware ageing and half the calls don't seem to be present (in2.6.2). Can anybody offer a current equivalent of his fragment?
___pygtk mailing list pygtk@daa.com.auhttp://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Whole App Cursor Setting

2005-10-28 Thread Loris Caren
I'm trying to put up a watch cursor while my app is busy. I've found 
how to do it for one widget, but I really want to freeze up the whole 
GUI.  http://www.daa.com.au/pipermail/pygtk/2000-October/000435.html
looks just what I'm after. However, it seems to have suffered from 
software ageing and half the calls don't seem to be present (in 
2.6.2). Can anybody offer a current equivalent of his fragment?
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Whole-app cursor setting patch revisited

2000-10-27 Thread Stephan R.A. Deibel

Hi,

Here is a patch for pygtk that exposes some of the lower-level gdk_window
functionality (creation of a gdk_window, show, hide,  destroy) to Python.

The motivation for this was a need to use an INPUT_ONLY GDK window to set
the cursor on the entire surface of a window, and to block mouse and
keyboard interaction with that window during that time (as you would when
the GUI is going to be unresponsive for a while due to some more lengthy
syncronous operation).

This could be used for other things as well, wherever there is a need to
temporarily overlay an existing window with an event-trapping transparent
window.

With this patch, you can now say something like this to set up a watch
cursor on any gtk_window:

  gdk_window = my_gtkwindow.get_window()
  attribs = { 'wmclass': GDK.INPUT_ONLY,
  'window_type': GDK.WINDOW_CHILD,
  'event_mask': 0,
  'x': 0,
  'y': 0,
  'width': gtk.screen_width(),
  'height': gtk.screen_height() }
  cursor_win = gtk.gdk_window_new(gdk_window, attribs)
  gdk_cursor = gtk.cursor_new(GDK.WATCH)
  cursor_win.set_cursor(gdk_cursor)
  cursor_win._show()

To set things back to normal you do this:

  cursor_win._hide()

To show the watch again later:

  cursor_win._show()

And when you're done with the cursor-setting window you say:

  cursor_win.destroy()
  cursor_win = None

This patch replaces the one that was sent by me to this list on Fri, 20
Oct 2000 20:28:38 -0400 (EDT).  It is a cdiff based on a somewhat modified
pygtk 0.6.5, so may not apply automatically.  But hopefully it's not too
hard to figure out, since it's just a set of added functions in several
files.  The 'WINGIDE_EXTENSION' ifdefs and comments can of course be
removed.

Please let me know if you have any questions or run into any problems
with this.

I hope that it's something that can be considered for a future version
of pygtk.

Thanks,

- Stephan


Archaeopteryx Software, Inc.Wing IDE for Python 
www.archaeopteryx.com   Take Flight!


Index: GDK.py
===
RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/GDK.py,v
retrieving revision 1.1
diff -c -r1.1 GDK.py
*** GDK.py  2000/03/13 18:45:37 1.1
--- GDK.py  2000/10/27 15:04:30
***
*** 294,299 
--- 294,313 
  XTERM = 152
  CURSOR_IS_PIXMAP = -1
  
+ # WINGIDE_EXTENSIONS
+ # GdkWindowClass's
+ INPUT_OUTPUT = 0
+ INPUT_ONLY = 1
+ 
+ # GdkWindowType's
+ WINDOW_ROOT = 0
+ WINDOW_TOPLEVEL = 1
+ WINDOW_CHILD = 2
+ WINDOW_DIALOG = 3
+ WINDOW_TEMP = 4
+ WINDOW_PIXMAP = 5
+ WINDOW_FOREIGN = 6
+ # END WINGIDE_EXTENSIONS
  
  # these are the Key Symbols for GDK
  # they were created with sed -n 's/#define GDK)\([^ ]*\)/\1 =/p' gdkkeysyms.h
Index: gtk.py
===
RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/gtk.py,v
retrieving revision 1.8
diff -c -r1.8 gtk.py
*** gtk.py  2000/09/25 19:47:24 1.8
--- gtk.py  2000/10/27 15:04:41
***
*** 2738,2743 
--- 2738,2769 
  keyval_to_upper = _gtk.gdk_keyval_to_upper
  keyval_to_lower = _gtk.gdk_keyval_to_lower
  
+ # WINGIDE_EXTENSIONS
+ # Low-level function to create new gdk window
+ def gdk_window_new(parent, attribs):
+   """ Creates a new gdk window which must be destroyed with an
+   explicit call to the _destroy() method.  parent is the new 
+   window's parent PyGdkWindow or None if the window should be a 
+   child of the root window.  attribs must be a dictionary of 
+   attribute values for the window; the following attribs must 
+   be specified:
+ window_type -- GDK.WINDOW_TOPLEVEL, GDK.WINDOW_CHILD
+GDK.WINDOW_DIALOG, GDK.WINDOW_TEMP
+GDK.WINDOW_PIXMAP, or GDK.WINDOW_FOREIGN
+ event_mask -- the events to get
+ width -- width of window
+ height -- height of window
+   The following attributes are optional:
+ wmclass -- GDK.INPUT_OUTPUT or GDK.INPUT_ONLY
+ x -- x offset from parent
+ y -- y offset from parent
+ colormap -- PyGdkColormap to use to interpret colors
+ override_redirect -- see gdk / X documentation
+   """
+   
+   return _gtk.gdk_window_new(parent, attribs)
+ # END WINGIDE_EXTENSIONS
+ 
  # screen size
  def screen_width():
return _gtk.gdk_screen_width()
Index: gtkmodule.c
===
RCS file: /home/cvs/src/ide/external/pygtk-0.6.5-wing/gtkmodule.c,v
retrieving revision 1.10
diff -c -r1.10 gtkmodule.c
*** gtkmodule.c 2000/09/28 22:49:52 1.10
--- gtkmodule.c 2000/10/27 15:05:30
***
*** 1665,1670 
---