#!/usr/bin/env python3 from pathlib import Path import dearpygui.dearpygui as dpg from vrutil.dialogs import Dialogs from vrutil.geproton import GeProtonSettings from vrutil.gpu import GpuSettings from vrutil.steamvr import SteamVrSettings from vrutil.valveindex import ValeIndexSettings _DEBUG = False _DIR = Path(__file__).parent _ASSET_DIR = f'{_DIR}/assets' _NO_STEAM_FOUND = 'No Steam installation found!' def get_steam_dir(): possible_paths = [ '.local/share/Steam', '.steam/steam', '.steam/root' ] for path in possible_paths: candidate = (Path.home() / Path(path)).resolve() if candidate.exists(): return str(candidate) return None def show_window(): steam_dir = get_steam_dir() dialogs = Dialogs() gpu_settings = GpuSettings() steamvr_settings = SteamVrSettings(steam_dir) geproton_settings = GeProtonSettings(steam_dir, dialogs) valveindex_settings = ValeIndexSettings() dpg.create_context() dpg.configure_app(manual_callback_management=_DEBUG) dpg.create_viewport(title='VRUtil', width=750, height=550) dialogs.create_dialogs() with dpg.window() as main_window: dpg.add_text('Current Steam dir:') dpg.add_text(get_steam_dir() or _NO_STEAM_FOUND) dpg.add_spacer(height=10) if steam_dir is not None: gpu_settings.create_views() steamvr_settings.create_views() geproton_settings.create_views() valveindex_settings.create_views() dpg.setup_dearpygui() dpg.show_viewport() dpg.set_primary_window(main_window, True) if _DEBUG: while dpg.is_dearpygui_running(): jobs = dpg.get_callback_queue() # retrieves and clears queue dpg.run_callbacks(jobs) dpg.render_dearpygui_frame() else: dpg.start_dearpygui() dpg.destroy_context() def main(): show_window() if __name__ == '__main__': main()