Skip to content

Commit a5e4fed

Browse files
committed
Updated a few references for handling the reorg
1 parent 9650687 commit a5e4fed

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

spacetradertk.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,9 @@
1111

1212
import src.constants as c
1313
from src.screens.char_create import CreateCommander
14-
15-
# from customtkinter import FontManager
14+
from src.screens.screen_manager import ScreenManager
1615
from src.utils import FontManager
1716

18-
# from time import sleep
19-
# from tkinter import font
20-
# from PIL import ImageFont
21-
2217

2318
class SpaceTrader(tk.Tk):
2419

@@ -31,6 +26,8 @@ def __init__(self):
3126
self.configure(bg=c.BKG_HEX)
3227
self._load_assets()
3328

29+
self.manager = ScreenManager(self)
30+
3431
def _load_assets(self):
3532
"""
3633
Loads all game assets, currently just pointers to directories
@@ -51,7 +48,8 @@ def _load_assets(self):
5148
FontManager.load_font(f"{self.fonts}palm-pilot-large-bold.ttf")
5249

5350

54-
game = SpaceTrader()
51+
window = SpaceTrader()
52+
53+
CreateCommander(window).tkraise()
5554

56-
CreateCommander(game)
57-
game.mainloop()
55+
window.mainloop()

src/ui_actions.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,29 @@
77
have to worry about rewriting the game logic.
88
"""
99

10+
from random import randint
11+
12+
import src.constants as c
13+
1014

1115
# Disordered list of user interactions
16+
def get_system_info():
17+
global current_system
18+
19+
# Format system pressure
20+
#!pressure = current_system.pressure
21+
pressure = randint(0, 7) # Placeholder
22+
pressure_str = f"System is {c.SocietalPressure.name(pressure)}"
23+
24+
return pressure_str
25+
26+
1227
def buy_fuel():
1328
pass
1429

1530

1631
def buy_news():
17-
pass
32+
print("Buying news!")
1833

1934

2035
def warp():

testing/ui_preview.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""
22
UI Previewer | RPINerd, 2024
3-
4-
This script is a simple UI previewer for the Space Trader game. It allows you to request a state and see what the current UI would look like.
5-
3+
4+
This script is a simple UI previewer for the Space Trader game.
5+
It allows you to request a state and see what the current UI would look like.
6+
67
Usage:
78
python ui_preview.py <state>
8-
99
"""
1010

1111
import os
@@ -14,7 +14,7 @@
1414

1515
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
1616
from src import constants as c
17-
from src.screen_manager import screens
17+
from src.screens.screen_manager import SCREENS
1818
from src.screens.system_info import SystemInfo
1919
from src.utils import FontManager
2020

@@ -44,12 +44,12 @@ def main(state):
4444
if __name__ == "__main__":
4545

4646
print("Select a state to preview...")
47-
for state in screens:
48-
print(f"{state}: {screens[state]['title']}")
47+
for state in SCREENS:
48+
print(f"{state}: {SCREENS[state]['title']}")
4949
print("\n")
5050
state = input("Enter the state to preview: ").upper()
5151

52-
if state in screens:
52+
if state in SCREENS:
5353
main(state)
5454
else:
5555
print(f"Invalid state: {state}")

0 commit comments

Comments
 (0)