Skip to content

Commit 4771d0a

Browse files
feat(all): more work for initial build
Most of installation modal screens, progress screens, etc.. Signed-off-by: Mythical-Github <MythicalData@gmail.com>
1 parent aafa48e commit 4771d0a

File tree

13 files changed

+835
-223
lines changed

13 files changed

+835
-223
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,4 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
src/ue4ss_installer_gui/settings.toml

settings.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/ue4ss_installer_gui/data_structures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ class GameInfo:
1515
install_dir: Path
1616
game_title: str
1717
ue4ss_version: str
18+
platform: GamePlatforms
19+
using_developer_version: bool
20+
show_pre_releases: bool
21+
using_keep_mods_and_settings: bool
1822
installed_files: List[Path] = field(default_factory=list)
19-
platform: GamePlatforms = GamePlatforms.OTHER
2023

2124

2225
def get_enum_from_val(enum_cls: Type[Enum], value: Any) -> Enum:
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import asyncio
2-
from ue4ss_installer_gui import ue4ss, constants
2+
from ue4ss_installer_gui import ue4ss
3+
34

45
def init():
5-
asyncio.run(auto_fetch_tags_on_start(constants.UE4SS_REPO_URL))
6+
asyncio.run(auto_fetch_tags_on_start())
67
asyncio.run(auto_scan_dirs())
78

8-
async def auto_fetch_tags_on_start(repo_url: str):
9-
ue4ss.ALL_TAGS = ue4ss.get_all_tags_from_repo_url(repo_url)
9+
10+
async def auto_fetch_tags_on_start():
11+
ue4ss.cache_repo_releases_info("UE4SS-RE", "RE-UE4SS")
1012

1113

1214
async def auto_scan_dirs():
1315
# do dir scanning here and populate the scroll box once it's ready, have scrollbox loading thing or something
14-
return
16+
return

src/ue4ss_installer_gui/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import ctypes
33
import dearpygui.dearpygui as dpg
44

5-
from ue4ss_installer_gui.screens import main as main_screen
5+
from ue4ss_installer_gui.screens import main_screen as main_screen
66
from ue4ss_installer_gui import file_io, constants, settings, logger, initialization
77

88

@@ -30,7 +30,6 @@ def on_viewport_ready(sender, app_data):
3030
def init_logging():
3131
logger.set_log_base_dir(os.path.normpath(f"{file_io.SCRIPT_DIR}/logs"))
3232
logger.configure_logging()
33-
logger.log_message("test")
3433

3534

3635
def main():
@@ -54,19 +53,20 @@ def main():
5453
dpg.set_viewport_small_icon(icon_path)
5554
dpg.set_viewport_large_icon(icon_path)
5655

57-
with dpg.font_registry():
58-
with dpg.font("C:/Windows/Fonts/segoeui.ttf", 20, tag="header_font"):
59-
dpg.add_font_range_hint(dpg.mvFontRangeHint_Default)
56+
# if not settings.is_linux():
57+
# with dpg.font_registry():
58+
# with dpg.font("C:/Windows/Fonts/segoeui.ttf", 20, tag="header_font"):
59+
# dpg.add_font_range_hint(dpg.mvFontRangeHint_Default)
6060

6161
main_screen.push_main_screen()
6262
dpg.set_viewport_pos([constants.X, constants.Y])
6363
dpg.setup_dearpygui()
6464
dpg.set_primary_window("main_window", True)
6565

6666
dpg.set_viewport_resize_callback(on_viewport_ready)
67-
dpg.show_viewport()
6867

6968
remove_maximize_button(constants.APP_TITLE)
7069

70+
dpg.show_viewport()
7171
dpg.start_dearpygui()
7272
dpg.destroy_context()

src/ue4ss_installer_gui/screens/add_game.py

Lines changed: 83 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import pathlib
33

4-
from ue4ss_installer_gui.screens import main
4+
from ue4ss_installer_gui.screens import main_screen
55

66
import dearpygui.dearpygui as dpg
77

@@ -96,6 +96,80 @@ def game_already_in_list_check(game_directory: pathlib.Path) -> bool:
9696
return False
9797

9898

99+
def add_manual_games_to_settings_file(game_dir_paths: list[pathlib.Path]) -> dict:
100+
bool_list = []
101+
loaded_settings = settings.get_settings()
102+
for game_dir_path in game_dir_paths:
103+
if not os.path.isdir(game_dir_path):
104+
bool_list.append(False)
105+
was_valid = True
106+
if game_already_in_list_check(game_dir_path):
107+
was_valid = False
108+
if not game_dir_actually_has_unreal_game_check(game_dir_path):
109+
was_valid = False
110+
if not was_valid:
111+
bool_list.append(was_valid)
112+
game_entry = data_structures.GameInfo(
113+
install_dir=game_dir_path,
114+
game_title=os.path.basename(str(game_dir_path)),
115+
ue4ss_version=ue4ss.get_default_ue4ss_version_tag(),
116+
platform=data_structures.GamePlatforms.OTHER,
117+
using_developer_version=False,
118+
show_pre_releases=False,
119+
using_keep_mods_and_settings=False,
120+
installed_files=[],
121+
)
122+
123+
new_installed_files = []
124+
for file in game_entry.installed_files:
125+
new_installed_files.append(file)
126+
127+
game_entry_dict = {
128+
"install_dir": str(game_entry.install_dir),
129+
"game_title": game_entry.game_title,
130+
"ue4ss_version": game_entry.ue4ss_version,
131+
"platform": game_entry.platform.value,
132+
"using_developer_version": game_entry.using_developer_version,
133+
"show_pre_releases": game_entry.show_pre_releases,
134+
"using_keep_mods_and_settings": game_entry.using_keep_mods_and_settings,
135+
"installed_files": new_installed_files,
136+
}
137+
138+
games_list = loaded_settings.get("games", [])
139+
games_list.append(game_entry_dict)
140+
loaded_settings["games"] = games_list
141+
142+
bool_list.append(was_valid)
143+
return loaded_settings
144+
145+
146+
def callback_directory_selected(sender, app_data):
147+
game_directory = pathlib.Path(app_data["file_path_name"])
148+
game_name = os.path.basename(game_directory)
149+
if add_manual_game_to_settings_file(game_directory):
150+
dpg.delete_item("directory_picker")
151+
# have this later add it so it's in the list alphabetically, using before= seems to replace entries
152+
main_screen.add_new_game_to_games_list(
153+
constants.GAME_PATHS_TO_DISPLAY_NAMES.get(game_name, game_name),
154+
str(game_directory),
155+
)
156+
157+
158+
def choose_directory():
159+
if dpg.does_item_exist("directory_picker"):
160+
dpg.delete_item("directory_picker")
161+
162+
dpg.add_file_dialog(
163+
directory_selector=True,
164+
show=True,
165+
callback=callback_directory_selected,
166+
tag="directory_picker",
167+
width=constants.WINDOW_WIDTH - 80,
168+
height=constants.WINDOW_HEIGHT - 80,
169+
modal=True,
170+
)
171+
172+
99173
def add_manual_game_to_settings_file(game_dir_path: pathlib.Path) -> bool:
100174
if not os.path.isdir(game_dir_path):
101175
return False
@@ -111,8 +185,11 @@ def add_manual_game_to_settings_file(game_dir_path: pathlib.Path) -> bool:
111185
install_dir=game_dir_path,
112186
game_title=os.path.basename(str(game_dir_path)),
113187
ue4ss_version=ue4ss.get_default_ue4ss_version_tag(),
114-
installed_files=[],
115188
platform=data_structures.GamePlatforms.OTHER,
189+
using_developer_version=False,
190+
show_pre_releases=False,
191+
using_keep_mods_and_settings=False,
192+
installed_files=[],
116193
)
117194

118195
new_installed_files = []
@@ -123,8 +200,11 @@ def add_manual_game_to_settings_file(game_dir_path: pathlib.Path) -> bool:
123200
"install_dir": str(game_entry.install_dir),
124201
"game_title": game_entry.game_title,
125202
"ue4ss_version": game_entry.ue4ss_version,
126-
"installed_files": new_installed_files,
127203
"platform": game_entry.platform.value,
204+
"using_developer_version": game_entry.using_developer_version,
205+
"show_pre_releases": game_entry.show_pre_releases,
206+
"using_keep_mods_and_settings": game_entry.using_keep_mods_and_settings,
207+
"installed_files": new_installed_files,
128208
}
129209

130210
games_list = loaded_settings.get("games", [])
@@ -133,30 +213,3 @@ def add_manual_game_to_settings_file(game_dir_path: pathlib.Path) -> bool:
133213

134214
settings.save_settings(loaded_settings)
135215
return was_valid
136-
137-
138-
def callback_directory_selected(sender, app_data):
139-
game_directory = pathlib.Path(app_data["file_path_name"])
140-
game_name = os.path.basename(game_directory)
141-
if add_manual_game_to_settings_file(game_directory):
142-
dpg.delete_item("directory_picker")
143-
# have this later add it so it's in the list alphabetically, using before= seems to replace entries
144-
main.add_new_game_to_games_list(
145-
constants.GAME_PATHS_TO_DISPLAY_NAMES.get(game_name, game_name),
146-
str(game_directory),
147-
)
148-
149-
150-
def choose_directory():
151-
if dpg.does_item_exist("directory_picker"):
152-
dpg.delete_item("directory_picker")
153-
154-
dpg.add_file_dialog(
155-
directory_selector=True,
156-
show=True,
157-
callback=callback_directory_selected,
158-
tag="directory_picker",
159-
width=constants.WINDOW_WIDTH - 80,
160-
height=constants.WINDOW_HEIGHT - 80,
161-
modal=True,
162-
)

0 commit comments

Comments
 (0)