Starting a GUI application out of an console application

Discussion in 'Python' started by Fabian Steiner, Jul 17, 2006.

  1. Hello!

    I am currently working on an alternative for the gnome-volume-manager
    for multiseat systems based on HAL and DBus. Whenever the signal
    'DeviceAdded' is received I would like to start a GUI-Interface where
    the user can choose from different options. But now I am wondering how I
    should start this interface since this GUI must be started by a console
    daemon. What is the most common way to do that?

    Usually, I start a PyQt application that way:

    app = QApplication(sys.argv)
    ui = Dialog()
    app.setMainWidget(ui)
    ui.show()
    app.exec_loop()

    If I start it that way, I am not quite sure whether this will work since
    I have got two main loops then (the one of console daemon [implemented
    by using gobject.MainLoop().run()] and the Qt one). Moreover, once the
    Qt application is started, it should run independently of the console
    daemon.

    Unfortunately, I can't think of any possibility to achieve this aim. Do
    you have any suggestions?
    Fabian Steiner, Jul 17, 2006
    #1
    1. Advertising

  2. Fabian Steiner

    faulkner Guest

    put your gui application in another script and start it the same way
    you'd start any other application whose exit status you didn't need:
    os.popen* or subprocess.Popen.
    or, use the threading module to give your qt application another
    thread.


    Fabian Steiner wrote:
    > Hello!
    >
    > I am currently working on an alternative for the gnome-volume-manager
    > for multiseat systems based on HAL and DBus. Whenever the signal
    > 'DeviceAdded' is received I would like to start a GUI-Interface where
    > the user can choose from different options. But now I am wondering how I
    > should start this interface since this GUI must be started by a console
    > daemon. What is the most common way to do that?
    >
    > Usually, I start a PyQt application that way:
    >
    > app = QApplication(sys.argv)
    > ui = Dialog()
    > app.setMainWidget(ui)
    > ui.show()
    > app.exec_loop()
    >
    > If I start it that way, I am not quite sure whether this will work since
    > I have got two main loops then (the one of console daemon [implemented
    > by using gobject.MainLoop().run()] and the Qt one). Moreover, once the
    > Qt application is started, it should run independently of the console
    > daemon.
    >
    > Unfortunately, I can't think of any possibility to achieve this aim. Do
    > you have any suggestions?
    faulkner, Jul 17, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Finney
    Replies:
    2
    Views:
    974
    Egor Bolonev
    Jun 30, 2003
  2. Egor Bolonev
    Replies:
    0
    Views:
    464
    Egor Bolonev
    Jun 30, 2003
  3. Serge Terekhoff
    Replies:
    0
    Views:
    630
    Serge Terekhoff
    Jun 30, 2003
  4. alexrait1
    Replies:
    5
    Views:
    287
    Grant Edwards
    Feb 3, 2005
  5. Siggi
    Replies:
    4
    Views:
    279
    siggi
    Jan 22, 2007
Loading...

Share This Page