Osmo Maatta | 21 Nov 21:52

Re: Setting value of gtk.SpinButton without triggering the "value-changed" event.

Hello and thanks for the answers for both Daniel and Paul.

I chose to use the signal blocking/unblocking method.
I now add a new data attribute "value-changed-signal" to the spin button. The data value contains the signal handler id which I can later read and use. The code looks like this:

        adj = gtk.Adjustment(orig_width, 1, orig_width, 1, 50, 0)
        self.width_spin = gtk.SpinButton(adj, climb_rate=0.0, digits=0)
        self.width_spin.show()
        self.width_spin.set_numeric(True)

        # Save the signal handler to "value-changed-signal" attribute.
        self.width_spin.set_data("value-changed-signal", self.width_spin.connect("value-changed", self.image_size_changed_callback, None))


and later in...

def some_function()
     # Block signals
     self.width_spin.handler_block(self.width_spin.get_data("value-changed-signal"))
     self.width_spin.set_value(some_value)
     # Unblock signals
     self.width_spin.handler_unblock(self.width_spin.get_data("value-changed-signal"))

Ok, thanks for now :-)
Osmo Antero

Daniel Hernández Bahr wrote:
p { margin: 0; }body { font-family: 'Verdana'; font-size: 10pt; color: #000000}I guess you can always do:
self.width_spin.freeze_child_notify()
self.width_spin.set_value(some_value)
self.width_spin.thaw_child_notify()

cheers
----- Original Message -----
From: "Osmo Maatta" <osmoma <at> gmail.com>
To: pygtk <at> daa.com.au
Sent: Friday, November 21, 2008 2:52:53 PM (GMT-0500) Auto-Detected
Subject: [pygtk] Setting value of gtk.SpinButton without triggering the "value-changed" event.

Hello,

I need to change the self.width_spin (gtk.SpinButton) value, but in some cases I do not want the changed event to fire. How do I set the value?  This is my code:

        adj = gtk.Adjustment(orig_width, 1, orig_width, 1, 50, 0)
        self.width_spin = gtk.SpinButton(adj, climb_rate=0.0, digits=0)
        self.width_spin.show()
        self.width_spin.set_numeric(True)
        self.width_spin.connect("value-changed", self.image_size_changed_callback, "width")
        hbox1.pack_start(self.width_spin, False, False, 0)

This call will trigger the "value-changed" event so I want to avoid it.
    self.width_spin.set_value(some_value)

gtk.SpinButton is derived from gtk.Entry, so if I could grab the entry field from gtk.SpinButton so it may be possible to write:
entry.set_data("value", some_value)

Do you know how to do this right?

Am writing a filter/resize/and scale plugin in Python for my screendump program http://bildr.no/view/291282. Screendump is written in GTK and c.

TIA
  Osmo Antero (moma)
  Oslo

_______________________________________________ pygtk mailing list pygtk <at> daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/

--
Daniel Hernández Bahr
Universidad de las Ciencias Informáticas.



_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Osmo Maatta | 21 Nov 20:50

Setting value of gtk.SpinButton without triggering the "value-changed" event.

Hello,

I need to change the self.width_spin (gtk.SpinButton) value, but in some cases I do not want the changed event to fire. How do I set the value?  This is my code:

        adj = gtk.Adjustment(orig_width, 1, orig_width, 1, 50, 0)
        self.width_spin = gtk.SpinButton(adj, climb_rate=0.0, digits=0)
        self.width_spin.show()
        self.width_spin.set_numeric(True)
        self.width_spin.connect("value-changed", self.image_size_changed_callback, "width")
        hbox1.pack_start(self.width_spin, False, False, 0)

This call will trigger the "value-changed" event so I want to avoid it.
    self.width_spin.set_value(some_value)

gtk.SpinButton is derived from gtk.Entry, so if I could grab the entry field from gtk.SpinButton so it may be possible to write:
entry.set_data("value", some_value)

Do you know how to do this right?

Am writing a filter/resize/and scale plugin in Python for my screendump program http://bildr.no/view/291282. Screendump is written in GTK and c.

TIA
  Osmo Antero (moma)
  Oslo

_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Gael Chamoulaud | 21 Nov 14:15
Favicon

Re: Looking for MacOS user to test software

Hi Frédéric,

I am going to install your Papywizard Software on my Mac OSX.
I will inform you about my test.

cheers,

Gaël

--
** http://korydwenn.free.fr **
** http://www.worldpictures.fr **
** http://www.wpstock.com **
** http://www.maxppp.com **


2008/11/21 Frédéric <frederic.mantegazza <at> gbiloba.org>

Hello,

I'm looking for MacOS user to test my Papywizard software. It is written
in PyGTK, and only use pyserial and pybluez additional modules. I works
under Nokia/maemo, Windows, and Openmoko - not fully tested -
plateforms. So it should works fine under MacOS; it may just need some
minor adjustements regarding files paths.

The sources are here:

   http://trac.gbiloba.org/papywizard/browser/trunk

(click on the link at the bottom of the page to get a zip archive).

If all works fine, I would also like to make a MacOS package. Does
anybody have links to documentation to do that?

Thanks,

--
  Frédéric
_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Ángel Alonso | 20 Nov 13:19

Re: Help with gtk.Menu.popup

Thanks for your help.

My problem is this:

self.icon = gtk.status_icon_new_from_stock(gtk.STOCK_REFRESH)
self.icon.connect('popup-menu', self.onRightClick)
self.icon.connect('activate', self.onLeftClick)

In onRightClick function the signal 'popup-menu' has activate_time param
but in onLeftClick function the signal 'activate' has not it.

http://www.pygtk.org/docs/pygtk/class-gtkstatusicon.html

I want to open a menu in a status_icon with the left button of my mouse.

Thanks.

El jue, 20-11-2008 a las 11:45 +0000, Pádraig Brady escribió:
> Ángel Alonso wrote:
> > Hi, i need help with this function:
> > 
> > http://www.pygtk.org/docs/pygtk/class-gtkmenu.html#method-gtkmenu--popup
> > 
> > I need the activate_time but i need to get this param.
> > 
> > Thanks and sorry about my english
> 
> If you specify the activate_time as 0 then the
> popup menu will disappear immediately on a right click being
> released for example. Usually you want the menu to remain
> so that you can subsequently click entries on it.
> Timing info is the only way GTK can decide whether
> to leave the menu or not.
> 
> So you need to get the time from the event object
> passed to your handler for the mouse click.
> Here is an example from an app I wrote:
> http://code.google.com/p/fslint/source/browse/trunk/fslint-gui?spec=svn55&r=55#1012
> 
> cheers,
> Pádraig.

_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Jim Trebbien | 19 Nov 14:52

store ListStore

Hi,
I need to save the values of a ListStore in a file, but apparently that is not that easy.
I tried with pickle, but that didn't work.
Is it possible at all?


_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
John Stowers | 18 Nov 09:19

Re: examples

On Mon, 2008-11-17 at 23:22 -0300, Carlos Albornoz wrote:
> carlos albornoz escribió:
> > hello list.
> >
> > I'm new at this, and I'm looking for examples but I find nothing, I need to
> > learn pygtk+mysql
> >
> > if someone here would be a big help guide me.
> >
> > thanks.
> >
> >   
> nobody have examples to show me for learn?

google codesearch is really useful for this

> 
> cheers
> 

_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Walter Leibbrandt | 18 Nov 08:22
Favicon
Gravatar

Re: examples

Hi,

Carlos Albornoz wrote:
> carlos albornoz escribió:
>   
>> hello list.
>>
>> I'm new at this, and I'm looking for examples but I find nothing, I need to
>> learn pygtk+mysql
>>
>> if someone here would be a big help guide me.
>>
>> thanks.
>>
>>   
>>     
> nobody have examples to show me for learn?
>
> cheers
>   
For PyGtk, the pygtk-demo program (that should be installed with PyGtk) 
contains some great examples. See http://mysql-python.sourceforge.net/ 
for more information about using MySQL in Python.

Regards,
Walter

--

-- 
Walter Leibbrandt                  http://translate.org.za/blogs/walter
Software Developer                                  +27 12 460 1095 (w)
Translate.org.za

Recent blogs:
* Switching from Subversion to git
http://www.translate.org.za/blogs/walter/en/content/switching-subversion-git
* The first official release of Spelt
* Auto-completion and auto-correction for Gtk+ widgets

_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Frédéric | 17 Nov 18:48

Re: DrawingArea user feedback

On lundi 17 novembre 2008, Frédéric wrote:

> GtkWarning: gtk_widget_set_events: assertion `!GTK_WIDGET_REALIZED
> (widget)' failed

As far as I understand, this assertion is raised because the set_events() 
method should be called *after* the widget is realized, ie after it is 
drawn on the screen.

But my drawing area is part of a dialog, and this dialog is opened from the 
main window as a modal dialog, calling its run() methog. Once it enters in 
its main loop, I can't do anything more, so I can't call the set_events() 
method!

I don't understand why GTK+ is so complicated for such simple things... Why 
signals are not enabled by default? As long as there are no callback, I 
don't see what could happen. In fact, I think that low-level stuffs are 
not object-oriented, and are very difficult to integrate in an 
object-oriented application.

Any idea to solve my problem?

--

-- 
    Frédéric

    http://www.gbiloba.org
_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Tristan Hill | 16 Nov 22:05

right way to share GOptionContext pointer from pygobject

I've done a patch for gnome-python to add GOption support[1].  Using the
existing GOptionContext wrapper in pygobject this is possible but access
to the wrapped GOptionContext pointer is required to pass to
gnome_program_init.

I'd be grateful to know whether cobjects are a good way of doing this
per http://bugzilla.gnome.org/attachment.cgi?id=117380&action=view -
included inline here because it is quite short:

--- glib/pygoptioncontext.c	(revision 949)
+++ glib/pygoptioncontext.c	(working copy)
@@ -281,6 +281,12 @@
     return -1;
 }

+static PyObject *
+pyg_option_get_context(PyGOptionContext *self)
+{
+    return PyCObject_FromVoidPtr(self->context, NULL);
+}
+
 static PyMethodDef pyg_option_context_methods[] = {
     { "parse", (PyCFunction)pyg_option_context_parse, METH_VARARGS | METH_KEYWORDS },
     { "set_help_enabled", (PyCFunction)pyg_option_context_set_help_enabled, METH_VARARGS |
METH_KEYWORDS },
@@ -290,6 +296,7 @@
     { "set_main_group", (PyCFunction)pyg_option_context_set_main_group, METH_VARARGS |
METH_KEYWORDS },
     { "get_main_group", (PyCFunction)pyg_option_context_get_main_group, METH_NOARGS },
     { "add_group", (PyCFunction)pyg_option_context_add_group, METH_VARARGS | METH_KEYWORDS },
+    { "_get_context", (PyCFunction)pyg_option_get_context, METH_NOARGS },
     { NULL, NULL, 0 },
 };

[1] http://bugzilla.gnome.org/show_bug.cgi?id=507174

_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Alessandro Dentella | 16 Nov 12:07

pygoocanvas binaries for windows available

I uploaded windows binaries for pygoocanvas to:

  http://sqlkit.argolinux.org/download

Thanks to Armin Burgmeier for providing them.

sandro
*:-)
_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

francesco | 15 Nov 16:00

gtkhtml2 for windows

I woud like to bring to your attention the article where you can 
directly download the python gtkhtml2 for Windows

http://blog.promotux.it/2008/11/15/python-gtkhtml2-for-windows-…its-possible/

regard

francesco
_______________________________________________
pygtk mailing list   pygtk <at> daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Gmane