Re: [pygtk] threading support in development pygtk

2002-01-10 Thread James Henstridge

Michael Gilfix wrote:

  So there's no need to worry anymore? Widgets can be accessed from
any thread?

To the same extent as they could in 0.6.x -- you need to use 
threads_enter/leave calls.  GTK still requires this for

 Very cool. Is there backwards compat with 0.6.8 though?
0.6.8 is so widespread that I wouldn't remove support from my app,
and the thread calls for a while though. Removing the threading calls
would make the code a lot prettier though.

Pygtk 1.99.x breaks compatibility (partly because of a lot of cleanups I 
have been putting off til a major release, and breakage in gtk itself). 
 As with C applications, it is recommended that any particular version 
of an app target 1.2 or 2.0, but not both.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] wrapper for gtk_stock_add

2002-01-10 Thread Skip Montanaro


If case anyone wants to add new stock images to their applications, I
submitted a patch last night to add a wrapper for gtk_stock_add to PyGtk.
It's at

http://bugzilla.gnome.org/show_bug.cgi?id=68363

The appended script demonstrates its use.

-- 
Skip Montanaro ([EMAIL PROTECTED] - http://www.mojam.com/)

#!/usr/bin/env python

import gtk

# change these to reference a PNG file on your system
dir = /home/skip/src/gtk/gtk+.cvs/demos/gtk-demo
imbase = gnome-foot
imfile = imbase + .png

factory = gtk.IconFactory()
factory.add_default()
pixbuf = gtk.gdk.pixbuf_new_from_file(%s/%s % (dir, imfile))
transparent = pixbuf.add_alpha(gtk.TRUE, chr(0xff), chr(0xff), chr(0xff))
icon_set = gtk.icon_set_new_from_pixbuf(transparent)
factory.add(imbase, icon_set)

gtk.rc_parse_string('''

pixmap_path %s

style icons {
stock[my-foot] = {
{ %s }
}
}

class GtkButton style icons

''' % (dir, imfile))

gtk.stock_add([(imbase, _New Folder, 0, 0, )])

w = gtk.Window()
w.connect(destroy, gtk.mainquit)
my = gtk.Button(stock=imbase)
w.add(my)

w.show_all()
gtk.mainloop()
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] Full Screen Window

2002-01-10 Thread Markus Schaber

Hi,

I'm currently working on a touch screen based information terminal
software, using Mark Crichtons great pygme widget.

Now I stumbled over opening the window in full screen mode. (Means the
window should be as big as the screen, and no border visible - invisible
borders in the off screen are won't hurt.)

One of the ideas I tried was:
window = GtkWindow(WINDOW_TOPLEVEL)
window.set_policy(0,0,1)
window.set_position(WIN_POS_CENTER)
window.set_uposition(0,0)
window.set_usize(screen_width(), screen_height())

This works fine without any wm (e. G. starting from the fail-safe xterm
session), but when sawfish is active, it doesn't work (the window is
shifted right and down, and the border is visible).

I tried to open the window as WINDOW_POPUP - this way, it has no borders,
but doesn't ever get the keyboard focus (which is currently needed for my
touchscreen keyboard emulation to work).

I tried much more tricks, but none did work. I'm currently using
debianized python-gtk 0.6.6-14 and libgtk 1.2.10-4. Does anybody know how
to solve this problem?

Thanks,
Markus

PS: I subscribed to this list, so no need for a personal reply.
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] Patch for GnomeDialog.button_connect

2002-01-10 Thread Martin Hicks


The version of pygnome that ships with debian unstable doesn't allow the passing
of extra data to the callback functions that are attached with the 
GnomeDialog.button_connect() function.  This patch simply copies the 
semantics from the generic connect() function and allows the passing of these
extra arguments.

This makes the pygnome wrapper of button_connect() have basically the same function
as it's C counterpart.

mh

-- 
Martin Hicks   || [EMAIL PROTECTED]
Use PGP/GnuPG  || DSS PGP Key: 0x4C7F2BEE  
Beer: So much more than just a breakfast drink.


--- python-gnome-1.4.1/pygnome/gnomeuimodule.orig.c Wed Jan  9 23:15:18 2002
+++ python-gnome-1.4.1/pygnome/gnomeuimodule.c  Wed Jan  9 23:15:26 2002
@@ -827,18 +827,21 @@
 }
 
 static PyObject *_wrap_gnome_dialog_button_connect(PyObject *self, PyObject *args) {
-  PyObject *obj, *callback, * extra, * data;
+  PyObject *obj, *callback, *extra = NULL, *data;
   int button;
 
-  if (!PyArg_ParseTuple(args, O!iO:gnome_dialog_button_connect, PyGtk_Type,
-   obj, button, callback))
+  if (!PyArg_ParseTuple(args, O!iO|O!:gnome_dialog_button_connect, PyGtk_Type,
+   obj, button, callback, PyTuple_Type, extra))
 return NULL;
   if (!PyCallable_Check(callback)) {
 PyErr_SetString(PyExc_TypeError, third argument not callable);
 return NULL;
   }
 
-  extra = PyTuple_New(0);
+  if (extra)
+Py_INCREF(extra);
+  else
+extra = PyTuple_New(0);
 
   if (extra == NULL)
 return NULL;
--- python-gnome-1.4.1/pygnome/gnome/ui.orig.py Thu Jan 10 10:40:25 2002
+++ python-gnome-1.4.1/pygnome/gnome/ui.py  Thu Jan 10 10:40:45 2002
@@ -37,8 +37,8 @@
return _gnomeui.gnome_dialog_run(self._o)
def run_and_close(self):
return _gnomeui.gnome_dialog_run_and_close(self._o)
-   def button_connect(self, button, callback):
-   _gnomeui.gnome_dialog_button_connect(self._o, button, callback)
+   def button_connect(self, button, callback, *extra):
+   _gnomeui.gnome_dialog_button_connect(self._o, button, callback, extra)
def set_default(self, button):
_gnomeui.gnome_dialog_set_default(self._o, button)
def set_sensitive(self, button, setting):



msg03437/pgp0.pgp
Description: PGP signature


[pygtk] Getting font-info

2002-01-10 Thread Christian Storgaard

How do I get the X font-info from a GdkFont?

In C I should be able to just use get_font_id(), but as far as I can tell, this
isn't implemented in PyGTK yet?

I want to use to reload a font in italic, if there's another way to do italic
fonts, I'll use it ;)

P.S. It's not for use on labels but by drawing functions (draw_text()).

P.P.S. The answer to my previous questions about masks was:
(thanks to John Finlay)
   A GdkBitmap is a GtkPixmap created with:
 mask=create_pixmap(None,width,height,1)
   And it should be drawn upon using only:
 transparent=mask.new_gc()
 mask=mask.new_gc()
 mask.foreground=mask.background

   Those were the excact answers I was looking for, so I hope they'll ease
   some other's searching.

   Thanks anyways to all who answered my many posts about it.


  .~.   ,~,
  /V\   Christian Storgaard / Cybolic   /V\
 // \\/   [EMAIL PROTECTED]\// \\
/(   ) (   )\
 ^`~'^ ^`~'^
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk