Exemplo n.º 1
0
    def cleanup(self, fs2_bin, old_path=None):
        if self._key_layout is not None:
            util.call(["setxkbmap", "-layout", self._key_layout])

        if sys.platform.startswith("win") and old_path is not None:
            # Cleanup
            retries = 3

            while retries > 0:
                try:
                    os.unlink(fs2_bin)
                except:
                    logging.exception('Failed to delete FSO file "%s"!', fs2_bin)

                if os.path.isfile(fs2_bin):
                    time.sleep(1)
                    retries -= 1
                else:
                    break
Exemplo n.º 2
0
    def cleanup(self, fs2_bin, old_path=None):
        if self._key_layout is not None:
            util.call(['setxkbmap', '-layout', self._key_layout])

        if sys.platform.startswith('win') and old_path is not None:
            # Cleanup
            retries = 3

            while retries > 0:
                try:
                    os.unlink(fs2_bin)
                except:
                    logging.exception('Failed to delete FSO file "%s"!',
                                      fs2_bin)

                if os.path.isfile(fs2_bin):
                    time.sleep(1)
                    retries -= 1
                else:
                    break
Exemplo n.º 3
0
def run_fs2_silent(params):
    fs2_path = center.settings['fs2_path']
    fs2_bin = os.path.join(fs2_path, center.settings['fs2_bin'])

    if not os.path.isfile(fs2_bin):
        return -128

    mode = os.stat(fs2_bin).st_mode
    if mode & stat.S_IXUSR != stat.S_IXUSR:
        # Make it executable.
        os.chmod(fs2_bin, mode | stat.S_IXUSR)

    env = {}
    if sys.platform.startswith('linux'):
        ld_path, missing = fix_missing_libs(fs2_bin)
        if len(missing) > 0:
            return -127

        env['LD_LIBRARY_PATH'] = ld_path

    try:
        return util.call([fs2_bin] + params, cwd=fs2_path, env=env)
    except OSError:
        return -129
Exemplo n.º 4
0
def run_fs2_silent(params):
    fs2_path = center.settings["fs2_path"]
    fs2_bin = os.path.join(fs2_path, center.settings["fs2_bin"])

    if not os.path.isfile(fs2_bin):
        return -128

    mode = os.stat(fs2_bin).st_mode
    if mode & stat.S_IXUSR != stat.S_IXUSR:
        # Make it executable.
        os.chmod(fs2_bin, mode | stat.S_IXUSR)

    env = {}
    if sys.platform.startswith("linux"):
        ld_path, missing = fix_missing_libs(fs2_bin)
        if len(missing) > 0:
            return -127

        env["LD_LIBRARY_PATH"] = ld_path

    try:
        return util.call([fs2_bin] + params, cwd=fs2_path, env=env)
    except OSError:
        return -129
Exemplo n.º 5
0
    def set_us_layout(self):
        key_layout = util.check_output(['setxkbmap', '-query'])
        self._key_layout = key_layout.splitlines()[2].split(':')[1].strip()

        util.call(['setxkbmap', '-layout', 'us'])
Exemplo n.º 6
0
    def set_us_layout(self):
        key_layout = util.check_output(["setxkbmap", "-query"])
        self._key_layout = key_layout.splitlines()[2].split(":")[1].strip()

        util.call(["setxkbmap", "-layout", "us"])