Spaces:
Running
Running
Alejandro Cremades
commited on
Commit
•
dc2bac2
1
Parent(s):
243694b
Add color checkboxes to card search
Browse files- Middle_School_Card_Search.py +24 -1
- streamlit_common/locale.py +28 -0
Middle_School_Card_Search.py
CHANGED
@@ -45,8 +45,31 @@ results_en_df = results_df[results_df["name"].str.contains(input_name, case=Fals
|
|
45 |
results_ja_df = results_df[results_df["name_ja"].str.contains(input_name, case=False)]
|
46 |
results_df = results_en_df.merge(results_ja_df, how="outer")
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
|
|
50 |
# Filter by type (select)
|
51 |
select_types = col1.multiselect(
|
52 |
_["search"]["select_type"][l],
|
|
|
45 |
results_ja_df = results_df[results_df["name_ja"].str.contains(input_name, case=False)]
|
46 |
results_df = results_en_df.merge(results_ja_df, how="outer")
|
47 |
|
48 |
+
# Filter by color
|
49 |
+
(
|
50 |
+
colorcol0,
|
51 |
+
colorcol1,
|
52 |
+
colorcol2,
|
53 |
+
colorcol3,
|
54 |
+
colorcol4,
|
55 |
+
colorcol5,
|
56 |
+
colorcol6,
|
57 |
+
) = st.columns(7)
|
58 |
+
colorcol0.write(_["search"]["search_by_color"][l])
|
59 |
+
if colorcol1.checkbox(_["search"]["color_w"][l]):
|
60 |
+
results_df = results_df[results_df["w"] == True]
|
61 |
+
if colorcol2.checkbox(_["search"]["color_u"][l]):
|
62 |
+
results_df = results_df[results_df["u"] == True]
|
63 |
+
if colorcol3.checkbox(_["search"]["color_b"][l]):
|
64 |
+
results_df = results_df[results_df["b"] == True]
|
65 |
+
if colorcol4.checkbox(_["search"]["color_r"][l]):
|
66 |
+
results_df = results_df[results_df["r"] == True]
|
67 |
+
if colorcol5.checkbox(_["search"]["color_g"][l]):
|
68 |
+
results_df = results_df[results_df["g"] == True]
|
69 |
+
if colorcol6.checkbox(_["search"]["color_c"][l]):
|
70 |
+
results_df = results_df[results_df["c"] == True]
|
71 |
|
72 |
+
col1, col2 = st.columns(2)
|
73 |
# Filter by type (select)
|
74 |
select_types = col1.multiselect(
|
75 |
_["search"]["select_type"][l],
|
streamlit_common/locale.py
CHANGED
@@ -30,6 +30,34 @@ def get_locale():
|
|
30 |
"en": "is an exact match.",
|
31 |
"ja": "が完全一致します。",
|
32 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
"cards_found": {
|
34 |
"en": " cards were found.",
|
35 |
"ja": "枚 のカードが見つかりました。",
|
|
|
30 |
"en": "is an exact match.",
|
31 |
"ja": "が完全一致します。",
|
32 |
},
|
33 |
+
"search_by_color": {
|
34 |
+
"en": "Color:",
|
35 |
+
"ja": "色:",
|
36 |
+
},
|
37 |
+
"color_w": {
|
38 |
+
"en": "W",
|
39 |
+
"ja": "白",
|
40 |
+
},
|
41 |
+
"color_u": {
|
42 |
+
"en": "U",
|
43 |
+
"ja": "青",
|
44 |
+
},
|
45 |
+
"color_b": {
|
46 |
+
"en": "B",
|
47 |
+
"ja": "黒",
|
48 |
+
},
|
49 |
+
"color_r": {
|
50 |
+
"en": "R",
|
51 |
+
"ja": "赤",
|
52 |
+
},
|
53 |
+
"color_g": {
|
54 |
+
"en": "G",
|
55 |
+
"ja": "緑",
|
56 |
+
},
|
57 |
+
"color_c": {
|
58 |
+
"en": "C",
|
59 |
+
"ja": "無/茶",
|
60 |
+
},
|
61 |
"cards_found": {
|
62 |
"en": " cards were found.",
|
63 |
"ja": "枚 のカードが見つかりました。",
|