Hello again,

I'm still wondering if I don't quite 'get it' as to how Python does things. I have the following where 'sourceMessage' is a QLineEdit and 'mainTextWindow' is a QTextEdit:

def doUpdateSources(self):
       self.sourcesMessage.setEnabled(1)
       self.sourcesMessage.setText("Updating your sources, please wait...")
       os.chdir("/etc/apt/")
       self.mainTextWindow.setEnabled(1)
       self.mainTextWindow.setText(commands.getoutput("apt-get update"))
       self.mainTextWindow.append("Done!")
       self.mainTextWindow.scrollToBottom()
       self.pbSaveMain.setEnabled(0)
       self.mainTextWindow.setReadOnly(1)

This works but not as I expect it to work. I thought this would first display the the text in 'sourceMessage' before moving on line by line (changing directory, do the 'apt-get update' etc). But it seems like it's going through the entire function before actually output anything, the display everything when it reaches the end. So I guess I've fallen in the trap of old-time thinking again...

So what I want it to do is to display the 'please wait' in the sourceMessage *before* doing the 'commands.output', just as this little console script does:

       import commands
       def test():
           print "Please wait"
           print commands.getoutput("apt-get update")
           print "Done"

       test()


For the whole shebang (pun intended), should someone want to take a look, I have ziped up everything at:
http://www.bestemselv.com/admin_priv/tinaptpkg.tar.bz2

Thanks
Tina



_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to