mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-12 09:18:00 +03:00
manager: Opening VM shouldn't always show 'console'
Like when the window is just minimized, it should simply raise the window. Rename signals to be more accurate and remove some of cruft.
This commit is contained in:
parent
064337ecf3
commit
d92f362de8
@ -1648,16 +1648,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
self.close()
|
||||
|
||||
# Launch details dialog for new VM
|
||||
vm = self.conn.get_vm(guest.uuid)
|
||||
gtype = vm.get_graphics_console()[0]
|
||||
if gtype in self.config.embeddable_graphics():
|
||||
self.emit("action-show-console", self.conn.get_uri(),
|
||||
guest.uuid)
|
||||
elif vm.get_connection().is_remote():
|
||||
self.emit("action-show-terminal", self.conn.get_uri(),
|
||||
guest.uuid)
|
||||
|
||||
|
||||
self.emit("action-show-vm", self.conn.get_uri(), guest.uuid)
|
||||
|
||||
def do_install(self, asyncjob, guest):
|
||||
meter = vmmCreateMeter(asyncjob)
|
||||
@ -1869,6 +1860,5 @@ class vmmCreate(vmmGObjectUI):
|
||||
return self.err.val_err(msg, extra)
|
||||
|
||||
vmmGObjectUI.type_register(vmmCreate)
|
||||
vmmCreate.signal_new(vmmCreate, "action-show-console", [str, str])
|
||||
vmmCreate.signal_new(vmmCreate, "action-show-terminal", [str, str])
|
||||
vmmCreate.signal_new(vmmCreate, "action-show-vm", [str, str])
|
||||
vmmCreate.signal_new(vmmCreate, "action-show-help", [str])
|
||||
|
@ -300,7 +300,6 @@ class vmmDetails(vmmGObjectUI):
|
||||
"on_details_menu_clone_activate": self.control_vm_clone,
|
||||
"on_details_menu_migrate_activate": self.control_vm_migrate,
|
||||
"on_details_menu_screenshot_activate": self.control_vm_screenshot,
|
||||
"on_details_menu_graphics_activate": self.control_vm_console,
|
||||
"on_details_menu_view_toolbar_activate": self.toggle_toolbar,
|
||||
"on_details_menu_view_manager_activate": self.view_manager,
|
||||
"on_details_menu_view_details_toggled": self.details_console_changed,
|
||||
@ -1188,7 +1187,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
def exit_app(self, src_ignore):
|
||||
self.emit("action-exit-app")
|
||||
|
||||
def activate_console_page(self):
|
||||
def activate_default_page(self):
|
||||
pages = self.window.get_widget("details-pages")
|
||||
pages.set_current_page(PAGE_CONSOLE)
|
||||
|
||||
@ -1204,6 +1203,9 @@ class vmmDetails(vmmGObjectUI):
|
||||
self._show_serial_tab(name, serialidx)
|
||||
break
|
||||
|
||||
def activate_console_page(self):
|
||||
pages = self.window.get_widget("details-pages")
|
||||
pages.set_current_page(PAGE_CONSOLE)
|
||||
|
||||
def activate_performance_page(self):
|
||||
self.window.get_widget("details-pages").set_current_page(PAGE_DETAILS)
|
||||
@ -1268,10 +1270,6 @@ class vmmDetails(vmmGObjectUI):
|
||||
self.emit("action-reboot-domain",
|
||||
self.vm.get_connection().get_uri(), self.vm.get_uuid())
|
||||
|
||||
def control_vm_console(self, src_ignore):
|
||||
self.emit("action-show-console",
|
||||
self.vm.get_connection().get_uri(), self.vm.get_uuid())
|
||||
|
||||
def control_vm_save(self, src_ignore):
|
||||
self.emit("action-save-domain",
|
||||
self.vm.get_connection().get_uri(), self.vm.get_uuid())
|
||||
@ -3036,7 +3034,6 @@ class vmmDetails(vmmGObjectUI):
|
||||
|
||||
|
||||
vmmGObjectUI.type_register(vmmDetails)
|
||||
vmmDetails.signal_new(vmmDetails, "action-show-console", [str, str])
|
||||
vmmDetails.signal_new(vmmDetails, "action-save-domain", [str, str])
|
||||
vmmDetails.signal_new(vmmDetails, "action-destroy-domain", [str, str])
|
||||
vmmDetails.signal_new(vmmDetails, "action-suspend-domain", [str, str])
|
||||
|
@ -64,6 +64,10 @@ def default_uri():
|
||||
|
||||
return tryuri
|
||||
|
||||
DETAILS_PERF = 1
|
||||
DETAILS_CONFIG = 2
|
||||
DETAILS_CONSOLE = 3
|
||||
|
||||
#############################
|
||||
# PackageKit lookup helpers #
|
||||
#############################
|
||||
@ -261,8 +265,7 @@ class vmmEngine(vmmGObject):
|
||||
self.systray.connect("action-shutdown-domain", self._do_shutdown_domain)
|
||||
self.systray.connect("action-reboot-domain", self._do_reboot_domain)
|
||||
self.systray.connect("action-destroy-domain", self._do_destroy_domain)
|
||||
self.systray.connect("action-show-console", self._do_show_console)
|
||||
self.systray.connect("action-show-details", self._do_show_details)
|
||||
self.systray.connect("action-show-vm", self._do_show_vm)
|
||||
self.systray.connect("action-exit-app", self.exit_app)
|
||||
|
||||
def system_tray_changed(self, *ignore):
|
||||
@ -698,22 +701,29 @@ class vmmEngine(vmmGObject):
|
||||
obj.connect("details-closed", self.decrement_window_counter)
|
||||
|
||||
self.connections[uri]["windowDetails"][uuid] = obj
|
||||
self.connections[uri]["windowDetails"][uuid].show()
|
||||
return self.connections[uri]["windowDetails"][uuid]
|
||||
|
||||
def _do_show_details(self, src, uri, uuid):
|
||||
def _show_vm_helper(self, src, uri, uuid, page=None, forcepage=False):
|
||||
try:
|
||||
details = self._get_details_dialog(uri, uuid)
|
||||
|
||||
if forcepage or not details.is_visible():
|
||||
if page == DETAILS_PERF:
|
||||
details.activate_performance_page()
|
||||
elif page == DETAILS_CONFIG:
|
||||
details.activate_config_page()
|
||||
elif page == DETAILS_CONSOLE:
|
||||
details.activate_console_page()
|
||||
elif page is None:
|
||||
details.activate_default_page()
|
||||
|
||||
details.show()
|
||||
return details
|
||||
except Exception, e:
|
||||
src.err.show_err(_("Error launching details: %s") % str(e))
|
||||
|
||||
def _do_show_console(self, src, uri, uuid):
|
||||
win = self._do_show_details(src, uri, uuid)
|
||||
if not win:
|
||||
return
|
||||
win.activate_console_page()
|
||||
def _do_show_vm(self, src, uri, uuid):
|
||||
self._show_vm_helper(src, uri, uuid)
|
||||
|
||||
def get_manager(self):
|
||||
if self.windowManager:
|
||||
@ -729,8 +739,7 @@ class vmmEngine(vmmGObject):
|
||||
obj.connect("action-save-domain", self._do_save_domain)
|
||||
obj.connect("action-migrate-domain", self._do_show_migrate)
|
||||
obj.connect("action-clone-domain", self._do_show_clone)
|
||||
obj.connect("action-show-console", self._do_show_console)
|
||||
obj.connect("action-show-details", self._do_show_details)
|
||||
obj.connect("action-show-vm", self._do_show_vm)
|
||||
obj.connect("action-show-preferences", self._do_show_preferences)
|
||||
obj.connect("action-show-create", self._do_show_create)
|
||||
obj.connect("action-show-help", self._do_show_help)
|
||||
@ -766,7 +775,7 @@ class vmmEngine(vmmGObject):
|
||||
return self.windowCreate
|
||||
|
||||
obj = vmmCreate(self)
|
||||
obj.connect("action-show-console", self._do_show_console)
|
||||
obj.connect("action-show-vm", self._do_show_vm)
|
||||
obj.connect("action-show-help", self._do_show_help)
|
||||
self.windowCreate = obj
|
||||
return self.windowCreate
|
||||
@ -824,22 +833,16 @@ class vmmEngine(vmmGObject):
|
||||
self._do_show_create(self.get_manager(), uri)
|
||||
|
||||
def show_domain_console(self, uri, uuid):
|
||||
win = self._do_show_details(self.get_manager(), uri, uuid)
|
||||
if not win:
|
||||
return
|
||||
win.activate_console_page()
|
||||
self._show_vm_helper(self.get_manager(), uri, uuid,
|
||||
page=DETAILS_CONSOLE, forcepage=True)
|
||||
|
||||
def show_domain_editor(self, uri, uuid):
|
||||
win = self._do_show_details(self.get_manager(), uri, uuid)
|
||||
if not win:
|
||||
return
|
||||
win.activate_config_page()
|
||||
self._show_vm_helper(self.get_manager(), uri, uuid,
|
||||
page=DETAILS_CONFIG, forcepage=True)
|
||||
|
||||
def show_domain_performance(self, uri, uuid):
|
||||
win = self._do_show_details(self.get_manager(), uri, uuid)
|
||||
if not win:
|
||||
return
|
||||
win.activate_performance_page()
|
||||
self._show_vm_helper(self.get_manager(), uri, uuid,
|
||||
page=DETAILS_PERF, forcepage=True)
|
||||
|
||||
#######################################
|
||||
# Domain actions run/destroy/save ... #
|
||||
|
@ -109,16 +109,16 @@ class vmmManager(vmmGObjectUI):
|
||||
"on_menu_file_quit_activate": self.exit_app,
|
||||
"on_menu_file_close_activate": self.close,
|
||||
"on_vmm_close_clicked": self.close,
|
||||
"on_vm_open_clicked": self.open_vm_console,
|
||||
"on_vm_open_clicked": self.show_vm,
|
||||
"on_vm_run_clicked": self.start_vm,
|
||||
"on_vm_new_clicked": self.new_vm,
|
||||
"on_vm_shutdown_clicked": self.poweroff_vm,
|
||||
"on_vm_pause_clicked": self.pause_vm_button,
|
||||
"on_menu_edit_details_activate": self.open_vm_console,
|
||||
"on_menu_edit_details_activate": self.show_vm,
|
||||
"on_menu_edit_delete_activate": self.do_delete,
|
||||
"on_menu_host_details_activate": self.show_host,
|
||||
|
||||
"on_vm_list_row_activated": self.open_vm_console,
|
||||
"on_vm_list_row_activated": self.show_vm,
|
||||
"on_vm_list_button_press_event": self.popup_vm_menu_button,
|
||||
"on_vm_list_key_press_event": self.popup_vm_menu_key,
|
||||
|
||||
@ -333,7 +333,7 @@ class vmmManager(vmmGObjectUI):
|
||||
add_vm_menu("delete", _("_Delete"), delete_icon, self.do_delete)
|
||||
|
||||
add_sep(self.vmmenu, self.vmmenu_items, "hsep2")
|
||||
add_vm_menu("open", gtk.STOCK_OPEN, None, self.open_vm_console)
|
||||
add_vm_menu("open", gtk.STOCK_OPEN, None, self.show_vm)
|
||||
self.vmmenu.show()
|
||||
|
||||
# Build connection context menu
|
||||
@ -522,30 +522,23 @@ class vmmManager(vmmGObjectUI):
|
||||
uri = self.current_connection_uri(default_selection=True)
|
||||
self.emit("action-show-host", uri)
|
||||
|
||||
def open_vm_console(self, ignore, ignore2=None, ignore3=None):
|
||||
if self.current_vmuuid():
|
||||
self.emit("action-show-console",
|
||||
self.current_connection_uri(), self.current_vmuuid())
|
||||
elif self.current_connection():
|
||||
def show_vm(self, ignore, ignore2=None, ignore3=None):
|
||||
conn = self.current_connection()
|
||||
vm = self.current_vm()
|
||||
if conn is None:
|
||||
return
|
||||
|
||||
if vm:
|
||||
self.emit("action-show-vm", conn.get_uri(), vm.get_uuid())
|
||||
else:
|
||||
if not self.open_connection():
|
||||
self.emit("action-show-host", self.current_connection_uri())
|
||||
self.emit("action-show-host", conn.get_uri())
|
||||
|
||||
def open_clone_window(self, ignore1=None, ignore2=None, ignore3=None):
|
||||
if self.current_vmuuid():
|
||||
self.emit("action-clone-domain", self.current_connection_uri(),
|
||||
self.current_vmuuid())
|
||||
|
||||
def show_vm_details(self, ignore):
|
||||
conn = self.current_connection()
|
||||
if conn is None:
|
||||
return
|
||||
vm = self.current_vm()
|
||||
if vm is None:
|
||||
self.emit("action-show-host", conn.get_uri())
|
||||
else:
|
||||
self.emit("action-show-console",
|
||||
conn.get_uri(), vm.get_uuid())
|
||||
|
||||
def do_delete(self, ignore=None):
|
||||
conn = self.current_connection()
|
||||
vm = self.current_vm()
|
||||
@ -1107,10 +1100,7 @@ class vmmManager(vmmGObjectUI):
|
||||
|
||||
vmmGObjectUI.type_register(vmmManager)
|
||||
vmmManager.signal_new(vmmManager, "action-show-connect", [])
|
||||
vmmManager.signal_new(vmmManager, "action-show-console", [str, str])
|
||||
vmmManager.signal_new(vmmManager, "action-show-terminal", [str, str])
|
||||
vmmManager.signal_new(vmmManager, "action-refresh-terminal", [str, str])
|
||||
vmmManager.signal_new(vmmManager, "action-show-details", [str, str])
|
||||
vmmManager.signal_new(vmmManager, "action-show-vm", [str, str])
|
||||
vmmManager.signal_new(vmmManager, "action-show-about", [])
|
||||
vmmManager.signal_new(vmmManager, "action-show-host", [str])
|
||||
vmmManager.signal_new(vmmManager, "action-show-preferences", [])
|
||||
|
@ -213,7 +213,7 @@ class vmmSystray(vmmGObject):
|
||||
open_item = gtk.ImageMenuItem("gtk-open")
|
||||
open_item.show()
|
||||
open_item.connect("activate", self.run_vm_action,
|
||||
"action-show-console", vm.get_uuid())
|
||||
"action-show-vm", vm.get_uuid())
|
||||
|
||||
vm_action_dict = {}
|
||||
vm_action_dict["run"] = run_item
|
||||
@ -438,6 +438,5 @@ vmmSystray.signal_new(vmmSystray, "action-shutdown-domain", [str, str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-reboot-domain", [str, str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-destroy-domain", [str, str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-show-host", [str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-show-details", [str, str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-show-console", [str, str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-show-vm", [str, str])
|
||||
vmmSystray.signal_new(vmmSystray, "action-exit-app", [])
|
||||
|
Loading…
Reference in New Issue
Block a user