Skip to content

Commit

Permalink
Add boilerplate market frame with ability to switch to it
Browse files Browse the repository at this point in the history
  • Loading branch information
Were-Woof committed Jun 24, 2024
1 parent 5ce5a2d commit d484b36
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from gui.frames.api_key import APIKeyFrame
from gui.frames.empty_frame import EmptyFrame
from gui.frames.outposts import OutpostsFrame
from gui.frames.market import MarketFrame


class App(tkinter.Tk):
Expand Down Expand Up @@ -43,6 +44,7 @@ def build_app(self, destroy: bool = False) -> None:
self.settings_frame = SettingsFrame(self)
self.api_key_frame = APIKeyFrame(self)
self.outposts_frame = OutpostsFrame(self)
self.market_frame = MarketFrame(self)
self.sidebar.place(x=0, y=0, height=600, width=150)
self.current_frame = EmptyFrame(self)
self.current_frame.place(x=150, y=0, height=600, width=650)
Expand Down
26 changes: 26 additions & 0 deletions gui/frames/market.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import tkinter
from ..components import labels, containers, dropdowns, popups


class MarketFrame(tkinter.Frame):
def __init__(self, parent, bg="gray"):
super().__init__(parent, width=650, height=600, bg=bg)
self.parent = parent
self.bg = bg

self.item_selector = dropdowns.Dropdown(
self, ["Placeholder One", "Placeholder Two", "Placeholder Three"]
)
self.item_selector_label = labels.InputLabel(self, "Item", bg="white")

self.buy_offers = tkinter.Listbox(self, bg=self.bg)

def render(self):
self.item_selector.place(x=150, y=100)
self.item_selector_label.place(x=150, y=80)
self.buy_offers.place(x=150, y=150)
# self.get_all_offers()

# def get_all_offers(self) -> list[dict]: #TODO fix issue where running this throws an backend.exceptions.ValidationError
# orders = self.parent.backend.get_market_orders()
# return orders
7 changes: 7 additions & 0 deletions gui/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ def __init__(self, parent):
)
self.outposts_button.pack()

self.market_button = buttons.Sidebarbutton(
self,
text="Market",
command=lambda: self.switch_frame(self.parent.market_frame),
)
self.market_button.pack()

self.apiKey_button = buttons.Sidebarbutton(
self,
text="API Key",
Expand Down

0 comments on commit d484b36

Please sign in to comment.