did rough first version of wxpython lobby window
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -5,12 +5,9 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="67d0f8e4-ef35-4641-9e95-eb79cf01a045" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/constants.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client.py" beforeDir="false" afterPath="$PROJECT_DIR$/client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/common.py" beforeDir="false" afterPath="$PROJECT_DIR$/common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server.py" beforeDir="false" afterPath="$PROJECT_DIR$/server.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/vckonline.py" beforeDir="false" afterPath="$PROJECT_DIR$/vckonline.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
32
client.py
32
client.py
@@ -6,13 +6,6 @@ import json
|
||||
|
||||
|
||||
class ClientVCKO(wx.App):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.frame = None
|
||||
self.connection_status = None
|
||||
self.in_lobby = None
|
||||
self.player_id = None
|
||||
|
||||
def OnInit(self):
|
||||
self.frame = MyFrame(self)
|
||||
self.frame.Show()
|
||||
@@ -23,6 +16,7 @@ class ClientVCKO(wx.App):
|
||||
return True
|
||||
|
||||
def parse_response(self, response):
|
||||
print(f"{response}")
|
||||
first_word = response.split()[0]
|
||||
match first_word:
|
||||
case "lobby":
|
||||
@@ -31,6 +25,9 @@ class ClientVCKO(wx.App):
|
||||
self.player_id = full_command[2]
|
||||
self.in_lobby = True
|
||||
print(self.player_id)
|
||||
print(self.frame)
|
||||
self.frame.show_list_view(None)
|
||||
print("did it work")
|
||||
else:
|
||||
print("Couldn't understand that response")
|
||||
case _:
|
||||
@@ -67,6 +64,27 @@ class MyFrame(wx.Frame):
|
||||
self.Bind(wx.EVT_TIMER, self.set_connection_status, self.timer)
|
||||
self.timer.Start(5000)
|
||||
|
||||
def show_list_view(self, event):
|
||||
print("show list view")
|
||||
# create a list view with a ready up button
|
||||
list_ctrl = wx.ListCtrl(self.panel, style=wx.LC_REPORT)
|
||||
list_ctrl.InsertColumn(0, "Player ID")
|
||||
list_ctrl.InsertColumn(1, "Ready Status")
|
||||
list_ctrl.InsertItem(0, self.app.player_id)
|
||||
list_ctrl.SetItem(0, 1, "Not Ready")
|
||||
|
||||
ready_button = wx.Button(self.panel, label="Ready Up")
|
||||
ready_button.Bind(wx.EVT_BUTTON, self.on_ready_up)
|
||||
|
||||
# Add the list view and button to the vertical sizer
|
||||
self.vertical_sizer.Insert(0, list_ctrl, 0, wx.ALL | wx.EXPAND, 5)
|
||||
self.vertical_sizer.Add(ready_button, 0, wx.ALL | wx.CENTER, 5)
|
||||
self.panel.Layout()
|
||||
|
||||
def on_ready_up(self, event):
|
||||
# implement ready up functionality here
|
||||
print("Ready Up button pressed!")
|
||||
|
||||
def set_connection_status(self, event=None):
|
||||
if connection_check():
|
||||
self.connection_status_indicator.SetLabel("Connected")
|
||||
|
||||
@@ -36,7 +36,7 @@ class ServerVCKO:
|
||||
joining_player = LobbyMember(joining_player_name, joining_player_id)
|
||||
self.lobby.append(joining_player)
|
||||
message = f"lobby joined {joining_player_id}"
|
||||
conn.send(joining_player_id.encode(Constants.text_format))
|
||||
conn.send(message.encode(Constants.text_format))
|
||||
elif full_command[1] == "get_status":
|
||||
lobby_data = []
|
||||
for lobby_member in self.lobby:
|
||||
|
||||
Reference in New Issue
Block a user