Skip to content

Commit cdc2f9d

Browse files
committed
More dropdown improvements
1 parent 7db70b6 commit cdc2f9d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/ManualClient.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class ManualContext(SuperContext):
8181
'category_in_logic': [2/255, 82/255, 2/255, 1],
8282
'deathlink_received': [1, 0, 0, 1],
8383
'deathlink_primed': [1, 1, 1, 1],
84-
'deathlink_sent': [0, 1, 0, 1]
84+
'deathlink_sent': [0, 1, 0, 1],
85+
'game_select_button': [150/255, 200/255, 200/255, 1],
8586
}
8687

8788
def __init__(self, server_address, password, game, player_name) -> None:
@@ -217,16 +218,15 @@ def make_gui(self) -> typing.Type["kvui.GameManager"]:
217218

218219
from kivy.metrics import dp
219220
from kivy.uix.button import Button
220-
from kivy.uix.label import Label
221-
from kivy.uix.layout import Layout
222221
from kivy.uix.boxlayout import BoxLayout
222+
from kivy.uix.dropdown import DropDown
223223
from kivy.uix.gridlayout import GridLayout
224+
from kivy.uix.label import Label
225+
from kivy.uix.layout import Layout
224226
from kivy.uix.scrollview import ScrollView
227+
from kivy.uix.spinner import Spinner, SpinnerOption
225228
from kivy.uix.textinput import TextInput
226-
from kivy.uix.spinner import Spinner
227-
from kivy.uix.tabbedpanel import TabbedPanelItem
228229
from kivy.uix.treeview import TreeView, TreeViewNode, TreeViewLabel
229-
from kivy.clock import Clock
230230
from kivy.core.window import Window
231231

232232
class TrackerAndLocationsLayout(GridLayout):
@@ -245,6 +245,13 @@ class TreeViewButton(Button, TreeViewNode):
245245
class TreeViewScrollView(ScrollView, TreeViewNode):
246246
pass
247247

248+
class GameSelectOption(SpinnerOption):
249+
background_color = self.colors['game_select_button']
250+
251+
class GameSelectDropDown(DropDown):
252+
# If someone can figure out how to give this a solid background, I'd be very happy.
253+
pass
254+
248255
class ManualManager(ui):
249256
logging_pairs = [
250257
("Client", "Archipelago"),
@@ -270,10 +277,11 @@ def build(self) -> Layout:
270277
self.manual_game_layout = BoxLayout(orientation="horizontal", size_hint_y=None, height=dp(30))
271278

272279
game_bar_label = Label(text="Manual Game ID", size=(dp(150), dp(30)), size_hint_y=None, size_hint_x=None)
273-
manuals = tuple([w for w in AutoWorldRegister.world_types.keys() if "Manual_" in w])
280+
manuals = [w for w in AutoWorldRegister.world_types.keys() if "Manual_" in w]
281+
manuals.sort() # Sort by alphabetical order, not load order
274282
self.manual_game_layout.add_widget(game_bar_label)
275283
self.game_bar_text = Spinner(text=self.ctx.suggested_game,
276-
size_hint_y=None, height=dp(30), values=manuals)
284+
size_hint_y=None, height=dp(30), values=manuals, option_cls=GameSelectOption, dropdown_cls=GameSelectDropDown)
277285
self.manual_game_layout.add_widget(self.game_bar_text)
278286

279287
self.grid.add_widget(self.manual_game_layout, 3)

0 commit comments

Comments
 (0)