Re: [pygtk] ProgressBar widget click event

2006-11-07 Thread Alessandro Pellizzari
Il giorno lun, 06/11/2006 alle 19.00 -0500, Noah Schwartz ha scritto:

 I don't seem to be able to capture the click event for ProgressBar. I tried 
 connecting the button-press-event to a function but, it wasn't getting 
 called. Then I set it up to capture all events and still I wasn't capturing 
 clicks.

Maybe I am wrong, but the progressbar doesn't support clicking events.
You can create a button (which is a container) and associate a progress
bar as child. This way, when you press the progress bar, you really
press the button, that emits the clicked signal.
You can give no border to the button, making it invisible.

Bye.

-- 
Alessandro Pellizzari


___
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] Bug in TreeView.scroll_to_cell()

2006-07-14 Thread Alessandro Pellizzari
Il giorno gio, 13/07/2006 alle 22.54 -0700, David M. Cook ha scritto:

 On Thu, Jul 13, 2006 at 03:21:02PM +0200, Alessandro Pellizzari wrote:
 
  It works pretty good until circa row 900, showing the cell at the top of
  the treeview, then it begins going wrong, showing cell 930 (or similar)
  at the top and not scrolling down, even for cell, e.g., 1200, which goes
  out of the visible area.
 
 Try doing the scroll_to_cell in an idle_add callback.

OK, it took me a while to understand (never used idle_add :)
Thank you for your help.

I tried:

 ...
if (self.magaddpath != 0):
  print self.magaddpath
  selection = self[tv_mag_list].get_selection()
  gobject.idle_add(self._scroll_to_cell, self.magaddpath)
  selection.select_path(self.magaddpath)
  self.on_tv_mag_list_selected()
  self.magaddpath=0

  def _scroll_to_cell(self, pos):
self[tv_mag_list].scroll_to_cell(pos)


This all is part of a class, hence self._scroll_to_cell inside
idle_add()
It works exactly as before, showing the row as last cell in the view

It seems that it makes his best to show it, but also tries to show
something else.

I've also read something about page_clamp() or similar, but it seems it
doesn't exist anymore for treeviews, only for adjustments.


Any other ideas?


-- 
Alessandro Pellizzari


___
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] Bug in TreeView.scroll_to_cell()

2006-07-14 Thread Alessandro Pellizzari
Il giorno ven, 14/07/2006 alle 14.33 +0200, Alessandro Pellizzari ha
scritto:

 I tried:
   def _scroll_to_cell(self, pos):
 self[tv_mag_list].scroll_to_cell(pos)

OK, I should read the manual better. :/

  self[tv_mag_list].scroll_to_cell(pos, None, True, 0.5, 0)

Solved the problem flawlessly.

Sorry... but thank you again for teaching me of idle_add()

Bye.

-- 
Alessandro Pellizzari


___
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] Combobox performance problems

2005-05-22 Thread Alessandro Pellizzari
Hi,

I am writing a software that needs a lot of ComboBoxes. I am using
python-gtk2 2.6.2 with gtk 2.6.7.

I have an entry window with 4 comboboxes. I must update the liststore
associated with those combos everytime I open the window, as the lists
can be modified in other parts of the program.

To achieve this, I call a function every time the window gets opened
that does

model.clear()
model.insert_before(blah blah)

It works well for the first 4-5 times I open the window, then it gets
slooow. After 15-20 times, it takes about 5 seconds (on a Centrino
1400) to show up the list of options when I click the ComboBox.

I think I will (temporarily) solve the problem destroying and recreating
the model everytime the window gets opened, but I wish to know if this
is a known bug or if there is a better way of doing this kind of
things.

Thanks. Bye.

-- 
Alessandro Pellizzari


___
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] intercept focus-out-event before other signals

2005-03-31 Thread Alessandro Pellizzari
Hi,

in a program I am writing there are a treeview and a textview. Selecting
a row in the tree allows you to modify the associated text.

I need to intercept any action the user may do when the textview loses
focus (tipically save the associated text), so I connected the
focus-out-event signal.

The problem is that the signal gets emitted AFTER any other signal.

By exmaple, if I select a new row in the treeview, first I get the
row-changed signal, and only after the focus-out-event.

This way the contents of the textview gets lost (replaced by that of the
new row) before I can save it.

Is there a way to modify the focus-out priority, or to use another
signal that gets emitted before anything else?

Many Thanks.
Bye.

-- 
Alessandro Pellizzari


___
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] TextView: signal when cursor changes position

2005-03-25 Thread Alessandro Pellizzari
Hi,

I need to know when the cursor inside a TextView changes position.
I tried to link to move_cursor signal, but if I move the cursor with a
mouse-click, the signal doesn't get emitted.

Is there a proper signal to link or must I catch both move_cursor and
button_released?

Thanks.

-- 
Alessandro Pellizzari


___
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] Resuing tabs?

2004-07-24 Thread Alessandro Pellizzari
On Fri, 23 Jul 2004 10:13:57 +1200, John C Barstow
[EMAIL PROTECTED] wrote:

 I have a project where, having done GLADE layout for a notebook, I
 need multiple instances of a certain tab. They will all be children of
 the same notebook.

I use something like this:

Create a notebook named nb_main in glade and add a single tab to it
with all the widgets you need. Call the container within
the tab tab_contents In every callback pass tab_contents as
widget. 

The structure shoul be something like

window
 +- notebook
 |   +- tab_contents
 |   |   +- widget1
 |   |   +- widget2
...

In prg.glade you should have something like

 child
   widget class=GtkEntry id=widget1
 ...
 signal name=changed handler=on_widget1_changed
object=tab_contents last_modification_time=Sat, 24 Apr 2004 09:12:57
GMT/
   /widget

When you need a new tab:

tablabel = gtk.Label(New tab)
tablist[maxtab+1]=libglade.XML(gladefile,tab_contents)
newtab = tablist[maxtab+1].get_widget(tab_contents)
gui.get_widget(nb_main).insert_page(tablabel, newtab)


As all the widgets will have the same name and handler of other tabs,
you must use tab_contents to know in which tab the signal was born:

for tab in tablist:
  if tab==passed_widget:
we are working on this tab


I simplified a lot and used meta-code, but I hope the concept is clear.
:)

Bye.
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Multithreading GUI + waiting for an Event

2003-05-30 Thread Alessandro Pellizzari
Hi,

I am writing a software and I would like to multithread it.

I've put the whole GUI into a class which inherits from
threading.Thread. This is the code:

class gui(threading.Thread):
def run(self):
 
self.gui = libglade.XML(gui.glade)
self.nameFuncMap = {}
for key in dir(self.__class__):
self.nameFuncMap[key] = getattr(self, key)

   
self.gui.signal_autoconnect(self.nameFuncMap)

   
gtk.threads_init()
gtk.main()

The problem is that I want to receive also events from the core part of
the program.
I know I can define a self._signal = threading.Event() into the
constructor or the run() method, but I don't know where to put the
self._signal.wait(), because gtk.main() monopolizes the thread.

Any idea?

Must I subdivide the GUI thread into 2 separate threads? And if so...
how? :)

Thanks! Bye.

-- 
Alessandro Pellizzari
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Changing expand/shrink at runtime

2003-01-29 Thread Alessandro Pellizzari
Hi,

I am writing a Python+Gtk2+Glade2 application. I placed a button that,
when pressed, hides some widgets.

But I created thos widgets with Y expand TRUE and now those containers
(now empty) keep on expanding vertically.

Is there a way to set Y expand to FALSE at runtime (and then back TRUE
when re-show()-n?)

Thanks.

-- 
Alessandro Pellizzari
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/