byte-vortex commited on
Commit
11f2290
·
verified ·
1 Parent(s): 8b79beb

Deploy Myco from CI

Browse files
Files changed (4) hide show
  1. tests/test_myco_core.py +3 -1
  2. ui/gradio_app.py +10 -1
  3. ui/renderers.py +12 -0
  4. ui/styles.py +16 -0
tests/test_myco_core.py CHANGED
@@ -334,6 +334,7 @@ class MycoCoreTests(unittest.TestCase):
334
  self.assertEqual(world_map_markdown([current]).count('class="map-card '), 4)
335
  self.assertIn("Quest Log", game_status_markdown(current, [current]))
336
  self.assertIn("Mystery thread", game_status_markdown(current, [current]))
 
337
  self.assertIn("Event:", game_status_markdown(current, [current]))
338
  self.assertIn("Mystery", game_status_markdown(current, [current]))
339
  self.assertIn(current["name"], game_status_markdown(current, [current]))
@@ -370,12 +371,13 @@ class MycoCoreTests(unittest.TestCase):
370
  self.assertNotIn("textbox_component", source)
371
  self.assertIn('with gr.Tabs(selected="home") as tabs:', source)
372
  self.assertIn('with gr.Tab("🎮 Play", id="play"):', source)
373
- self.assertIn('start_play_button.click(open_play_tab, outputs=(tabs,))', source)
374
  self.assertIn('with gr.Group(elem_id="game-shell"):', source)
375
  self.assertIn('search_button = gr.Button("🎮 Search Clearing", variant="primary")', source)
376
  self.assertIn('with gr.Group(elem_id="near-monitor-controls"):', source)
377
  self.assertIn('pick_button = gr.Button("🍄 Pick", variant="primary")', source)
378
  self.assertIn('whisper_button = gr.Button("🌌 Follow Whisper")', source)
 
379
 
380
  def test_gradio_app_rejects_old_corrupted_callback_fragments(self):
381
  source = Path("ui/gradio_app.py").read_text()
 
334
  self.assertEqual(world_map_markdown([current]).count('class="map-card '), 4)
335
  self.assertIn("Quest Log", game_status_markdown(current, [current]))
336
  self.assertIn("Mystery thread", game_status_markdown(current, [current]))
337
+ self.assertIn("Impossible bloom", game_status_markdown(current, [current]))
338
  self.assertIn("Event:", game_status_markdown(current, [current]))
339
  self.assertIn("Mystery", game_status_markdown(current, [current]))
340
  self.assertIn(current["name"], game_status_markdown(current, [current]))
 
371
  self.assertNotIn("textbox_component", source)
372
  self.assertIn('with gr.Tabs(selected="home") as tabs:', source)
373
  self.assertIn('with gr.Tab("🎮 Play", id="play"):', source)
374
+ self.assertIn('start_play_button.click(open_play_tab, outputs=(tabs,), show_progress="hidden")', source)
375
  self.assertIn('with gr.Group(elem_id="game-shell"):', source)
376
  self.assertIn('search_button = gr.Button("🎮 Search Clearing", variant="primary")', source)
377
  self.assertIn('with gr.Group(elem_id="near-monitor-controls"):', source)
378
  self.assertIn('pick_button = gr.Button("🍄 Pick", variant="primary")', source)
379
  self.assertIn('whisper_button = gr.Button("🌌 Follow Whisper")', source)
380
+ self.assertIn('show_progress="hidden"', source)
381
 
382
  def test_gradio_app_rejects_old_corrupted_callback_fragments(self):
383
  source = Path("ui/gradio_app.py").read_text()
ui/gradio_app.py CHANGED
@@ -258,17 +258,19 @@ def build_app():
258
  with gr.Tab("🧭 Guide"):
259
  gr.Markdown(GUIDE_MARKDOWN)
260
 
261
- start_play_button.click(open_play_tab, outputs=(tabs,))
262
 
263
  search_button.click(
264
  search_forest,
265
  inputs=(collection, player_position),
266
  outputs=(scene, status, discovery, current_mushroom, chat, dex, progress),
 
267
  )
268
  ask_button.click(
269
  ask_companion,
270
  inputs=(prompt, chat, current_mushroom),
271
  outputs=(prompt, chat),
 
272
  )
273
 
274
  for direction, button in (
@@ -281,36 +283,43 @@ def build_app():
281
  move_player,
282
  inputs=(player_position, gr.State(direction), current_mushroom, collection),
283
  outputs=(player_position, scene, status),
 
284
  )
285
  prompt.submit(
286
  ask_companion,
287
  inputs=(prompt, chat, current_mushroom),
288
  outputs=(prompt, chat),
 
289
  )
290
  collect_button.click(
291
  collect_discovery,
292
  inputs=(current_mushroom, collection, chat, player_position),
293
  outputs=(collection, scene, status, dex, world_map, chat, progress),
 
294
  )
295
  pick_button.click(
296
  pick_discovery,
297
  inputs=(current_mushroom, collection, chat, player_position),
298
  outputs=(collection, current_mushroom, scene, status, discovery, dex, world_map, chat, progress),
 
299
  )
300
  whisper_button.click(
301
  follow_story_whisper,
302
  inputs=(current_mushroom, collection, chat, player_position),
303
  outputs=(current_mushroom, scene, status, discovery, chat),
 
304
  )
305
  study_button.click(
306
  study_discovery,
307
  inputs=(current_mushroom, chat, collection, player_position),
308
  outputs=(current_mushroom, scene, status, discovery, chat),
 
309
  )
310
  eat_button.click(
311
  block_unsafe_eating,
312
  inputs=(current_mushroom, chat),
313
  outputs=(chat,),
 
314
  )
315
 
316
  return demo
 
258
  with gr.Tab("🧭 Guide"):
259
  gr.Markdown(GUIDE_MARKDOWN)
260
 
261
+ start_play_button.click(open_play_tab, outputs=(tabs,), show_progress="hidden")
262
 
263
  search_button.click(
264
  search_forest,
265
  inputs=(collection, player_position),
266
  outputs=(scene, status, discovery, current_mushroom, chat, dex, progress),
267
+ show_progress="hidden",
268
  )
269
  ask_button.click(
270
  ask_companion,
271
  inputs=(prompt, chat, current_mushroom),
272
  outputs=(prompt, chat),
273
+ show_progress="hidden",
274
  )
275
 
276
  for direction, button in (
 
283
  move_player,
284
  inputs=(player_position, gr.State(direction), current_mushroom, collection),
285
  outputs=(player_position, scene, status),
286
+ show_progress="hidden",
287
  )
288
  prompt.submit(
289
  ask_companion,
290
  inputs=(prompt, chat, current_mushroom),
291
  outputs=(prompt, chat),
292
+ show_progress="hidden",
293
  )
294
  collect_button.click(
295
  collect_discovery,
296
  inputs=(current_mushroom, collection, chat, player_position),
297
  outputs=(collection, scene, status, dex, world_map, chat, progress),
298
+ show_progress="hidden",
299
  )
300
  pick_button.click(
301
  pick_discovery,
302
  inputs=(current_mushroom, collection, chat, player_position),
303
  outputs=(collection, current_mushroom, scene, status, discovery, dex, world_map, chat, progress),
304
+ show_progress="hidden",
305
  )
306
  whisper_button.click(
307
  follow_story_whisper,
308
  inputs=(current_mushroom, collection, chat, player_position),
309
  outputs=(current_mushroom, scene, status, discovery, chat),
310
+ show_progress="hidden",
311
  )
312
  study_button.click(
313
  study_discovery,
314
  inputs=(current_mushroom, chat, collection, player_position),
315
  outputs=(current_mushroom, scene, status, discovery, chat),
316
+ show_progress="hidden",
317
  )
318
  eat_button.click(
319
  block_unsafe_eating,
320
  inputs=(current_mushroom, chat),
321
  outputs=(chat,),
322
+ show_progress="hidden",
323
  )
324
 
325
  return demo
ui/renderers.py CHANGED
@@ -207,6 +207,7 @@ def game_status_markdown(
207
  event = "**Event:** waiting for the first omen"
208
  clue_line = mystery_line
209
  thread_line = "**Mystery thread:** The Wrong Memory — search the first clearing."
 
210
  else:
211
  name = current.get("name", "Mystery mushroom")
212
  studied = current.get("studied") == "Yes"
@@ -217,6 +218,7 @@ def game_status_markdown(
217
  objective = "Current objective: **move to the next clearing and search again**."
218
  else:
219
  objective = f"Current objective: **{next_step}**."
 
220
  discovery = f"Active discovery: **{name}** · Rarity: **{current.get('rarity', 'Unknown')}**"
221
  event = f"**Event:** {current.get('event_emoji', '✨')} {current.get('event_title', 'Strange Omen')}"
222
  clue_line = f"**Clue:** {current.get('clue', 'Myco is still listening.')}"
@@ -234,6 +236,7 @@ def game_status_markdown(
234
  f"**Map position:** ({pos_x + 1}, {pos_y + 1})",
235
  discovery,
236
  objective,
 
237
  event,
238
  clue_line,
239
  thread_line,
@@ -243,6 +246,15 @@ def game_status_markdown(
243
  )
244
 
245
 
 
 
 
 
 
 
 
 
 
246
  def mushroom_card(
247
  mushroom: Mushroom | None,
248
  clue: str | None = None,
 
207
  event = "**Event:** waiting for the first omen"
208
  clue_line = mystery_line
209
  thread_line = "**Mystery thread:** The Wrong Memory — search the first clearing."
210
+ bloom_line = f"**Impossible bloom:** {_mystery_bloom_meter(count)}"
211
  else:
212
  name = current.get("name", "Mystery mushroom")
213
  studied = current.get("studied") == "Yes"
 
218
  objective = "Current objective: **move to the next clearing and search again**."
219
  else:
220
  objective = f"Current objective: **{next_step}**."
221
+ bloom_line = f"**Impossible bloom:** {_mystery_bloom_meter(count)}"
222
  discovery = f"Active discovery: **{name}** · Rarity: **{current.get('rarity', 'Unknown')}**"
223
  event = f"**Event:** {current.get('event_emoji', '✨')} {current.get('event_title', 'Strange Omen')}"
224
  clue_line = f"**Clue:** {current.get('clue', 'Myco is still listening.')}"
 
236
  f"**Map position:** ({pos_x + 1}, {pos_y + 1})",
237
  discovery,
238
  objective,
239
+ bloom_line,
240
  event,
241
  clue_line,
242
  thread_line,
 
246
  )
247
 
248
 
249
+ def _mystery_bloom_meter(count: int) -> str:
250
+ """Render mystery progress as a magical bloom, not a generic XP bar."""
251
+ filled = max(0, min(5, count))
252
+ petals = "".join("🌕" if index < filled else "🌑" for index in range(5))
253
+ if filled >= 5:
254
+ return f"{petals} Impossible Bloom visible"
255
+ return f"{petals} {5 - filled} clue-whispers remain"
256
+
257
+
258
  def mushroom_card(
259
  mushroom: Mushroom | None,
260
  clue: str | None = None,
ui/styles.py CHANGED
@@ -284,6 +284,11 @@ APP_CSS = """
284
  padding: 0.45rem 0.65rem;
285
  text-align: center;
286
  }
 
 
 
 
 
287
  #game-shell {
288
  padding: 1rem;
289
  border: 1px solid rgba(255, 244, 190, 0.28);
@@ -326,6 +331,14 @@ APP_CSS = """
326
  font-size: 1.05rem !important;
327
  }
328
 
 
 
 
 
 
 
 
 
329
  #game-shell button {
330
  font-weight: 900 !important;
331
  }
@@ -367,6 +380,9 @@ APP_CSS = """
367
 
368
  .forest-scene {
369
  position: relative;
 
 
 
370
  overflow: hidden;
371
  min-height: 18rem;
372
  padding: 1rem;
 
284
  padding: 0.45rem 0.65rem;
285
  text-align: center;
286
  }
287
+ #game-shell,
288
+ #game-shell * {
289
+ backface-visibility: hidden;
290
+ }
291
+
292
  #game-shell {
293
  padding: 1rem;
294
  border: 1px solid rgba(255, 244, 190, 0.28);
 
331
  font-size: 1.05rem !important;
332
  }
333
 
334
+ #game-shell .generating,
335
+ #game-shell .generating * {
336
+ opacity: 1 !important;
337
+ }
338
+ #game-shell .generating::before,
339
+ #game-shell .generating::after {
340
+ display: none !important;
341
+ }
342
  #game-shell button {
343
  font-weight: 900 !important;
344
  }
 
380
 
381
  .forest-scene {
382
  position: relative;
383
+ isolation: isolate;
384
+ transform: translateZ(0);
385
+ transition: box-shadow 120ms ease, filter 120ms ease;
386
  overflow: hidden;
387
  min-height: 18rem;
388
  padding: 1rem;