[pygtk] ComboBoxEntry not shown correctly after second call of the thread

2004-08-26 Thread Martin . Zohlhuber
Hello 

I run my (whole) gui in one thread. 
If i start the thread again (after i had it closed), the entry of the 
ComboBoxEntry will not shown (only the button to open the list - but the 
list is not visible). Same problem with the old Combo (nothing visible). 
Combobox (without Entry) works correct. 

I add a example below. Close the first window within 3 seconds and wait 
until second combo get visible. (If you do not close the first window 
within 3 Seconds, the second box does not  become visible  until you close 
the first (but then you will see it without failure)). 

What's wrong ? Is this a bug ? 

Thanks 
martin


I use: 
Win 2k
gtk.2.4
pygtk 2.3.96

---
import gtk
import sys
import threading
import time

class My_App (threading.Thread) :
def __init__ (self) :
threading.Thread.__init__ (self)

def cb (self, widget) :
gtk.main_quit ()

def run (self) :
gtk.threads_enter()
w = gtk.Window ()
w.connect(destroy, self.cb)
liststore = gtk.ListStore(str)
liststore.append ([text_a])
liststore.append ([text_b])
combobox = gtk.ComboBoxEntry(liststore, 0)
##  combobox = gtk.ComboBox(liststore) ## works
cell = gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.add_attribute(cell, 'text', 0)
c = combobox
w.add (c)
w.show_all ()
gtk.main ()
gtk.threads_leave()

def _test () :
thread = My_App ()
thread.start ()

def _duo_test () :
_test ()
time.sleep (3)
_test ()
 
if __name__ == __main__:
#_test ()
_duo_test ()
___
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] Is a bug in gtk.Menu - Motion/Enter/Leave_Notify Event ???

2004-03-04 Thread Martin . Zohlhuber
I want to make a menubar.deselect() when the mouse leave the application 
(i want avoid, that the popupmenu will still on top, if the user change 
into a other application). 

Problem: When the menu is popup i get only events from this menu. 
I can move the mousepointer around the toplevel window but i get the 
motion event from the menu. When i leave the toplevel window, i get a 
leave event from the menu. 

I think its wrong (bug), because leave the toplevelwindow i shout get the 
event from the window, not from the menu. 

The leave and enter event of the menu also occur, when i move the mouse in 
the popup menu and the menuitem change. I think this is not a very good 
implementation,  because the menu-widget was not leaved. 

For better understanding a add a small program. 

Have i make something wrong ? 
Is this a bug  ?  (use w2k, pygtk 2.0, gtk 2.2.4)
If it is correct - Why (and how can i  solve my problem) ?
Have somebody other the same failure ?

Thanks for any help !

martin

---
import gtk

def _cb_win_leave(widget, event, data=None):
print window leave, widget
def _cb_win_enter(widget, event, data=None):
print window enter, widget
def _cb_win_motion(widget, event, data=None):
print window motion, widget
def _cb_menu_leave(widget, event, data=None):
print _menu_ leave, widget
def _cb_menu_enter(widget, event, data=None):
print _menu_ enter, widget
def _cb_menu_motion(widget, event, data=None):
print _menu_ motion, widget


window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.show()
window.set_default_size(210, 300)
window.add_events(gtk.gdk.LEAVE_NOTIFY|gtk.gdk.ENTER_NOTIFY|gtk.gdk.MOTION_NOTIFY)
window.connect(leave_notify_event, _cb_win_leave)
window.connect(enter_notify_event, _cb_win_enter)
window.connect(motion_notify_event, _cb_win_motion)

menu_items = ( # menupath, accel, callback, callbackaction, itemtype, 
stock
 ( /File,  None,  None , 0, Branch ),
 ( /File/Open, None,  None , 1, None),
 ( /Edit,  None,  None , 0, Branch ),
 ( /Edit/Undo, None,  None , 1, None),
 ( /Edit/Cut, None,  None , 1, None),
 ( /Edit/Paste, None,  None , 1, None),
 ( /Edit/Copy, None,  None , 1, None)
 )

accel_group = gtk.AccelGroup()
item_factory = gtk.ItemFactory(gtk.MenuBar, main, accel_group)
item_factory.create_items(menu_items)
menubar = item_factory.get_widget(main)
menubar.show()
item = item_factory.get_widget(/Edit) 
item.add_events(gtk.gdk.LEAVE_NOTIFY|gtk.gdk.ENTER_NOTIFY|gtk.gdk.MOTION_NOTIFY)
item.connect(leave_notify_event, _cb_menu_leave)
item.connect(enter_notify_event, _cb_menu_enter)
item.connect(motion_notify_event, _cb_menu_motion)

item = item_factory.get_widget(/File) 
item.add_events(gtk.gdk.LEAVE_NOTIFY|gtk.gdk.ENTER_NOTIFY|gtk.gdk.MOTION_NOTIFY)
item.connect(leave_notify_event, _cb_menu_leave)
item.connect(enter_notify_event, _cb_menu_enter)
item.connect(motion_notify_event, _cb_menu_motion)

box = gtk.VBox()
box.show()
box.pack_start(menubar, gtk.FALSE, gtk.FALSE)
b = gtk.Button(Fill rest of the area)
b.connect(clicked, gtk.mainquit)
b.show()
box.pack_start(b)
window.add(box)
gtk.main()

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


Re: [pygtk] key_release_event of the mod1 (alt) key does not work

2004-02-27 Thread Martin . Zohlhuber
I test again with your code and found out, in combination with another key 
like a accelerator/shortcut (e.g.ALT+Q) i get a release event from both 
keys (113, 65513), but from ALT alone i get no callback. 

martin
--
import gtk

def foo(widget, event):
print widget
print event.keyval

w = gtk.Window()
w.add_events(gtk.gdk.KEY_RELEASE_MASK)
w.connect(key-release-event, foo)
w.show_all()

gtk.mainloop()




Christian Robottom Reis [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
27.02.2004 10:03

To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [pygtk] key_release_event of the mod1 (alt)  key does not work






On Wed, Feb 25, 2004 at 04:39:37PM +0100, [EMAIL PROTECTED] 
wrote:
 I want select first item of the menubar, if Alt (in gtk named mod1; i 
do 
 not mean Alt Gr) released. I connect the key-release-event and it  work 
 for all other keys, but not for Mod1. For Mod1 i get only the keypressed 

 event. 

That's odd. I can't reproduce your problem here locally with the
following testcase:

import gtk, GDK

def foo(*args):
print args

w = gtk.GtkWindow()
w.add_events(GDK.KEY_RELEASE_MASK)
w.connect(key-release-event, foo)
w.show_all()

gtk.mainloop()

(which, yes, is based on PyGTK 0.6). If you're doing the pygtk2
equivalent, ISTM this is a bug, and if so, it's probably in the GTK+
port of Win32. Can anybody with pygtk2 check if this works for them?

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
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 mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] key_release_event of the mod1 (alt) key does not work

2004-02-25 Thread Martin . Zohlhuber
Hello 
I want select first item of the menubar, if Alt (in gtk named mod1; i do 
not mean Alt Gr) released. I connect the key-release-event and it  work 
for all other keys, but not for Mod1. For Mod1 i get only the keypressed 
event. 

Maybe helpfull information: 
I am a Windows 2k user with german windows keyboard. 
Python 2.3.0
GTK 2.2.4
PyGTK 2.0


martin


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