Skip to content

Commit

Permalink
feat: Update AllianceFrame to dynamically display alliance information
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNeil17 committed Jun 24, 2024
1 parent 5ce5a2d commit 825291a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions gui/frames/alliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,27 @@ def __init__(self, parent):
command=self.update_alliance_user_limit,
)

def update_data(self):
self.allianceData = self.parent.backend.get_alliance()
self.allianceNameLabel.config(text=f"Alliance: {self.allianceData.name}")
self.allianceOwnerLabel.config(text=f"Owner (Discord ID): {self.allianceData.owner}")
self.allianceUserLimitLabel.config(text=f'User Limit: {"{:,}".format(self.allianceData.user_limit)}')
self.allianceBankBalanceLabel.config(text=f'Bank Balance: {"{:,}".format(self.allianceData.bank)}')
self.allianceCreationTimestamp.config(text=f"Alliance Creation Timestamp: {self.allianceData.created_at}")

def update_alliance_name(self):
name = self.allianceNameUpdateField.get()

self.parent.backend.update_alliance_name(name)

self.parent.change_frame(
AllianceFrame(self.parent)
) # TODO instead of initialising a new frame, update the current frame
self.update_data()

def update_alliance_user_limit(self):
user_limit = self.allianceUserLimitUpdateField.get()

self.parent.backend.update_alliance_user_limit(int(user_limit))

self.parent.change_frame(
AllianceFrame(self.parent)
) # TODO instead of initialising a new frame, update the current frame
self.update_data()

def render(self):
self.label.grid(row=0, column=0)
Expand Down

0 comments on commit 825291a

Please sign in to comment.