Re: [pygtk] ListStore iter vs. path
Caleb Marcus wrote: One question I have is, what's the difference between iters and paths? At a guess, I'd say that iters are likely to be more efficient, as they can hook directly into the underlying data structure, whereas a path requires some sort of lookup operation each time it's used. Whether this difference remains detectable amongst all the other overhead of Python/C interfacing is uncertain, though. I'd say just use whichever is more convenient for you, and only worry about performance if it becomes an issue. -- Greg ___ 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] ANNOUNCE: GnomePython 2.21.0 (unstable)
GnomePython 2.21.0 has been just released. This a development release for testing. I am especially interested in people testing the new WAF build system. GnomePython provides python interfacing modules for most of the GNOME Developer Platform libraries (except those already wrapped somewhere else.) Currently the list of provided python modules includes: - gnome, gnome.ui - gnomecanvas - gnomevfs - gconf - bonobo, bonobo.activation, bonobo.ui Overview of Changes from gnome-python 2.20.1 to gnome-python 2.21.0 * Bug 462884 – Add support for get_file_mime_type. * Bug 467688 – Binding for gnome_vfs_create_symbolic_link. * Bug 494500 – gnomecanvas.path_def_new() doesn't provide a way to build a closed path. * Ship with html docs * New WAF build system (to use it, do ./waf configure && ./waf) The source tarball can be found here: http://download.gnome.org/sources/gnome-python/2.21/ Please file bug reports (bugs, missing APIs) here: http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-python -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> The universe is always one step beyond logic ___ 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] context menus for ListViews
How can I create context menus for ListView elements? The PyGTK Tutorial doesn't go into this, and I can't follow the GtkTreeView tutorial as it's not in Python. signature.asc Description: This is a digitally signed message part ___ 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] ListStore iter vs. path
I'm just starting to learn PyGTK and GUI programming in general, and Tree/ListViews confuse me tremendously. One question I have is, what's the difference between iters and paths? It seems like paths are much easier to use, because I can simply use model[path][column] to access any part of the ListStore. Is there any way to get the current selection as a path rather than an iter? signature.asc Description: This is a digitally signed message part ___ 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/
Re: [pygtk] utf8 validating string
John Ehresman wrote: > Yann Leboulanger wrote: >> John Ehresman wrote: >>> I'm confused here; I think your last example passes '\x0' to a gtk >>> function which does not work. Either remove the '\x0' or do something >>> else with \x0 here. Or am I missing something? >>> >> >> removeing the \x0 isn't a problem, a replce can do that, but is it the >> only char that will cause this problem? > > Yes as long as the rest is valid utf8. \x0 is a problem because it > terminates C strings so you can never have a C string with a \x0 in it > (it's not quite that simple, but if you don't know C it's probably close > enough). Python strings can contain \x0 so there's a problem when > passing the length to the conversion function. > > Cheers, > > John > ok great, thanks, python's greater than C ;) Ok ok I go out ->[] ;) -- Yann ___ 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/
Re: [pygtk] utf8 validating string
John Ehresman wrote: > I'm confused here; I think your last example passes '\x0' to a gtk > function which does not work. Either remove the '\x0' or do something > else with \x0 here. Or am I missing something? > removeing the \x0 isn't a problem, a replce can do that, but is it the only char that will cause this problem? -- Yann ___ 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/
Re: [pygtk] utf8 validating string
John Ehresman wrote: > Yann Leboulanger wrote: >> I'd like not to have it. But I getthis string by gpg-decodding a message >> send by Miranda IM. I think it's a bug in their GnuPG implementation, >> but anyway I'd like my client to detect those bad string and a) print >> message correctly if I can or b) don't traceback and print a warning >> message. But for that I need a function that tells me that >> g_utf8_validate will fail ... > > You probably should explicitly decide how to handle \0. If it's always > at the end, it's probably just a simple bug and can be chopped off but > it may be something more if valid text follows the \0. > > But in general, I think this'll work: > > def valid_glib_utf8(s): > try: > unicode(s, 'utf-8') > except Exception: > return False > else: > return '\x0' not in s > > In case you need it s.replace('\x0', '') will remove the \0's. > > Cheers, > > John > That doesn't work: >>> import gtk >>> tv = gtk.TextView() >>> b = tv.get_buffer() >>> t = "test\x00" >>> u = unicode(t, 'utf-8') >>> b.set_text(t) __main__:1: GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed it's the same if I try with the unicode: >>> import gtk >>> tv = gtk.TextView() >>> b = tv.get_buffer() >>> t = "test\x00" >>> u = unicode(t, 'utf-8') >>> b.set_text(u) __main__:1: GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed -- Yann ___ 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] Re: pygtk: Frameworks (e.g. kiwi)
Thomas Guettler wrote: > just a general question: > > Does anyone use a framework like kiwi or pygtkmvc to use pygtk? > > Which one do you use and why? I use pygtkmvc. It is simple to use and elegant. It does not introduce another dependency. It makes MVC-style programming easy. I have not used Kiwi. -- Jeffrey Barish ___ 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] gtk.statusicon menu on win32
in windows, the gtk.statusicon menu "scrolls" into view, which is very slow and frustrating. any idea how i can stop this? it doesnt scroll on linux and i dont see what would cause it ___ 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/
Re: [pygtk] Re: A Timer and refreshing TextView
On Dec 3, 2007, at 9:18 AM, Mark Stahler wrote: John Finlay wrote: Nathaniel Smith wrote: On Sun, Dec 02, 2007 at 09:34:40PM -0800, Aravind Vijayakumar wrote: Since you are opening the file afresh each time in refreshLog, won't you be reading the first line each time? The .read() method in Python reads the whole file, not just the first line. read() will also read from the current position so you can keep reading as new data is added. An alternative is to not open the file in refreshLog but when initializing and then read it in refreshLog which is called by timeout_add - something like: Code: textview = self.gui.get_widget("bottom_textview") # Methods that need to be run on start file = open('log.txt') self.refreshLog() # Timer to autorefresh log timer = gobject.timeout_add(500, self.refreshLog) timer.start() def refreshLog(self): string = file.read() if string: buffer = textview.get_buffer() mark = buffer.create_mark("end", buffer.get_end_iter()) textview.scroll_to_mark(mark, 0) buffer.insert_at_cursor(string) buffer.delete_mark_by_name("end") return True John ___ 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/ Thank you all for the replies. I was not aware of the problems with the threading in GTK+. I got it working perfectly using the gobject timeout with Johns modified routine. I now only have to insert new text from the log and dont have to reread the whole thing. You have it working now so this isn't really relevant. However, I had success using gnome.vfs.monitor_add. It can call your event handler in several situations, I used MONITOR_EVENT_CHANGED to find out when my log files changed. I keep track of the current file position each time so I open, seek to that position, read, close, record the new position and add the data to the text buffer. No polling necessary. And I assume that the gnome.vfs call is doing a select so it should be much more efficient. Thanks! ___ 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 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] Re: A Timer and refreshing TextView
John Finlay wrote: Nathaniel Smith wrote: On Sun, Dec 02, 2007 at 09:34:40PM -0800, Aravind Vijayakumar wrote: Since you are opening the file afresh each time in refreshLog, won't you be reading the first line each time? The .read() method in Python reads the whole file, not just the first line. read() will also read from the current position so you can keep reading as new data is added. An alternative is to not open the file in refreshLog but when initializing and then read it in refreshLog which is called by timeout_add - something like: Code: textview = self.gui.get_widget("bottom_textview") # Methods that need to be run on start file = open('log.txt') self.refreshLog() # Timer to autorefresh log timer = gobject.timeout_add(500, self.refreshLog) timer.start() def refreshLog(self): string = file.read() if string: buffer = textview.get_buffer() mark = buffer.create_mark("end", buffer.get_end_iter()) textview.scroll_to_mark(mark, 0) buffer.insert_at_cursor(string) buffer.delete_mark_by_name("end") return True John ___ 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/ Thank you all for the replies. I was not aware of the problems with the threading in GTK+. I got it working perfectly using the gobject timeout with Johns modified routine. I now only have to insert new text from the log and dont have to reread the whole thing. Thanks! ___ 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] pygtk: Frameworks (e.g. kiwi)
Hi, just a general question: Does anyone use a framework like kiwi or pygtkmvc to use pygtk? Which one do you use and why? Thomas ___ 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/
Re: [pygtk] [Fwd: PyGTK in Vista?]
Rafael Villar Burke a écrit : Sujet: PyGTK in Vista? Expéditeur: "Nicklas Larsson" <[EMAIL PROTECTED]> Date: Sat, 1 Dec 2007 07:44:48 +0100 Destinataire: [EMAIL PROTECTED] Destinataire: [EMAIL PROTECTED] Hi, I have tried to install PyGTK in Microsoft Windows Vista but failed. I have installed GTK+ runtime, and that wen well, but I got dialogs during installation of PyCairo, PyGObject, and PyGTK telling me that some things could not be created. At the end however, they tell me that it is installed. From python, I get DLL load failed when I do import gtk. I am in no way a Windows Vista expert, I just thought it would be nice to be able to also run my graphical python applications both on Linux and on Windows. The package of PyGTK I found was from November 2006. I found no information on your site about Microsoft Windows Vista. Regards, Nicklas Larsson you installed pycairo, pygobject and pygtk from there? http://pygtk.org/downloads.html pygtk version there is from 30 August 2007 -- Yann ___ 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] [Fwd: PyGTK in Vista?]
--- Begin Message --- Hi, I have tried to install PyGTK in Microsoft Windows Vista but failed. I have installed GTK+ runtime, and that wen well, but I got dialogs during installation of PyCairo, PyGObject, and PyGTK telling me that some things could not be created. At the end however, they tell me that it is installed. From python, I get DLL load failed when I do import gtk. I am in no way a Windows Vista expert, I just thought it would be nice to be able to also run my graphical python applications both on Linux and on Windows. The package of PyGTK I found was from November 2006. I found no information on your site about Microsoft Windows Vista. Regards, Nicklas Larsson --- End Message --- ___ 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/
Re: [pygtk] A Timer and refreshing TextView
Nathaniel Smith wrote: On Sun, Dec 02, 2007 at 09:34:40PM -0800, Aravind Vijayakumar wrote: Since you are opening the file afresh each time in refreshLog, won't you be reading the first line each time? The .read() method in Python reads the whole file, not just the first line. read() will also read from the current position so you can keep reading as new data is added. An alternative is to not open the file in refreshLog but when initializing and then read it in refreshLog which is called by timeout_add - something like: Code: textview = self.gui.get_widget("bottom_textview") # Methods that need to be run on start file = open('log.txt') self.refreshLog() # Timer to autorefresh log timer = gobject.timeout_add(500, self.refreshLog) timer.start() def refreshLog(self): string = file.read() if string: buffer = textview.get_buffer() mark = buffer.create_mark("end", buffer.get_end_iter()) textview.scroll_to_mark(mark, 0) buffer.insert_at_cursor(string) buffer.delete_mark_by_name("end") return True John ___ 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/