[pygtk] traversing a TreeView
I've got a question about the best way to iterate over the items in a TreeView starting with an arbitrary item in the treeview. I'm trying to implement a search that starts with the row selected by the user and then continues searching down the rows, but I can't figure out a decent way to do it. Here's the basic layout of my code: def onSearchActivated(self, widget): searchText = widget.get_text() (path, column) = self.treeView.get_cursor() iter = self.treeStore.get_iter(path) for searchIter in : item = self.treeStore.get_value(searchIter, 0) if item.prompt.find(searchText) > -1: searchPath = self.treeStore.get_path(searchIter) self.treeView.set_cursor(searchPath, column, 0) break Does anyone know how to do this? I'm using python 2.3 so generators are perfectly acceptable (and preferred since they remove the search logic from the traversal logic). I thought of doing a depth first search, but I want to traverse to siblings of the user selected row's parent. Basically, any row that is visually underneath/below the current row when the tree is completely expanded out. If anyone has done this before, I'd love some advice. Thanks. -- Christian Bird ___ 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] PyGTK2 Tutorial v.2.1
Alex Roitman wrote: Say, if I were to write that section, what tools should I use to create a nice page? I want it to fit into the overall style, and to minimize monkeying around with manually switching tags, class names, etc. Any docbook template/example? The source is in the gnome.org cvs server under pygtk-docs/2.0/tut The best approach is to check out the source and see what tags are in use. As for tools I use emacs and the psgml.el module. The docs are all docbook book XML. I don't use a huge number of tags in the tutorial so it should be possible to look at a couple of simple chapters and figure out the basic usage model. John ___ 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] PyGTK2 Tutorial v.2.1
On Tue, 2004-07-06 at 14:56, John Finlay wrote: > Alex Roitman wrote: > >If you'd like me to put my work where my mouth is :-), let me know and I > >can scribble something. > > > Contributions are always cheerfully accepted. Say, if I were to write that section, what tools should I use to create a nice page? I want it to fit into the overall style, and to minimize monkeying around with manually switching tags, class names, etc. Any docbook template/example? Thanks, Alex -- Alexander Roitman http://ebner.neuroscience.umn.edu/people/alex.html Dept. of Neuroscience, Lions Research Building 2001 6th Street SE, Minneapolis, MN 55455 Tel (612) 625-7566 FAX (612) 626-9201 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] PyGTK2 Tutorial v.2.1
Alex Roitman wrote: John, On Tue, 2004-07-06 at 14:06, John Finlay wrote: I've updated the PyGTK2 Tutorial at: http://www.moeraki.com/pygtktutorial/pygtk2tutorial/index.html Great work, as always!!! Thanks In addition to receiving comments about tutorial problems, errors and enhancements, While we're at it, I noticed that the new FileChooser-based methods of selecting files are not covered. As I understand, the FileChooser is a preferred way of selecting files in gtk2.4. Your pygtk reference is very good on this subject. I think that including an example code from pygtk source would make a nice subsection in the tutorial as well. It's at the top of my list after GenericCellRenderer. Then there are: UIManager ComboBox and ComboboxEntry EntryCompletion Actions IconInfo, IconSet, IconSource, IconTheme, etc. Toolbars with ToolItems Pango and so on If not, then maybe it should be added to the undocumented widgets list. I want to eliminate that section. :-) If you'd like me to put my work where my mouth is :-), let me know and I can scribble something. Contributions are always cheerfully accepted. John ___ 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] PyGTK2 Tutorial v.2.1
John, On Tue, 2004-07-06 at 14:06, John Finlay wrote: > I've updated the PyGTK2 Tutorial at: > http://www.moeraki.com/pygtktutorial/pygtk2tutorial/index.html Great work, as always!!! > In addition to receiving comments about tutorial problems, errors and > enhancements, While we're at it, I noticed that the new FileChooser-based methods of selecting files are not covered. As I understand, the FileChooser is a preferred way of selecting files in gtk2.4. Your pygtk reference is very good on this subject. I think that including an example code from pygtk source would make a nice subsection in the tutorial as well. If not, then maybe it should be added to the undocumented widgets list. If you'd like me to put my work where my mouth is :-), let me know and I can scribble something. Thanks, Alex -- Alexander Roitman http://ebner.neuroscience.umn.edu/people/alex.html Dept. of Neuroscience, Lions Research Building 2001 6th Street SE, Minneapolis, MN 55455 Tel (612) 625-7566 FAX (612) 626-9201 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/
[pygtk] PyGTK2 Tutorial v.2.1
I've updated the PyGTK2 Tutorial at: http://www.moeraki.com/pygtktutorial/pygtk2tutorial/index.html Tarball at: http://www.moeraki.com/pygtktutorial/pygtk2tutorial.tgz (1.0 MB) And PDF at: http://www.moeraki.com/pygtktutorial/pygtk2tutorial.pdf (1.6 MB) The changes from the last version include: - GenericTreeModel - Sorting of TreeModel rows - Update tree row drag and drop example - Editable and activatable TreeView cells - New example using cell data functions - Update timeout, IO and idle functions section - Update drag and drop section - bug fixes due to reports by: Thomas Mills Hinkle, Rafael Villar Burke, Guilherme Salgado, Ming Hua, Doug Quale and vector180 In addition to receiving comments about tutorial problems, errors and enhancements, I'm interested in hearing from poeple who have used the GenericTreeModel. Specifically, I'm interested in what applications require a custom tree model instead of the standard ones, and what issues they encountered developing and using a custom tree model. Same for the GenericCellRenderer. John ___ 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] Gtkmvc + treemodel/treeview
I'm using gtkmvc for a semi-complex GUI program and wondered if you guys had any ideas on the best way to integreate the MVC structure of gtkmvc with the treemodel/treeview structures. Any good strategies? Thanks, Joe Laughlin NCO Simulation Labs Integrated Defense Systems The Boeing Company ___ 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] I need a list of all items selected in a 'gtk.multiple' liststore, but I'm using pygtk 2.0
On Tue, Jul 06, 2004 at 11:20:20AM -0700, Chris Irish wrote: >Thanks Christian, I guess I should have looked there first. No problem, but answers should CC: the mailing list. > I have a few questions still though. Since that lambda is called from > the .selected_foreach method are those model, path, iter variables > already supplied or do I need to define them first? They are already supplied -- the lambda is invoked as a callback with that specific function signature. > I copied it directly into my code and it ran but I'm not sure what it > returned. I got a list of tuple pairs i.e. [(0,), (1,)] etc... Are > these values the iter's Well, from reading the code, they are the paths of the items selected. I guess you could swap path for iter in the lambda and get the iters instead, but you'd need to test that -- I've never used TreeView :-) > or something else and should there be a value after the comma? No, it's just Python's way of displaying a single-item tuple. >>> a = (1,) >>> print a (1,) Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 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] I need a list of all items selected in a 'gtk.multiple' liststore, but I'm using pygtk 2.0
On Tue, Jul 06, 2004 at 10:46:56AM -0700, Chris Irish wrote: > Hi all, I need a list of all items selected in a liststore set to > gtk.multiple, however I can't use .get_selected_rows(model) because I'm > not using pygtk 2.2 or above. Any suggestions, thanks in advance, http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.007.htp (That's why it's called a FAQ :-P) Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 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] I need a list of all items selected in a 'gtk.multiple' liststore, but I'm using pygtk 2.0
Hi all, I need a list of all items selected in a liststore set to gtk.multiple, however I can't use .get_selected_rows(model) because I'm not using pygtk 2.2 or above. Any suggestions, thanks in advance, Chris ___ 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] How to get the text from (new style) ComboBoxEntry
On Tue, 2004-07-06 at 08:12, Nikos Kouremenos wrote: > but I couldn't understand [sorry I'm new in the GTK world] how to get > the text from the selection that the user has finally done! > Somehow I have the feeling that this is the improper way to get the currently selected text, but the attached file is the result of my playing around with the new ComboBox. The callback "on_combo_box_changed" is probably of most interest to you. There is probably a more elegant way to do this, but it appears to work ;P If anyone can confirm this, I can add it to the FAQ. Hope it helps, ~djc combo_test.py Description: application/python ___ 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] How to get the text from (new style) ComboBoxEntry
hello and kudos to the devs. I'm testing PyGTK and I have latest Glade-2 so it uses latest GTK API. I downloaded the last pygtk and gnome-python. but tell me something, I've seen this: http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkcombobox.html#function-gtk--combo-box-new-text but I couldn't understand [sorry I'm new in the GTK world] how to get the text from the selection that the user has finally done! I guess you have a working example, but that is NOWHERE in the internet(as google sees it). Could please post an example (either programmatically or gladely :P) so as to do this? and if you do I think you should add it at least in the FAQ atm in http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq14.008.htp Thanks again, Nikos Kouremenos Greece.Athens ___ 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] g_log_set_handler?
A Seg, 2004-07-05 às 18:47, John Ehresman escreveu: > Gustavo J. A. M. Carneiro wrote: > > Did this. All (and only) Gtk warnings now are caught and raised as > > python warnings. The advantage of doing so is that by default python > > shows the python source file and line number that caused the warning to > > be raised. Also, warnings can be turned into exceptions or redirected > > somewhere else. > > Thanks, I generally agree with this approach. There's a practical > problem on Windows, though, because a GUI application should redirect > all log domains to prevent a console window from appearing when > something is printed to stdout or stderr. Currently, Wing redirects the > following domains: NULL, "Pango", "Gtk", "Gdk", "GLib", "GLib-GObject". > > Maybe pygtk should redirect more domains and provide an api to add new > redirected domains. +1 Regards. -- Gustavo João Alves Marques Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> The universe is always one step beyond logic. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/