vendredi 4 septembre 2015

How to test if GTK+ dialog has been created?

I've used Wnck to check whether a window has been created like this:

    screen = Wnck.Screen.get_default()
    screen.force_update()  # recommended per Wnck documentation
    window_list = screen.get_windows()

    for window in window_list:
        print(window.get_name())
        if window.has_name():
            if window.get_name() == self.xld_main_window.get_title():
                window_found = True
                break
    assert window_found, 'The Gtk.Window named {window_name} has not been found.'\
        .format(window_name=self.xld_main_window.get_title())

    # clean up Wnck (saves resources, check documentation)
    window = None
    screen = None

However, since dialogs don't show up in the list of tasks, I can't find them that way. What is an appropriate way of checking whether they're displayer or not?

Aucun commentaire:

Enregistrer un commentaire