[PyQt] hidden signals?

Jochen Georges jochengeorges at yahoo.de
Mon Dec 24 08:16:17 GMT 2007


hello,

sorry for the tons of beginner-questions and thanks for your patience.

there is a strange behaviour of a pushbutton and do not see, why it is ...

there are two buttons and two lineedits.
if the first button is clicked, only the first lineedit should be "alive"
if the second button is clicked, the user should insert some data first in the 
first and then in the second lineedit.

the program seems to pass the first-lineedit's slot correctly, but after that 
it runs through the first-button-slot, i never told it to do so !!??

I remember Java to have lots of builtin FocusEvents, but I do not think that 
this is the problem here.

Can you give me a hint?
Thanks a lot

Merry Christmas
jochen

output:
"
btn2_Clicked
!Modus_firstButton
edit1_ReturnPressed, !Modus_firstButton
btn1.has NO Focus	#!!!!
btn1_Clicked		#??????????
Modus_firstButton
"

self.connect(self.btn1, SIGNAL("clicked()"), self.btn1_Clicked)
self.connect(self.btn2, SIGNAL("clicked()"), self.btn2_Clicked)
self.connect(self.edit1, SIGNAL("returnPressed()"), self.edit1_ReturnPressed)
self.connect(self.edit2, SIGNAL("returnPressed()"), self.edit2_ReturnPressed)

def btn1_Clicked(self):
    self.qtb_browser.append("btn1_Clicked")
    self.Modus_firstButton = True
    self.qtb_browser.append("Modus_firstButton")
    self.edit2.setDisabled(True)
    self.edit1.selectAll()
    self.edit1.setFocus()
def btn2_Clicked(self):
    self.qtb_browser.append("btn2_Clicked")
    self.Modus_firstButton = False
    self.qtb_browser.append("!Modus_firstButton")
    self.edit1.selectAll()
    self.edit1.setFocus()
def edit1_ReturnPressed(self):
    if self.Modus_firstButton:
        self.qtb_browser.append("edit1_ReturnPressed, Modus_firstButton")
    else:
        self.qtb_browser.append("edit1_ReturnPressed, !Modus_firstButton")
        self.edit2.setDisabled(False)
        self.edit2.selectAll()
        self.edit2.setFocus()
    if self.btn1.hasFocus():
        self.qtb_browser.append("btn1.hasFocus")
    else:
        self.qtb_browser.append("btn1.has NO Focus")
def edit2_ReturnPressed(self):
    self.qtb_browser.append("edit2_ReturnPressed")



More information about the PyQt mailing list