2024-07-06 00:11:56 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import dearpygui.dearpygui as dpg
|
|
|
|
|
2024-07-07 15:05:16 +02:00
|
|
|
from vrutil.dialogs import Dialogs
|
|
|
|
from vrutil.geproton import GeProtonSettings
|
|
|
|
from vrutil.gpu import GpuSettings
|
|
|
|
from vrutil.steamvr import SteamVrSettings
|
2024-07-07 16:53:24 +02:00
|
|
|
from vrutil.valveindex import ValeIndexSettings
|
2024-07-06 00:11:56 +02:00
|
|
|
|
2024-07-07 16:53:24 +02:00
|
|
|
_DEBUG = False
|
2024-07-07 15:05:16 +02:00
|
|
|
_DIR = Path(__file__).parent
|
|
|
|
_ASSET_DIR = f'{_DIR}/assets'
|
|
|
|
_NO_STEAM_FOUND = 'No Steam installation found!'
|
2024-07-06 00:11:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2024-07-07 16:53:24 +02:00
|
|
|
valveindex_settings = ValeIndexSettings()
|
2024-07-06 00:11:56 +02:00
|
|
|
|
|
|
|
dpg.create_context()
|
2024-07-07 16:53:24 +02:00
|
|
|
dpg.configure_app(manual_callback_management=_DEBUG)
|
2024-07-06 00:11:56 +02:00
|
|
|
|
|
|
|
with dpg.font_registry():
|
2024-07-07 15:05:16 +02:00
|
|
|
with dpg.font(f'{_ASSET_DIR}/Hack-Regular.ttf', size=14, pixel_snapH=True) as default_font:
|
2024-07-06 00:11:56 +02:00
|
|
|
dpg.add_font_range(0x2190, 0x21FF)
|
|
|
|
dpg.bind_font(default_font)
|
|
|
|
|
2024-07-07 16:53:24 +02:00
|
|
|
dpg.create_viewport(title='VRUtil', width=750, height=550)
|
2024-07-06 00:11:56 +02:00
|
|
|
|
|
|
|
dialogs.create_dialogs()
|
|
|
|
|
|
|
|
with dpg.window() as main_window:
|
|
|
|
dpg.add_text('Current Steam dir:')
|
2024-07-07 15:05:16 +02:00
|
|
|
dpg.add_text(get_steam_dir() or _NO_STEAM_FOUND)
|
2024-07-06 00:11:56 +02:00
|
|
|
|
|
|
|
dpg.add_spacer(height=10)
|
|
|
|
|
|
|
|
if steam_dir is not None:
|
|
|
|
gpu_settings.create_views()
|
|
|
|
steamvr_settings.create_views()
|
|
|
|
geproton_settings.create_views()
|
2024-07-07 16:53:24 +02:00
|
|
|
valveindex_settings.create_views()
|
2024-07-06 00:11:56 +02:00
|
|
|
|
|
|
|
dpg.setup_dearpygui()
|
|
|
|
dpg.show_viewport()
|
|
|
|
dpg.set_primary_window(main_window, True)
|
2024-07-07 16:53:24 +02:00
|
|
|
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()
|
2024-07-06 00:11:56 +02:00
|
|
|
dpg.destroy_context()
|
|
|
|
|
|
|
|
|
2024-07-07 15:05:16 +02:00
|
|
|
def main():
|
2024-07-06 00:11:56 +02:00
|
|
|
show_window()
|
2024-07-07 15:05:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|