Re: [pygtk] delete selection
Sorry for such a late response, but I just had a chance to come back to the pygtk stuff. Thank you for your help. I tried using the following code and it worked. However, it is meant only delete one row at a time right? (since get_slected() does not work in SELECTION_MULTIPLE mode) If I would like to delete multiple rows that are selected, do you have any suggestions? Again, using selection.selected_foreach produced errors. > #Here is the function attached to the delete button: > > def RemoveWatchVariables(button): > # delete each variable > def DeleteVar(model,path,iter,data=None): > model.remove(iter) > # get selection and iterate through > selection = watchvars_view.get_selection() > selection.selected_foreach(DeleteVar) On Tue, 2003-08-05 at 12:42, Grzegorz Adam Hankiewicz wrote: > On 2003-08-05, Yang Zheng <[EMAIL PROTECTED]> wrote: > > Can I not delete iterator like this? > > Hmmm... can't say what you do wrong, but here's my deletion code, > maybe it helps you: > >selection = self.list_view.get_selection() >model, iter, = selection.get_selected() >if iter: > path = model.get_path(iter) > model.remove(iter) > selection.select_path(path) > if not selection.path_is_selected(path): > row = path[0]-1 > if row >= 0: > selection.select_path((row,)) ___ 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] pygtk and databases
Gary Herron [Fri, Sep 26, 2003 at 10:31:10AM -0700]: > > Well, I thought that this might be because of the columns auto-sizing > > option. I did set_size(gtk.TREE_VIEW_COLUMN_FIXED) on all columns. Still > > the same behaviour. How could I get around it? I don't want the TreeView to > > "scan" throught rows in my model when those rows are not visible, because > > it takes much time. > > > Well now you've gone beyond my knowledge of TreeView's, but I think Thank you for your response and a link to FAQ, Gary. However, GTK+ developers just told me, that one of the scans is for sure a "validation scan" - and there's no possilibity of turning it off. Such possibility will be added in 2.4. Thank you. Regards, -- Michal Pasternak :: http://pasternak.w.lub.pl Noise to meet you. ___ 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] pygtk and databases
On Friday 26 September 2003 12:10 pm, Michal Pasternak wrote: > Gary Herron [Wed, Sep 24, 2003 at 10:14:54PM -0700]: > > On Wednesday 24 September 2003 11:45 pm, Michal Pasternak wrote: > > > Hi, > > > > > > do you know about any tips or documentation about using GTK widgets > > > to display large amounts of data? > > > > > > I have some TreeViews (both TreeStore and ListStore), to which I have > > > to insert a lot of data. Well, the scrolling seems fast enough, but the > > > insertion of the data lasts some time. Aren't there any tips and tricks > > > to make it a bit faster / less memory-consuming? > > > > Yes. Use the more general TreeModel class. > > Well, I did. As I have been debugging, the TreeView requests only the > values of the visible rows from the model - which is just fine - but just > after TreeView.set_model my TreeView scans _all_ the rows of the model, 2 > times. > > Well, I thought that this might be because of the columns auto-sizing > option. I did set_size(gtk.TREE_VIEW_COLUMN_FIXED) on all columns. Still > the same behaviour. How could I get around it? I don't want the TreeView to > "scan" throught rows in my model when those rows are not visible, because > it takes much time. Well now you've gone beyond my knowledge of TreeView's, but I think there is hope. I remember an example where the children are not even added to a TreeStore until their parent row is expanded, so certainly no time could be wasted traversing them at start up time. Perhaps you can apply something similar to your TreeModel. The example is in the PyGtk FAQ: http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.030.htp Good luck, Gary Herron ___ 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] pygtk and databases
Gary Herron [Wed, Sep 24, 2003 at 10:14:54PM -0700]: > On Wednesday 24 September 2003 11:45 pm, Michal Pasternak wrote: > > Hi, > > > > do you know about any tips or documentation about using GTK widgets > > to display large amounts of data? > > > > I have some TreeViews (both TreeStore and ListStore), to which I have to > > insert a lot of data. Well, the scrolling seems fast enough, but the > > insertion of the data lasts some time. Aren't there any tips and tricks to > > make it a bit faster / less memory-consuming? > > Yes. Use the more general TreeModel class. Well, I did. As I have been debugging, the TreeView requests only the values of the visible rows from the model - which is just fine - but just after TreeView.set_model my TreeView scans _all_ the rows of the model, 2 times. Well, I thought that this might be because of the columns auto-sizing option. I did set_size(gtk.TREE_VIEW_COLUMN_FIXED) on all columns. Still the same behaviour. How could I get around it? I don't want the TreeView to "scan" throught rows in my model when those rows are not visible, because it takes much time. -- Michal Pasternak :: http://pasternak.w.lub.pl Noise to meet you. ___ 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 is just great.
Gentlemen, I am using PyGTK 2 on NetBSD and Win32 and I must say, that it is just great. Everything works fine, using glade I can develop GUI very fast, TreeViews are the best thing I have ever seen in a GUI library and the API makes a lot more sense, than wxWindows (I have used wx before). And, on Win32 platforms, the different look of GTK (when not using GTK-WIMP) might be even a feature (did you notice, that there's a tendency in Windows world to create applications, which don't look too standard?). Thanks for it! Regards, -- Michal Pasternak :: http://pasternak.w.lub.pl Noise to meet you. ___ 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 my own widget in Pygthon - Some more info
On Thu, Sep 25, 2003 at 04:28:45PM +1200, Tim Evans wrote: > There is nothing wrong with subclass a gtk widget class in Python. > Something like this should work fine: > > class MyTopWidget(gtk.VBox): > def __init__(self): > gtk.VBox.__init__(self, False, 6) > self.set_border_width(12) > self.connect('expose-event', self._on_expose) > > def add(self, widget): > self.pack_start(widget, fill=True, expand=True) > > def _on_expose(self, widget, event): > print "I've been exposed!" > > Make sure that you are using pygtk-2.0.0. I don't think that > subclassing will work at all with 0.6, and some 1.99.x versions had Note that subclassing *does* work fine in 0.6 -- Kiwi uses it all over the place :-) Take care, -- Christian 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] libglade.XML.signal_autoconnect() problems
On Mon, Sep 15, 2003 at 01:19:21PM +0200, Igor Stroh wrote: > is there any way to find out the signal handler ids for sig.handlers > that were connected to widgets using signal_autoconnect() from > libglade.XML? http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.008.htp Take care, -- Christian 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] Connecting Spinner Widget to Variable?
On Tue, Sep 23, 2003 at 05:15:35PM +, Ian Szufnara wrote: > I was wondering if there is a way to connect a widget such as a > gtk.SpinButton() to a variable. So say i stored some value into a > variable, myVar = 10, the value shown on the Spinner would update to the > new value. You can implement this by associating myVar with an instance and hooking the __setattr__() method to do a spinbutton value update (using set_value() or set_text(), depending on the content). I do this in the Kiwi (http://www.async.com.br/projects/kiwi/) Proxy class automatically, but it doesn't support PyGTK2 (yet). > I currently have a (rather large) array that holds the values of each one > of my spinners when they get updated, using the command: > mySpin.connect("value_changed", self.handle_change_value, cardnum, rownum, > item) > > (where cardnum, rownum, item can be thought of as a 3 dimensional array) > > I want to be able change the value of each 'item' to a value by setting the > corresponding varuable to a certain value. Which means you want the reverse of what widget.connect() does. > I know that there is something similar in Tkinter, where a widget can be > attached to a variable, is there any equivalent in (py)GTK 2.x? Really? Do you have a reference for code that does this? I'm curious to see what the semantics are. Take care, -- Christian 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] Tooltips.
On Tue, Sep 23, 2003 at 06:07:00PM +0200, Michael Bauer wrote: > I'am calling this part of code in a for loop several times. The for loop > itselfe is called in a for loop several times. But the tooltips get only > displayed for the last for loop ran trough. See http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq03.007.htp The trick here is to realize where your callback can take a while to return, or where it is dynamically changing the window contents, and add a section like this in the body of your callback handler: while gtk.events_pending(): gtk.mainiteration(gtk.FALSE) This tells gtk to process any window events that have been left pending. If your handler has a long loop, for instance, inserting this snippet as part of the loop will avoid it hanging the window till the callback has finished. Take care, -- Christian 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] Problems compiling current CVS head on Win32.
Hi, > I got the same problem. The missing functions are > > gdk_font_get_display > gtk_plug_construct_for_display > gtk_plug_new_for_display > gtk_im_preedit_style_get_type > gtk_im_status_style_get_type These are indeed the infamous missing functions that James wanted to know about. > GtkPlug is not available on win32. The gdk_font and gtk_im functions are > not DLL exported in the latest gtk+-2.2.4 binaries. > gtk_im_preedit_style_get_type and gtk_im_status_style_get_type are in > gtk.def on CVS since July but it seems gtk.def was not updated in the > latest (2.2.4) gtk+ tarball. gdk_font_get_display is not listed in gdk.def. > > This is definitely a gtk+ on win32 bug that should be logged on bugzilla. > Instead of adding a bunch of functions to gtk-fake-win32.c, I think we > should list those functions in gtk.override in the win32-ignore section, > waiting for fxed def files and updated DLLs. > > Cedric I agree totally. The patch that I submitted on bugzilla was just a primitive hack to let everyone know about the problem since I couldn't find any bug already submitted about this. I like to keep an upto date copy of PyGtk compiled on my WinXP box. That was the quickest way to get it done without knowing too much about the inner workings of all the .override files. Alif. Heaven on earth can only be in one distant peaceful corner of the world...New Zealand. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/