Re: [pygtk] Make Dialog disappear without returning to main loop

2010-03-20 Thread Florian Diesch
Nikolaus Rath nikol...@rath.org writes:

 I am creating a dialog in a callback function. Is there a way to make
 the dialog window disappear before the callback function returns?

 I do not care if the main window keeps unresponsive, I just want the
 dialog to disappear.

 Here is a small sample script to demonstrate what I mean:


 I would like to have the dialog window disappear *before* the
 time.sleep() in do_stuff() finishes. Is that possible?

Call

  while gtk.events_pending():
  gtk.main_iteration ()

so that pending events are processed.


   Florian
-- 
GUIs programmieren mit Python und Glade:
http://www.florian-diesch.de/doc/python-und-glade/
___
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 write an agenda view?

2010-03-01 Thread Florian Diesch
Martin Drautzburg martin.drautzb...@web.de writes:

 I need to write an agenda  view, with a timesheet (hours/days) in the 
 background and with items drawn as boxes with text. I dont' quite know 
 where to start. Here are some specific questions:
[...]
 How would you guy approach this?

Maybe one of the canvas libs listed on
http://live.gnome.org/ProjectRidley/CanvasOverview can help you.


   Florian
-- 
GUIs programmieren mit Python und Glade:
http://www.florian-diesch.de/doc/python-und-glade/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] ANN: easygconf 0.03

2010-02-16 Thread Florian Diesch


I'm happy to announce easygconf 0.03

Get it at http://www.florian-diesch.de/software/easygconf/


Changes since 0.02:
---

 * renamed GConfDict.add_listner() to add_listener()
 * fixed bug in GConfDict.from_python() (thanks to Pawn Hearts pawn13 at 
gmail.com)




easygconf provids an easy, pythonic way to access GConf
http://projects.gnome.org/gconf/`__ through a dict-like interface.

Example
---
::

from easygconf import GConfDict
import gtk


key = 'test
gc=GConfDict('/apps/easygconftest')

print %s is %s%(key, gc[key])
gc[key] = 'foo'
print Now %s is %s%(key, gc[key])


def callback (key, value, gconfdict, id, args):
print %s changed to %s%(key, value)

gc.add_listener('test', callback)
try:
gtk.main()
except KeyboardInterrupt:
pass
gc.unset('test')


   Florian
-- 
GUIs programmieren mit Python und Glade:
http://www.florian-diesch.de/doc/python-und-glade/
___
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 Florian Diesch
Alessandro Dentella san...@e-den.it writes:

 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.

I like to read here announcements of projects that help me to use PyGtk in
some way if they are not too frequent.
I don't want to get announcements of every projects that uses PyGtk.


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

+1



   Florian
-- 
http://www.florian-diesch.de/software/easygconf/
___
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] ANN: PyGUI 2.1

2009-11-18 Thread Florian Diesch
Greg Ewing greg.ew...@canterbury.ac.nz writes:

 John Finlay wrote:

 Start your own list for the community that is interested in your project.

 That's not going to reach anyone who doesn't already
 know about it.

 It's probably a good idea for ongoing discussion,
 though. Any suggestions on the best way of going
 about it? I could start a Google Group, but I'd
 prefer a real mailing list server if possible.

Some OpenSource project hosters, e.g. http://www.berlios.de/, let you
create mailing lists.


   Florian
-- 
http://www.florian-diesch.de/software/easygconf/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] ANN: easygconf 0.02

2009-11-16 Thread Florian Diesch

Hi!

I'm happy to announce easygconf 0.02.
Get it at http://www.florian-diesch.de/software/easygconf/

easygconf provids an easy, pythonic way to access GConf
through a dict-like interface.


Example
---

from easygconf import GConfDict
import gtk


key = 'test'
gc=GConfDict('/apps/easygconftest')

print %s is %s%(key, gc[key])
gc[key] = 'foo'
print Now %s is %s%(key, gc[key])
 
def callback (key, value, gconfdict, id, args):
print %s changed to %s%(key, value)

gc.add_listner('test', callback)
try:
gtk.main()
except KeyboardInterrupt:
pass
gc.unset('test')



   Florian
-- 
http://www.florian-diesch.de/
___
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] make a ListStore to sort itself

2007-01-30 Thread Florian Diesch
Volker Helm [EMAIL PROTECTED] wrote:


 Bye,

 Volker

  Original-Nachricht 
 Datum: Fri, 26 Jan 2007 23:24:10 +0100
 Von: Florian Diesch [EMAIL PROTECTED]
 An: pygtk@daa.com.au
 Betreff: Re: [pygtk] make a ListStore to sort itself

 Volker Helm [EMAIL PROTECTED] wrote:
 
  I have a sorted ListStore containing values that change themself. After
  a change I want to sort it again.
  
  So far I'm doing it by calling set_sort_column_id() with a different
  sort_column_id or order and then calling it again with the right
 values.
  
  Is there a better way? 
  
  Calling row_changed() or sort_column_changed() doesn't work and using
  set(), remove() etc. is difficult as the values don't know to which row
  they belong.
 
  just use gtk.TreeModelSort(model).
 
  There is an example in the tutorial
 
 http://www.pygtk.org/pygtk2tutorial/sec-TreeModelSortAndTreeModelFilter.html
 
  Hope that will help,
 
 
 I don't understand how to do it as I can't tell TreeModelSort to resort
 itself or its  child model.

 These are the magical lines:

 win.sm = gtk.TreeModelSort(self.liststore)
 # Set sort column
 win.sm.set_sort_column_id(n, gtk.SORT_ASCENDING)
 win.tv = gtk.TreeView(win.sm)

 So, when you insert a line into the model, now win.sm, with sorting
 column n, the row sorting itself. That was the way as I understood it.

My problem is that I don't insert new rows but just get noticed that
some value in an existing row has been changed.





   Florian
-- 
http://www.florian-diesch.de/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] make a ListStore to sort itself

2007-01-27 Thread Florian Diesch
Volker Helm [EMAIL PROTECTED] wrote:

 I have a sorted ListStore containing values that change themself. After
 a change I want to sort it again.
 
 So far I'm doing it by calling set_sort_column_id() with a different
 sort_column_id or order and then calling it again with the right values.
 
 Is there a better way? 
 
 Calling row_changed() or sort_column_changed() doesn't work and using
 set(), remove() etc. is difficult as the values don't know to which row
 they belong.

 just use gtk.TreeModelSort(model).

 There is an example in the tutorial
 http://www.pygtk.org/pygtk2tutorial/sec-TreeModelSortAndTreeModelFilter.html

 Hope that will help,


I don't understand how to do it as I can't tell TreeModelSort to resort
itself or its  child model.

But I can use set_sort_func() to resort the ListStore which works for
me.


   Florian
-- 
http://www.florian-diesch.de/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Liststore model

2007-01-14 Thread Florian Diesch
Seth Mahoney [EMAIL PROTECTED] wrote:

 If this doesn't work, then I've got another idea (though I don't know if
 it will work for you, either).  You could try generating the liststore
 with a str for every possible column, and then only show the columns you
 need.  So, if there were five different data items:

 store = gtk.ListStore(str, str, str, str, str)

 and then use gtk.TreeView.append_column() and
 gtk.TreeView.remove_column() to hide and show columns as necessary.

Another way is to use a ListStore with a column containing complex data
like doicts, lists or objects and then use a cell_data_func to access
its attributes. Like this (extracted from some of my code, maybeneeds
some fixing, but the idea should be clear):

class Foo(object):
 def __init__(self, bar):
self.bar=bar

self.model=gtk.ListStore(gobject.TYPE_PYOBJECT)
self.model.append([Foo(i) for i in range(0,5)])
self.widget.set_model(self.model)

cell=gtk.CellRendererText()
col=gtk.TreeViewColumn(self.title)
col.pack_start(cell, True)
def callback(column, cell, model, iter):
   cell.set_property('text', 
 getattr(model.get_value(iter, 0), 'bar'))
col.set_cell_data_func(cell, callback)
self.widget.append_column(col)




   Florian
-- 
http://www.florian-diesch.de/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] make a ListStore to sort itself

2007-01-13 Thread Florian Diesch

Hi!

I have a sorted ListStore containing values that change themself. After
a change I want to sort it again.

So far I'm doing it by calling set_sort_column_id() with a different
sort_column_id or order and then calling it again with the right values.

Is there a better way? 

Calling row_changed() or sort_column_changed() doesn't work and using
set(), remove() etc. is difficult as the values don't know to which row
they belong.



   Florian
-- 
http://www.florian-diesch.de/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] A few questions/comments

2007-01-10 Thread Florian Diesch
[EMAIL PROTECTED] wrote:

  The documentation for TreeModel.get_iter_from_string(string_path) does
 not define the format for 'string_path' This got me a couple of months
 ago, and then again yesterday.  

It is defined in the description of TreeModel:


A path is essentially a potential node. It is a location on a model
 that may or may not actually correspond to a node on a specific model. A
 path can be converted into either an array of unsigned integers or a
 string. The string form is a list of numbers separated by a colon. Each
 number refers to the offset at that level. Thus, the path 0 refers to
 the root node and the path 2:4 refers to the fifth child of the third
 node.


Maybe there should be a reference in the docs of get_iter_from_string

 How do I put in a request to get the documentation fixed?

Send an email at [EMAIL PROTECTED] or file a bug report at
bugzilla.gnome.org  as said in Introduction.



 For 'button-press-event' handlers:

 def mouseClick(self, widget, event):
 #
 x,y = event.get_coords()
  
 Is there a reason that x,y are floating point values?  

I don't know. It's the way it is done in GDK and PyGtk just wrapps it.

 When I turn
 around and call TreeView function get_path_at_pos(x,y) I get a warning
 because of the floating point values (I'm casting them so I'm not
 seeing the warning at the moment).

That's what I'm doing too.


   Florian
-- 
http://www.florian-diesch.de/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/