details: Improve UI labeling of keyboard devices

This commit is contained in:
Cole Robinson 2015-04-09 13:36:40 -04:00
parent 22b9932c47
commit 92c42bc5a0
4 changed files with 21 additions and 17 deletions

View File

@ -292,6 +292,7 @@
<!-- input devices -->
<input type='mouse' bus='ps2'/>
<input type='tablet' bus='usb'/>
<input type='keyboard' bus='usb'/>
<!-- Graphics devices -->

View File

@ -4532,7 +4532,7 @@ if you know what you are doing.&lt;/small&gt;</property>
<object class="GtkLabel" id="label407">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Virtual Pointer&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Virtual Input Device&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>

View File

@ -801,6 +801,16 @@ class vmmAddHardware(vmmGObjectUI):
model.append([None, _("Hypervisor default")])
uiutil.set_grid_row_visible(combo, False)
@staticmethod
def label_for_input_device(typ, bus):
if typ == "tablet" and bus == "usb":
return _("EvTouch USB Graphics Tablet")
if bus in ["usb", "ps2"]:
return _("Generic") + (" %s %s" %
(bus.upper(), str(typ).capitalize()))
return "%s %s" % (str(bus).capitalize(), str(typ).capitalize())
#########################
# UI population methods #
@ -825,9 +835,12 @@ class vmmAddHardware(vmmGObjectUI):
def populate_input_model(self, model):
model.clear()
model.append([_("EvTouch USB Graphics Tablet"), "tablet", "usb"])
model.append([_("Generic USB Mouse"), "mouse", "usb"])
model.append([_("Generic USB Keyboard"), "keyboard", "usb"])
def _add_row(typ, bus):
model.append([self.label_for_input_device(typ, bus), typ, bus])
_add_row("tablet", "usb")
_add_row("mouse", "usb")
_add_row("keyboard", "usb")
def populate_host_device_model(self, devtype, devcap, subtype, subcap):
devlist = self.widget("host-device")

View File

@ -265,6 +265,8 @@ def _icon_for_device(dev):
return "drive-harddisk"
if devtype == "input":
if dev.type == "keyboard":
return "input-keyboard"
if dev.type == "tablet":
return "input-tablet"
return "input-mouse"
@ -2785,19 +2787,7 @@ class vmmDetails(vmmGObjectUI):
if not inp:
return
ident = "%s:%s" % (inp.type, inp.bus)
if ident == "tablet:usb":
dev = _("EvTouch USB Graphics Tablet")
elif ident == "mouse:usb":
dev = _("Generic USB Mouse")
elif ident == "mouse:xen":
dev = _("Xen Mouse")
elif ident == "mouse:ps2":
dev = _("PS/2 Mouse")
elif ident == "keyboard:ps2":
dev = _("PS/2 Keyboard")
else:
dev = inp.bus + " " + inp.type
dev = vmmAddHardware.label_for_input_device(inp.type, inp.bus)
mode = None
if inp.type == "tablet":