fix problem with never ending gtk.main()
This commit is contained in:
parent
05764da2c6
commit
ddadec4a7e
1
AUTHORS
1
AUTHORS
|
@ -15,6 +15,7 @@ done by:
|
|||
Further patches have been submitted by:
|
||||
|
||||
William Sheehan <william-dot-sheehan-at-openinterface-dot-com>
|
||||
Karel Zak <kzak-at-redhat-dot-com>
|
||||
|
||||
<...send a patch & get your name here...>
|
||||
|
||||
|
|
|
@ -136,6 +136,11 @@ class vmmConsole(gobject.GObject):
|
|||
logging.error("Failure when disconnecting from VNC server")
|
||||
return 1
|
||||
|
||||
def is_visible(self):
|
||||
if self.window.get_widget("vmm-console").flags() & gtk.VISIBLE:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def control_vm_run(self, src):
|
||||
return 0
|
||||
|
||||
|
|
|
@ -309,6 +309,11 @@ class vmmCreate(gobject.GObject):
|
|||
self.topwin.hide()
|
||||
return 1
|
||||
|
||||
def is_visible(self):
|
||||
if self.topwin.flags() & gtk.VISIBLE:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def finish(self, ignore=None):
|
||||
# first things first, are we trying to create a fully virt guest?
|
||||
if self.get_config_method() == VM_FULLY_VIRT:
|
||||
|
|
|
@ -148,6 +148,11 @@ class vmmDetails(gobject.GObject):
|
|||
self.window.get_widget("vmm-details").hide()
|
||||
return 1
|
||||
|
||||
def is_visible(self):
|
||||
if self.window.get_widget("vmm-details").flags() & gtk.VISIBLE:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def hw_selected(self, src=None):
|
||||
vmlist = self.window.get_widget("hw-list")
|
||||
selection = vmlist.get_selection()
|
||||
|
|
|
@ -116,6 +116,9 @@ class vmmEngine:
|
|||
self.timer = gobject.timeout_add(interval, self.tick)
|
||||
|
||||
def tick(self):
|
||||
if self.windowConnect == None and gtk.main_level() > 0 and self.count_visible_windows() == 0:
|
||||
gtk.main_quit()
|
||||
|
||||
for uri in self.connections.keys():
|
||||
try:
|
||||
self.connections[uri]["connection"].tick()
|
||||
|
@ -125,6 +128,18 @@ class vmmEngine:
|
|||
logging.error(("Could not refresh connection %s" % (uri)) + str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1]))
|
||||
return 1
|
||||
|
||||
def count_visible_windows(self):
|
||||
ct = 0
|
||||
for conn in self.connections.values():
|
||||
for name in [ "windowDetails", "windowConsole", "windowSerialConsole" ]:
|
||||
for window in conn[name].values():
|
||||
ct += window.is_visible()
|
||||
if conn["windowManager"]:
|
||||
ct += conn["windowManager"].is_visible()
|
||||
if self.windowCreate:
|
||||
ct += self.windowCreate.is_visible()
|
||||
return ct
|
||||
|
||||
def change_timer_interval(self,ignore1,ignore2,ignore3,ignore4):
|
||||
gobject.source_remove(self.timer)
|
||||
self.schedule_timer()
|
||||
|
|
|
@ -153,6 +153,11 @@ class vmmManager(gobject.GObject):
|
|||
win.hide()
|
||||
return 1
|
||||
|
||||
def is_visible(self):
|
||||
if self.window.get_widget("vmm-manager").flags() & gtk.VISIBLE:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def exit_app(self, src=None, src2=None):
|
||||
gtk.main_quit()
|
||||
|
||||
|
|
|
@ -71,6 +71,11 @@ class vmmSerialConsole:
|
|||
self.window.hide()
|
||||
return True
|
||||
|
||||
def is_visible(self):
|
||||
if self.window.flags() & gtk.VISIBLE:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def opentty(self):
|
||||
if self.ptyio != None:
|
||||
self.closetty()
|
||||
|
|
Loading…
Reference in New Issue