Skip to content

Commit

Permalink
Add option to keep Pokémon cards on one line
Browse files Browse the repository at this point in the history
Closes #37

The option is in the local config, as users might wish to use
different settings on multiple devices.
  • Loading branch information
zjosua committed Nov 19, 2023
1 parent a2796e8 commit e7be98c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pokemanki/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
Version information
"""

__version__ = "1.5.1"
__version__ = "1.6.0"
3 changes: 2 additions & 1 deletion src/pokemanki/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"align_cards": "wrap",
"gen4_evolutions": true,
"gen2": true,
"gen3": true,
"gen4": true,
"gen5": true,
"X_or_Y_mega_evolutions": "X"
}
}
8 changes: 6 additions & 2 deletions src/pokemanki/config.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Generations
If you change the generation configs from `true` to `false`, you may need to reset the pokemons or an error may occur.
- `align_cards` [string]:
`wrap` to start a new row if Pokémon cards don't fit on one line;
`hscroll` to keep them on one line and add a horizontal scroll bar

### Generations
If you change the generation configs from `true` to `false`, you may need to reset the pokemons or an error may occur.
8 changes: 7 additions & 1 deletion src/pokemanki/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ def _show(
txt += '<div class="pk-st-single">'
multi = False
else:
txt += '<div class="pk-st-container">'
conf = get_local_conf()
card_flow = conf.get("align_cards", "wrap")
if card_flow == "wrap":
txt += '<div class="pk-st-container">'
elif card_flow == "hscroll":
txt += '<div class="pk-st-container" style="flex-wrap: nowrap; \
justify-content: flex-start;">'
multi = True

sortedData = sorted(data, key=lambda k: k[2], reverse=True)
Expand Down

0 comments on commit e7be98c

Please sign in to comment.