Example #1
0
    def stop(self):
        '''
        stop display

        :rtype: self
        '''
        self.redirect_display(False)
        EasyProcess.stop(self)
        if self.use_xauth:
            self._clear_xauth()
        return self
Example #2
0
 def __init__(self, use_xauth=False):
     mutex.acquire()
     try:
         self.display = self.search_for_display()
         while self.display in USED_DISPLAY_NR_LIST:
             self.display += 1
         USED_DISPLAY_NR_LIST.append(self.display)
     finally:
         mutex.release()
     if xauth and not xauth.is_installed():
         raise xauth.NotFoundError()
     self.use_xauth = use_xauth
     self._old_xauth = None
     self._xauth_filename = None
     EasyProcess.__init__(self, self._cmd)
Example #3
0
    def start(self):
        '''
        start display

        :rtype: self
        '''
        if self.use_xauth:
            self._setup_xauth()
        EasyProcess.start(self)

        # https://github.com/ponty/PyVirtualDisplay/issues/2
        # https://github.com/ponty/PyVirtualDisplay/issues/14
        self.old_display_var = os.environ.get('DISPLAY', None)

        self.redirect_display(True)
        # wait until X server is active
        # TODO: better method
        time.sleep(0.1)
        return self
Example #4
0
def is_installed():
    '''
    Return whether or not xauth is installed.
    '''
    try:
        p = EasyProcess(['xauth', '-V'])
        p.enable_stdout_log = False
        p.enable_stderr_log = False
        p.call()
    except Exception:
        return False
    else:
        return True
Example #5
0
def is_installed():
    """
    Return whether or not xauth is installed.
    """
    try:
        p = EasyProcess(["xauth", "-V"])
        p.enable_stdout_log = False
        p.enable_stderr_log = False
        p.call()
    except Exception:
        return False
    else:
        return True
Example #6
0
 def check_installed(cls):
     p = EasyProcess([PROGRAM, '-help'])
     p.enable_stdout_log = False
     p.enable_stderr_log = False
     p.call()
Example #7
0
def call(*args):
    '''
    Call xauth with the given args.
    '''
    EasyProcess(['xauth'] + list(args)).call()
Example #8
0
 def check_installed(cls):
     EasyProcess([PROGRAM, '-help'], url=URL,
                 ubuntu_package=PACKAGE).check_installed()
Example #9
0
def call(*args):
    """
    Call xauth with the given args.
    """
    EasyProcess(["xauth"] + list(args)).call()