Re: [pygtk] Windows Threading Fixes
On Tue, Feb 10, 2004 at 05:03:55PM -0500, Dave Aitel wrote: > So in order to address the threading bugs in Win32 once and for all, I > submit this little code snippet which is a very Proof of Concept thing I > wanted to use just to see if the concept worked and wasn't too aweful. > Some draconian firewalls will squawk about the use of an INET socket (not that you really have a choice of sockets on Windows). This may just be a minor inconvenice. Why don't you try the attached module? That way you can just use a Win32 event. import gsource import win32event queue_event = win32event.CreateEvent(None, 0, 0, None) qeid = gsource.add(queue_event, gsource.IO_IN, callback, arg) When you want to run the queue callback just do a win32event.SetEvent(queue_event). That's all there is to it! The setup.py file was something I just hacked up for this email. I think it should work. If you use MSVC you'll probably have to get the dsextras.py module to pass a --msvc-syntax to pkgconfig. --jkl gsource-test.tar.gz Description: Binary data ___ 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] Windows Threading Fixes
So in order to address the threading bugs in Win32 once and for all, I submit this little code snippet which is a very Proof of Concept thing I wanted to use just to see if the concept worked and wasn't too aweful. I haven't tried the idle() solution yet. I might check to see if it's better tomarrow (without sucking 100% cpu), but for now, this seems to work. Once I get my whole program ported over to it, I'll put my finished version in the FAQ. -dave testgui.tgz Description: Binary data ___ 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] Memory leak caused by set_cell_data_func and subsequent call of rendering function?
Hi, I am seeing a significant memory leak when using the set_cell_data_func() method of a gtk.TreeViewColumn. I have included an example program that illustrates the problem, I am using python2.3 on Sun Solaris 5.9 but also see the problem when running on a Linux box. Each time the rendering function (renderFunc) is called the memory usage increases, even when the rendering function executes no code. When I commend out the call to set_cell_data_func() the memory leak does not occur. Any help would be greatly appreciated. Thanks, Liza #!/opt/python/bin/python2.3 import sys import gtk import gobject as g # Class for storing dummy data class myData: def __init__(self): self.string1 = "string1" self.string2 = "string2" self.string3 = "string3" self.string4 = "string4" self.int1 = 1 self.int2 = 2 self.int3 = 3 self.int4 = 4 self.double1 = 1.00 self.double2 = 2.00 self.double3 = 3.00 self.double4 = 4.00 self.bool1 = gtk.TRUE self.iter = None return class windowTest: def __init__(self): self.window = gtk.Window() # Column Titles self.columns = ["string1", "string2", "string3", "string4", "int1", "int2", "int3", "int4", "double1", "double2", "double3", "double4", "bool1"] # ListStore self.model = gtk.ListStore(g.TYPE_STRING, g.TYPE_STRING, g.TYPE_STRING, g.TYPE_STRING, g.TYPE_INT, g.TYPE_INT, g.TYPE_INT, g.TYPE_INT, g.TYPE_DOUBLE, g.TYPE_DOUBLE, g.TYPE_DOUBLE, g.TYPE_DOUBLE, g.TYPE_BOOLEAN) # gtk.TreeView self.view = gtk.TreeView() self.window.add(self.view) self.window.show_all() self.view.set_model(self.model) # Add Columns to TreeView self.makeColumns() # Generate some dummy data self.data = [] self.makeData() # Force screen update gtk.timeout_add(500, self.writeToList) return def makeColumns(self): for title in self.columns: renderer = gtk.CellRendererText() column = gtk.TreeViewColumn(title, renderer, text=self.columns.index(title)) # Commenting out the following line gets rid of the memory leak column.set_cell_data_func(renderer, self.renderFunc, self.columns.index(title)) self.view.insert_column(column, self.columns.index(title)) del renderer del column return def renderFunc(self, column, cell, model, iter, col_no): ##print "renderFunc" ##print "column ref count =", sys.getrefcount(column) ##print "cell ref count = ", sys.getrefcount(cell) ##print "model ref count =", sys.getrefcount(model) ##print "iter ref count = ", sys.getrefcount(iter) ##print "col_no ref count =", sys.getrefcount(col_no) ##print "---" return def writeToList(self): m = self.model i = 0 for d in self.data: if d.iter == None: d.iter = m.insert(0) i += 1 print "inserting row ", i self.model.set_value(d.iter, self.columns.index("string1"), d.string1) self.model.set_value(d.iter, self.columns.index("string2"), d.string2) self.model.set_value(d.iter, self.columns.index("string3"), d.string3) self.model.set_value(d.iter, self.columns.index("string4"), d.string4) self.model.set_value(d.iter, self.columns.index("int1"), d.int1) self.model.set_value(d.iter, self.columns.index("int2"), d.int2) self.model.set_value(d.iter, self.columns.index("int3"), d.int3) self.model.set_value(d.iter, self.columns.index("int4"), d.int4) self.model.set_value(d.iter, self.columns.index("double1"), d.double1) self.model.set_value(d.iter, self.columns.index("double2"), d.double2) self.model.set_value(d.iter, self.columns.index("double3"), d.double3) self.model.set_value(d.iter, self.columns.index("double4"), d.double4) self.model.set_value(d.iter, self.columns.index("bool1"), d.bool1) return gtk.TRUE def makeData(s
Re: [pygtk] Bonobo and Python
A Ter, 2004-02-10 às 07:31, Girish Wadhwani escreveu: > That doesn't seem to work either. > > What I am trying to do is to load a compotent to view > a file. From my understanding gnome will select the > right component. What is the moniker that I have to > use? Do I have to use gnome vfs? I haven't found much > documentation on monikers except for: > http://primates.ximian.com/~miguel/monikers.html > Yes, bonobo automatically finds a component that can open the MIME type of the URI. However, that may not be very helpful in practice, since it may find the worst of several components capable of displaying that MIME type. Can you try the test program in attachment? It should print an object reference. For me it prints: [emperor:tmp]$ ./test-bonobo-monikers.py Bonobo-Message: Stream extender: 'vfs:http://www.gnome.org/' Bonobo-Message: Attempt activate object satisfying 'bonobo:supported_mime_types.has ('text/html') AND repo_ids.has ('IDL:Bonobo/Control:1.0') AND repo_ids.has ('IDL:Bonobo/PersistStream:1.0')': 0x81e41f0 (test-bonobo-monikers.py:2836): gtkhtml-WARNING **: No such file or directory (test-bonobo-monikers.py:2836): gtkhtml-WARNING **: No such file or directory > Thanks, > Girish > > > > > Using: > > > container = bonobo.ui.Container() > > > control = bonobo.ui.Widget("http://www.gnome.org";, > > >container.corba_objref()) > > > > > > Bonobo-WARNING **: Activation exception 'Moniker > > > interface cannot be found' > > > > Bonobo is right ;) Try this instead: > > > > control = > > bonobo.ui.Widget("vfs:http://www.gnome.org";, > >container.corba_objref()) > > > > In a more general case, you have to be very > > careful with what you put > > after the moniker prefix (vfs:), since some > > characters have special > > meaning to bonobo. When in doubt, escape the URI > > string first, using > > bonobo.moniker_util_escape(). > > > __ > Do you Yahoo!? > Yahoo! Finance: Get your refund fast by filing online. > http://taxes.yahoo.com/filing.html > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> #!/usr/bin/env python import pygtk; pygtk.require("2.0") import bonobo import bonobo.ui import gnome.vfs obj = bonobo.get_object("vfs:http://www.gnome.org/";, "IDL:Bonobo/Control:1.0") print obj ___ 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] multi-line cellrenderertext in C was: Re: VBox in a treeview?
Graham Ashton writes: > Apologies for responding to my own message, but I found a way to achieve > the same result (multi-line text inside a cell) by drawing a pango > layout directly onto the treeview widget. Apparently others want multi-line text in trees, too, so here is my version: (first release, not really polished, but should work. It should be good enough for debugging, but not for end-user release.) http://abeld.web.elte.hu/wrappedtext.tar.gz It is a C widget, you need to compile the widget part first. It can also be edited, the editing is handled by a TextView which is modified to implement the CellEditable interface. I will use it in an outliner program I am working on. I also tried the 'draw a pango layout on the widget' idea, but I decided against it. Can't exactly remember why, I think I had problems with setting the cell size. You set it to be big enough, right? So there will be a varying amount of space below each cell. Doesn't that look ugly? -- Abel Daniel -- abeld.web.elte.hu ___ 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 GNOME applets with Python tutorial
sorry, i'm still feeling asleep, the urls were wrong. Here are the correct ones: El mar, 10-02-2004 a las 17:27, Arturo GonzÃlez escribiÃ: > Hi all, > > We have a first available release of a gnome applets with pygtk > tutorial[1]. The link will soon be at pygtk.org. Please contact the > authors for any comment, or download the docbook source[2] and modify it > yourself with new features and corrections :). > > I hope it's worth reading it. > > [1] http://tad1.ugr.es/~arturogf/applets/ > [2] http://tad1.ugr.es/~arturogf/applets/python-applets.xml [1] http://www.ugr.es/~arturogf/applets/ [2] http://www.ugr.es/~arturogf/applets/python-applets.xml sorry for the inconvenience. -- - Arturo GonzÃlez Ferrer. Centro de EnseÃanzas Virtuales de la Universidad de Granada. mi blog: http://arturogf.weblogs.us - ___ 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 GNOME applets with Python tutorial
For both URLs, I'm getting: 404 Not Found Tim. On Tue, 2004-02-10 at 10:27, Arturo González wrote: > Hi all, > > We have a first available release of a gnome applets with pygtk > tutorial[1]. The link will soon be at pygtk.org. Please contact the > authors for any comment, or download the docbook source[2] and modify it > yourself with new features and corrections :). > > I hope it's worth reading it. > > [1] http://tad1.ugr.es/~arturogf/applets/ > [2] http://tad1.ugr.es/~arturogf/applets/python-applets.xml -- ___ Timothy E. Peoples Have Camel, Will Code [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] Tooltips inside a TreeView
On Mon, 09 Feb 2004 11:39:37 + Graham Ashton <[EMAIL PROTECTED]> wrote: > I was wondering if it's possible to do row specific tooltips. > > The Tooltips.set_tip method takes a widget as it's first parameter, so > I was wondering whether or not I'd need to insert an invisible widget > (e.g. EventBox) inside my Treeview somehow. > > My other hypothesis involves binding a callback to the mouse movement > signals that works out which row the mouse is currently hovering over > and sets the whole TreeView's tooltip depending on which row it's > over. It's a bit stinky though, and I get the distinct impression that > it might be really hard (hence this message, asking if there's an > easier way). some times ago i composed an example for what you want. i had the intention to let it "rest" for a while, then going throug again, but did't do it yet. the tooltips with the example are actually popup-windows. it has at least the advantage that one can put into all kind of stuff. the tips are created for cells but it would likely not difficult to do the same trick only for rows. although this version is ugly and raw it could be helpful for you or others. maybe someone can provide improvements too. walter #!/usr/bin/env python try: import pygtk; pygtk.require("2.0") except: pass import gtk import gobject data = [["zero","ZERO"],["one","ONE"],["two","TWO"],["three","THREE"]] class PopupExample: current_path = None current_column = None def onTreeviewLeaveNotify(self, treeview, event, popup_win): self.current_column = None self.current_path = None popup_win.hide() def onTreeviewMotionNotify(self, treeview, event): current_path, current_column = self.getCurrentCellData(treeview, event)[:2] if self.current_path != current_path: self.current_path = current_path treeview.emit("path-cross-event", event) if self.current_column != current_column: self.current_column = current_column treeview.emit("column-cross-event", event) def getCurrentCellData(self, treeview, event): try: current_path, current_column = treeview.get_path_at_pos(int(event.x), int(event.y))[:2] except: return (None, None, None, None, None, None) current_cell_area = treeview.get_cell_area(current_path, current_column) treeview_root_coords = treeview.get_bin_window().get_origin() cell_x = treeview_root_coords[0] + current_cell_area.x cell_y = treeview_root_coords[1] + current_cell_area.y cell_x_ = cell_x + current_cell_area.width cell_y_ = cell_y + current_cell_area.height return (current_path, current_column, cell_x, cell_y, cell_x_, cell_y_) def handlePopup(self, treeview, event, popup_win): current_path, current_column, cell_x, cell_y, cell_x_, cell_y_ = \ self.getCurrentCellData(treeview, event) if cell_x != None: popup_win.get_child().set_text(str(current_path) + " -- " + current_column.get_title()) popup_width, popup_height = popup_win.get_size() pos_x, pos_y = self.computeTooltipPosition(treeview, cell_x, cell_y, cell_x_, cell_y_, popup_width, popup_height, event) popup_win.move(int(pos_x) , int(pos_y)) popup_win.show_all() else: popup_win.hide() def emitCellCrossSignal(self, treeview, event): treeview.emit("cell-cross-event", event) def computeTooltipPosition(self, treeview, cell_x, cell_y, cell_x_, cell_y_, popup_width, popup_height, event): screen_width = gtk.gdk.screen_width() screeen_height = gtk.gdk.screen_height() pos_x = treeview.get_bin_window().get_origin()[0] + event.x - popup_width/2 if pos_x < 0: pos_x = 0 elif pos_x + popup_width > screen_width: pos_x = screen_width - popup_width print "here" pos_y = cell_y_ + 3 if pos_y + popup_height > screeen_height: pos_y = cell_y - 3 - popup_height return (pos_x , pos_y) def __init__(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect("delete_event", gtk.mainquit) window.set_default_size(200,250) scrolledwin = gtk.ScrolledWindow() scrolledwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) window.add(scrolledwin) model = gtk.ListStore(str, str) for item in data: iter = model.append() model.set(iter, 0, item[0], 1, item[1]) treeview = gtk.TreeView(model) scrolledwin.add(treeview) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("Header", renderer, text=0)
[pygtk] new GNOME applets with Python tutorial
Hi all, We have a first available release of a gnome applets with pygtk tutorial[1]. The link will soon be at pygtk.org. Please contact the authors for any comment, or download the docbook source[2] and modify it yourself with new features and corrections :). I hope it's worth reading it. [1] http://tad1.ugr.es/~arturogf/applets/ [2] http://tad1.ugr.es/~arturogf/applets/python-applets.xml -- - Arturo GonzÃlez Ferrer. Centro de EnseÃanzas Virtuales de la Universidad de Granada. mi blog: http://arturogf.weblogs.us - ___ 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] GRAMPS project bounty program
A Ter, 2004-02-10 às 04:12, Don Allingham escreveu: > Following the example of the GNOME project, The GRAMPS project is > starting a modest bounty program to encourage participation in our > project. The bounty program is entirely funded by donations to the > project. > > GRAMPS is a pygtk/gnome-python based genealogy program. We are looking > for a person to step forward to claim the gnome-print integration into > GRAMPS. This will use the GNOME print infrastructure to allow print > preview and direct printing of reports. We have a start on the code, but > not enough resources to complete the task as quickly as we would like. > > With the donations we have received, we have been able to set the bounty > for this task at $100. While it may not be a tremendous amount, it > should buy a few books, quite a bit of pizza, or a new disk drive. > > For more information and the requirements, see > http://gramps.sourceforge.net/phpwiki/index.php/GnomePrintBounty Are you insane?! Giving away $100 for such a fun project! You're just lucky I don't have time right now to work on this!... :) Good luck! -- 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/
Re: [pygtk] Tooltips inside a TreeView
On Mon, 2004-02-09 at 21:53, David M. Cook wrote: > On Mon, Feb 09, 2004 at 11:39:37AM +, Graham Ashton wrote: > > > I was wondering if it's possible to do row specific tooltips. > > See http://bugzilla.gnome.org/show_bug.cgi?id=80980 Thanks for that. I'll see if I can do the nasty workaround for now (I'll post it here if I have any joy). -- Graham Ashton ___ 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 find control indexes of the children of a control...
hi! i scanned a window say, 'Find' dialog box of notepad, i am able to access all the controls of the 'Find' dialog using the Accessible object of pyAA. suppose, the treeview looks like this: Find(window) NAMELESS(titlebar) IME(push button) Minimize(push button) Maximize(push button) Context help(push button) Close(push button) now, if i loop through the accessible object of the find(window), i'm able to access the names, description, location of each control. i want to get the index of each control meaning, index of IME is 1 index of Minimize is 2 index of Maximize is 3 index of Context help is 4 index of Close is 5 i'm unable to do this. is there any way to get this either using pyAA or win32? = thanks and regards, Karthik. __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html ___ 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 default action for a window. help please..
hi! i'm unable to find the default action for a window. say, for 'font dialog box' of notepad, the default action is "OK". just i need to get the string 'ok' can anyone give a solution please? = thanks and regards, Karthik. __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html ___ 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] Bonobo and Python
That doesn't seem to work either. What I am trying to do is to load a compotent to view a file. From my understanding gnome will select the right component. What is the moniker that I have to use? Do I have to use gnome vfs? I haven't found much documentation on monikers except for: http://primates.ximian.com/~miguel/monikers.html Thanks, Girish > > Using: > > container = bonobo.ui.Container() > > control = bonobo.ui.Widget("http://www.gnome.org";, > >container.corba_objref()) > > > > Bonobo-WARNING **: Activation exception 'Moniker > > interface cannot be found' > > Bonobo is right ;) Try this instead: > > control = > bonobo.ui.Widget("vfs:http://www.gnome.org";, >container.corba_objref()) > > In a more general case, you have to be very > careful with what you put > after the moniker prefix (vfs:), since some > characters have special > meaning to bonobo. When in doubt, escape the URI > string first, using > bonobo.moniker_util_escape(). __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/