[pygtk] fix for segfault in PyGdkWindow_PropertyChange

2000-03-06 Thread Charles G Waldman


Trying to set a property with format != 8 was giving me repeatable
core dumps;  I took a look in gtkmodule.c and found the problem pretty
quickly.

Here's a patch against pygtk-0.6.4:

--- gtkmodule.c~Wed Feb 16 08:57:02 2000
+++ gtkmodule.c Mon Mar  6 19:50:07 2000
@@ -1551,7 +1551,7 @@
}
nelements = PySequence_Length(pdata);
data16 = g_new(guint16, nelements);
-   data = (guchar *)data;
+   data = (guchar *)data16;
for (i = 0; i < nelements; i++) {
PyObject *item = PySequence_GetItem(pdata, i);
Py_DECREF(item);
@@ -1578,7 +1578,7 @@
}
nelements = PySequence_Length(pdata);
data32 = g_new(guint32, nelements);
-   data = (guchar *)data;
+   data = (guchar *)data32;
for (i = 0; i < nelements; i++) {
PyObject *item = PySequence_GetItem(pdata, i);
Py_DECREF(item);
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] PyGnomeHello and internationalization

2000-03-06 Thread Hassan Aurag


 Hi,

 I hate my GMath_install.py even though it does the job. And yes I'd love to have a 
way to respect the gnome standard. But how to use autogen.sh or Makefiles with python 
is beyong me for now. So yes I'd love to see something on this in your tutorial.

 This is especially important if we want to have a unified way of making srpms, rpms 
tar.gz  files.

 For internationalization, I'd like to have it, but could be left for version 2.0 of 
your tutorials.

 Good luck
> 
> Hi pythoneers:
> 
> I'm making a PyGnomeHello a shamessly python copy fo the GnomeHello of 
> the GGAD book.
> I think that the directory structure and  GNU instalation utilities could
> be usefull for proving order in the pygnome applications.
> 
> I think that it would help avoiding the work of custom instalation
> utilites like the GMath_install.py. But perhaps the application's author
> would like more to do their own intalation srcipts.
> 
> Anyway, my problem is to how make internationalization work in python. 
> I don't know if it would be prudent to use gettext on python programs
> and how to avoid python parsing errors with N_. It should be foolish to
> have to run a python program throught some kind of preprocesor in order to
> make it workable.
> 
> So I'm hopping for replies encouraging my mediocrity saying  
> " skip the internationalazion and include the PyGnomeHello in the
> tutorial" or a viable solution using gettext or some other program for 
> internationalization.
> 
> Thanks a lot
> 
>   Daniel Kornhauser
> 
> 
> 
> 
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] PyGnomeHello and internationalization

2000-03-06 Thread James Henstridge

There is a gettext module included with gnome-python.  It is fairly
similar to the C API, but has some problems with big endian architectures
at the moment (this will be fixed).

You can use it like so:

  import gettext

  _ = gettext.gettext
  gettext.bindtextdomain("translation-domain", "/usr/share/locale")
  gettext.textdomain("translation-domain")

  print _("Hello world")

If you make the translated strings look like C strings (that is, use
double quotes and no triple quotes, etc), you should be able to use the
standard xgettext program to extract strings.

Alternatively, if you can get your program to translate every string
during its run (difficult if you are trying to translate error messages),
you can set the PY_XGETTEXT environment variable to a file name.  Then the
gettext module will work in reverse and output each translated string to
the file named in PY_XGETTEXT.  It outputs in standard PO file format,
complete with module name, function name and line number.

You can also use the gettext module for creating or editing message
catalogs:
  cat = gettext.Catalog('translation-domain')
  cat['Hello world'] = 'hello-world-in-some-other-language'
  cat.save('filename.mo')

James.

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


On Sun, 5 Mar 2000, Daniel Kornhauser wrote:

> Hi pythoneers:
> 
> I'm making a PyGnomeHello a shamessly python copy fo the GnomeHello of 
> the GGAD book.
> I think that the directory structure and  GNU instalation utilities could
> be usefull for proving order in the pygnome applications.
> 
> I think that it would help avoiding the work of custom instalation
> utilites like the GMath_install.py. But perhaps the application's author
> would like more to do their own intalation srcipts.
> 
> Anyway, my problem is to how make internationalization work in python. 
> I don't know if it would be prudent to use gettext on python programs
> and how to avoid python parsing errors with N_. It should be foolish to
> have to run a python program throught some kind of preprocesor in order to
> make it workable.
> 
> So I'm hopping for replies encouraging my mediocrity saying  
> " skip the internationalazion and include the PyGnomeHello in the
> tutorial" or a viable solution using gettext or some other program for 
> internationalization.
> 
> Thanks a lot
> 
>   Daniel Kornhauser
> 
> 
> 
> 
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]