Re: [pygtk] ANNOUNCE: PyGTK 2.0.0
At 01:20 PM 9/2/2003 -0300, Christian Reis wrote: On Tue, Sep 02, 2003 at 08:17:40PM +0400, Alejandro David Weil wrote: One question: Does pygtk works in M$ Windows? See below: Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ In particular: http://www.async.com.br/faq/pygtk/index.py?req=showfile=faq21.001.htp The new pygtk-2.0.0 for win32 installer is now available on my site. To people downloading this release, I strongly recommend to upgrade GTK+ to the recently release 2.2.3 available from http://www.dropline.net/gtk/ Cedric ___ 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] CVS branches and plans for the future.
On Wed, 2003-09-03 at 19:19, James Henstridge wrote: On 3/09/2003 9:50 AM, Malcolm Tredinnick wrote: [...] What do you think about moving the gtksourceview bindings into the main module (I'm not sure where exactly in the directory tree)? This is all said without having talked to the maintainer about his plans, but I like the idea of having a single-source download for this kind of stuff. Things like vte are different, since it includes the Python bindings in the main module. This is an interesting question. I really don't want to stick bindings for too many libraries into the pygtk tarball. I think it is a good thing that it is fairly low in the dependency stack, since it makes it easier for other packages to depend on pygtk for their builds. Making these sort of things optional dependencies is really a copout though. For people building packages (ie. Linux distros, etc), the optional dependencies are essentially hard dependencies if they want all features of the package to be built (even if they then split things up into multiple binary packages). If pygtk has an optional dependency on libfoo, then other packages that depend on pygtk (optional or not) will also depend on libfoo. If these dependencies get too complex, they are likely to either (a) not build pygtk's libfoo binding, or parts of other packages that depend on pygtk. I agree with all of this. My original mail may not have been too clear: I was asking about including it under the gnome-python CVS module, not inside pygtk itself. It is already beneficial to only need a stack that goes up to GTK+ to build PyGTK. Now it might make sense to distribute the GtkSourceView binding with gnome-python. Alternatively, it might make sense to package them with GtkSourceView itself (like with VTE). I don't know. Obviously the latter makes the most sense. Rather than us all having a hearty round or two of it would be nice..., I will follow this up with the various maintainers and see what falls out. 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/
[pygtk] Creating custom CellRenderer
Hi! As a beginner pygtk user, I'm trying to make a TreeView which has multi-line cells. Each node would contain about 1-4 lines of text. If I were to use a gtk.CellRendererText, only 1 line would be visible, and the user would have to scroll horizontally to see the rest of the text. I want the full text to be visible, by having it wrap if it is more than one line. The best solution would be using a TextView as a CellRenderer. But it looks like normal widgets can't be used like that. (Is there a reason for this? One would think that CellRenderers would be very similar to normal widgets.) So I guess my best bet is making a custom CellRenderer. I thought something like this would work: ---8 import pygtk pygtk.require('2.0') import gtk import gobject import pango class MyCellRenderer(gtk.GenericCellRenderer): def __init__(self): self.__gobject_init__() def on_render(self, window, widget, background_area, cell_area, expose_area, flags): context = widget.get_pango_context() layout = pango.Layout(context) layout.set_text(long_string) layout.set_wrap(gtk.WRAP_CHAR) layout.set_width(cell_area.width) widget.style.paint_layout(window, gtk.STATE_NORMAL, gtk.TRUE, cell_area, widget, 'footext', cell_area.x, cell_area.y, layout) def on_get_size(self, widget, cell_area): return 0,0,100,100 # return something big enough gobject.type_register(MyCellRenderer) class Tree(gtk.TreeView): def __init__(self): self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) gtk.TreeView.__init__(self) self.set_size_request(300, 200) self.set_model(self.store) self.set_headers_visible(gtk.TRUE) rend = gtk.CellRendererText() column = gtk.TreeViewColumn('First', rend, text=0) self.append_column(column) rend = MyCellRenderer() column = gtk.TreeViewColumn('Second', rend) self.append_column(column) def insert(self, name): iter = self.store.append() self.store.set(iter, 0, name) long_string=long-long string for testing asdf asdf asdf asdf adsf asdf asdf asdasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf w = gtk.Window() w.set_position(gtk.WIN_POS_CENTER) w.connect('delete-event', gtk.mainquit) t = Tree() t.insert('baz') w.add(t) w.show_all() gtk.main() ---8--- The immedate problem is that layout.set_width() apparently expects something other than pixels. If I do layout.set_width(20), get_pixel_size() will return a width of 195 pixels. I couldn't find anything in the documentation about the units set_width() expects or how to convert number of pixels to it. Where is this documented, and how could I handle the conversion? Even if I somehow manage to convert pixels to this unit system, I will have another problem: I want the width of the text to adjust to the width of the TreeView widget. The height of the text should adjust to the amount of text in that given node. The problem is, that as I understand it, the CellRenderer has to calculate the size needed in on_get_size(). But I couldn't find a way to get the size of the TreeWidget (or rather, the size left for the cell after indentation, the little icon showing expandedness, etc.) in that method. cell_area is None there. I can access the width of the cell from on_render(), (it seems to be cell_area.width) but I don't see a way to change the height of the cell there. Is there a way to solve this? Thanks in advance, Abel Daniel ___ 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] Creating custom CellRenderer
Hi, The immedate problem is that layout.set_width() apparently expects something other than pixels. If I do layout.set_width(20), get_pixel_size() will return a width of 195 pixels. I couldn't find anything in the documentation about the units set_width() expects or how to convert number of pixels to it. Where is this documented, and how could I handle the conversion? The factor is pango.SCALE, and you can use pango.PIXELS(layout_space) to convert (or just divide). No clue about your other question, though. Iaki ___ 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] PyGTK, Win32 and py2exe: no luck
I am trying to bundle up a GTK+2 app on Win32 which uses PyGTK (from Cedric's pygtk installer). I have tried py2exe, cx_Freeze, and Gordon McMillan's Installer, but I can't seem to make a working standalone .exe file with any of them. Since the PyGTK FAQ says that you can do this with py2exe, I'll just focus on that attempt for now. I get a whole bunch of messages and py2exe creates an .exe file. When I run it, I get this error: Traceback (most recent call last): File string, line 17, in ? File pygtk.pyc, line 73, in require AssertionError: required version '2.0' not found on system ... which is probably a result of calling pygtk.require('2.0'). Here's my setup.py: # setup.py from distutils.core import setup import glob try: import py2exe except: import sys sys.stderr.write(You need py2exe.\n) import gtk_path dlls=[gtk_path.gtkdir[0] + '\\lib\\libglib-2.0-0.dll'] setup(name=posgui, version=0.0.1, scripts=[posgui.pyw], data_files=[(., [posgui.glade]), (., dlls)], ) And here's setup.cfg: [py2exe] includes=pango,atk,gtk (Adding the 'gtk' module in 'includes' doesn't seem to have an effect) I do get the following warning: warning: py2exe: * The following modules were not found: warning: py2exe: * FCNTL warning: py2exe: * gdk warning: py2exe: * javax.comm warning: py2exe: * ltihooks but I can't figure out how to resolve the gdk one, and I'm not using the other modules directly. Here are some relevant version numbers: Python: 2.3 py2exe: 0.4.1 and 0.4.2 (same results) GTK: GTK-Runtime-Environment-2.2.1.2.exe (from dropline) pygtk: 1.99.17 Any suggestions? thanks, -- Charles Lepple [EMAIL PROTECTED] http://www.ghz.cc/charles/ ___ 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] Can anyone do a status on OSX + PyGTK?
Scott Prive said: I am using PyGTK2 on Windows and Linux. Has anyone built a package for OS/X? I understand from a few weeks ago's threads that there were issues building under OS/X, but they should/might be cleared up now. Is there perhaps an un-official or experimental fink package? I places a set of pygtk2 packages in Fink's unstable on August 13. It's based on pygtk-1.99.17 (I'll move it to 2.0.0 next week) and is available for python 2.2 and 2.3 (NB: the -py22 is untested). Let me (or the usual Fink help channels) know if you have any trouble getting it installed. dan -- Daniel Macks [EMAIL PROTECTED] http://www.netspace.org/~dmacks ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/