Skip to content

Commit 886d9f8

Browse files
bokikoclaude
andcommitted
v1.16.0: Replace game buttons with dropdown selector
- Game selector now uses a dropdown with full game names - Shows server count for selected game - Cleaner UI with less clutter - All 9 games with full names: Overwatch 2, Call of Duty, etc. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2c1b9a6 commit 886d9f8

2 files changed

Lines changed: 63 additions & 33 deletions

File tree

desktop/src/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313

1414
# App Version
15-
APP_VERSION = "1.15.0"
15+
APP_VERSION = "1.16.0"
1616

1717
# Ping Configuration
1818
PING_COUNT = 10 # Number of pings per server

desktop/src/gui.py

Lines changed: 62 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -452,34 +452,58 @@ def _create_header(self, parent):
452452
self.location_label.pack(anchor=tk.E)
453453

454454
def _create_selectors_section(self, parent):
455-
"""Combined game and region selectors"""
455+
"""Game dropdown and region selectors"""
456456
section = tk.Frame(parent, bg=COLORS["bg"])
457457
section.pack(fill=tk.X, pady=(0, 16))
458458

459-
# Game row
459+
# Game dropdown row
460460
game_row = tk.Frame(section, bg=COLORS["bg"])
461-
game_row.pack(fill=tk.X, pady=(0, 10))
461+
game_row.pack(fill=tk.X, pady=(0, 12))
462462

463463
tk.Label(game_row, text="Game:",
464464
font=get_font(12, "bold"),
465465
bg=COLORS["bg"], fg=COLORS["text"]).pack(side=tk.LEFT, padx=(0, 12))
466466

467-
self.game_buttons = {}
468-
for game_id, game_info in GAMES.items():
469-
btn = tk.Label(
470-
game_row,
471-
text=game_info["short"],
472-
font=get_font(11, "bold"),
473-
bg=COLORS["bg_secondary"],
474-
fg=COLORS["text_muted"],
475-
padx=12, pady=6,
476-
cursor="hand2"
477-
)
478-
btn.pack(side=tk.LEFT, padx=(0, 6))
479-
btn.bind("<Button-1>", lambda e, g=game_id: self._select_game(g))
480-
self.game_buttons[game_id] = btn
467+
# Create game name to id mapping
468+
self.game_name_to_id = {info["name"]: gid for gid, info in GAMES.items()}
469+
self.game_id_to_name = {gid: info["name"] for gid, info in GAMES.items()}
470+
game_names = list(self.game_name_to_id.keys())
471+
472+
# Style the combobox
473+
style = ttk.Style()
474+
style.theme_use('clam')
475+
style.configure("Game.TCombobox",
476+
fieldbackground=COLORS["bg_secondary"],
477+
background=COLORS["bg_tertiary"],
478+
foreground=COLORS["text"],
479+
arrowcolor=COLORS["text"],
480+
borderwidth=0,
481+
padding=8)
482+
style.map("Game.TCombobox",
483+
fieldbackground=[('readonly', COLORS["bg_secondary"])],
484+
selectbackground=[('readonly', COLORS["accent"])],
485+
selectforeground=[('readonly', '#ffffff')])
486+
487+
self.game_combo_var = tk.StringVar(value=self.game_id_to_name.get(self.current_game, "Overwatch 2"))
488+
self.game_combo = ttk.Combobox(
489+
game_row,
490+
textvariable=self.game_combo_var,
491+
values=game_names,
492+
state="readonly",
493+
style="Game.TCombobox",
494+
width=25,
495+
font=get_font(12)
496+
)
497+
self.game_combo.pack(side=tk.LEFT, fill=tk.X, expand=True)
498+
self.game_combo.bind("<<ComboboxSelected>>", self._on_game_selected)
499+
# Set initial selection
500+
self.game_combo.set(self.game_id_to_name.get(self.current_game, "Overwatch 2"))
481501

482-
self._update_game_buttons()
502+
# Server count label
503+
self.server_count_label = tk.Label(game_row, text="",
504+
font=get_font(11),
505+
bg=COLORS["bg"], fg=COLORS["text_muted"])
506+
self.server_count_label.pack(side=tk.RIGHT, padx=(12, 0))
483507

484508
# Region row
485509
region_row = tk.Frame(section, bg=COLORS["bg"])
@@ -506,26 +530,31 @@ def _create_selectors_section(self, parent):
506530

507531
self._update_region_buttons()
508532

509-
def _select_game(self, game_id):
533+
def _on_game_selected(self, event=None):
534+
"""Handle game dropdown selection"""
510535
if self.is_testing:
511536
return
512-
self.game_var.set(game_id)
513-
self.current_game = game_id
514-
self._update_game_buttons()
515-
# Reload servers for new game
516-
self._reload_servers()
517-
518-
def _update_game_buttons(self):
519-
selected = self.game_var.get()
520-
for game_id, btn in self.game_buttons.items():
521-
if game_id == selected:
522-
btn.config(bg=COLORS["accent"], fg="#ffffff")
523-
else:
524-
btn.config(bg=COLORS["bg_secondary"], fg=COLORS["text_muted"])
537+
selected_name = self.game_combo.get()
538+
game_id = self.game_name_to_id.get(selected_name)
539+
if game_id:
540+
self.game_var.set(game_id)
541+
self.current_game = game_id
542+
self._reload_servers()
543+
544+
def _update_server_count(self):
545+
"""Update the server count label for current game"""
546+
total = 0
547+
for region, servers in self.servers.items():
548+
total += len(servers)
549+
if total > 0:
550+
self.server_count_label.config(text=f"{total} servers")
551+
else:
552+
self.server_count_label.config(text="")
525553

526554
def _reload_servers(self):
527555
def load():
528556
self.servers = self.api.get_servers(self.current_game)
557+
self.root.after(0, self._update_server_count)
529558
thread = threading.Thread(target=load, daemon=True)
530559
thread.start()
531560

@@ -674,6 +703,7 @@ def load():
674703
self.isp_info = self.api.get_isp_info()
675704
self.root.after(0, self._update_isp_display)
676705
self.servers = self.api.get_servers(self.current_game)
706+
self.root.after(0, self._update_server_count)
677707

678708
thread = threading.Thread(target=load, daemon=True)
679709
thread.start()

0 commit comments

Comments
 (0)