2013-03-18 01:06:52 +04:00
#
2013-10-28 00:59:46 +04:00
# Copyright 2009, 2013 Red Hat, Inc.
2013-03-18 01:06:52 +04:00
# Cole Robinson <crobinso@redhat.com>
#
2018-03-20 22:00:02 +03:00
# This work is licensed under the GNU GPLv2.
# See the COPYING file in the top-level directory.
2013-03-18 01:06:52 +04:00
2018-03-20 19:18:35 +03:00
from . device import Device
2018-03-20 19:27:37 +03:00
from . . xmlbuilder import XMLProperty
2013-03-18 01:06:52 +04:00
2013-04-13 22:34:52 +04:00
2018-03-20 19:18:35 +03:00
class DeviceVideo ( Device ) :
2018-03-21 01:59:14 +03:00
_XML_ROOT_NAME = " video "
2013-03-18 01:06:52 +04:00
# Default models list
MODEL_DEFAULT = " default "
2016-03-04 14:31:52 +03:00
MODELS = [ " cirrus " , " vga " , " vmvga " , " xen " , " qxl " , " virtio " ]
2013-03-18 01:06:52 +04:00
@staticmethod
def pretty_model ( model ) :
2013-07-15 19:07:40 +04:00
if model in [ " qxl " , " vmvga " , " vga " ] :
2013-03-18 01:06:52 +04:00
return model . upper ( )
return model . capitalize ( )
2014-12-01 17:56:29 +03:00
_XML_PROP_ORDER = [ " model " , " vram " , " heads " , " vgamem " ]
2013-09-19 21:27:30 +04:00
model = XMLProperty ( " ./model/@type " ,
2013-07-15 19:07:40 +04:00
default_cb = lambda s : " cirrus " ,
default_name = MODEL_DEFAULT )
2013-09-19 21:27:30 +04:00
vram = XMLProperty ( " ./model/@vram " , is_int = True )
2017-03-05 22:51:25 +03:00
vram64 = XMLProperty ( " ./model/@vram64 " , is_int = True )
2013-09-19 21:27:30 +04:00
ram = XMLProperty ( " ./model/@ram " , is_int = True )
heads = XMLProperty ( " ./model/@heads " , is_int = True )
2014-12-01 17:56:29 +03:00
vgamem = XMLProperty ( " ./model/@vgamem " , is_int = True )
2016-03-04 14:31:52 +03:00
accel3d = XMLProperty ( " ./model/acceleration/@accel3d " , is_yesno = True )