Use VirtualGraphics during domain creation. Lookup default keymap during addhardware.
This commit is contained in:
parent
39915a3eb3
commit
3c68fb3424
|
@ -51,6 +51,8 @@ PAGE_INPUT = 3
|
|||
PAGE_GRAPHICS = 4
|
||||
PAGE_SUMMARY = 5
|
||||
|
||||
KEYBOARD_DIR = "/etc/sysconfig/keyboard"
|
||||
|
||||
class vmmAddHardware(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
"action-show-help": (gobject.SIGNAL_RUN_FIRST,
|
||||
|
@ -324,7 +326,24 @@ class vmmAddHardware(gobject.GObject):
|
|||
and self.window.get_widget("graphics-keymap").get_text() != "":
|
||||
return self.window.get_widget("graphics-keymap").get_text()
|
||||
else:
|
||||
return None
|
||||
# Set keymap to same as hosts
|
||||
import keytable
|
||||
keymap = None
|
||||
try:
|
||||
f = open(KEYBOARD_DIR, "r")
|
||||
except IOError, e:
|
||||
logging.debug('addhardware: Could not open "/etc/sysconfig/keyboard" ' + str(e))
|
||||
else:
|
||||
while 1:
|
||||
s = f.readline()
|
||||
if s == "":
|
||||
break
|
||||
if re.search("KEYTABLE", s) != None:
|
||||
kt = s.split('"')[1]
|
||||
if keytable.keytable.has_key(kt):
|
||||
keymap = keytable.keytable[kt]
|
||||
f.close
|
||||
return keymap
|
||||
|
||||
def get_config_network(self):
|
||||
if os.getuid() != 0:
|
||||
|
|
|
@ -574,7 +574,7 @@ class vmmCreate(gobject.GObject):
|
|||
else:
|
||||
logging.debug('No guest nics found in install phase.')
|
||||
|
||||
# set up the graphics to use SDL
|
||||
# Set vnc display to use same keymap as host
|
||||
import keytable
|
||||
keymap = None
|
||||
vncport = None
|
||||
|
@ -592,7 +592,14 @@ class vmmCreate(gobject.GObject):
|
|||
if keytable.keytable.has_key(kt):
|
||||
keymap = keytable.keytable[kt]
|
||||
f.close
|
||||
guest.graphics = (True, "vnc", vncport, keymap)
|
||||
try:
|
||||
guest._graphics_dev = virtinst.VirtualGraphics(type=virtinst.VirtualGraphics.TYPE_VNC,
|
||||
port=vncport,
|
||||
keymap=keymap)
|
||||
except Exception, e:
|
||||
self.err.show_err(_("Error setting up graphics device:") + str(e),
|
||||
"".join(traceback.format_exc()))
|
||||
return False
|
||||
|
||||
logging.debug("Creating a VM " + guest.name + \
|
||||
"\n Type: " + guest.type + \
|
||||
|
|
Loading…
Reference in New Issue