本文整理汇总了Python中lutris.thread.LutrisThread.start方法的典型用法代码示例。如果您正苦于以下问题:Python LutrisThread.start方法的具体用法?Python LutrisThread.start怎么用?Python LutrisThread.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lutris.thread.LutrisThread
的用法示例。
在下文中一共展示了LutrisThread.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xboxdrv
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def xboxdrv(self, config):
command = ("pkexec xboxdrv --daemon --detach-kernel-driver "
"--dbus session --silent %s"
% config)
logger.debug("xboxdrv command: %s", command)
thread = LutrisThread(command)
thread.start()
示例2: remove_game_data
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def remove_game_data(self, **kwargs):
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return False
appid = self.game_config.get('appid')
logger.debug("Launching Wine Steam uninstall of game %s" % appid)
command = '"%s" steam://uninstall/%s' % (self.steam_exe, appid)
thread = LutrisThread(command, path=self.working_dir)
thread.start()
示例3: remove_game_data
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def remove_game_data(self, **kwargs):
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return False
appid = self.game_config.get("appid")
logger.debug("Launching Wine Steam uninstall of game %s" % appid)
command = [self.steam_exe, "steam://uninstall/%s" % appid]
thread = LutrisThread(command, runner=self)
thread.start()
示例4: remove_game_data
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def remove_game_data(self, **kwargs):
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return False
appid = self.game_config.get('appid')
env = self.get_env()
command = self.launch_args + ['steam://uninstall/%s' % appid]
self.prepare_launch()
thread = LutrisThread(' '.join(command), runner=self, env=env)
thread.start()
示例5: remove_game_data
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def remove_game_data(self, appid=None, **kwargs):
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return False
appid = appid if appid else self.appid
env = self.get_env(full=False)
command = self.launch_args + ['steam://uninstall/%s' % appid]
self.prelaunch()
thread = LutrisThread(command, runner=self, env=env, watch=False)
thread.start()
示例6: remove_game_data
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def remove_game_data(self, appid=None, **kwargs):
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return False
appid = appid if appid else self.game_config.get('appid')
if appid is None:
raise RuntimeError('No appid given for uninstallation '
'(game config=%s)' % self.game_config)
logger.debug("Launching Steam uninstall of game %s" % appid)
command = [self.get_executable(), 'steam://uninstall/%s' % appid]
thread = LutrisThread(command, runner=self)
thread.start()
示例7: run
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def run(self, *args):
"""Run the runner alone."""
if not self.runnable_alone:
return
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return
command_data = self.get_run_data()
command = command_data.get('command')
env = (command_data.get('env') or {}).copy()
thread = LutrisThread(command, runner=self, env=env, watch=False)
thread.start()
示例8: joy2key
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def joy2key(self, config):
""" Run a joy2key thread. """
win = "grep %s" % config['window']
if 'notwindow' in config:
win = win + ' | grep -v %s' % config['notwindow']
wid = "xwininfo -root -tree | %s | awk '{print $1}'" % win
buttons = config['buttons']
axis = "Left Right Up Down"
rcfile = "~/.joy2keyrc"
command = "sleep 5 "
command += "&& joy2key $(%s) -X -rcfile %s -buttons %s -axis %s" % (
wid, rcfile, buttons, axis
)
joy2key_thread = LutrisThread(command)
self.game_thread.attach_thread(joy2key_thread)
joy2key_thread.start()
示例9: wineexec
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def wineexec(executable, args="", wine_path=None, prefix=None, arch=None,
working_dir=None, winetricks_wine='', blocking=False):
"""Execute a Wine command."""
detected_arch = detect_prefix_arch(prefix)
executable = str(executable) if executable else ''
if arch not in ('win32', 'win64'):
arch = detected_arch or 'win32'
if not wine_path:
wine_path = wine().get_executable()
if not working_dir:
if os.path.isfile(executable):
working_dir = os.path.dirname(executable)
if executable.endswith(".msi"):
executable = 'msiexec /i "%s"' % executable
elif executable:
executable = '%s' % executable
# Create prefix if necessary
if not detected_arch:
wine_bin = winetricks_wine if winetricks_wine else wine_path
create_prefix(prefix, wine_path=wine_bin, arch=arch)
env = {
'WINEARCH': arch
}
if winetricks_wine:
env['WINE'] = winetricks_wine
else:
env['WINE'] = wine_path
if prefix:
env['WINEPREFIX'] = prefix
wine_config = LutrisConfig(runner_slug='wine')
if not wine_config.system_config['disable_runtime'] and not runtime.is_disabled():
env['LD_LIBRARY_PATH'] = ':'.join(runtime.get_paths())
command = [wine_path]
if executable:
command.append(executable)
command += shlex.split(args)
if blocking:
return system.execute(command, env=env, cwd=working_dir)
else:
thread = LutrisThread(command, runner=wine(), env=env, cwd=working_dir)
thread.start()
return thread
示例10: joy2key
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def joy2key(self, config):
"""Run a joy2key thread."""
if not system.find_executable('joy2key'):
logger.error("joy2key is not installed")
return
win = "grep %s" % config['window']
if 'notwindow' in config:
win += ' | grep -v %s' % config['notwindow']
wid = "xwininfo -root -tree | %s | awk '{print $1}'" % win
buttons = config['buttons']
axis = "Left Right Up Down"
rcfile = os.path.expanduser("~/.joy2keyrc")
rc_option = '-rcfile %s' % rcfile if os.path.exists(rcfile) else ''
command = "sleep 5 "
command += "&& joy2key $(%s) -X %s -buttons %s -axis %s" % (
wid, rc_option, buttons, axis
)
joy2key_thread = LutrisThread(command)
self.game_thread.attach_thread(joy2key_thread)
joy2key_thread.start()
示例11: run
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def run(self, *args):
"""Run the runner alone."""
if not self.runnable_alone:
return
if not self.is_installed():
installed = self.install_dialog()
if not installed:
return
if self.use_runtime():
if runtime.is_outdated() or runtime.is_updating():
result = dialogs.RuntimeUpdateDialog().run()
if not result == Gtk.ResponseType.OK:
return
command_data = self.get_run_data()
command = command_data.get('command')
env = (command_data.get('env') or {}).copy()
if self.use_runtime():
env.update(runtime.get_env())
thread = LutrisThread(command, runner=self, env=env, watch=False)
thread.start()
示例12: do_play
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def do_play(self, prelaunched, _error=None):
if not prelaunched:
self.state = self.STATE_STOPPED
return
system_config = self.runner.system_config
self.original_outputs = sorted(
display.get_outputs(),
key=lambda e: e[0] == system_config.get('display')
)
gameplay_info = self.runner.play()
env = {}
logger.debug("Launching %s: %s" % (self.name, gameplay_info))
if 'error' in gameplay_info:
self.show_error_message(gameplay_info)
self.state = self.STATE_STOPPED
return
sdl_gamecontrollerconfig = system_config.get('sdl_gamecontrollerconfig')
if sdl_gamecontrollerconfig:
path = os.path.expanduser(sdl_gamecontrollerconfig)
if os.path.exists(path):
with open(path, "r") as f:
sdl_gamecontrollerconfig = f.read()
env['SDL_GAMECONTROLLERCONFIG'] = sdl_gamecontrollerconfig
sdl_video_fullscreen = system_config.get('sdl_video_fullscreen') or ''
env['SDL_VIDEO_FULLSCREEN_DISPLAY'] = sdl_video_fullscreen
restrict_to_display = system_config.get('display')
if restrict_to_display != 'off':
display.turn_off_except(restrict_to_display)
time.sleep(3)
self.resolution_changed = True
resolution = system_config.get('resolution')
if resolution != 'off':
display.change_resolution(resolution)
time.sleep(3)
self.resolution_changed = True
if system_config.get('reset_pulse'):
audio.reset_pulse()
self.killswitch = system_config.get('killswitch')
if self.killswitch and not os.path.exists(self.killswitch):
# Prevent setting a killswitch to a file that doesn't exists
self.killswitch = None
# Command
launch_arguments = gameplay_info['command']
primusrun = system_config.get('primusrun')
if primusrun and system.find_executable('primusrun'):
launch_arguments.insert(0, 'primusrun')
xephyr = system_config.get('xephyr') or 'off'
if xephyr != 'off':
if xephyr == '8bpp':
xephyr_depth = '8'
else:
xephyr_depth = '16'
xephyr_resolution = system_config.get('xephyr_resolution') or '640x480'
xephyr_command = ['Xephyr', ':2', '-ac', '-screen',
xephyr_resolution + 'x' + xephyr_depth, '-glamor',
'-reset', '-terminate', '-fullscreen']
xephyr_thread = LutrisThread(xephyr_command)
xephyr_thread.start()
time.sleep(3)
env['DISPLAY'] = ':2'
if system_config.get('use_us_layout'):
setxkbmap_command = ['setxkbmap', '-model', 'pc101', 'us', '-print']
xkbcomp_command = ['xkbcomp', '-', os.environ.get('DISPLAY', ':0')]
xkbcomp = subprocess.Popen(xkbcomp_command, stdin=subprocess.PIPE)
subprocess.Popen(setxkbmap_command,
env=os.environ,
stdout=xkbcomp.stdin).communicate()
xkbcomp.communicate()
pulse_latency = system_config.get('pulse_latency')
if pulse_latency:
env['PULSE_LATENCY_MSEC'] = '60'
prefix_command = system_config.get("prefix_command") or ''
if prefix_command:
launch_arguments = shlex.split(os.path.expandvars(prefix_command)) + launch_arguments
single_cpu = system_config.get('single_cpu') or False
if single_cpu:
logger.info('The game will run on a single CPU core')
launch_arguments.insert(0, '0')
launch_arguments.insert(0, '-c')
launch_arguments.insert(0, 'taskset')
terminal = system_config.get('terminal')
if terminal:
terminal = system_config.get("terminal_app",
system.get_default_terminal())
#.........这里部分代码省略.........
示例13: Game
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
#.........这里部分代码省略.........
resolution = system_config.get('resolution')
if resolution != 'off':
display.change_resolution(resolution)
time.sleep(3)
self.resolution_changed = True
if system_config.get('reset_pulse'):
audio.reset_pulse()
self.killswitch = system_config.get('killswitch')
if self.killswitch and not os.path.exists(self.killswitch):
# Prevent setting a killswitch to a file that doesn't exists
self.killswitch = None
# Command
launch_arguments = gameplay_info['command']
primusrun = system_config.get('primusrun')
if primusrun and system.find_executable('primusrun'):
launch_arguments.insert(0, 'primusrun')
xephyr = system_config.get('xephyr') or 'off'
if xephyr != 'off':
if xephyr == '8bpp':
xephyr_depth = '8'
else:
xephyr_depth = '16'
xephyr_resolution = system_config.get('xephyr_resolution') or '640x480'
xephyr_command = ['Xephyr', ':2', '-ac', '-screen',
xephyr_resolution + 'x' + xephyr_depth, '-glamor',
'-reset', '-terminate', '-fullscreen']
xephyr_thread = LutrisThread(xephyr_command)
xephyr_thread.start()
time.sleep(3)
env['DISPLAY'] = ':2'
if system_config.get('use_us_layout'):
setxkbmap_command = ['setxkbmap', '-model', 'pc101', 'us', '-print']
xkbcomp_command = ['xkbcomp', '-', os.environ.get('DISPLAY', ':0')]
xkbcomp = subprocess.Popen(xkbcomp_command, stdin=subprocess.PIPE)
subprocess.Popen(setxkbmap_command,
env=os.environ,
stdout=xkbcomp.stdin).communicate()
xkbcomp.communicate()
pulse_latency = system_config.get('pulse_latency')
if pulse_latency:
env['PULSE_LATENCY_MSEC'] = '60'
prefix_command = system_config.get("prefix_command") or ''
if prefix_command:
launch_arguments = shlex.split(os.path.expandvars(prefix_command)) + launch_arguments
single_cpu = system_config.get('single_cpu') or False
if single_cpu:
logger.info('The game will run on a single CPU core')
launch_arguments.insert(0, '0')
launch_arguments.insert(0, '-c')
launch_arguments.insert(0, 'taskset')
terminal = system_config.get('terminal')
if terminal:
terminal = system_config.get("terminal_app",
system.get_default_terminal())
if terminal and not system.find_executable(terminal):
示例14: Game
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
#.........这里部分代码省略.........
"could not be launched:\n"
"%s" % terminal)
return False
# Env vars
env = {}
game_env = gameplay_info.get('env') or {}
env.update(game_env)
ld_preload = gameplay_info.get('ld_preload')
if ld_preload:
env["LD_PRELOAD"] = ld_preload
ld_library_path = []
if self.use_runtime(system_config):
env['STEAM_RUNTIME'] = os.path.join(settings.RUNTIME_DIR, 'steam')
ld_library_path += runtime.get_runtime_paths()
game_ld_libary_path = gameplay_info.get('ld_library_path')
if game_ld_libary_path:
ld_library_path.append(game_ld_libary_path)
if ld_library_path:
ld_full = ':'.join(ld_library_path)
env["LD_LIBRARY_PATH"] = "{}:$LD_LIBRARY_PATH".format(ld_full)
# /Env vars
self.game_thread = LutrisThread(launch_arguments,
runner=self.runner, env=env,
rootpid=gameplay_info.get('rootpid'),
term=terminal)
self.state = self.STATE_RUNNING
if hasattr(self.runner, 'stop'):
self.game_thread.set_stop_command(self.runner.stop)
self.game_thread.start()
if 'joy2key' in gameplay_info:
self.joy2key(gameplay_info['joy2key'])
xboxdrv_config = system_config.get('xboxdrv')
if xboxdrv_config:
self.xboxdrv_start(xboxdrv_config)
if self.runner.is_watchable:
# Create heartbeat every
self.heartbeat = GLib.timeout_add(HEARTBEAT_DELAY, self.beat)
def joy2key(self, config):
"""Run a joy2key thread."""
if not system.find_executable('joy2key'):
logger.error("joy2key is not installed")
return
win = "grep %s" % config['window']
if 'notwindow' in config:
win += ' | grep -v %s' % config['notwindow']
wid = "xwininfo -root -tree | %s | awk '{print $1}'" % win
buttons = config['buttons']
axis = "Left Right Up Down"
rcfile = os.path.expanduser("~/.joy2keyrc")
rc_option = '-rcfile %s' % rcfile if os.path.exists(rcfile) else ''
command = "sleep 5 "
command += "&& joy2key $(%s) -X %s -buttons %s -axis %s" % (
wid, rc_option, buttons, axis
)
joy2key_thread = LutrisThread(command)
self.game_thread.attach_thread(joy2key_thread)
joy2key_thread.start()
def xboxdrv_start(self, config):
command = [
示例15: do_play
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import start [as 别名]
def do_play(self, prelaunched, _error=None):
if not prelaunched:
self.state = self.STATE_STOPPED
return
system_config = self.runner.system_config
self.original_outputs = display.get_outputs()
gameplay_info = self.runner.play()
env = {}
logger.debug("Launching %s: %s" % (self.name, gameplay_info))
if 'error' in gameplay_info:
show_error_message(gameplay_info)
self.state = self.STATE_STOPPED
return
restrict_to_display = system_config.get('display')
if restrict_to_display != 'off':
display.turn_off_except(restrict_to_display)
time.sleep(3)
self.resolution_changed = True
resolution = system_config.get('resolution')
if resolution != 'off':
display.change_resolution(resolution)
time.sleep(3)
self.resolution_changed = True
if system_config.get('reset_pulse'):
audio.reset_pulse()
self.killswitch = system_config.get('killswitch')
if self.killswitch and not os.path.exists(self.killswitch):
# Prevent setting a killswitch to a file that doesn't exists
self.killswitch = None
# Command
launch_arguments = gameplay_info['command']
primusrun = system_config.get('primusrun')
if primusrun and system.find_executable('primusrun'):
launch_arguments.insert(0, 'primusrun')
xephyr = system_config.get('xephyr') or 'off'
if xephyr != 'off':
if xephyr == '8bpp':
xephyr_depth = '8'
else:
xephyr_depth = '16'
xephyr_resolution = system_config.get('xephyr_resolution') or '640x480'
xephyr_command = ['Xephyr', ':2', '-ac', '-screen',
xephyr_resolution + 'x' + xephyr_depth, '-glamor',
'-reset', '-terminate', '-fullscreen']
xephyr_thread = LutrisThread(xephyr_command)
xephyr_thread.start()
time.sleep(3)
env['DISPLAY'] = ':2'
pulse_latency = system_config.get('pulse_latency')
if pulse_latency:
env['PULSE_LATENCY_MSEC'] = '60'
prefix_command = system_config.get("prefix_command") or ''
if prefix_command.strip():
launch_arguments.insert(0, prefix_command)
terminal = system_config.get('terminal')
if terminal:
terminal = system_config.get("terminal_app",
system.get_default_terminal())
if terminal and not system.find_executable(terminal):
dialogs.ErrorDialog("The selected terminal application "
"could not be launched:\n"
"%s" % terminal)
self.state = self.STATE_STOPPED
return
# Env vars
game_env = gameplay_info.get('env') or {}
env.update(game_env)
system_env = system_config.get('env') or {}
env.update(system_env)
ld_preload = gameplay_info.get('ld_preload')
if ld_preload:
env["LD_PRELOAD"] = ld_preload
ld_library_path = []
if self.runner.use_runtime():
env['STEAM_RUNTIME'] = os.path.join(settings.RUNTIME_DIR, 'steam')
ld_library_path += runtime.get_paths()
game_ld_libary_path = gameplay_info.get('ld_library_path')
if game_ld_libary_path:
ld_library_path.append(game_ld_libary_path)
if ld_library_path:
ld_full = ':'.join(ld_library_path)
env["LD_LIBRARY_PATH"] = "{}:$LD_LIBRARY_PATH".format(ld_full)
# /Env vars
self.game_thread = LutrisThread(launch_arguments,
#.........这里部分代码省略.........