#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    12
    Rep Power
    0

    printing lines in order


    i have been trying to run a small PyQt script that will check certain files. i want to update the status bar on the Qt gui and then call the Verify() function from another class.

    however, with the code below, it is running through the Verify() function and then updating the staus bar.

    is there some way i can make sure that the message is printed before running the Verify() function?

    def runVerifier(self):
    #run the verifier script
    w.statusBar().message( "Running Verifier...", 2000 )
    verifier.Verify()
    self.refreshLog()
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    London, ON, Canada, eh
    Posts
    127
    Rep Power
    12
    Originally Posted by mattcronin57
    i have been trying to run a small PyQt script that will check certain files. i want to update the status bar on the Qt gui and then call the Verify() function from another class.

    however, with the code below, it is running through the Verify() function and then updating the staus bar.

    is there some way i can make sure that the message is printed before running the Verify() function?

    def runVerifier(self):
    #run the verifier script
    w.statusBar().message( "Running Verifier...", 2000 )
    verifier.Verify()
    self.refreshLog()
    Umm...update() in between w.statusBar... and verifier?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    12
    Rep Power
    0

    same problem, differnet scenario


    using update() didn't work, thanks anyway

    i have found another piece of code which is doing the same thing with the line order:

    logFile.write("\012(" + self.time + ") Starting script...\012")

    #write any changes to the log file
    self.checkFileChanges()

    the script always goes through and prints the output of checkFileChanges() to the log file before it prints the line about starting the script.

    i can't figure out why this would happen at all. is this a defect in the language or am i missing something really simple?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    12
    Rep Power
    0
    I have found a solution to the problem described in my previous post, although i don't htink it is the way thiat it should be done properly. the way i have got around python not printing the lines i want in the order i want, i have had to open and close the fog file for each line i want to write:


    logFile = open('/path/to/log_file', "a")
    logFile.write("\012(" + self.time + ") Starting script...\012")
    logFile.close()

    #write any changes to the log file
    self.checkFileChanges()

    there must be a better than opening and closing the same file for possibly thousands of times in the same script, but i haven't figured it out yet

    this also doesn't solve my first problem

IMN logo majestic logo threadwatch logo seochat tools logo