Re: [pygtk] UnicodeError/LookupError and exe installers
Added at the end of FAQ 21.5 http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.005.htp Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] New FAQ: rendering computed TreeViewColumns
On Wed, Oct 15, 2003 at 12:34:25PM -0500, Michael Urman wrote: > It's easy to have a gtk.CellRendererText render an integer i from your > model, but it's not so easy to render f(i). In my case I wanted to > store file sizes (in bytes) as integers, but report them in ls -sh's > familiar xx.xM format. Added a hacked version as FAQ 13.24: http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.024.htp Let me know if something needs improving. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] New FAQ entry about TreeView.expand_row
On Sat, Oct 11, 2003 at 10:50:19PM +, Michal Pasternak wrote: > Q: Why TreeView.expand_row doesn't work for paths logner, than 1 element? > > A: TreeView.expand_row expands only the specified row, so you'd rather use: > >for a in range(len(path)): > tree_view.expand_row(path[:a+1], gtk.TRUE) > >to make sure all rows get expanded. I started to add this one, but I'm not entirely sure what you mean. From the code, it *looks* like you're expanding all the rows up to a certain point (the target of the path), and then expanding the target's children. Am I right? Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] misc widgets with a treeview?
On Mon, Oct 13, 2003 at 09:50:57AM +0200, Lorenzo Gil Sanchez wrote: > > I'd like to display a combo box in a cell within a treeview. I'm fairly sure > > I've seen other gtk ap[ps doing this, so I'm hoping it's possible... > > > You can do that with C. With Python you can create a custom CellRenderer > to render the cells in the way you want. What you can not do in Python > is a CellRender with edit capabilities, like a combo box. If you want a > CellRenderer to support edition it must implement the CellEditable > interface. There is no way to make a Python class to implement a GLib > interface with the current PyGTK bindings. But what about your example posted to http://www.mail-archive.com/[EMAIL PROTECTED]/msg06091.html ? Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Temporarily disabling a TreeView from sorting?
I have a TreeView that can contain hundreds to thousands of entries. It can take 60 seconds or more to enter data into the tree. However, if sorting was never enabled, it takes under 2 seconds. Is there a way of temporarily disabling sorting while data is being entered, and the reenabling sorting after the data has been entered? -- Don Allingham <[EMAIL PROTECTED]> GRAMPS OpenSource Genealogy signature.asc Description: This is a digitally signed message part ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Making librsvg bindings..
On Thu, 2003-10-16 at 12:20, alejandro david weil wrote: [...] > Related question, is the def files's format one known or standard format? Kind of. JamesH will be able to answer this a bit more completely, but the format is described in codegen/README.defs (in the source tarball). I don't think that the current codegen implementation actually uses all of the features described in that file. There was at one point a concerted effort to sort out language bindings (which was how README.defs came about in the first place). The rest of the history is something I do not know. Cheers, Malcolm ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Making librsvg bindings..
On Tue October 14 2003 22:11, Malcolm Tredinnick wrote: > On Tue, 2003-10-14 at 18:07, alejandro david weil wrote: > > I mean classes. Only thing I want from librsvg is a function, that reads > > a .svg file an returns a Pixbuf, and I want the Pixbuf created to be of > > the same class that python-gtk2 uses for Pixbufs. > > Oh, I see what you want now. The method mentioned in the FAQ about > including other .def files is really the recommended way to do this. > Look at something like the gnome-python/gnome bindings from CVS or a > source tarball (e.g nautilus.override or something similar) to see how > it includes classes from other modules. The required header files will > be installed somewhere under ${prefix}/include/ is you have the > appropriate *-devel packages installed (depends on your distribution). > > > > second: where should I take the pygtk's codegen from? I used the one > > > > from my debian's python-gtk2 source packages, but have had lots of > > > > problems (for example, doesn't have autoget.sh, to automake/confs > > > > problems..).. so i wanted to checkout, if there exists some stable > > > > version? > > > > > > Whatever comes with the pygtk sources is really the "official" version > > > and it works well for its purpose (generating the gnome-python > > > bindings). > > > > > > Periodically I think that it may not be crazy to release it as a > > > separate package, since the .defs format is good for many language > > > bindings (it is used by a couple of others) and is relatively simple to > > > create for extra packages. I have an unreleased thing at the moment I > > > am working on where I used the .defs format to create the Python > > > bindings. But I have the same problem you do -- it creates an implicit > > > pygtk dependency for a package that doesn't use pygtk. > > Mmmh.. the module I made, doesn't seems to import pygtk, is this > > enough?: > I don't think you are responding to the comment I wrote. :-) Mmh.. I answered that, because, i think that you were talking about a "runtime" reference :-). Maybe because, I saw, in one of the faqs, that for using the module created, one should import pygtk before importing the module created. Talking about packages, I also think that it's not crazy to release python-gtk's-gen separated! :-) Related question, is the def files's format one known or standard format? > > Well, at least, binary packages from debian: > > ii python2.3-gnom 2.0.0-5Python bindings for GNOME 2 > > ii python2.3-gtk2 2.0.0-2Python bindings for the GTK+ widget set > > Seems to doesn't have codegen installed :-( > You possibly need the development package for pygtk as well. I am not > familiar enough with Debian's packaging scheme to know for sure. Ok, and, as Charles said, it's on python-gtk2-dev has pygtk-codegen! Thanks for the answers! alejandro -- + There is no dark side of the moon really. Matter of fact it's all dark. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] McMillan Installer problems
> The "Widget" type is missing from the gtk._gtk module. In fact, > I did an inventory of the class and found of the 702 normal attributes, > there were only 569 present. The missing attributes are: My bad.. this actually happens because I forgot to tell installer about the "atk" module (and because pygtk will silently continue running after an import failure.. *sigh*). Anyway.. now I got back to the original problem I was trying to solve. I am also using pygtkgl, it fails when trying to do an import: if ((module = PyImport_ImportModule("gtk.gdkgl")) != NULL) { [...] } else { PyErr_SetString(PyExc_ImportError, "could not import gtk.gdkgl"); return; gtk.gdkgl is failing to load, even though I did ensure to copy _gdkgl.so to the install directory. Has anyone experience this before or found out the issue? Still investigating... > Tim N. Tim N. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] McMillan Installer problems
Hi, I'm trying to use the McMillan python installer package (http://www.mcmillan-inc.com/install1.html) on some sources that use pygtk. I'm having some problems doing so. I was wondering if anyone has gotten this to work in the past? I'm aware that the installer requires me to specify which imports are hidden in native C code. I believe I've caught most of these (and handling some of them manually).. But.. after getting past that hurdle I'm seeing very weird behavior. in libglade.c:pylibglade_register_classes there is a failure during import: if ((module = PyImport_ImportModule("gtk._gtk")) != NULL) { PyObject *moddict = PyModule_GetDict(module); _PyGtkWidget_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Widget"); if (_PyGtkWidget_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Widget from gtk._gtk"); return; } The "Widget" type is missing from the gtk._gtk module. In fact, I did an inventory of the class and found of the 702 normal attributes, there were only 569 present. The missing attributes are: AccelGroup AccelLabel Accessible Adjustment Alignment Arrow AspectFrame Bin Box Button ButtonBox Calendar CellEditable CellRenderer CellRendererPixbuf CellRendererText CellRendererToggle CheckButton CheckMenuItem CList ColorSelection ColorSelectionDialog Combo Container CTree CTreeNode Curve Dialog DrawingArea Editable [...] TreeSortable TreeStore TreeView TreeViewColumn VBox VButtonBox Viewport VPaned VRuler VScale VScrollbar VSeparator Widget Window WindowGroup ie.. just about all of the widget types. I'm not too familiar with the innards of pygtk (getting more familiar with it now). Does this ring a bell to anyone? How is the process of defining this set of attributes different than the rest of the pygtk attributes? Any help or hints appreciated... Tim N. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] UnicodeError/LookupError and exe installers
Hi, I put up a simple page about fixing UnicodeError exception after exefication with some installers. http://pasternak.w.lub.pl/python-installers-unicode.html Hope it can be useful. Regards, -- Michal Pasternak :: http://pasternak.w.lub.pl ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] gnomeprint
A Qua, 2003-10-15 às 22:00, Earney, Billy C. escreveu: > When I execute the following half a dozen lines of python code I get the > error below. gnome_glyphlist_new seems to be a function, but the error > below states otherwise. Does anyone have a clue why? gnome_glyphlist_new is only in C code. In python code you should just instantiate the gnomeprint.GlyphList class. Regards. -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] gnomeprint
When I execute the following half a dozen lines of python code I get the error below. gnome_glyphlist_new seems to be a function, but the error below states otherwise. Does anyone have a clue why? Billy #!/usr/bin/python import pygtk; pygtk.require("2.0") import gnomeprint gnomeprint.gnome_glyphlist_new() % ./glyph.py Traceback (most recent call last): File "./glyph.py", line 7, in ? gnomeprint.gnome_glyphlist_new() AttributeError: 'module' object has no attribute 'gnome_glyphlist_new' ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] New FAQ: rendering computed TreeViewColumns
Hello! New subscriber here; #pygtk's very own kiko suggested I contribute this here after I got my answer, and let you work your magic so other people might not ask this over and over again :) It's easy to have a gtk.CellRendererText render an integer i from your model, but it's not so easy to render f(i). In my case I wanted to store file sizes (in bytes) as integers, but report them in ls -sh's familiar xx.xM format. The solution hinges around gtk.TreeViewColumn.set_cell_data_func, using the -original- CellRendererText you supply to that column, and setting the renderer's 'text' property. Here's a quick and dirty example that kinda does an ls -shA . and reports it in a list. I'm not sure why my sizes are somewhat off, but that doesn't impact the relevent process. :) -m -- #! /usr/bin/env python import pygtk pygtk.require("2.0") import gtk # set_cell_data_func's callback - reads the size, sets the renderer def render_filesize(column, cell, model, iter, renderer): bytes = model.get_value(iter, 1) if bytes < 1000: sizestr = str(bytes) + 'B' elif bytes < 1000*2**10: sizestr = '%.2fK' % (bytes/2.0**10) elif bytes < 1000*2**20: sizestr = '%.2fM' % (bytes/2.0**20) elif bytes < 1000*2**30: sizestr = '%.2fG' % (bytes/2.0**30) renderer.set_property('text', sizestr) win = gtk.Window() model = gtk.ListStore(str, int) view = gtk.TreeView(model) view.append_column(gtk.TreeViewColumn('File', gtk.CellRendererText(), text=0)) size_renderer = gtk.CellRendererText() size_renderer.set_property('xalign', 1.0) size_column = gtk.TreeViewColumn('Size', size_renderer, text=1) # note that I carefully use the column's original renderer and I # pass it as the user_data argument so the callback has it size_column.set_cell_data_func(size_renderer, render_filesize, size_renderer) view.append_column(size_column) win.add(view) win.show_all() win.connect('delete-event', gtk.mainquit) win.connect('destroy-event', gtk.mainquit) # get some info to test it import os for f in os.listdir('.'): model.append((f, os.stat(f)[6])) gtk.mainloop() -- -- Michael Urman [- [EMAIL PROTECTED] -] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Making librsvg bindings..
On Tuesday, October 14, 2003, at 09:11 PM, Malcolm Tredinnick wrote: Well, at least, binary packages from debian: ii python2.3-gnom 2.0.0-5Python bindings for GNOME 2 ii python2.3-gtk2 2.0.0-2Python bindings for the GTK+ widget set Seems to doesn't have codegen installed :-( You possibly need the development package for pygtk as well. I am not familiar enough with Debian's packaging scheme to know for sure. In Debian, python-gtk2-dev seems to have it. -- Charles Lepple [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] vtk problem with libpng
> "John" == John Hunter <[EMAIL PROTECTED]> writes: John> It's not clear to me importing vtk would change the libpng John> that gtk is linking with. David Thompson, on the VTK mailing list, advised me to compile with VTK_USE_SYSTEM_PNG turned ON, as well as VTK_USE_SYSTEM_EXPAT VTK_USE_SYSTEM_JPEG VTK_USE_SYSTEM_TIFF VTK_USE_SYSTEM_ZLIB which worked. These options are exposed by cmake -i if you request to see the advanced options. JDH ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/