/usr/lib/python3/dist-packages/pyvirtualdisplay/display.py is in python3-pyvirtualdisplay 0.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | from pyvirtualdisplay.abstractdisplay import AbstractDisplay
from pyvirtualdisplay.xephyr import XephyrDisplay
from pyvirtualdisplay.xvfb import XvfbDisplay
from pyvirtualdisplay.xvnc import XvncDisplay
class Display(AbstractDisplay):
'''
Common class
:param color_depth: [8, 16, 24, 32]
:param size: screen size (width,height)
:param bgcolor: background color ['black' or 'white']
:param visible: True -> Xephyr, False -> Xvfb
:param backend: 'xvfb', 'xvnc' or 'xephyr', ignores ``visible``
:param xauth: If a Xauthority file should be created.
'''
def __init__(self, backend=None, visible=False, size=(1024, 768), color_depth=24, bgcolor='black', use_xauth=False, **kwargs):
self.color_depth = color_depth
self.size = size
self.bgcolor = bgcolor
self.screen = 0
self.process = None
self.display = None
self.visible = visible
self.backend = backend
if not self.backend:
if self.visible:
self.backend = 'xephyr'
else:
self.backend = 'xvfb'
self._obj = self.display_class(
size=size,
color_depth=color_depth,
bgcolor=bgcolor,
**kwargs)
AbstractDisplay.__init__(self, use_xauth=use_xauth)
@property
def display_class(self):
assert self.backend
if self.backend == 'xvfb':
cls = XvfbDisplay
if self.backend == 'xvnc':
cls = XvncDisplay
if self.backend == 'xephyr':
cls = XephyrDisplay
# TODO: check only once
cls.check_installed()
return cls
@property
def _cmd(self):
self._obj.display = self.display
return self._obj._cmd
|