[pygtk] Selection and?...

2011-05-26 Thread Alessandro Dentella


In some circumstancies I get to a situation as in the attached image, a row
in a TreeView is selected but a cell in another row has a different
background (pink in the image).

I don't really know what state is that so that I don't know how to look for
info...

Which other stated do exist apart selected?


sandro
*:-)
 
attachment: selection.png___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Simplifying what's stored in a ListStore (was Re: Inconsistent format for path in TreeView callbacks)

2011-05-09 Thread Alessandro Dentella
On Mon, May 09, 2011 at 09:21:52AM +0800, Jason Heeris wrote:
 On 7 May 2011 15:55, Neil Muller drnlmuller+...@gmail.com wrote:
  You can do via TreeViewColumn.set_cell_data_func and calling
  set_property on the cell renderers.
 
 This approach has cleaned up my code somewhat, but there's one snag
 I've hit. The object with the properties I'm showing in the table is a
 subclass of GObject, and it has a use property that is displayed in
 a CellRendererToggle in the table. It's easy enough to connect to the
 activate signal and change the use property in the object, but
 it's going to other way I'm having problems with, ie. updating what
 the table displays when the use property changes in the object.
 
 Is there a way to tell the CellRenderer to redraw, or recheck?

sure. Emitting a row-changed will trigger a redraw:

   model.emit('row-changed', path, iter)



sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Simplifying what's stored in a ListStore (was Re: Inconsistent format for path in TreeView callbacks)

2011-05-07 Thread Alessandro Dentella
On Sat, May 07, 2011 at 12:39:01PM +0800, Jason Heeris wrote:
 On 7 May 2011 03:24, Neil Muller drnlmuller+...@gmail.com wrote:
  On 6 May 2011 21:07, Jason Heeris jason.hee...@gmail.com wrote:
  Storing the object in a hidden column is fine, and what I assumed you
  were doing originally.
 
 Hah! Okay then, now that it's morning, I can't believe that didn't
 occur to me :P
 
 While we're on the topic though, it strikes me as more sensible to
 simply put the objects themselves in a ListStore without manually
 extracting the information for the other columns (ie. so the ListStore
 just contains one column, which is displayed in different ways). Is
 there a way to tell each TreeViewColumn to, say, look at column zero,
 take the x.fit.param_A attribute, format it using 0x%03X and display
 it in a CellRendererText — and then so on for each attribute, each
 describing to a different view of the same column?


Sure, you can use column's set_cell_data_function's method to sett cell's
property values as you prefere. These functions will be called pretty
frequently, each time a cell's area is redrawn, but it's not called for not
visible cell's -as far as I understood-. That means it can be faster or
slower that a pre-process in which you set all item's in advance in each
column. 

I use this method in sqlkit and you can have a look here [1] to see several
different cell_data_functions for different data types.


sandro
*:-)



[1] http://hg.argolinux.org/py/sqlkit/file/tip/sqlkit/widgets/table/columns.py
-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] broken Reordable TreeView 2.22?

2011-04-06 Thread Alessandro Dentella
hi,

I just realized that pygtk 2.22 has broken .set_reordable().

Given a TreeView with set_reordable() I can grab the row and move it around,
but the selection underneath does not change and it not possible to drop it
in a different position.

I verified this behaviour on 2 XP boxes with gtk installed from the
all-in-one installer.

I attach a simple script that shows the problem: under XP + 2.22.1 I can't
drop the lines in new positions. Is this a known issue? do other people
verify this?


sandro
*:-)




-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] catch key_press_event on gtk.CellRendererText (or gtk.TreeViewColumn)

2011-03-23 Thread Alessandro Dentella
On Wed, Mar 23, 2011 at 06:59:24PM +0100, Giuseppe Penone wrote:
 Hi,
 I have a table with editable cells implemented with liststore+treeview in my
 application http://giuspen.com/cherrytree .
 I'm trying to connect a callback to any char inserted in a editable liststore
 cell but I cannot find a way since
 
 1) when the user is inserting text in an editable liststore text cell the 
 event
 is not catched from the treeview

It should not in fact. In that moment it's a gtk.Entry your widget and
that's the widgets that feels the events.

 2) neither gtk.CellRendererText nor gtk.TreeViewColumn descend from a widget
 (but gtk.object instead).

no problem

 If anybody has an example to provide or a clue please help me.
 Thanks  best regards,

You can see [1] but it's probably a bit difficult to understand it at a
glance. The sense it that in the editing_started_cb the 'editable' var
contains the gtk.Entry, you can connect to that Entry to implement wahtever
you need. 


sandro
*:-)




[1] 
http://hg.argolinux.org/py/sqlkit/file/b27e0a1085ef/sqlkit/widgets/table/columns.py#l457



-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Best practice for gobject deletion? connect as weakref?x

2011-02-10 Thread Alessandro Dentella
On Thu, Feb 10, 2011 at 07:46:50PM +0100, Alessandro Dentella wrote:
 What I'd like is to have a connect that only behaves as a weakref!
 
 
 This should be the key of some memory leaks I have, but I don't know which
 should be the best practices to follow when using GObject and signals and I
 didnt't find any documentation on this issue.

After sending this mail I found on stackoverflow this thread [1] that
addresses the same problem. I'm still interested to know which is the best
practice in this list.


[1] 
http://stackoverflow.com/questions/1364923/how-to-connect-to-a-gobject-signal-in-python-without-it-keeping-a-reference-to-t

thanks
sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Glade, event handlers, gtk.Builder question

2011-02-09 Thread Alessandro Dentella
On Wed, Feb 09, 2011 at 08:32:23AM -0500, Adam Tauno Williams wrote:
 builder = gtk.Builder()
 builder.add_from_file(self.gladefile)
 self.window = builder.get_object(MainWindow)
 
 This, according to my understanding creates an instance of the
 MainWindow widget as defined in the Glade file.
 
 Now if I want to connect the events defined in the Glade file to
 handlers of the 'current' instance I perform -
 
 builder.connect_signals(self)
 
 But according to the log messages this tries to connect any event
 handler defined in the glade file to methods of this object.  Is there a
 way to only connect event handlers for the MainWindow widget?  Do I
 need to define each widget in a separate Glade file?

In the Builder documentations it says:

  The connect_signals() method uses Python's introspective features to look at
  the keys (if object is a mapping) or attributes (if object is an instance)
  and tries to match them with the signal handler names given in the interface
  description. The callbacks referenced by each matched key or attribute are
  connected to their matching signals.

So that you can pass a dict with only the keys corresponding to the handler
you need to connect.

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Can I have selectable Statusbar?

2011-01-26 Thread Alessandro Dentella

hi, is it any possible to turn a Statusbar into a selectable one (as for
labels)?

I guess it's not possible as I don't see any such property, but I wander if
there's any other way.

TIA

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Interactive plots with pygtk

2011-01-25 Thread Alessandro Dentella
On Tue, Jan 25, 2011 at 02:46:35PM -0800, Soumyaroop Roy wrote:
 Hi there:
 
 Are there any libraries built with pygtk to create interactive plots
 (histograms and line charts, mostly)? Say, I want to zoom in to a
 region or select a region in the plot to do something?


have you tried matplotlib?

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] ANNOUNCE: PyGTK All-in-one Installer 2.22.5

2010-12-24 Thread Alessandro Dentella
On Fri, Dec 24, 2010 at 06:55:56AM +0100, Dieter Verfaillie wrote:
 We are pleased to announce release 2.22.5 of the PyGTK All-in-one
 installer for Windows.

Thanks Dieter! I strongly believe that this is a great boost in PyGTK
adoption and diffusion. A very nice christmas gift!


sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Builder correct to switch?

2010-12-18 Thread Alessandro Dentella
On Tue, Dec 14, 2010 at 01:02:15AM +0100, france...@promotux.it wrote:
   5. I'm having problems under gtk 2.14: .add_from_string() needs one more
   arg (the length of the xml text), but even in that case Builder
   complains about wrong caracter in utf-8 in the last position of the
   buffer (corresponding to '' of/interface)...
 
 
 i don't know about that

this turns out it was my error, I was changing the xml between 2 run and
lenght was not the correct one.  builder.add_from_string(obj.xml(), 
len(obj.xml()))

 I'm uncertain whether switching now is a good thing, I started becouse I
 wanted to get rid of a dependancy but I'm afraid it turns in more problems
 due to needed upgrade.

Just to clear possible shadows: all problems have been solved and there's no
drawback for me passing from glade to Builder (tested with pygtk 2.12+).

Thanks to Francesco, Dieter and Marian.

I addec  FAQs 22.14 /22.15 on this subjects

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] gtk.Builder inherited widgets

2010-12-14 Thread Alessandro Dentella
Hi,

in the attached example I have a very simple xml definition (a button in a
Window). 

The Button is not really a gtk.Button it's defined with its own signal:

   class Test(gtk.Button):
   __gtype_name__ = 'Test'

   __gsignals__ = {
   'my-signal' : (gobject.SIGNAL_RUN_LAST,
  gobject.TYPE_NONE,
  ()
  ),  
   }
   def __init__(self):
   self.emit('my-signal')

A second Test is derived from this one. The example fails when using the
second example and works correctly with the first one.

What am I doing wong?

It seems there's no way to make it see the signal defined in the derived
Test2 class, but I don't see anything special. Even Test inheritates from
other widgets (gtk.Button).

Any hints?

thanks

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
#!/usr/bin/python

?xml version=1.0?
interface
  requires lib=gtk+ version=2.16/
  !-- interface-requires pythonplugin 0.0 --
  !-- interface-naming-policy project-wide --
  object class=GtkWindow id=window1
property name=visibleTrue/property
child
  object class=%s id=test1
property name=label translatable=yesStop/property
property name=visibleTrue/property
property name=can_focusTrue/property
property name=receives_defaultTrue/property
  /object
/child
  /object
/interface


# call this script as 'python mytest.py Test' and it just works
# call this script as 'python mytest.py Test2' and it complains:
#
# Traceback (most recent call last):
#  File mytest.py, line 58, in __init__
#self.emit('my-signal2')
# TypeError: Test2 object at 0x920f144 (Test at 0x8fdc480): unknown signal name: my-signal2



import gobject
import gtk

class Test(gtk.Button):
__gtype_name__ = 'Test'

__gsignals__ = {
'my-signal' : (gobject.SIGNAL_RUN_LAST,
   gobject.TYPE_NONE,
   ()
   ),  
}
def __init__(self):
self.emit('my-signal')

class Test2(Test):
__gtype_name__ = 'Test2'

__gsignals__ = {
'my-signal2' : (gobject.SIGNAL_RUN_LAST,
   gobject.TYPE_NONE,
   ()
   ),  
}
def __init__(self):
Test.__init__(self)
self.emit('my-signal2')

if __name__ == '__main__':

import gtk
import sys

b = gtk.Builder()
xml = __doc__ % (len(sys.argv)  1 and sys.argv[1] or 'Test')
b.add_from_string(xml, len(xml))
b.get_object('test1').connect('clicked', gtk.main_quit)

try:
gtk.main()
except KeyboardInterrupt:
sys.exit()


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] gtk.Builder inherited widgets

2010-12-14 Thread Alessandro Dentella
Hi Dieter,

On Tue, Dec 14, 2010 at 08:28:19PM +0100, Dieter Verfaillie wrote:
 On 14/12/2010 17:41, Alessandro Dentella wrote:
  What am I doing wong?
 
 See the attachment. Got it working :)

If I understand correctly, what makes the difference, is that you're emitting
the signal OUT of __init__. That works but does not explain why Test1 *can*
emit from within the __init__.

In the real example, the signal is really emitted within __init__, and that
have always worked in glade.


sandro
*:-)


 
 mvg,
 Dieter

 #!/usr/bin/python
 
 
 ?xml version=1.0?
 interface
   requires lib=gtk+ version=2.16/
   !-- interface-requires pythonplugin 0.0 --
   !-- interface-naming-policy project-wide --
   object class=GtkWindow id=window2
 property name=visibleFalse/property
 child
   object class=GtkHBox id=hbox1
 property name=visibleTrue/property
 child
   object class=Test1 id=test1
 property name=label translatable=yesTest1/property
 property name=visibleTrue/property
 property name=can_focusTrue/property
 property name=receives_defaultTrue/property
   /object
   packing
 property name=position0/property
   /packing
 /child
 child
   object class=Test2 id=test2
 property name=label translatable=yesTest2/property
 property name=visibleTrue/property
 property name=can_focusTrue/property
 property name=receives_defaultTrue/property
   /object
   packing
 property name=position1/property
   /packing
 /child
   /object
 /child
   /object
 /interface
 
 
 
 import sys
 import gobject
 import gtk
 
 
 class Test1(gtk.Button):
 __gtype_name__ = 'Test1'
 
 __gsignals__ = {'my-signal':
 (gobject.SIGNAL_RUN_LAST,
  gobject.TYPE_NONE,
  ())}
 
 def __init__(self):
 gtk.Button.__init__(self)
 
 def do_clicked(self):
 print 'my-signal'
 self.emit('my-signal')
 
 
 class Test2(Test1):
 __gtype_name__ = 'Test2'
 
 __gsignals__ = {'my-signal2':
 (gobject.SIGNAL_RUN_LAST,
  gobject.TYPE_NONE,
  ())}
 def __init__(self):
 Test1.__init__(self)
 
 def do_clicked(self):
 print 'my-signal2'
 self.emit('my-signal2')
 
 
 if __name__ == '__main__':
 # Manual
 window1 = gtk.Window()
 window1.set_title('Manual')
 hbox = gtk.HBox()
 window1.add(hbox)
 test = Test1()
 test.set_label('Test')
 hbox.pack_start(test)
 test1 = Test2()
 test1.set_label('Test2')
 hbox.pack_start(test1)
 window1.show_all()
 
 # GtkBuilder
 builder = gtk.Builder()
 builder.add_from_string(__doc__)
 window2 = builder.get_object('window2')
 window2.set_title('GtkBuilder')
 window2.show_all()
 
 try:
 gtk.main()
 except KeyboardInterrupt:
 sys.exit()

 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Builder correct to switch?

2010-12-13 Thread Alessandro Dentella
On Wed, Dec 08, 2010 at 02:55:40PM +0100, france...@promotux.it wrote:
 Il 08/12/2010 00:51, Alessandro Dentella ha scritto:
 I want to port an application from glade to Builder but I don't understand
 how to cope with custom widgets. Any ponters to this? I saw a mail from
 Geral Britton last year but no one answered publicly.
 
 
 thanks in advance
 sandro
 *:-)
 
 
 
 hi , i wrote some time ago a small how to about.
 this is the link
 
 http://forum.promotux.it/viewtopic.php?f=32t=80
 http://forum.promotux.it/viewtopic.php?f=32t=80
 
 italian version:
 
 http://forum.promotux.it/viewtopic.php?f=32t=79
 http://forum.promotux.it/viewtopic.php?f=32t=79


Thanks a lot, this hint helped me migrate sqlkit to Builder along with
studying you promoGest2 example. But there are quite a few thinks that I find
less than clear:

 1. You correctly use env variable GLADE_CATALOG_PATH while docs [1] speak
about GLADE_ENV_CATALOG_PATH. Why that? Have you followed some other
docs? Should I be able to put the pythonplugin* stuff in a place visible
for the whole system?

 2. The name pythonplugin.py and pythonplugin.xml are hardcoded in glade (or
better in it's python plugin)? I don't ned to change I just want to
understand 

 3. [1] says:

   c) make sure your catalog name is the same as your python import
  library since glade_python_init() will use this name to import your
  widgets into the interpreter.

 I don't understand.Catalog name is pythonplugin.xml?

 4. If you don't need glade (the application) as .xml files have been
created already, do you need the plugin or you just need that at
Builder.add_from_file() time the widgets are available to python? That's
my impression...

 5. I'm having problems under gtk 2.14: .add_from_string() needs one more
 arg (the length of the xml text), but even in that case Builder
 complains about wrong caracter in utf-8 in the last position of the
 buffer (corresponding to '' of /interface)... 

I'm uncertain whether switching now is a good thing, I started becouse I
wanted to get rid of a dependancy but I'm afraid it turns in more problems
due to needed upgrade.

Thanks for any possible explanation


sandro
*:-)


[1] http://library.gnome.org/devel/gladeui/stable/pythonsupport.html


PS: Builder is a much cleaner interface anyhow to add new widgets that it
was glade + custom_handler

-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] 'name' attribute for objects created by gtk.Builder

2010-12-11 Thread Alessandro Dentella
Hi, 

in the process of migrating from glade to Builder I wrote the 2 attached test
files, where the main part is:

   gld = gtk.glade.xml_new_from_buffer(__doc__,len(__doc__))
   gld.get_widget('window1').connect('destroy', gtk.main_quit)
   print Lable.name, gld.get_widget('label1').name
  label1

   bld = gtk.Builder()
   bld.add_from_string(__doc__)
   bld.get_object('window1').connect('destroy', gtk.main_quit)
   print Lable.name, bld.get_object('label1').name
  None

Where clearlu 'name' attribute is empty for the object created w/ Builder
and has the name I gave to the object in glade, for libglade.

I don't know it a 'name' object should exists, but which is the canonical
way to the get the name given in the glade interface?

Not that clearly get_object('label1') works correctly!


thanks in advance
sandro
*:-)



-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy

interface
  requires lib=gtk+ version=2.16/
  !-- interface-naming-policy project-wide --
  object class=GtkWindow id=window1
property name=visibleTrue/property
child
  object class=GtkLabel id=label1
property name=visibleTrue/property
property name=label translatable=yeslabel/property
  /object
/child
  /object
/interface

import pygtk
pygtk.require('2.0')
import gtk

bld = gtk.Builder()
bld.add_from_string(__doc__)
bld.get_object('window1').connect('destroy', gtk.main_quit)

print Lable.name, bld.get_object('label1').name
gtk.main()

?xml version=1.0?
glade-interface
  !-- interface-requires gtk+ 2.16 --
  !-- interface-naming-policy project-wide --
  widget class=GtkWindow id=window1
property name=visibleTrue/property
child
  widget class=GtkLabel id=label1
property name=visibleTrue/property
property name=label translatable=yeslabel/property
  /widget
/child
  /widget
/glade-interface

import pygtk
pygtk.require('2.0')
import gtk.glade

gld = gtk.glade.xml_new_from_buffer(__doc__,len(__doc__))
gld.get_widget('window1').connect('destroy', gtk.main_quit)

print Lable.name, gld.get_widget('label1').name
gtk.main()

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] 'name' attribute for objects created by gtk.Builder

2010-12-11 Thread Alessandro Dentella
On Sat, Dec 11, 2010 at 02:22:56PM +0100, Dieter Verfaillie wrote:
 So, in your case the following works:
 
 label = bld.get_object('label1')
 print gtk.Buildable.get_name(label)


thanks Dieter, it works perfectly!
*:-)

-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Builder set_custom_handler

2010-12-08 Thread Alessandro Dentella
On Wed, Dec 08, 2010 at 01:19:37AM +0100, Marian Tietz wrote:
 On Wed, 8 Dec 2010 00:51:59 +0100
 Alessandro Dentella san...@e-den.it wrote:
 
  
  I want to port an application from glade to Builder but I don't understand
  how to cope with custom widgets. Any ponters to this? I saw a mail from
  Geral Britton last year but no one answered publicly.
  
 
 You could look here[1] and also look in the sources of this project [2], it
 uses glade with gtk.Builder.


thanks for the pointer but it seems to me completely oriented ad glade not
gtk.Builder. It's examples still import  gtk.glade. That's exactly the
dependence I want to get rid. Am I wrong?

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Builder set_custom_handler

2010-12-07 Thread Alessandro Dentella

I want to port an application from glade to Builder but I don't understand
how to cope with custom widgets. Any ponters to this? I saw a mail from
Geral Britton last year but no one answered publicly.


thanks in advance
sandro
*:-)



-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Can't get tool tip to display

2010-12-04 Thread Alessandro Dentella
On Sat, Dec 04, 2010 at 11:05:14PM +0100, Dieter Verfaillie wrote:
 Quoting Gerald Britton gerald.brit...@gmail.com:
 Say, how would I patch this code to show tips when I mouse over the
 column headers?  It works great for the rows underneath.
 
 That's a good question... Has anybody done something like that?

in sqlkit i substitute the header with a gtk.Label(), at that point you can
do:

   label.et_markup(...)
   label.set_tooltip_text(...)

and tooltips work as expected even thought it won't show the little arrow to
sort the column.

I had to substitute the header to be able to use markup in the label and to
have a menu  dropdown, by  I wasn't able to have the dropdown on button press
I just have it on button release.


sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] CheckBbox look of inconsistent state in late gtk releases

2010-12-02 Thread Alessandro Dentella
Hi,

the inconsistent state of a gtk.CheckButton in late releases is really not
very explicit compared to a False one. 

Here you can see it under Ubuntu 10.04 [1] and under Windows-xp w/ gtk-2.22.

Up to Ubuntu 8.04 it used to have a nice horizontal sign that I consider
much more explicit. Is there a way to use that mark again in new checkbox?

thanks

sandro
*:-)

[1]  http://www.e-den.it/misc/check_box.png
[2]  http://www.e-den.it/misc/win.png


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] gtkTreeView slows down application exit

2010-11-12 Thread Alessandro Dentella
On Thu, Nov 11, 2010 at 06:51:38AM -0700, John Haiducek wrote:
 I have an app that sometimes loads a lot of data into a gtkTreeView (several
 thousand rows). It performs pretty well during user interaction, but if there
 is a large amount of data in the treeview, it takes a really long time to 
 exit.
 
 I'm storing the data in a gtkListStore and a gtkTreeModelSort. I assume the
 bottleneck is in freeing memory used by either the TreeView or the ListStore.
 Is there any way to speed up destruction of these objects? Or am I
 misinterpreting the symptoms here?


I don't experiment this problem. Sqlkit is based on treeview that load and
display data from a database table. The model has classes arranged by
sqlalchemy and each cell renderer picks data from that object to represent
it via a cell_data_func. 

I display foreign key  picking data from the related table so that loading
data is somehow slowed down (2-10 seconds for 10.000 records depending on
foreign keys). Destroying this table is done almost immediately, you don't
perceive any significant delay.

I'm testing it on Ubuntu 10.04 running on a notebook 1.8 GHz centrino.

sandro




-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] gtkTreeView slows down application exit

2010-11-12 Thread Alessandro Dentella
On Fri, Nov 12, 2010 at 07:17:41AM -0700, John Haiducek wrote:
  I display foreign key  picking data from the related table so that loading
  data is somehow slowed down (2-10 seconds for 10.000 records depending on
  foreign keys). Destroying this table is done almost immediately, you don't
  perceive any significant delay.
  
  I'm testing it on Ubuntu 10.04 running on a notebook 1.8 GHz centrino.
 
 Do you know what TreeModel Sqlkit uses? Is it a gtk.ListStore, or
 something custom? Perhaps the delay for me is in destroying the
 ListStore rather than the table.

Sqlkit can use eather modelstores, I tested it with ListStore. By the way my
notebook is a simple old single core...

It shouldn't be very difficult to setup a test in which you just create a
TreeView + ListStore w/o anything else.

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] ANNOUNCE: PyGTK 2.22 (and Friends) Windows Installers

2010-11-06 Thread Alessandro Dentella
On Fri, Nov 05, 2010 at 12:17:00AM +1300, John Stowers wrote:
 Hi All,
 
 I have updated the official Windows installers for Pycairo, PyGObject and 
 PyGTK.
 
 These installers have been tested on XP, Vista and Windows 7. Versions
 supporting Python 2.6 and Python 2.7 are provided. The installers can
 be downloaded from

Thanks John. May I ask why you produce and upload to ftp.gnome.org only .exe
installers rather than .msi that are considered the best ones even by
distutils docs [1]:

   In most cases, the bdist_msi installer is a better choice than the
   bdist_wininst installer, because it provides better support for Win64
   platforms, allows administrators to perform non-interactive installations,
   and allows installation through group policies.

That would also go towards the possibility to create a batch
installation. By the way Dieter Verfaillie has already produced them and
posted the URL for these to this list [2]


sandro
*:-)


[1] http://docs.python.org/distutils/apiref.html#module-distutils.command.bdist
[2] http://www.optionexplicit.be/projects/gnome-windows/20101102/


-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] dialog preview

2010-09-23 Thread Alessandro Dentella
Hi,

dialogs can show a preview in a very simple way. A preview for common image
format is already inserted as example in the docs.

A preview for openoffice documents was petty easy to add, as they have a
thumbnail already available.

Does anybody have a preview for other simple cases? .doc, .xls or .pdf?

sandro
*:-)


PS: the strange thing is that openoffice document have a preview that is not
always the first page. In my presentations it picks a random slide... but
that's a problem for another mailing list...

-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Tooltips on MenuItem and ui_manager

2010-09-08 Thread Alessandro Dentella
Hi. Sorry for reposting. But it seems strange to me that such an ordinary
feature of Actions/MenuItem tooltip is not known by anybody.

Most of the application I see do have tooltips on menuItems: I can't believe
I should copy tooltips from action to MenuItem by hand...


I've searched in the docs to see if there is a flag that enables them w/o
finding anything.

sandro
*:-)

On Thu, Sep 02, 2010 at 10:13:37AM +0200, Alessandro Dentella wrote:
 Hi again,
 
 
 I use  UIManager() + group_action.add_actions() to create MenuItems and
 ToolItems. I set tooltips as required by actiongroup.add_actions( 5^ field).
 
 These tooltip show correctly for toolitems but they won't for menu
 entries. Is it the desired behaviour? What can I do to have tooltips for
 MenuItems as well? Note that
 
   ui_manager.get_action(action_name).props.tooltip
 
 shows the tooltip correctly while *both* menyitem and toolitem don't (but
 toolitem shows the tooltip correctly):
 
   ui_manager.get_widget(menu_entry_name).props.tooltip_text   ### None
   ui_manager.get_widget(tool_entry_name).props.tooltip_text   ### None
  
 
 .set_tooltip_text() works correctly in menu items, but it's terribly
 inconvenient to set them one by one when I already set tooltips in the
 actions, I guess I'm missing something!
 
 
 any hints?
 
 thanks
 
 sandro
 *:-)
 
 
 
 
 -- 
 Sandro Dentella  *:-)
 http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Tooltips on MenuItem and ui_manager

2010-09-08 Thread Alessandro Dentella
here is the code that shows what I mean. The action 'Test' has a tooltip in
the ToolButton and not in the meny entry:

thanks in advance for any possible hint/explanation

import gtk

GENERAL_UI = '''
  menubar name=Main
 menu action=File
menuitem action=Test/
/menu
  /menubar
  toolbar name=TbMain
 toolitem action=Test/
  /toolbar
 '''

class Test(object):

def __init__(self):
w = gtk.Window()
h = gtk.VBox()
w.add(h)

actions = gtk.ActionGroup('test')
actions.add_actions([
('File', None, 'FILE'),
('Test', gtk.STOCK_ABOUT, 'Test name', None, 'Tooltip for test', 
self.debug),
])

ui_manager = gtk.UIManager()
ui_manager.add_ui_from_string(GENERAL_UI)
ui_manager.insert_action_group(actions)

menu= ui_manager.get_widget('/Main')
toolbar = ui_manager.get_widget('/TbMain')

h.add(menu)
h.add(toolbar)
w.resize(200, 60)
w.show_all()

def debug(self, action):
print action

t = Test()

gtk.main()


On Wed, Sep 08, 2010 at 09:26:52AM +0200, Alessandro Dentella wrote:
 Hi. Sorry for reposting. But it seems strange to me that such an ordinary
 feature of Actions/MenuItem tooltip is not known by anybody.
 
 Most of the application I see do have tooltips on menuItems: I can't believe
 I should copy tooltips from action to MenuItem by hand...
 
 
 I've searched in the docs to see if there is a flag that enables them w/o
 finding anything.
 
 sandro
 *:-)
 
 On Thu, Sep 02, 2010 at 10:13:37AM +0200, Alessandro Dentella wrote:
  Hi again,
  
  
  I use  UIManager() + group_action.add_actions() to create MenuItems and
  ToolItems. I set tooltips as required by actiongroup.add_actions( 5^ field).
  
  These tooltip show correctly for toolitems but they won't for menu
  entries. Is it the desired behaviour? What can I do to have tooltips for
  MenuItems as well? Note that
  
ui_manager.get_action(action_name).props.tooltip
  
  shows the tooltip correctly while *both* menyitem and toolitem don't (but
  toolitem shows the tooltip correctly):
  
ui_manager.get_widget(menu_entry_name).props.tooltip_text   ### None
ui_manager.get_widget(tool_entry_name).props.tooltip_text   ### None
   
  
  .set_tooltip_text() works correctly in menu items, but it's terribly
  inconvenient to set them one by one when I already set tooltips in the
  actions, I guess I'm missing something!
  
  
  any hints?
  
  thanks
  
  sandro
  *:-)
  
  
  
  
  -- 
  Sandro Dentella  *:-)
  http://sqlkit.argolinux.orgSQLkit home page - 
  PyGTK/python/sqlalchemy
  ___
  pygtk mailing list   pygtk@daa.com.au
  http://www.daa.com.au/mailman/listinfo/pygtk
  Read the PyGTK FAQ: http://faq.pygtk.org/
 
 -- 
 Sandro Dentella  *:-)
 http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Tooltips on MenuItem and ui_manager

2010-09-08 Thread Alessandro Dentella
On Wed, Sep 08, 2010 at 12:12:06PM +0200, Timo wrote:
 On 08-09-10 09:51, Alessandro Dentella wrote:
 here is the code that shows what I mean. The action 'Test' has a tooltip in
 the ToolButton and not in the meny entry:
 
 thanks in advance for any possible hint/explanation
 Connect the uimanager to the connect-proxy signal, there you can set
 tooltips to the menuitems.
 See in-code for a working implementation.

Thanks Timo. This solves my need.

I still don't understand the logig behind the fact that tooltips are only
activated for Tool items and not for menu Items...


sandro
*:-)
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Tooltips on MenuItem and ui_manager

2010-09-08 Thread Alessandro Dentella
On Wed, Sep 08, 2010 at 06:54:46PM +0200, Timo wrote:
 On 08-09-10 15:39, Alessandro Dentella wrote:
 On Wed, Sep 08, 2010 at 12:12:06PM +0200, Timo wrote:
 On 08-09-10 09:51, Alessandro Dentella wrote:
 here is the code that shows what I mean. The action 'Test' has a tooltip in
 the ToolButton and not in the meny entry:
 
 thanks in advance for any possible hint/explanation
 Connect the uimanager to the connect-proxy signal, there you can set
 tooltips to the menuitems.
 See in-code for a working implementation.
 Thanks Timo. This solves my need.
 
 I still don't understand the logig behind the fact that tooltips are only
 activated for Tool items and not for menu Items...
 
 
 I don't know, but I never saw a program with tooltips on the
 menuitems, they always show up in the statusbar. Maybe it is against
 some (GNOME?) guidelines to do it.

Ubuntu - System - * all do have tooltips

sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] eventbox and ugly look

2010-09-02 Thread Alessandro Dentella
On Wed, Sep 01, 2010 at 01:55:54PM +0200, Neil Muller wrote:
 On 31 August 2010 18:56, Alessandro Dentella san...@e-den.it wrote:
  Hi,
 
  in order to get tooltips in the header of a TreViewColumn I add a Label to
  en EventBox. It works but upgrading from Ubuntu 8.04 to 10.04 (pygtk 2.17) I
  realized that very ugly border appear (that where not present previously)
  as in the attached example.
 
  Does anybody know how to fix the look or to get tooltip in the header of
  the column w/o event box?
 
 You should be able to just set the tooltip directly on the label,
 using set_tooltip_text and set_has_tooltip, without needing the
 EventBox.

you are right. I was already using set_tooltip_markup but I didn't realize
it worked for label as well. Thanks to you and john for the answer.


sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Tooltips on MenuItem and ui_manager

2010-09-02 Thread Alessandro Dentella
Hi again,


I use  UIManager() + group_action.add_actions() to create MenuItems and
ToolItems. I set tooltips as required by actiongroup.add_actions( 5^ field).

These tooltip show correctly for toolitems but they won't for menu
entries. Is it the desired behaviour? What can I do to have tooltips for
MenuItems as well? Note that

  ui_manager.get_action(action_name).props.tooltip

shows the tooltip correctly while *both* menyitem and toolitem don't (but
toolitem shows the tooltip correctly):

  ui_manager.get_widget(menu_entry_name).props.tooltip_text   ### None
  ui_manager.get_widget(tool_entry_name).props.tooltip_text   ### None
 

.set_tooltip_text() works correctly in menu items, but it's terribly
inconvenient to set them one by one when I already set tooltips in the
actions, I guess I'm missing something!


any hints?

thanks

sandro
*:-)




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] eventbox and ugly look [solved]

2010-09-01 Thread Alessandro Dentella
On Tue, Aug 31, 2010 at 06:56:30PM +0200, Alessandro Dentella wrote:
 Hi,
 
 in order to get tooltips in the header of a TreViewColumn I add a Label to
 en EventBox. It works but upgrading from Ubuntu 8.04 to 10.04 (pygtk 2.17) I
 realized that very ugly border appear (that where not present previously)
 as in the attached example.
 
 Does anybody know how to fix the look or to get tooltip in the header of
 the column w/o event box?
 
 I attach the example to repoduce the 2 different column headers.
 
 I guess I should get the backgroud style from the label and attach it to the
 other, but I'm not sure becouse a standalone label does not show the same
 way it shows as a header of a column...
 
 Any hints?

I solved it making the EnentBox' window invisible:

event_box.props.visible_window = False

sandro

PS: any mail I send to the mailing list I keep receiving an aknowledge of
receipt from  supp...@mpcustomer.com. I gues it's a mistake... is it?
isn't it possible to unsubscribe them?

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] eventbox and ugly look

2010-08-31 Thread Alessandro Dentella
Hi,

in order to get tooltips in the header of a TreViewColumn I add a Label to
en EventBox. It works but upgrading from Ubuntu 8.04 to 10.04 (pygtk 2.17) I
realized that very ugly border appear (that where not present previously)
as in the attached example.

Does anybody know how to fix the look or to get tooltip in the header of
the column w/o event box?

I attach the example to repoduce the 2 different column headers.

I guess I should get the backgroud style from the label and attach it to the
other, but I'm not sure becouse a standalone label does not show the same
way it shows as a header of a column...

Any hints?

thanks
sandro
*:-)




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
attachment: eventbox.pngimport gtk

class TreeMenu(object):

def __init__(self):

window = gtk.Window()
tv = gtk.TreeView() 

window.add(tv)

liststore = gtk.ListStore(str, str)
tv.set_model(liststore)
liststore.append(['abc', 'xyz'])

self.create_col(with eventbox, 0, tv, eventbox=True)
self.create_col(simple label, 1, tv, eventbox=False)

window.show_all()

def create_col(self, label, n_col, tv, eventbox=False):

cr = gtk.CellRendererText()
tc = gtk.TreeViewColumn(label, cr, text=n_col)
tc.set_clickable(True)
tv.append_column(tc)
label = gtk.Label(label)
if eventbox:
event_box = gtk.EventBox()
event_box.add(label)
tc.set_widget(event_box)
event_box.show_all()
else:
tc.set_widget(label)
label.show()


t = TreeMenu()

gtk.main()
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Center aligning a wrapped gtk.label under a gtk.Image object

2010-07-23 Thread Alessandro Dentella
On Fri, Jul 23, 2010 at 11:35:18AM +0530, Anish Mangal wrote:
 Hi,
 
 Can someone help me with this? Seems pretty trivial but I can't seem
 to get it right. Thanks!
 
 --
 Anish Mangal
 an...@sugarlabs.org
 
 On Fri, Jul 2, 2010 at 2:26 PM, Anish Mangal anishmangal2...@gmail.com 
 wrote:
  Hi,
 
  I'm trying to center align gtk.label object under a gtk.Image object
  by putting them both in a vbox and calling the set_alignment, and
  set_justify tasks wherever needed. When I set the label wrapping to
  OFF, the label gets perfectly center aligned under the text. However,

you mean under the *image*?

  I'm restricted to have label wrapping ON since the parent vbox needs
  to have a fixed horizontal dimension. So when I turn wrapping on, the
  label gets left aligned instead of being center aligned.
 
  I've sought for help on this on #pygtk with little success so far. Any
  help would be appreciated.
 
  Here is the pygtk code that demonstrates the issue.
  http://people.sugarlabs.org/~anish/table-image-label-center-test.py
 
  One can comment out the set_wrap lines and see that the label gets
  center aligned under the text.

I may have misunderstood your words but I get it center aligned, as shown
here: http://www.e-den.it/misc/center.png

sandro
*:-)



___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Center aligning a wrapped gtk.label under a gtk.Image object

2010-07-23 Thread Alessandro Dentella
On Fri, Jul 23, 2010 at 03:00:38PM +0530, Anish Mangal wrote:
  I may have misunderstood your words but I get it center aligned, as shown
  here: http://www.e-den.it/misc/center.png
 
 That is exactly what I needed. Can you share your code? :-)


I just tested *your* code!!!

I'm on ubuntu 8.04. pygtk 2.12.1


sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] CheckButton: toggled vs. clicked signal

2010-06-15 Thread Alessandro Dentella
Hi,

I just realized that a 'clicked' signal is emitted each time a value
is I toggled using .set_active(is_active) in a CheckButton.

I find it misleading and counter-intuitive since no one is clicking
anything. If that's the desired behaviour, what is the difference between
signal 'toggled' and 'clicked'?

The documentation states: The clicked signal is emitted when the mouse
button is pressed and released while the pointer is over the button.

thanks in advance
sandro
*:-)




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy


the example
==

import gtk

class Test(object):

def __init__(self):

w = gtk.Window()

self.c1 = gtk.CheckButton()

w.add(self.c1)

w.show_all()

self.c1.connect('clicked', self.clicked_cb)
self.c1.connect('toggled', self.toggled_cb)

def clicked_cb(self, cb):
print clicked
return True

def toggled_cb(self, cb):
print toggled
return True

if __name__ in '__main__':

t = Test()
t.c1.set_active(True)
gtk.main()

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] memory, del, and classes that has gtk.Window inside...

2010-05-24 Thread Alessandro Dentella
On Fri, May 21, 2010 at 05:57:00PM +0200, Alessandro Dentella wrote:
 Hi,
 
 I'm trying to figure out the correct way to delete a class that builds
 GUI. 
 
 I was not able to delete the object from a callback in a clean way.
 
 The following code should demostrate what I mean::
 
   import weakref
   import gtk
   import gobject
 
   class A(object): pass
 
 
   class G(object):
   def __init__(self):
 self.a = A()
 self.w = gtk.Window()
 self.w.show()
 self.w.connect_after('delete-event', self.delete_event_cb)
 
   def delete_event_cb(self, win, ev):
 print 'killed'
 del self
 print s, s()   # I'd like to see this to become None
 gtk.main_quit()
 
   g = G()
 
   s = weakref.ref(g.a)
 
   gtk.main()
 
 My goal is to create a class 'G'  that will destroy itself completely
 when the window it holds receives a delete_event. 
 
 As written in the comment, I'd like to see that the weakref to an element
 inside the instance 'g' should be None after deletion of 'g'. But it's not!
 
 Deleteing the object prints:
 
   san...@bluff: $ python test_mem.py
   killed
   s __main__.A object at 0x8329eec
 
 If I get rid of 'self'in the callback, everithing works but that makes
 it impossible to put the function inside the class.
 
 If I use a delete_event_cb as a separate function I manage to destroy it if
 I don't pass the g object as argument to the callbac (ie: making it global)
 but clearly that's a far less usefull setup.
 
 What's the best practice to delete compound widgets?

Further tests on this showed me that if I  set data on a widget
(e.g. using set_data) that contitues a strong reference that will not let
the gc to delete the object::

   import gc
   import sys
   import weakref
   import gtk

   class G(object):
   def __init__(self):
   self.w = gtk.Window()
   self.w.show()
   self.w.set_data('obj', self)  # this reference keeps 's' alive
   self.w.connect_after('delete-event', self.delete_event_cb)
   self.w.connect('enter-notify-event', self.enter_event_cb)

   def delete_event_cb(self, win, ev):
   print 'killed'

   def enter_event_cb(self, win, ev):
   global s
   print 'enter', s()


   s = weakref.ref(G())
   print s()

   try:
   gtk.main()
   except KeyboardInterrupt:
   print s()
   sys.exit(1)

I'd say this is a bug, am I wrong? is this a known problem?
That clearly leads to memory leaks. 

Any hints?

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] set_interactive documentation

2010-05-22 Thread Alessandro Dentella
 Hello everybody,
 A few years ago I wrote a patch to allow interactive usage of pygtk, by 
 including a new function set_interactive. The code in this patch was included 
 in pygtk versions 2.15.0 and later. I would like to add some documentation 
 for this function, but I am wondering what the appropriate place for that is. 
 The PyGTK reference manual at
 http://library.gnome.org/devel/pygtk/stable/
 describes classes in pygtk, while set_interactive is a function.
 Section 1.1 in the pygtk tutorial is more relevant:
 http://www.pygtk.org/pygtk2tutorial/ch-Introduction.html#sec-ExploringPygtk
 but the tutorial is based on pygtk version 2.4.

It seeme to me that later in the tutorial there are some additions of later 
widgets.

 What would be the right place to add this documentation?

I can't say and I can't really understand what the function
does. Interactive PyGTK isn't what you can to via ipython -gthread? I use it
a lot while debugging. 


sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] memory, del, and classes that has gtk.Window inside...

2010-05-21 Thread Alessandro Dentella
Hi,

I'm trying to figure out the correct way to delete a class that builds
GUI. 

I was not able to delete the object from a callback in a clean way.

The following code should demostrate what I mean::

  import weakref
  import gtk
  import gobject

  class A(object): pass


  class G(object):
  def __init__(self):
  self.a = A()
  self.w = gtk.Window()
  self.w.show()
  self.w.connect_after('delete-event', self.delete_event_cb)

  def delete_event_cb(self, win, ev):
  print 'killed'
  del self
  print s, s()   # I'd like to see this to become None
  gtk.main_quit()

  g = G()

  s = weakref.ref(g.a)

  gtk.main()

My goal is to create a class 'G'  that will destroy itself completely
when the window it holds receives a delete_event. 

As written in the comment, I'd like to see that the weakref to an element
inside the instance 'g' should be None after deletion of 'g'. But it's not!

Deleteing the object prints:

  san...@bluff: $ python test_mem.py
  killed
  s __main__.A object at 0x8329eec

If I get rid of 'self'in the callback, everithing works but that makes
it impossible to put the function inside the class.

If I use a delete_event_cb as a separate function I manage to destroy it if
I don't pass the g object as argument to the callbac (ie: making it global)
but clearly that's a far less usefull setup.

What's the best practice to delete compound widgets?


sandro
*:-)



-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Setting user-data property

2010-03-10 Thread Alessandro Dentella
On Wed, Mar 10, 2010 at 12:45:51PM +0100, Tobias Weber wrote:
 Hi,
 every widget inherits it, but no matter what argument type I 
 set_property('user-data', value) to I get an error. Probably cause it's 
 supposed to be a pointer.
 
 Now how do I attach a dictionary of custom meta data to a TreeViewColum as 
 recommended?
 http://faq.pygtk.org/index.py?req=showfile=faq13.026.htp

or pass user data in
what it means is you should use something like:

   col = gtk.TreeViewcolumn(..)
   col.connect('clicked', clicke_cb, 'my_data')

   def ckecked_cb(column, my_data):
   pass


it you want to write data to a widget, you can also use set_data():

col.set_data('my_data', string_or_what_i_want)


sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] TreeView problem, really simple program

2010-02-02 Thread Alessandro Dentella
On Tue, Feb 02, 2010 at 10:03:37AM -0600, Chris Gonnerman wrote:
 I'm writing a script to scan a folder for files, retrieve the version 
 information via Win32 API calls, and display the results in a sortable 
 list.  I've gotten partway into the process (reading the directory and 
 filling in the TreeView with names and blank fields) but the filenames 
 never appear on my screen... the rows are there, but they are entirely 
 blank.
 
 But if I add a hack to the code to retrieve the value of a column and 
 print it, it appears in the console window where I started the script 
 (much as I expect it to).  So the filename is there, but it's not appearing.
 
 I've missed something elementary, I know, but I don't know what it is, 
 and the examples I've been looking at are not terribly clear.  Perhaps 
 someone can tell me what I've done wrong?

you forgot to specify the source of data for the CellRenderer, you do that
when you create the column and is the index of the column in the model where
is should read the data:

self.programview.append_column(
   gtk.TreeViewColumn(allflds[i], gtk.CellRendererText(), text=i))

namely you forgot to add text=i


ciao
sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] TreeStores and rows-reordered signal

2009-12-14 Thread Alessandro Dentella
On Mon, Dec 14, 2009 at 02:28:25PM +0200, Neil Muller wrote:
 On 12/14/09, Alessandro Dentella san...@e-den.it wrote:
  Hi,
 
I'm probably misinterpreting what 'rows-reordered' means, but I thought 
  that
should be a signal emitted by a TreeStore when rows are reordered by DD
operations. Am I wrong?
 
 rows-reordered is sent by actions such as sorting the tree - it
 doesn't cater for items changing depth in the tree. D  D operations
 result in row-deleted and row-inserted signals being sent.

Thanks Neil, 

I was mistaken by the fact that 'set_reoderable' is the way you set
DD on the TreeView... I find it misleading.

sandro

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] treeview: next visible (not collpsed) row?

2009-12-10 Thread Alessandro Dentella

Hi,

  i'm loosing too much time to find out a pretty simple thing so maybe some
  has already a working solution.

  I want to know -given a path- which is the next visible (i.e. not hidden
  by the parend being collapsed) path. The same algorithm used by threeview
  when -after selecting a row- you press Down and traverse the treeview.

  sandro
  *:-)


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] How to destroy Window hierarchy and corner cases

2009-12-04 Thread Alessandro Dentella
Hi,

  I have an application that writes to StatusBar and uses timeout_add to
  delete the message after a fixed number of seconds.

  If in the meanwhile I destroy() the toplevel window I notice that under
  Linux I get the following message:

/home/misc/src/hg/py/sqlkit/sqlkit/layout/layout.py:661: GtkWarning: 
gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed
  msg_id = sb.push(idx, txt)
/home/misc/src/hg/py/sqlkit/sqlkit/layout/layout.py:669: GtkWarning: 
gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed
  sb.remove(idx, msg_id)

  Under Windows sometimes it just crashed the application.

  
  The problem is that when I receive a delete-event from a window, I
  destroy() it but the children are not really destroyed, e.g., with
  ipython you can still browse all its methods. The difference is that
  get_toplevel() will return the widget itself rather than the toplevel.

  
  Which is the correct/suggested way to destroy all elements of a hierarcy
  of widgets upon delete-event?


  TIA
  sandro
  *:-)



-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] How to destroy Window hierarchy and corner cases

2009-12-04 Thread Alessandro Dentella
On Fri, Dec 04, 2009 at 11:52:55PM +0100, Pietro Battiston wrote:
 Il giorno ven, 04/12/2009 alle 19.20 +0100, Alessandro Dentella ha
 scritto:
  Hi,
  
I have an application that writes to StatusBar and uses timeout_add to
delete the message after a fixed number of seconds.
  
If in the meanwhile I destroy() the toplevel window I notice that under
Linux I get the following message:
  
  /home/misc/src/hg/py/sqlkit/sqlkit/layout/layout.py:661: GtkWarning: 
  gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed
msg_id = sb.push(idx, txt)
  /home/misc/src/hg/py/sqlkit/sqlkit/layout/layout.py:669: GtkWarning: 
  gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed
sb.remove(idx, msg_id)
  
Under Windows sometimes it just crashed the application.
  

The problem is that when I receive a delete-event from a window, I
destroy() it but the children are not really destroyed, e.g., with
ipython you can still browse all its methods. The difference is that
get_toplevel() will return the widget itself rather than the toplevel.
  

Which is the correct/suggested way to destroy all elements of a hierarcy
of widgets upon delete-event?
  
 
 
 (I might be wrong, but) I think that destroy() is not exactly what you
 think. I mean: for instance,
 
 w=gtk.Window()
 w.destroy()
 w.get_position()
 
 works perfectly and returns (0,0).

mmh that's something I wouldn't have expected in fact.

I think I'm really confused about destroy/delete freeing memory in this cases.

 Destroying a widget simply means deleting it from any widget gerarchy:
 for instance, if your widget is in a container, the container will
 forget about it; if your widget is a toplevel, it will disappear from
 the toplevels list.
 
 Then, if(f) the reference count for the object goes to 0, the object
 will be presumably really destroyed (its memory freed), but if you
 (through pure python, not pygtk) keep some reference to it, it will stay
 there: that's why the above w.destroy has no effect at all.
 
 When you destroy a toplevel, its children are destroyed only in the
 sense that they may become unreferenced, and then disappear.
 
 That said, I don't understand the error you get, neither why you'll
 experience crashes in Windows, and there _may_ be some (py)gtk bug
 showing; however, if I understood correctly what you're assuming, I hope
 I explained correctly why it's not a correct assumption.

yes, that make sense at least!

sandro
*:-)




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] AccellLabel in MenuItem with uimanager and popup

2009-11-20 Thread Alessandro Dentella
Hi,

  I use uimanager with menubar, toolbar and popup, the same action
  defined as:
 ('Zoom-fit', gtk.STOCK_ZOOM_FIT, None, 'Controlz', None, 
self.on_zoom_fit),
  appear in menubar and popup. In menubar it does have an AccelLabel while in
  popup it doen't. Is there any reason?

  Following the main step I do to create the popup from the same uimanager
  that works for menubar:

  popup name=TreePopup
...
menuitem action=Zoom-fit /
...
  /popup


  menu = self.ui_manager.get_widget('/TreePopup')
  menu.popup(None, None, None, event.button, event.time)

  TIA
  sandro
  *:-)

  
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] announcement policy

2009-11-19 Thread Alessandro Dentella
On Thu, Nov 19, 2009 at 06:19:31PM +0100, Yann Leboulanger wrote:
 John Finlay a écrit :
  I'm disappointed that I appear to be the only one on this list that 
  finds these announcements objectionable. And contrary to speculation I 

I don't find announcement on PyGTK addons objectionable and surely not just
becouse I'm amoung those who send these announcement every now and then, but
becouse I like to be informed on what's moving aroung the pygtk world and I
happened to use software that was advertized on this list.

The subject ANN makes it so easy to skip if you are not interested...

And we are talking about 3% of the traffic, including announcement of
PyGTK/Pygobject that are not questionable and make 1/4 of the announcements.

To be even more clear, I would rather prefer if announcement stayed in this
same list. 



PyGUI on the other hand is not an addon to pygtk.


sandro
*:-)


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] pygtk on Mac and right click

2009-11-09 Thread Alessandro Dentella
Hi,

  I needed to port an application in PyGTK based on sqlkit to
  mac. Everithing works but the customer complains that he cannot use the
  one-button mouse emulating the right click with Control-click.

  Is there any way to enable it?

  TIA
  sandro
  *:-)



-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] change cursor on threeview header widget

2009-11-09 Thread Alessandro Dentella
Hi,

  some time ago [1] I tried hard to make a treeview header widget to be
  sensitive to press-event, with no luck.

  Now I just want to change the cursor but I can't do it eather.

  I can change the widget into a Label + EventBox, make it hihglight when
  mouse hoovers it but I can't make the EventBox change the cursor.

  The attached code is my attempt to make it change the cursor. Does anybody
  know how to make it work?

  TIA
  sandro
  *:-)





[1] http://www.mail-archive.com/pygtk@daa.com.au/msg17784.html
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy

--

import gtk

HAND2 = gtk.gdk.Cursor(gtk.gdk.HAND2)
LBL_HOOVER_STYLE = gtk.gdk.color_parse('red')

class TreeMenu(object):

def __init__(self):

window = gtk.Window()
vbox = gtk.VBox()
label = self.make_label(label con hand2)
mb = gtk.MenuBar()
mb2 = gtk.MenuBar()
tv = gtk.TreeView() 
self.m = create_menu_button(File)

window.add(vbox)
vbox.add(mb)
vbox.add(label)
vbox.add(tv)
mb.append(self.m)
window.show_all()

liststore = gtk.ListStore(str, str)
tv.set_model(liststore)
liststore.append(['abc', 'xyz'])

cr = gtk.CellRendererText()
cr2 = gtk.CellRendererText()
tc = gtk.TreeViewColumn('A', cr, text=0)
tc2 = gtk.TreeViewColumn('B', cr, text=1)
tc.set_clickable(True)
tc2.set_clickable(True)
m = create_menu_button(I'm a MenuItem with submenu)
ev_box = self.make_label(I'm a label with changed cursor)
# this to experiment with MenuItem as 
tc.set_widget(mb2)
tc2.set_widget(ev_box)
mb2.append(m)
mb2.show_all()
tc.set_clickable(True)


tv.append_column(tc)
tv.append_column(tc2)
window.show_all()

def ene_cb(self, eb, event):
eb.get_child().set_state(gtk.STATE_PRELIGHT)
return True

def lne_cb(self, eb, event):
eb.get_child().set_state(gtk.STATE_NORMAL)
return True

def make_label(self, label=label):
label = gtk.Label(label)
event_box = gtk.EventBox()
event_box.add(label)
event_box.connect('realize', self.realize_cb)

event_box.connect('enter-notify-event', self.ene_cb)
event_box.connect('leave-notify-event', self.lne_cb)
label.modify_fg(gtk.STATE_PRELIGHT, LBL_HOOVER_STYLE)

event_box.connect(realize, self.realize_cb)
event_box.show_all()


return event_box

def realize_cb(self, widget):
widget.window.set_cursor(HAND2)


def create_menu_button(label):
m = gtk.MenuItem(label)
menu = gtk.Menu()
m.set_submenu(menu)
menu.append(gtk.MenuItem('Item 1'))
menu.append(gtk.MenuItem('Item 2'))
menu.append(gtk.MenuItem('Item 3'))
m.show_all()
return m

t = TreeMenu()

gtk.main()
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] problem with listStore append in a treeview

2009-10-28 Thread Alessandro Dentella
On Wed, Oct 28, 2009 at 07:15:55PM +0200, Petsas Athanasios wrote:
 I disabled sorting while doing the appends is happening, but it's still slow.
 Maybe some calls in my
 code must be in a different order..

Have you atk enabled? It seems strange but when I enabled atk sqlkit loading
was extremly slow. I even opened a ticket but I was unable to produce a short
sample of code that chowed the problem. Do you have a simple working example?

sandro

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] problem with listStore append in a treeview

2009-10-28 Thread Alessandro Dentella
On Wed, Oct 28, 2009 at 08:14:13PM +0200, Petsas Athanasios wrote:
 hmm! What is atk? 

the accessibility toolkit

 I don't know if it is enabled.. But surely I don't have the
 packet
 python-atk if you mean this..

I don't have it eather. When I enabled it was throught gnome panel
preferences/assistive technologies (I don't have an english desktop to say
how it was exactly)


Do you have the load of the machine going up in those 2 minutes? It *really*
seems like the probelm I had. On which OS/environment are you working?

Can you produce a simple code?

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] gtk.Entry with dynamic completion

2009-10-01 Thread Alessandro Dentella
On Thu, Oct 01, 2009 at 06:55:56AM -0700, jamesb-py...@acelere.net wrote:
 I'd like to use gtk.Entry with 'context-sensitive' completion.  The
 space of possible completions is quite large, so the user might
 type
 
 f
 
 in which case it offers the competion foo, and when they type
 
 foo.b
 
 it offers completions foo.b1, foo.b2 etc.
 
 It seems that gtk.EntryCompletion is more geared towards static
 lists of completions in the gtk.ListStore.
 
 Has anyone tried to do anything like this?

sqlkit uses completion in a dynamic mode and uses gtk.EntryCompletion.

What you say about static list is bypassed by the fact that you can change
the model from which you pick the values and moreover you can change the
match_function that determines visibility of the records in the model.

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] treeview issues

2009-09-29 Thread Alessandro Dentella
 I am attaching the py file in which i used the module in the above url.

that's a long listing. Can you reproduce the problem in a simple example?
To run your example you need at least 3 modules that are not provided (report,
gnukhata_global, and gridset)

sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] treestore sqlalchemy examples

2009-09-23 Thread Alessandro Dentella
On Wed, Sep 23, 2009 at 12:19:12AM +0100, Alberto Ruiz wrote:
 2009/9/22 Alessandro Dentella san...@e-den.it:
  I like it for extensibility and mapping to complex sql schema's, but
  I was thinking if I could map all columns of a treeview and an extra
  column for the path. The path could then be applied to create the
 
  in the first, non public, release of sqlkit I used a 1:1 mapping between
  liststore (I don't currently use treestores) and it turned out to be slower.
 
  Ythe reason is that in that case, you have to distribute the data you get
  from the class to the model for all values of the model, while I let the
  column's cell_data_function to do it just for the visible cells.
 
 Hi guys,
 
 What you guys should be doing is implementing the TreeModel interface
 on top of your ORM instead of feeding a TreeStore/ListStore object.
 
 Note that treestore/liststore is just a reference implementation of
 the treemodel interface that gets abused very often (actually due to
 TreeModel being a huge interface to implement though). This would be
 the only way to have a proper model with an acceptable performance.

that's an interesting idea, but the huge interface to implement scares me,
and I have so many ideas to add to sqlkit before pushing the performance
that is not bad anyhow. I'd give a try if sombody else implemented it,
thought!

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] treestore sqlalchemy examples

2009-09-22 Thread Alessandro Dentella
On Tue, Sep 22, 2009 at 08:26:01PM +1000, Kim Adil wrote:
 Has anyone seen any good, small examples using gtktreestores and 
 sqlalchemy. SQLKit is the obvious big example, but I cannot seem to find 
 any small samples, yet they like an seem ideal combination.

It really depends on the fact that you simply want to show data or edit them.

I'm not in the mood to produce a small exmaple but I can tell you which is
the idea behind sqlkit way of populating the treeview from the sqlalchemy
result.

The treeview has only one column, that holds the instance returned by
sqlalchemy query. Each column has a cell_data_function that populates the
cell renderers. Each column is specialized to handle a type of data
according to specification desumed by information gathered from the
__mapper__ of the result.

If you want to understand how I cope with different data you should read
sqlkit.widgets.table.columns.py [1]. It's more complicated than what is
needed to just show data as it has calls to validation function hat
complicates the game quite a bit.

sandro
*:-)



[1] 
http://hg.argolinux.org/py/sqlkit/file/230d6baaf634/sqlkit/widgets/table/columns.py


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] treestore sqlalchemy examples

2009-09-22 Thread Alessandro Dentella
 I like it for extensibility and mapping to complex sql schema's, but
 I was thinking if I could map all columns of a treeview and an extra
 column for the path. The path could then be applied to create the

in the first, non public, release of sqlkit I used a 1:1 mapping between
liststore (I don't currently use treestores) and it turned out to be slower.

Ythe reason is that in that case, you have to distribute the data you get
from the class to the model for all values of the model, while I let the
column's cell_data_function to do it just for the visible cells.


 I am trying to determine if this might be a better
 fit for small apps. It will keep the data storage in the same shape
 that the widget uses, and keep it simple so I do not get confused :)

I personally don't find it's simpler, the class that sqlalchemy returns it's
a pretty easy object to work with, it's normally in the session and you
don't have to retrieve the data from the TreeModel to check if it's changed,
you just check session.dirty, maybe session.is_modified(obj).

I'd really suggest you check why you consider it more natural, you're using
an ORM that is exactly the way to use the *record* in an object oriented way,
not in a tabular way...

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] ANNOUNCE: Spiff GtkWidgets (goocalendar, AnnotatedTextView, color tools)

2009-09-12 Thread Alessandro Dentella

Hi Samuel, 
On Wed, Jun 25, 2008 at 09:18:52PM +0200, Samuel Abels wrote:
 Hi,
 
 I am happy to announce Spiff GtkWidgets, a collection of Gtk widgets
 written in Python.
 
 SpiffGtkWidgets.Calendar
 -
 About a year ago I dropped a calendar widget similar to Google Calendar
 on this list (goocalendar). I wasn't planning to maintain it back then,
 but now I rewrote it, and ported it to hippocanvas. The end result is a
 much improved calendar:

   - Improved event layout.
   - Significantly higher (font) rendering quality thanks to hippocanvas.

i'd like to port this to goocanvas, are you still on this list?
I'd like to ask you some details if you are available. 

sandro
*:-)

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] ANNOUNCE - Sqlkit 0.8.6

2009-09-12 Thread Alessandro Dentella
  ANNOUNCE: sqlkit 0.8.6

September, 12 - 2009


I'm happy to announce release 0.8.6 of sqlkit package for python.

  http://sqlkit.argolinux.org/

This release


This is the first stable release. It features a new interface for the
standalone command (sqledit), many improvements and functions added.

We have used pyinstaller to create standalone executable for Linux and Mac,
you can download them to use the application and to run the demo.

It's now registered in pypi so you can 'easy_install' it, if you already
installed pygtk.
I'm currently looking for a debian sponsor to upload the package in sqeeze.

A new tutorial is available here:
http://sqlkit.argolinux.org/sqlkit/tutorial.html

Refer to http://sqlkit.argolinux.org/download/Changelog for details


The package
---
SQLkit PyGtk package provides Mask and Table widgets to edit database
data. It's meant as a base for database desktop applications.

The application
---
It also provides 'sqledit' a PyGTK application based on sqlkit that can be
used from command line to browse and edit data. 

The package has 2 very rich demo suites for sql widgets (the main one in
sqlkit/demo/sql/demo.py) and for layout creation
  
Translations


If you like sqlkit and want to help translating, you may find the project on:
  
  https://launchpad.net/sqlkit

Main features of sqlkit:


  * editor of databases in 2 modes: table  mask
  * based on sqlalchemy: can cope with many different databases
  * very powerfull filtering capabilities:
- each field can be used to filter records
- filter may span relationship
- date filtering possible also on relative basis (good for saved 
  queries)
  * completion on all text field and foreign keys
  * very easy way to draw a layout for mask views
  * completely effortless editing of relationships
  * very easy way to set defaults
  * possibility to display totals of numeric fields
  * any possible sql constraint can be attached to a Mask or a 
Table. It can be expressed a s a normal sqlalchemy query or with 
django-like syntax
  * sqledit: python script to edit db
  

Sqlkit is based on:
---
  * python (= 2.4 - but developed on 2.5)  
  * PyGtk   
  * Sqlalchemy (= 0.5)
  * glade
  * python-dateutil
  * babel (localization)
  * you db driver of choice

Dowload  more:
---

  * Download: http://sqlkit.argolinux.org/sqlkit/download.html
  easy_install sqlkit
  * Source:   hg clone http://hg.argolinux.org/py/sqlkit
  * Google Group: http://groups.google.it/group/sqlkit/
  * Translation:  https://launchpad.net/sqlkit
  * Tutorial: http://sqlkit.argolinux.org/sqlkit/tutorial.html
  * Changelog:http://sqlkit.argolinux.org/download/Changelog
  * License:  GNU GPL
  

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] preparing a PyGTK app for PyPi

2009-09-04 Thread Alessandro Dentella
On Fri, Sep 04, 2009 at 05:13:30PM +0200, Arjan Molenaar wrote:
 Hi,

 seems like nobody responded ;/. Anyway, I do not set a dependency in  
 setup.py because of the same reason you describe below. I just describe 
 it in the description field, so it shows up on the PyPI.

 See http://pypi.python.org/pypi/gaphor.


I ended up adding a test in setup.py for 'import gtk'. It that fails I issue
a warning end exit from the script.

It seems setuptools can only detect presence of packages if it finds the
metadata and (at least under Ubuntu) pygtk is not packaged with metadata, so
that it's never detected.

Moreover I'm convinced that setuptools fails implementing the dependencies
in some cases. I described one in my comment on the (already) open bug 
http://bugs.python.org/setuptools/issue17 .



sandro
*:-)




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] text entry question

2009-08-16 Thread Alessandro Dentella
On Sun, Aug 16, 2009 at 07:01:02AM -0400, nipun batra wrote:
 I tried to make a program which on a button click,starts reading from a file
 and then shows contents in different text fields.However i am not able to do
 that properly.I have attached two attempts.How can i do the above task.

I only read entry.py, I don't see the problem in writng to a different
entry. I rather see that is difficoult to understand which test should that
be. Moreover there is code to handle  the toggle buttons that is not
relevant and some regexp code that suppose we know what you want to do. 

I suggest you write an example that -when run- shows your problem in a
simpler way (don't leave reference to files that do not exist in our system or
tell us how they sould be).

sandro
*:-)


PS: 

  vars = re.compile('^(\d+\.?\d*)a(\d+\.?\d*)b(\d+\.?\d*)c(\d+\.?\d*)d(.*)')

'vars' is not a smart way for a variable in python, it's already a
builtin function
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] preparing a PyGTK app for PyPi

2009-08-05 Thread Alessandro Dentella

NOTE: I've being trying to send this mail several times in the last 2
  weeks. It gets blocked by mailman for some reason and no administrator
  unblocks it. It seems it's recognized by mailman as an administrative
  one. That's why I split some words...

Hi,

  I'd like to re gister sqlkit with PyPi. I would like to know how should I
  set dependancies on pygtk. 

  Would it be enought to set 

  set up (
 ...
 re quires = ['pygtk = 2.10']
  )


  What real meaning would that have? Is it correct to expect that it would
  at least fail if it's not able to grant an installation of pygtk?

  The question arises since I have looked at some packages (kiwi and a
  couple of others) that do not set any re quire, so I wandered which could
  be the reason.

  I noticed that writing as above in ubuntu jaunty with pygtk already
  installed does not seem to be recognized. An attempt to download pygtk is
  done and then a message that tells that compiling pygtk is not supported
  by distutils (message may be a little different).

  sandro   
  *:-)

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] size request in scrolled windows + viewport

2009-08-03 Thread Alessandro Dentella
Hi

  I have a table with many widgets inside, so that total dimenstions are
  bigger that the screen so that I put it in a ScrolledWindow + ViewPort.

  So far so good. ow I have a Window with all widgets in a pane that scrolls
  fine... but starts very little indeed.

  I'd like to know how to propagate the dimentions that the table would
  have requested to set dimentions of the Viewport.

  I'm a little lost between size_request/get_child_requisition and similar
  methds.

  Any hints?

  Thanks
  sandro
  *:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] how to associate a button press event on gtk.CellRenderer cell

2009-07-15 Thread Alessandro Dentella
 Well the first reference seems to be of  no use . I have a sneeky
 feeling second would have been of use :(
 
 Some algorithmic help would be of great use as i do not understand the
 gtk architecture very well . I am only beginning to learn pygtk.

well... if you think so, go ahead and read the second reference...

But I think you don't necessarily need that to make a cell renderer to be
sensitive to a 'button-press-event'. You could use the signal of the
TreeView, get the cell where the pointer is and do whatever you want, or
you could just use the signal of the editable, depending on what you need.

sandro
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] how to associate a button press event on gtk.CellRenderer cell

2009-07-14 Thread Alessandro Dentella
On Tue, Jul 14, 2009 at 10:30:06PM +0530, Amit Sethi wrote:
 well i did not know how to define the term , well basically i need
 help/tutorial regarding how to add  a signal.

I all what you need is to know how to add a signal *callback*, have a look
at the pygtk tutotial [1]. I you're lookiing at how to add a signal (that i
don't think you really need now) have a lok at how gobject works with
signals [2] (not responing right now).

I'm not sure about your needs, but you may just need to add a callback to the
editable of the cell. You can easily do that in the callback of the
'editing-started' signal of the cell renderer.


sandro
*:-)

[1] 
http://www.andrew.cmu.edu/user/skey/research_prev/checker/working%20now/gui/pygtk2tutorial/pygtk2tutorial/index.html

[2] http://www.sicem.biz/personal/lgs/docs/gobject-python/gobject-tutorial.html


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Change background of selected cell in a TreeView

2009-06-29 Thread Alessandro Dentella
On Mon, Jun 29, 2009 at 08:15:19PM +0300, Noam Yorav-Raphael wrote:
 Hello,
 
 TreeViews usually highlight the background of the selected cell. I
 would like to change that color to white (the background of unselected
 cells), so that a border would be drawn around the cell but its
 background won't change.
 
 I tried using treeview.modify_bg(gtk.STATE_SELECTED,
 gdk.color_parse('white')), but it had no effect.
 
 Do you have any idea how to do it?

I think this explains what you need:

  http://faq.pygtk.org/index.py?req=showfile=faq13.031.htp

It works for me.

sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] AccelGroup and Up/Down/Left/Right keys

2009-06-19 Thread Alessandro Dentella
On Fri, Jun 19, 2009 at 08:52:44AM +0200, Pierre wrote:
 Hi list,
 
 I was wondering if it's possible to use the 'Up', 'Down', 'Left', and
 'Right' keys as accelerators in AccelGroup.
 
 I'm led to believe one can't, as the short snippet below fails to call
 the blop() method when 'Up' is pressed, whereas pressing 'b' does
 succesfully call blip().
 
 Is there any workaround ?


I obtain the same result and do not have workaroud. Have you noticed that
CtrlUp works. It seems GTK reserve Up. 

In fact if you try in gnome to bind shortcuts to Up, a message warns you that
that would interfere with normal operation...

sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] button-press-event on a TreeViewColumn Header?

2009-06-17 Thread Alessandro Dentella
Hi,

  I'd like to connect to a 'button-press-event' of a column header of a
  TreeViewColumn. As only clicked is provided, I set the widget::

label = gtk.Label(title)
box = gtk.EventBox()
box.add(label)
column.set_widget(box)
box.connect('button-press-event', self.box_clicked_cb)
#column.connect('clicked', self.clicked_cb)

  but box_clicked_cb is never called. Why that?

  Any Hints?

  thanks in advance
  sandro


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] reply address for this list - retry

2009-06-17 Thread Alessandro Dentella
On Mon, Jun 01, 2009 at 12:18:55PM +, F Wolff wrote:
 Op Vr, 2009-05-29 om 15:14 +0200 skryf Alessandro Dentella:
  I did it again, so I repost the same request as some months ago. Even if you
  are not the person in the position to modify it, I'd like to know if there
  are any objections to setting a default reply to the list.
  
  sandro
  *:-)
  
  
  Hi,
  
I found mysel many times answering to the original author rather than to
the list. I think that this doesn't only happen to me as is pretty normal
for public mailing list to have reply address set to the list.
  
I think this is inconvenient as many answers of public interest don't
arrive to the list.
  
Is it possible to change this  setting?
  
sandro
*:-)
 
 
Sorry, for some reason I didn't see the answer up to today.

 Hallo
 
 Almost none of the lists I am subscribed to follow your proposed setup.

lets'say all google groups, as an example... not really a minority


 For some idea of why some people might not want this change, see this
 page:
 http://www.unicom.com/pw/reply-to-harmful.html

the clue in that page is that you loose the possibility to answer directly
to the poster, *if the poster is different from what is in the From*. Do you
think this is frequent?

On the other side you catch all the answer of people that don't realize
they're answering to a single person. 

There are so many simple questions that gets unaswered in this list that
I *hope* people are answering directly to the posters, and that happens to
me frequently, but that's a loss for the list in my opinion.

sandro
*:-)


PS: ops! I was just sending to you directly...
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] button-press-event on a TreeViewColumn Header?

2009-06-17 Thread Alessandro Dentella
On Wed, Jun 17, 2009 at 11:22:45AM +0200, Roberto Cavada wrote:
 Alessandro Dentella wrote:
 
but box_clicked_cb is never called. Why that?
 
 
 Use 'clicked' signal, after enabling it:
 
 col = gtk.TreeViewColumn(...)
 col.set_clickable(True)
 col.connect(clicked, self.on_col_clicked)


That's what I'm using now.
'clicked' beahaves as button-release. I want button-press.

It pops a menu and is more natural to have menus popped when you press, not
when you release...


sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] button-press-event on a TreeViewColumn Header?

2009-06-17 Thread Alessandro Dentella
On Wed, Jun 17, 2009 at 02:08:00PM +0400, ilya korcdmk wrote:
 Maybe you need to add event to catch button press with

 col.add_events(gtk.gdk.BUTTON_PRESS_MASK)

thanks for the hint but it doesn't work

column.add_events(gtk.gdk.BUTTON_PRESS_MASK)
AttributeError: 'gtk.TreeViewColumn' object has no attribute 'add_events'

On the other hand, I already added a widget (EventBox) as header of the
column and Im connecting directly to the EventBox, so why should the
column sensitivness be implied?


sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] getting goocanvas Group coordinates

2009-06-12 Thread Alessandro Dentella
Hi,

  I'm trying to figure out the logic that I should use to move around group
  objects in a goocanvas.
  
  What I do is: I create a Group object, declare it as parent in a rectangle
  and a text, use group.translate(dx, dy) to move the object to a position. 

  From then on I'd like to query the object and get the Group position for
  further processing but I can't see a property to query (no props.x) not a
  method that returns x,y coordinates?
  
  Am I wrong thinking that a Group *has* an x,y for the origin?

  sandro
  *:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] making a editable treeview stay in edit mode

2009-06-12 Thread Alessandro Dentella

 The idea here that hitting tab, back-tab, up-arrow or down-arrow move the cell
 being edited and not leave edit mode. I like the treeview because the list 
 being

I use this code as callback of 'key-press-event' on Tab to achieve what you
are looking for. 

The key ise 'treeview.set_cursor', that lets you say if you want to want to
get into editing mode::

   def set_cursor(path, focus_column=None, start_editing=False)

the example is more complicated than you need, as I onnly use editing mode
if the column represents an editable data and I call self.get_direct_edit for 
that.

def key_tree_Tab(self, treeview, event, data):
path, col = treeview.get_cursor()
## only visible columns!!
columns = [c for c in treeview.get_columns() if c.get_visible()]
colnum = columns.index(col)
if colnum + 1  len(columns):
next_column = columns[colnum + 1]
next_field_name = next_column.get_data('field_name')
gobject.idle_add(treeview.set_cursor, path,
 next_column, self.get_direct_edit(next_field_name) 
)
else:
tmodel = treeview.get_model()
titer = tmodel.iter_next(tmodel.get_iter(path))
if titer is None:
titer = tmodel.get_iter_first()
path = tmodel.get_path(titer)

next_column = columns[0]
next_field_name = next_column.get_data('field_name')
gobject.idle_add(self.treeview.set_cursor, path, next_column,
 self.get_direct_edit(next_field_name) )
return False


sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Adding menu items at runtime

2009-06-05 Thread Alessandro Dentella
On Wed, Jun 03, 2009 at 01:01:44PM +0200, Johannes Bauer wrote:
 Hello list,
 
 I have a Pyton application which reads in some plugins and needs to add
 items to a plugins menu accordingly at runtime. Now I expected to to a
 builder/get for the MenuItem parent entry and then use add (as
 MenuItem inherits from Bin).
 
 But - weird: Although in the glade-File I see my Plugins_MenuItem as
 of type GtkMenuItem, in the generated XML it is of type GtkAction
 (and is so also during runtime). I cannot add children to a GtkAction,
 however...

I don't use glade, so I can't be of help with that, but testing it with
glade I don't get GtkAction entries. 

I only recently started using the gtk.UIManager() object and that's in my
opinion the better way to go if you want a simple and dynamic solution.

sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] problem with focus in notebook

2009-06-04 Thread Alessandro Dentella
On Thu, Jun 04, 2009 at 08:27:13AM -0400, Mike Bernson wrote:
 I have a notebook that I want to control where the focus goes on page 
 switches.
 
 I connect to the switch-page signal.
 
 In the handle for the switch-page signal I set the focus to a Entry widget. 
 The
 focus ends up on the tab for the page. If I call idle_add with function to 
 set the
 focus to the Entry widget it works.
 
 I do not like using the idle_add to set the focus widget. It looks like a 
 hack and
 I would like to find a better way to handle this.


I don't really know, but just guessing the switched is not yet completed
when you try to focus and the corrent page is not yet changed I'd try using
'connect-after', or connecting to 'focus-tab'

sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] pygtk fatal exceptions

2009-05-29 Thread Alessandro Dentella
On Fri, May 29, 2009 at 02:22:12PM +0200, Guillaume Bouchard wrote:
 Hello,
 
 I want to debug a pygtk program with PDB (the internal python debuger)
 because the program raise an exception.
 
 My aim is to be able to directly jump to the exception with python -m
 pdb myprogram.py and then '(c)ontinue' and wait for the exception to be
 catch by pdb.

I'm not really following you, but I debug gtk program using 'ipython
-gthread'. When you hit an exception you are jumped into a pdb interpreter
 run from ipython (i.e. you have completion available that you dont have in
 a normal pdb session). Try:

  ipython -gthread -pdb -- your_script.py

I think and hope this should be (more) than what you where looking for.

*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] reply address for this list - retry

2009-05-29 Thread Alessandro Dentella
I did it again, so I repost the same request as some months ago. Even if you
are not the person in the position to modify it, I'd like to know if there
are any objections to setting a default reply to the list.

sandro
*:-)


Hi,

  I found mysel many times answering to the original author rather than to
  the list. I think that this doesn't only happen to me as is pretty normal
  for public mailing list to have reply address set to the list.

  I think this is inconvenient as many answers of public interest don't
  arrive to the list.

  Is it possible to change this  setting?

  sandro
  *:-)



  
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] events_pending main_iteration_do

2009-04-25 Thread Alessandro Dentella
 There might be more than one task to do in the main iteration, so you
 might run the main iteration as long as there is something to process:
 
 while gtk.events_pending():
 gtk.main_iteration_do()
 

thanks. That makes the difference

*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] changing the foreground colour of entry box dynamically

2009-04-09 Thread Alessandro Dentella
On Thu, Apr 09, 2009 at 10:36:18AM +1200, Tim Evans wrote:
 Tim Evans wrote:
  ganesh gajare wrote:
  Hello,
   I have created an entry box widget using glade.
   and I am doing validation on that field...
   So whenever an invalid text is entered in the entry box,the text color 
  of entry should change dynamically..
  
  I haven't tested this, but the method 'modify_text' should do what you 
  need.  For example, to set the text to red, use:
  
   entry.modify_text(gtk.gdk.color_parse('red'))
  
  and to set it back to the default black:
  
   entry.modify_text(None)
  
 
 Well, that's what I get for not even checking the documentation before 
 posting.  I forgot the first argument to 'modify_text' should be a state 
 value.  The relevant states here are:
 
   - gtk.STATE_NORMAL for unselected text
   - gtk.STATE_SELECTED for selected text when the entry is focused
   - gtk.STATE_ACTIVE for selected text when a different widget is focused


In case you need to change the background too, i tryed to use modify_bg with
no luck while modify_base just works. I have not understood which is the
difference between one and the other, not I could find an explanation
of the difference between modify_bg and modify_text. The second works to
modify the text of an entry, the first does not.

Any one  can explain or pint to documentaion on the difference between
base/bg and text/fg?

In the kiwi package there is an interesting validation field that uses also
images as background. I wanted to do the same but didn't manage missing a
simpler example... 

sandro
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Announce: sqlkit 0.8.6-rc2

2009-03-26 Thread Alessandro Dentella


  ANNOUNCE: sqlkit 0.8.6-rc2

March, 25 - 2009


I'm happy to announce release 0.8.6-rc21 of sqlkit package for python.

  http://sqlkit.argolinux.org/

This release


Many things have been added: signals, hooks for validation, improved filters
for related tables, many new demo snippets and many bug fixes are among the
most important ones.

Refer to http://sqlkit.argolinux.org/download/Changelog for details

The package
---
SQLkit PyGtk package provides Mask and Table widgets to edit database
data. It's meant as a base for database desktop applications.

The application
---
It also provides 'sqledit' a PyGTK application based on sqlkit that can be
used from command line to browse and edit data.

The package has 2 very rich demo suites for sql widgets (the main one in
sqlkit/demo/sql/demo.py) and for layout creation
  
Main features of sqlkit:


  * editor of databases in 2 modes: table  mask
  * based on sqlalchemy: can cope with many different databases
  * very powerfull filtering capabilities:
- each field can be used to filter records
- filter may span relationship
- date filtering possible also on relative basis (good for saved 
  queries)
  * completion on all text field and foreign keys
  * very easy way to draw a layout for mask views
  * completely effortless editing of relationships
  * very easy way to set defaults
  * possibility to display totals of numeric fields
  * any possible sql constraint can be attached to a Mask or a 
Table. It can be expressed a s a normal sqlalchemy query or with 
django-like syntax
  * sqledit: python script to edit db
  

Sqlkit is based on:
---
  * python (= 2.4) 
  * PyGtk   
  * Sqlalchemy (= 0.5)
  * glade
  * dateutils
  * babel (localization)


Dowload  more:
---

  * http://sqlkit.argolinux.org/sqlkit/download.html
  * hg clone http://hg.argolinux.org/py/sqlkit
  * google group: http://groups.google.it/group/sqlkit/
  * License: GNU GPL

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] gobject, property and Exception - resent

2009-03-16 Thread Alessandro Dentella
May I repost this as I guess this is something I'm really missing and I
think pygtk *is* the list where I have more chance to meet who can explain
this... 

thanks
sandro

On Fri, Mar 13, 2009 at 12:33:34PM +0100, Alessandro Dentella wrote:
 Hi,
 
  I just realized that I cannot try/except an error raised in a
  get_property. in the following example, get_date will raise an error but
  the try/except loop won't catch it.
  
  Any idea why and what I can do to have an error that is catched by
  by try/except statement?
 
  TIA
  sandro
  *:-)
 
 
 import gobject
 
 class MyError(Exception): pass
 
 class Test(gobject.GObject):
 __gproperties__ = {
 'date' : (gobject.TYPE_PYOBJECT,   # type
 'Date',# nick name
 'The date currently selected', # description
 gobject.PARAM_READWRITE),  # flags
 }
 
 def get_date(self):
 raise MyError(Gulp!)
 
 def do_get_property(self, property): 
 if property.name == 'date':
 return self.get_date()
 
 
 
 t = Test()
 try:
 t.get_property('date')  # this will raise MyError
 except: # this will not catch it
 pass
 
 
 
 
 -- 
 Sandro Dentella  *:-)
 http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] enty with an image as background

2009-03-14 Thread Alessandro Dentella
Hi,

  I wanted to implement an entry with a simple image as background, mainly
  to warn if a validation error was raised.

  I thought I could use style property bg_pixmap but I can't work out how it
  should work. Here is the code I tried (of course I copied error.png in the
  same directory).
  
  Any hint is appreciated. Thanks
  sandro
  *:-)



class W(object):

def __init__(self):
w = gtk.Window()
self.e = gtk.Entry()
w.add(self.e)
w.show_all()

self.pixbuf = gtk.gdk.pixbuf_new_from_file('error.png')
self.pixmap, self.mask = self.pixbuf.render_pixmap_and_mask() 

style = self.e.get_style().copy()
style.bg_pixmap[gtk.STATE_NORMAL] = self.pixmap

self.e.set_style(style)

w = W()

  
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] gobject, property and Exception

2009-03-13 Thread Alessandro Dentella
Hi,

 I just realized that I cannot try/except an error raised in a
 get_property. in the following example, get_date will raise an error but
 the try/except loop won't catch it.
 
 Any idea why and what I can do to have an error that is catched by
 by try/except statement?

 TIA
 sandro
 *:-)


import gobject

class MyError(Exception): pass

class Test(gobject.GObject):
__gproperties__ = {
'date' : (gobject.TYPE_PYOBJECT,   # type
'Date',# nick name
'The date currently selected', # description
gobject.PARAM_READWRITE),  # flags
}

def get_date(self):
raise MyError(Gulp!)

def do_get_property(self, property): 
if property.name == 'date':
return self.get_date()



t = Test()
try:
t.get_property('date')  # this will raise MyError
except: # this will not catch it
pass




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] hungry TreeStore... SOLVED (was GTK_MODULES=gail:atk-bridge)

2009-02-12 Thread Alessandro Dentella
Hi, 





On Thu, Feb 12, 2009 at 04:40:31PM +0100, Alessandro Dentella wrote:
 Hi, since yesterday, on my linux Ubuntu 8.0.4 I'm experimenting very strange
 things that I don't see on other machines. TreeStore  'append' method is
 taking a huge amount of time as shown by this 'prun' inside ipython:
 
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   3324.6440.0144.6480.014 {method 'append' of 
 'gtk.TreeStore' objects}
   4950.4900.0010.4900.001 {method 'set' of 
 'gtk.TreeStore' objects}
 
 
 the same program on a different machine:
 
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   4950.0110.0000.0110.000 {method 'set' of 
 'gtk.TreeStore' objects}
   3320.0040.0000.0070.000 {method 'append' of 
 'gtk.TreeStore' objects}
 
 
 
 I'm not at all aware of any changes. I didn't upgrade any tools and I don't
 remember to have installed anything in the last 2 days.
 
 One more strangeness is that I'm having these messages:
  Warning: /build/buildd/glib2.0-2.16.4/gobject/gsignal.c:2271: signal name
  `selection_changed' is invalid for instance `0x88e2998'
 
 that I don't receive on other machines and I didn't receive until yesterday.
 
 doesn that give you any idea wher I could investigate to understand what
 happened?


I solved the problem when answering to Laszlo and Albert (thnaks to both of
you). I realied that the error message (from the second problem) was related
to a directory that is not an Ubuntu nor one of mine  (  Warning: 
/build/buildd/glib2.0-2.16.4/gobject/gsignal.c:2271: signal name
 `selection_changed' is invalid for instance `0x88e2998')

So I remembered that a week ago I wanted to test gtkparasite. I had to
enable assistive tecnologies. At the end I got an enviromental variable
GTK_MODULES=gail:atk-bridge 

It was sufficient to unset it and everithing is working correctly.

I hope this can help others that may  get into troubles like this...


sandro
*:-)



-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] reply address for this list

2009-02-09 Thread Alessandro Dentella
Hi,

  I found mysel many times answering to the original author rather than to
  the list. I think that this doesn't only happen to me as is pretty normal
  for public mailing list to have reply address set to the list.

  I think this is inconvenient as many answers of public interest don't
  arrive to the list.

  Is it possible to change this  setting?

  sandro
  *:-)



  
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Simple question on reusing stock item - SOLVED

2009-02-09 Thread Alessandro Dentella
On Mon, Feb 09, 2009 at 02:04:24AM -0800, John Finlay wrote:
 Alessandro Dentella wrote:
  Hi,
 
i'd like to use stock item in menu entries with modified labels to better
suit context.
 
*  MenuItem doesn't allow to use images (reasonable)
*  ImageMenuItem doesn't appearently allow to change label (really???)
 
I think I could go with IconFactory but it seems to me it's more complex
than what is should be and I wandered if there is a simple way I was not
able to work out.
 
Thanks

sandro
*:-)
 

 A MenuItem is a Container so you can add anything to it. In your case 
 create an empty MenuItem and add an HBox containing an Image and a Label.

Today pygtk FAQ is back (yesterday was not reachable) and I saw the solution
there. What I didn't imaginis that you can instantiate an ImageMenuItem as:

   item = gtk.ImageMenuItem('Foo')


even thought official docs say:

   gtk.ImageMenuItem(stock_id=None, accel_group=None)

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Simple question on reusing stock item

2009-02-09 Thread Alessandro Dentella
On Mon, Feb 09, 2009 at 02:24:35PM +, Amondo Roquentin wrote:
 John Finlay wrote:
 
  A MenuItem is a Container so you can add anything to it. In your case
  create an empty MenuItem and add an HBox containing an Image and a Label.
 
 Is there a policy on the spacing to apply to HBoxes in this
 circumstance? For example, should the spacing be zero or a fixed number?

I don't have the answer, but I can point out 2 things that I wrote yesterday
erroneusly to John instead of the list  (see other mail on Repy-To).

  1. the code I attach to this message adds the icon but the alignment is
 wrong as can be seen in this image ex.:
 http://www.e-den.it/misc/menu.png

  2. in pygtk FAQ tere are 2 aswers. (It's a pity on Sunday the pygtk FAQ was
 unreachable) and the hint there shows that you can write:

item = gtk.ImageMenuItem('Foo')

 even thought official docs say:

gtk.ImageMenuItem(stock_id=None, accel_group=None)

 This works correctly

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy

###   bad  
code that leads to uncorrect alignment:

  class StockMenuItem(gtk.MenuItem):

  def __init__(self, label, stock, size=gtk.ICON_SIZE_MENU):
  gtk.MenuItem.__init__(self)
  label = gtk.AccelLabel(label)
  hbox = gtk.HBox(spacing=5)
  image = gtk.Image()
  image.set_from_stock(stock, size)
  hbox.add(image)
  hbox.add(label)
  self.add(hbox)
  self.show_all()


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Simple question on reusing stock item

2009-02-08 Thread Alessandro Dentella
Hi,

  i'd like to use stock item in menu entries with modified labels to better
  suit context.

  *  MenuItem doesn't allow to use images (reasonable)
  *  ImageMenuItem doesn't appearently allow to change label (really???)

  I think I could go with IconFactory but it seems to me it's more complex
  than what is should be and I wandered if there is a simple way I was not
  able to work out.

  Thanks
  
  sandro
  *:-)

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] KP_Decimal map to decimal separator

2009-01-28 Thread Alessandro Dentella
Is there a preferred way to handle KP_Decimal to locale aware decimal
separator? 

And if not what's the suggested way? should I trap a ksym 'KP_Decimal' and
emit a signal with event a separator or is there a simpler solution?

thanks
sandro



-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] how to know if completion is visible

2009-01-26 Thread Alessandro Dentella
Hi,

  I'd like to change bindings of an entry according to the fact that the
  completion is visible or not.

  How can I tell? 
  
  GtkEntryCompletion is not a gtk.Widget, so which widget is it the widget
  that shows the possible completions?

  thanks
  sandro

-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] TreeView/cell/signals - SOLVED

2009-01-25 Thread Alessandro Dentella
 If I understand your question I don't think that you can prevent the 
 Entry that is used as the CellEditable for the CellRendererText from 
 closing when activated. You can only prevent the edits from being 
 applied which is the default.

thanks for your answer that awoke my brain... Really you *can* stop the
process, what you cannot do is stopping from withing 'edited' callback. You
must be in 'remove-widget' callback.

I ended up using some variables to define the validation-state during
'edited' callback, I can also start completion with EntryCompletion. It
wouldn't normally even popup as the widget is deemed to be removed, but
I intercept it with 'remove_widget_cb' that returns True to stop the
process.

It's up to you to prevent opening several different cell editable at that
point... 

sandro
*:-)


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Problem with Notebook - stop-emission doubts

2009-01-22 Thread Alessandro Dentella
On Sat, Dec 27, 2008 at 09:59:55AM +0100, Alessandro Dentella wrote:
 1. the explanation is exactly the same as for emit_stop_by_name: which
is the difference? 
  
 
  They are the same.
 
 ok, I guess some hystorical reason...
 
  Some signals provide an explicit means of stopping the signal emission 
  using a return value from a handler. The clicked handler is not 
  supposed to provide a return value so returning True does nothing.

This sentenced induced me to think that stop_emission could be used always
while return True only by those signals that support it. 

On the contrary in the following example I try to stop emission of
key-press-event from within the 'edited' callback back to the treeview
callback and it seems not to work.

I connected with Tab from the treeview a callback that shiftws the cell to
be edited, but I'd like to stop it under some conditions from within
editabel callback. it's enought to return True (Line  59) and it works
but it does not work instead the line:

self.treeview.emit_stop_by_name('key-press-event')



Did I mis-interpret the signal?

sandro
*:-)


#!/usr/bin/python

import gtk
import gtk.gdk
import gobject

class Tree(object):
def __init__(self):
self.w = gtk.Window()
self.w.connect('destroy', gtk.main_quit)
self.treeview = gtk.TreeView()
self.w.add(self.treeview)

self.model = gtk.ListStore(str, str)
self.treeview.set_model(self.model)
self.col1, cell1  = self.add_col('col1', 0)
self.col2, cell2  = self.add_col('col2', 1)

self.treeview.connect('key-press-event', self.on_tree_key_press)
cell1.connect('editing-started', self.text_editing_started_cb)
cell1.connect('edited', self.text_edited_cb )
self.fill_model()
self.w.show_all()

def on_tree_key_press(self, widget, event):
ksym = gtk.gdk.keyval_name(event.keyval)
if ksym == Tab:
print Tab from treeview
path, col = self.treeview.get_cursor()
#self.treeview.set_cursor(path, self.col2, True)
self.tag = gobject.idle_add(self.treeview.set_cursor, path, 
self.col2, True)

def add_col(self, label, pos):
cell = gtk.CellRendererText()
cell.set_property('editable', True)
cell.set_property('editable-set', True)

col = gtk.TreeViewColumn(label)
col.pack_start(cell)
col.add_attribute(cell, 'text', pos )
col.set_expand(True)


self.treeview.append_column(col)
return col, cell

def text_editing_started_cb(self, cell, editable, path):
#editable.connect('editing-done', self.editing_done_cb)
editable.connect('key-press-event', self.on_editable_cb)

def text_edited_cb(self, cell, editable, path):
#self.treeview.stop_emission
pass

def on_editable_cb(self, widget, event):
ksym = gtk.gdk.keyval_name(event.keyval)
if ksym == Tab:
print Tab from editable
#return True    line 59
#gobject.source_remove(self.tag)
widget.stop_emission('key-press-event')
#self.treeview.stop_emission('key-press-event')
self.treeview.emit_stop_by_name('key-press-event')

# def editing_done_cb(self, celleditable):
# if celleditable.get_text() == 'x':
# celleditable.stop_emission('remove-widget')

def fill_model(self):
for i in ('uno', 'due', 'tre'):
self.model.append([i *3, i*2])


t = Tree()
t.w.resize(400, 200)
#t.treeview.set_cursor(0, t.col2, True)

try:
gtk.main()
except KeyboardInterrupt, e:
pass


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] TreeView/cell/signals

2009-01-22 Thread Alessandro Dentella
... the same problem, a different point of view...

If I enter a CellRendererText in editing mode I can press return and the
mode switched and signal 'edited'is emitted.

Who is responsable for that?  I guess is the editable as I can't imagine
anything else... but how can I be sure? I mean is there a way to listen all
signals and who is emitting them?

Which is the signal emitted? 

What can I do from within the 'edited' callback to stop switching from
editing mode? 

sandro


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Tooltips on comboBox

2009-01-21 Thread Alessandro Dentella
I forward here the answer from Kristian Rietveld in gtk list. I thinks it may
be useful to others.

After this I decided to use deprecated widget OptionMenu, that gives a
normal MenuItem that supports tooltips



sandro

---
On Wed, Jan 21, 2009 at 10:22 AM, Alessandro Dentella san...@e-den.it wrote:
 In my attempt to get tooltips I see that as I click on the arrow and the
 popup appears, the tooltip disappears.

This is also because GTK+ hides a tooltip as soon as something is
clicked to avoid the tooltip getting in your way.

 It seems the popup is a different gtk.Widget, and I should connect to that
 one to attach tooltips. Is that correct? and in case how can I have that
 widget?

Yes, the popup is a different widget.  There is no API call to access
this popup widget directly (this has also been done deliberately,
since the popup widget/window can change when the theme changes and in
general people shouldn't mess around with it ;).

 Can somebody clearify which is the way a ComboBox pops a menu and how I can
 get to it's components to set a tooltip?

Right now I don't see a way how to easily set a tooltip on the combo
box popup.  I do agree that this would be very useful to be able to do
and we should support this in a future version of GTK+.


regards,

-
On Wed, Jan 21, 2009 at 1:16 PM, Alessandro Dentella san...@e-den.it wrote:
 Right now I don't see a way how to easily set a tooltip on the combo
 box popup.  I do agree that this would be very useful to be able to do
 and we should support this in a future version of GTK+.

 sigh...

 Thank you so much for the explanation.

I have this mail thread marked in my inbox so that I won't forget to
open a bug for this issue ;)

 Of course I think that addition would be really usefull. For the time being
 I think the only solution for me will be to mock it with a menu. Would
 OptionMenu (that was deprecated in favor to ComboBox) give me the
 opportunity to set tootlip or I would meet the same problem?

I think the option menu will give you this opportunity since you have
to create the menu that is popped up yourself and pass that to the
GtkOptionMenu.

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] try/except won't trap DeprecationWarning from OptionMenu

2009-01-21 Thread Alessandro Dentella
Hi,

  I'd like to use deprecated OptionMenu, but I can't stop the
  DeprecationWarning. Why is it different from a self produced one?

import gtk

try:
raise DeprecationWarning
except DeprecationWarning, e:
pass


try:
a = gtk.OptionMenu()
except DeprecationWarning, e:
pass

  
  only the first one will be trapped. Why?
  Is there a way to stop it?



  sandro
  *:-)


PS: the reason why I want to use OptionMenu is as per my other thread the
possibilityto add tooltips
  
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Adding Validation in TreeView: how to use 'edited' cb and stop any other processing?

2009-01-20 Thread Alessandro Dentella
Hi,

   I'm trying to add validation in a TreeView. 

   Connecting to cell's 'edited'  signal I can trigger validation on a cell
   input and if the field is not valid I reset it to previous value. That's
   not ideal, since the invalid value must be completely reentered while I'd
   like to leave it there.

   really It's pretty easy to do exacly what I want trapping a Tab on the
   editable, but that's junst *one* way to travel throught data (albeith
   very common).
   
   What I was not able to do is to prevent from moving from that cell, from
   within the 'edited' callback. I don't know how to stop any further
   processing of possible precedent events (click on other cell or DonwArrow
   or Tab...)

   Any hints?

   TIA
   sandro



-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Tooltips on comboBox

2009-01-20 Thread Alessandro Dentella
On Sun, Jan 18, 2009 at 11:31:57PM +0100, Alessandro Dentella wrote:
 hi,
 
   I  have been googling around for a while but I can't see if there is any
   possibility to set tooltips for combobox entries.
 

   Is it any possible?

in my attempt to get tooltips I see that as I click on the arrow and the
popup appears, the tooltip disappears.

It seems the popup is a different gtk.Widget, and I should connect to that
one to attach tooltips. Is that correct? and in case how can I have that
widget?

I tried to connect to 'add' signal but it's never triggered. I see the 
ComboBox has a child: a CellView, but if I understand correctly CellView
only displayes *one* line and moreover I was not able to add a tooltip
anyhow.

Can somebody clearify widh is the way a ComboBox pops a menu and how Ican
get to it's components to set a ooltip?

thanks
sandro
*:-)







import gtk
import datetime

class Test(object):

def __init__(self):
self.w = gtk.Window()
self.v = gtk.VBox()
self.c = gtk.ComboBox()
self.c = gtk.combo_box_new_text()
#print self.c, type(self.c)

for i in =   = = ~ ~!.split():
self.c.append_text(i)

self.c.set_property('has-tooltip', True)
self.c.connect('query-tooltip', self.on_query_tooltip)

self.w.add(self.v)
self.v.add(self.c)

self.w.show_all()

def on_query_tooltip(self, widget,  x, y, keyboard_mode, tooltip):
print widget, x, y, keyboard_mode, tooltip
tooltip.set_text(datetime.datetime.now().strftime('%M:%S'))
return True


if __name__ == '__main__':

t = Test()
gtk.main()
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Tooltips on comboBox

2009-01-18 Thread Alessandro Dentella
hi,

  I  have been googling around for a while but I can't see if there is any
  possibility to set tooltips for combobox entries.

  Is it any possible?
  Is there some working example

  Thanks
  sandro

  
-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] [Announce] sqlkit - 0.8.5

2009-01-16 Thread Alessandro Dentella
I'm pleased to announce rel 0.8.5 of sqlkit, that adds many improvements to
sqlkit. 

In this release localization has been added. I'd be very pleased if someone
would like to contribute localization file for any language (but italian).

Changes in this release:

sqlkit 0.8.5 - 16.1.09  

* localization: added localization for numbers and dates
added localization for messages
-- now waiting for translations  ;-)  --
* table: - added a smart way to automatically set dimentions of the
   table based on info retrieved from the database
   (thanks to Pietro Battiston)
 - complete rewrite of the column setup function
 - added a basic multiline cellRenderer
 - grately improved the navigation with Tab that now
   correctly triggers validation/completion
* fields: many improvements in clean_value/validation
* mask: - added handling of comments
- fixed integer/float miniwiget (0 was rendered as  '')
- text now uses gtk.WRAP_WORD
- fixed current_idx was a class attribute not an instance attr
* layout: added check and hints on errors for Panes widgets
* django_syntax: fix in typo
* filters: fixed handlung of boolena  NULL check in related tables
* signals: - record_selected - record-selected to follow gtk standard
   - added records-displayed
* widgets/layout: added label_map support
* sqlwidget: rationalized menu entries


The package
---
SQLkit PyGtk package provides Mask and Table widgets to edit database
data. It's meant as a base for database desktop applications.

The application
---
It also provides 'sqledit' a PyGTK application based on sqlkit that can be
used from command line to browse and edit data.

The package has 2 very rich demo suites for sql widgets (the main one in
sqlkit/demo/sql/demo.py) and for layout creation
  
Main features of sqlkit:


  * editor of databases in 2 modes: table  mask
  * based on sqlalchemy: can cope with many different databases
  * very powerfull filtering capabilities:
- each field can be used to filter records
- filter may span relationship
- date filtering possible also on relative basis (good for saved 
  queries)
  * completion on all text field and foreign keys
  * very easy way to draw a layout for mask views
  * completely effortless editing of relationships
  * very easy way to set defaults
  * possibility to display totals of numeric fields
  * any possible sql constraint can be attached to a Mask or a 
Table. It can be expressed a s a normal sqlalchemy query or with 
django-like syntax
  * sqledit: python script to edit db
  

Sqlkit is based on:
---
  * python (= 2.4) 
  * PyGtk   
  * Sqlalchemy (= 0.5)
  * glade
  * dateutils


Dowload  more:
---

  * http://docs.argolinux.org/sqlkit/sqlkit/download.html
  * hg clone http://hg.argolinux.org/py/sqlkit
  * google group: http://groups.google.it/group/sqlkit/
  * License: GNU GPL
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Listviews and SQL

2009-01-13 Thread Alessandro Dentella
On Mon, Jan 12, 2009 at 09:58:54PM +0100, Jelle De Loecker wrote:
 Hi everyone,
 
 I'm in the process of converting an Access frontend to python, I must
 admit Access  VBA made me a bit lazy. (VB  VBA is also the only
 language I learned in school, years ago, but python is quite nice to
 learn)

I've never used Access so I don't really know what it provides.

I think you may be interested in sqledit [1], a package that provides A
Widgets SqlTable and SqlMask that can edit directy a table or any mapper
defined in sqlalchemy [2].

I plan to release a localized version before tomorrow. There's a rich demo
so you can have a feeling of what it can do. 

Being base on sqlalchemy it can be used with many different database
backends (eg: postgres, sqlite, mysql, and others). It's being used both in
Linux and Windows.


sandro
*:-)


[1] http://sqlkit.argolinux.org
[2] http://www.sqlalchemy.org

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] date multiline cell renderers for sqlkit

2009-01-07 Thread Alessandro Dentella
Hi,

   I'd like to add good cellrenderers for date/datetime and multiline text to
   sqlkit [1].
   
   Since I believe that it's a pretty common renderer, before starting what
   I guess would be a long job for me, I ask you if there is some freely
   available renderer.

   thanks
   sandro
   *:-)



[1] http://sqlkit.argolinux.org


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Problem with Notebook - stop-emission doubts

2008-12-26 Thread Alessandro Dentella
On Wed, Dec 24, 2008 at 01:22:49PM +0100, Gian Mario Tagliaretti wrote:
 On Wed, Dec 24, 2008 at 9:57 AM, Frédéric
 frederic.mantega...@gbiloba.org wrote:
 
  PS: BTW, where did you find the stop_emission() method? I can't retreive it
  in the doc...
 
 it a gobject method:
 http://library.gnome.org/devel/pygobject/stable/class-gobject.html#method-gobject--stop-emission

following the docs I have several questions?

  1. the explanation is exactly the same as for emit_stop_by_name: which
 is the difference? 


  The stop_emission() method stops the current emission of the signal
  specified by detailed_signal


  2. current emission means the emission of the signal that is now
 handled? if this is the case, what's the need for specifying the name?

  3. How is it different from returning True? 
 I tested it with::

b = gtk.Button(Press me)
e = gtk.Entry()
b.connect('clicked', self.on_clicked1)
b.connect('clicked', self.on_clicked2)

e.connect('key-press-event', self.on_key_press_event1)
e.connect('key-press-event', self.on_key_press_event2)


 on_clicked2 cannot be inhibited returning True from on_clicked1 while 
 on_key_press_event1 *can* be inhibited simply returning True.

 Both can be inhibited using stop_emission.
  
Thanks
sandro
*:-)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


  1   2   >