From b2c947eb8b5a6ac012ae53d11f78f346b3a3230b Mon Sep 17 00:00:00 2001 From: Eevee Date: Thu, 19 Aug 2010 20:48:34 -0700 Subject: [PATCH] Giant amazing UI overhaul of the stored list. --- splinext/gts/controllers/gts_browse.py | 2 + splinext/gts/templates/css/gts.mako | 5 + splinext/gts/templates/gts/list.mako | 308 +++++++++++++++++---------------- 3 files changed, 165 insertions(+), 150 deletions(-) diff --git a/splinext/gts/controllers/gts_browse.py b/splinext/gts/controllers/gts_browse.py index 09a398b..acd6d15 100644 --- a/splinext/gts/controllers/gts_browse.py +++ b/splinext/gts/controllers/gts_browse.py @@ -14,6 +14,7 @@ from spline.model import meta from spline.lib.base import BaseController, render from spline.lib import helpers as h from splinext.gts import model as gts_model +from splinext.pokedex.db import pokedex_session log = logging.getLogger(__name__) @@ -27,6 +28,7 @@ class GTSBrowseController(BaseController): c.savefiles = [] for gts_pokemon in gts_pokemons: savefile = SaveFilePokemon(gts_pokemon.pokemon_blob) + savefile.use_database_session(pokedex_session) c.savefiles.append(savefile) return render('/gts/list.mako') diff --git a/splinext/gts/templates/css/gts.mako b/splinext/gts/templates/css/gts.mako index 9a21ba1..bea10fd 100644 --- a/splinext/gts/templates/css/gts.mako +++ b/splinext/gts/templates/css/gts.mako @@ -9,4 +9,9 @@ .gts-pokemon ul.gts-pokemon-markings li { display: inline; } .gts-pokemon ul.gts-pokemon-ribbons li { display: inline; } .gts-pokemon ul.gts-pokemon-leaves li { display: inline-block; width: 16px; height: 16px; } +.gts-pokemon .gts-pokemon-columns { margin-bottom: 1em; } .gts-pokemon .gts-pokemon-columns table tbody th { text-align: left; } +.gts-pokemon .gts-pokemon-columns table .gts-bar-container { width: 3em; } + +.gts-bar-container { width: 12em; line-height: 1.5; border: 1px solid #d8d8d8; background: #f0f0f0; } +.gts-bar { font-size: 0.8em; min-height: 1em; white-space: nowrap; background: #d8d8d8; } diff --git a/splinext/gts/templates/gts/list.mako b/splinext/gts/templates/gts/list.mako index a94259b..4f8878a 100644 --- a/splinext/gts/templates/gts/list.mako +++ b/splinext/gts/templates/gts/list.mako @@ -1,4 +1,5 @@ <%inherit file="/base.mako" /> +<%namespace name="dexlib" file="/pokedex/lib.mako"/> <%def name="title()">Stored Pokémon @@ -7,9 +8,9 @@ % if savefile.structure.ivs.is_egg: ${h.pokedex.pokedex_img("heartgold-soulsilver/egg.png", class_='icon')} % else: - ${h.pokedex.pokedex_img("heartgold-soulsilver/{0}{1}.png".format( - 'shiny/' if savefile.is_shiny else '', - savefile.structure.national_id), + ${h.pokedex.pokemon_sprite(savefile.species, + form=savefile.structure.alternate_form, + prefix='heartgold-soulsilver/' + ('shiny/' if savefile.is_shiny else ''), class_='icon')} % endif
@@ -17,8 +18,7 @@ % if savefile.structure.ivs.is_nicknamed: “${savefile.structure.nickname}” % else: - ## XXX pokemon name - ${savefile.structure.nickname} + ${savefile.species.full_name} % endif % if savefile.structure.gender == 'male': @@ -29,9 +29,6 @@ ∅ % endif - % if savefile.structure.alternate_form: - ~ ${savefile.structure.alternate_form} - % endif
${savefile.structure.personality}
@@ -39,158 +36,157 @@
+ ## Met stuff

Original trainer: ${savefile.structure.original_trainer_name} ${u'♂' if savefile.structure.original_trainer_gender == 'male' else u'♀'} ${savefile.structure.original_country}, - ID ${savefile.structure.original_trainer_id} - / ${savefile.structure.original_trainer_secret_id} + ID ${"%05d" % savefile.structure.original_trainer_id} + / ${"%05d" % savefile.structure.original_trainer_secret_id}

- % if savefile.structure.date_egg_received == savefile.structure.date_met: - Born and hatched on ${savefile.structure.date_egg_received} - % elif savefile.structure.date_egg_received: - Born on ${savefile.structure.date_egg_received}; - hatched on ${savefile.structure.date_met}) + ${h.pokedex.pokedex_img("items/%s.png" % h.pokedex.filename_from_name(savefile.pokeball.name), + alt=savefile.pokeball.name, title=savefile.pokeball.name)} + % if savefile.structure.date_egg_received: + Egg received on ${savefile.structure.date_egg_received} around ${savefile.egg_location.name}. + Hatched on ${savefile.structure.date_met} around ${savefile.met_location.name} at level 1. % else: - [${savefile.structure.dppt_pokeball} ${savefile.structure.hgss_pokeball}] - Caught on ${savefile.structure.date_met} - at level ${savefile.structure.met_at_level} + Encountered via ${savefile.structure.encounter_type} + and caught on ${savefile.structure.date_met} + around + ${h.pokedex.pokedex_img("versions/{0}.png".format(savefile.structure.original_version))} + ${savefile.met_location.name} + at level ${savefile.structure.met_at_level}. % endif +

- at place number ${savefile.structure.dp_met_location_id} - or maybe ${savefile.structure.dp_egg_location_id} - orrrr ${savefile.structure.pt_met_location_id} - or???? ${savefile.structure.pt_egg_location_id} - ${h.pokedex.pokedex_img("versions/{0}.png".format(savefile.structure.original_version))} - - ps was a ${savefile.structure.encounter_type} - % if savefile.structure.fateful_encounter: - also fateful + ## Ribbons + -

Stats

-
-
Experience
-
${savefile.structure.exp}
-
Happiness
-
${savefile.structure.happiness}
-
Held item
-
${savefile.structure.held_item_id}
-
Ability
-
${savefile.structure.ability_id}
-
Pokérus
-
${savefile.structure.pokerus}
-
Markings
-
-
    - % if savefile.structure.markings.heart: -
  • - % else: -
  • - % endif - % if savefile.structure.markings.diamond: -
  • - % else: -
  • - % endif - % if savefile.structure.markings.triangle: -
  • - % else: -
  • - % endif - % if savefile.structure.markings.square: -
  • - % else: -
  • - % endif - % if savefile.structure.markings.star: -
  • - % else: -
  • - % endif - % if savefile.structure.markings.circle: -
  • + ## Shiny leaves + % if savefile.structure.shining_leaves.crown: +

    ${h.pokedex.pokedex_img('chrome/leaf-crown.png', alt='Leaf Crown', title='Leaf Crown')}

    + % elif any(savefile.shiny_leaves): +
      + % for leaf in savefile.shiny_leaves: +
    • + % if leaf: + ${h.pokedex.pokedex_img('chrome/shiny-leaf.png', alt='Shiny Leaf', title='Shiny Leaf')} + % endif +
    • + % endfor +
    + % endif + + <%! from pokedex import formulae %>\ +
    +
    +
      +
    • Level ${savefile.level}: ${savefile.structure.exp} EXP
    • + % if savefile.exp_to_next: +
    • +
      +
       ${savefile.exp_to_next} to level ${savefile.level + 1}
      +
      +
    • + % endif +
    • Has ${savefile.ability.name}
    • +
    • + % if savefile.held_item: + Holding ${h.pokedex.item_link(savefile.held_item)} % else: -
    • + Holding nothing % endif -
    -
-
Shiny leaves
-
- % if savefile.structure.shining_leaves.crown: - ${h.pokedex.pokedex_img('chrome/leaf-crown.png', alt='Leaf Crown', title='Leaf Crown')} - % else: -
    - % for leaf_n in range(1, 6): -
  • - % if savefile.structure.shining_leaves['leaf' + str(leaf_n)]: - ${h.pokedex.pokedex_img('chrome/shiny-leaf.png', alt='Shiny Leaf', title='Shiny Leaf')} - % endif -
  • - % endfor -
+ +
  • +
    +
     ${savefile.structure.happiness} happiness
    +
    +
  • + + % if savefile.structure.fateful_encounter: +
  • fateful encounter
  • + % endif + % if savefile.structure.pokerus: +
  • PokéRUS! ${savefile.structure.pokerus}
  • % endif -
    -
    Ribbons
    -
    -
      - % for region, ribbon_container in ('hoenn', savefile.structure.hoenn_ribbons), \ - ('sinnoh', savefile.structure.sinnoh_ribbons), \ - ('sinnoh', savefile.structure.sinnoh_contest_ribbons): - % for ribbon in reversed(ribbon_container.__attrs__): - % if ribbon_container[ribbon]: -
    • ${h.pokedex.pokedex_img("ribbons/{0}/{1}.png".format(region, ribbon.replace(u'_', u'-')), alt=ribbon.replace(u'_', u' ').title(), title=ribbon.replace(u'_', u' ').title())}
    • - % endif - % endfor - % endfor -
    -
    -
    -
    +
  • +
      + % if savefile.structure.markings.heart: +
    • + % else: +
    • + % endif + % if savefile.structure.markings.diamond: +
    • + % else: +
    • + % endif + % if savefile.structure.markings.triangle: +
    • + % else: +
    • + % endif + % if savefile.structure.markings.square: +
    • + % else: +
    • + % endif + % if savefile.structure.markings.star: +
    • + % else: +
    • + % endif + % if savefile.structure.markings.circle: +
    • + % else: +
    • + % endif +
    +
  • + +
    - + + + + % for stat_info in savefile.stats: - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + % endfor
    StatBase Gene ExpCalc
    HP${savefile.structure.ivs.iv_hp}${savefile.structure.effort_hp}
    Attack${savefile.structure.ivs.iv_attack}${savefile.structure.effort_attack}
    Defense${savefile.structure.ivs.iv_defense}${savefile.structure.effort_defense}
    Special Attack${savefile.structure.ivs.iv_special_attack}${savefile.structure.effort_special_attack}
    Special Defense${savefile.structure.ivs.iv_special_defense}${savefile.structure.effort_special_defense}
    Speed${savefile.structure.ivs.iv_speed}${savefile.structure.effort_speed}${stat_info.stat.name}${stat_info.base} +
    +
     ${stat_info.gene}
    +
    +
    +
    +
     ${stat_info.exp}
    +
    +
    ${stat_info.calc}
    @@ -198,40 +194,52 @@ - - - + - % for i in range(1, 5): + % for contest_stat in ('beauty', 'cool', 'cute', 'smart', 'tough'): - - - + + % endfor + + + +
    move_idpppp_upsContest stats
    ${savefile.structure['move' + str(i) + '_id']}${savefile.structure['move' + str(i) + '_pp']}${savefile.structure['move' + str(i) + '_pp_ups']}${h.pokedex.pokedex_img("chrome/contest/{0}.png".format(contest_stat))} +
    +
     ${savefile.structure['contest_' + contest_stat]}
    +
    +
    Sheen +
    +
     ${savefile.structure.contest_sheen}
    +
    +
    -
    - + + + ## Moves +
    + ${dexlib.move_table_columns()} - - + ${dexlib.move_table_header()} - % for contest_stat in ('beauty', 'cool', 'cute', 'smart', 'tough'): + % for move, pp in zip(savefile.moves, savefile.move_pp): - - + % if move: + ${dexlib.move_table_row(move, pp_override=pp)} + % else: + ${dexlib.move_table_blank_row()} + % endif % endfor -
    ${contest_stat}${savefile.structure['contest_' + contest_stat]}
    -
    - + % endfor -- 2.7.4