Text not showing up

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Simone

    #1

    Text not showing up

    Hi all, I am new to python and trying to write a simple GUI that would
    call 2 growisofs processes (dvd burning) at the same time, and retrive
    the exit code to be printed on a text box (couldn't find any program
    that could use multiple dvd burners, not even k3b). Excuse me if this is
    really a simple problem, but two days of googling didn't help.
    The program is really simple, I developed the GUI using glade and it
    works.
    The only thing I would like to improve is that I'd like it to show in
    the text boxes messages like "Waiting for use input" or "Burning dvd
    please wait", but it looks like even though I don't have any error, the
    message won't show up until the burning process is finished (showing
    either "burning successfully" or "an error occurred").
    I am not sure I made myself clear on this, but I will post the relevant
    code trying to explain it:

    import os, sys
    import gtk.glade

    class DVD:


    def __init__(self):
    print "Initializi ng the Graphic User Interface: This may take
    some time"
    self.xml=gtk.gl ade.XML("./dvd2.xml")
    self.window=sel f.xml.get_widge t("dvd")
    self.xml.signal _connect('on_qu it_clicked', self.Quit)
    self.xml.signal _connect('on_bu rn_clicked', self.Burn)

    self.OrdKeys=["comboentry1"," entry1","spinbu tton1","entry2" ,"esitotext","e sitotext1"]
    # here esitotext is the box I want the text to show up



    def Quit(self, *args):
    gtk.mainquit()

    def Burn(self, *args):

    comand=""
    comand2=""

    name=self.xml.g et_widget("entr y1").get_text () #name
    for the dvd
    path=self.xml.g et_widget("comb oentry1").get_t ext() #path to
    dvd AUDIO_TS and VIDEO_TS
    num=self.xml.ge t_widget("spinb utton1").get_te xt() #chosing
    the number of dvd to burn
    pub=self.xml.ge t_widget("entry 2").get_text ()
    #publisher
    self.xml.get_wi dget("esitotext ").set_text("Wa iting for
    input") # THIS NEVER SHOWS UP


    dvd1="/dev/hda" # this is the first dvd
    burner, edit as needed
    dvd2="/dev/hdc" # this is the second dvd
    burner, edit as needed



    comand+="growis ofs -dvd-compat -Z "+dvd1+" -dvd-video -V
    "+name+" -publisher "+pub+" "+path
    comand2+="growi sofs -dvd-compat -Z "+dvd2+" -dvd-video -V
    "+name+" -publisher "+pub+" "+path


    if num == "1":
    self.xml.get_wi dget("esitotext ").set_text("Bu rning the dvd,
    please wait") # THIS NEVER SHOWS UP, unless i have an error and
    the program

    # quits
    before executing the command
    self.xml.get_wi dget("esitotext ").show()
    # don't know if this is correct,
    but it doesn't work either
    f = os.popen(comand , 'r')
    line = f.readline()

    error_in_prog = f.close()
    if error_in_prog:
    error=str(error _in_prog)
    self.xml.get_wi dget("esitotext ").set_text ("An error
    occurred. Burn not completed") # THIS COMES UP as it should
    self.xml.get_wi dget("esitotext ").show()
    else:
    self.xml.get_wi dget("esitotext ").set_text("Bu rn
    completed successfully") # THIS COMES UP as it should
    self.xml.get_wi dget("esitotext ").show()


    if __name__=='__ma in__':
    main=DVD()
    gtk.main()


    Any comment, help, url, really appreciated.

    Have a nice day
    Simone



Working...