freemt
commited on
Commit
Β·
78bc728
1
Parent(s):
57208b4
Update settings.py state.ns.sourcecount
Browse files- app.py +6 -2
- litbee/app-.py +1 -1
- litbee/app.py +7 -3
- litbee/fetch_upload.py +2 -2
- litbee/home.py +2 -2
- litbee/settings.py +50 -30
app.py
CHANGED
@@ -118,7 +118,7 @@ loggu.add(
|
|
118 |
|
119 |
# from PIL import Image
|
120 |
# page_icon=Image.open("icon.ico"),
|
121 |
-
st.set_page_config(
|
122 |
page_title=f"litbee v{__version__}",
|
123 |
# page_icon="π§",
|
124 |
page_icon="π",
|
@@ -134,6 +134,7 @@ pd.options.display.float_format = "{:,.2f}".format
|
|
134 |
_ = dict(
|
135 |
beetype="ezbee",
|
136 |
sourcetype="upload",
|
|
|
137 |
src_filename="",
|
138 |
tgt_filename="",
|
139 |
src_fileio=b"",
|
@@ -179,7 +180,10 @@ def main():
|
|
179 |
# The main app
|
180 |
app.run()
|
181 |
|
182 |
-
st.markdown(f"""<div class="text"> run: {state.ns.count}</div>""", unsafe_allow_html=True)
|
|
|
|
|
|
|
183 |
loggu.debug(f" run: {state.ns.count}")
|
184 |
state.ns.count += 1
|
185 |
|
|
|
118 |
|
119 |
# from PIL import Image
|
120 |
# page_icon=Image.open("icon.ico"),
|
121 |
+
st.set_page_config( # type: ignore
|
122 |
page_title=f"litbee v{__version__}",
|
123 |
# page_icon="π§",
|
124 |
page_icon="π",
|
|
|
134 |
_ = dict(
|
135 |
beetype="ezbee",
|
136 |
sourcetype="upload",
|
137 |
+
sourcecount=2,
|
138 |
src_filename="",
|
139 |
tgt_filename="",
|
140 |
src_fileio=b"",
|
|
|
180 |
# The main app
|
181 |
app.run()
|
182 |
|
183 |
+
# st.markdown(f"""<div class="text"> run: {state.ns.count}</div>""", unsafe_allow_html=True)
|
184 |
+
|
185 |
+
if set_loglevel() <= 10:
|
186 |
+
st.markdown(state.ns.count)
|
187 |
loggu.debug(f" run: {state.ns.count}")
|
188 |
state.ns.count += 1
|
189 |
|
litbee/app-.py
CHANGED
@@ -100,7 +100,7 @@ loggu.add(
|
|
100 |
|
101 |
# from PIL import Image
|
102 |
# page_icon=Image.open("icon.ico"),
|
103 |
-
st.set_page_config(
|
104 |
page_title=f"litbee v{__version__}",
|
105 |
# page_icon="π§",
|
106 |
page_icon="π",
|
|
|
100 |
|
101 |
# from PIL import Image
|
102 |
# page_icon=Image.open("icon.ico"),
|
103 |
+
st.set_page_config( # type: ignore
|
104 |
page_title=f"litbee v{__version__}",
|
105 |
# page_icon="π§",
|
106 |
page_icon="π",
|
litbee/app.py
CHANGED
@@ -118,11 +118,11 @@ loggu.add(
|
|
118 |
|
119 |
# from PIL import Image
|
120 |
# page_icon=Image.open("icon.ico"),
|
121 |
-
st.set_page_config(
|
122 |
page_title=f"litbee v{__version__}",
|
123 |
# page_icon="π§",
|
124 |
page_icon="π",
|
125 |
-
layout="wide",
|
126 |
initial_sidebar_state="auto", # "auto" or "expanded" or "collapsed",
|
127 |
menu_items=menu_items,
|
128 |
)
|
@@ -134,6 +134,7 @@ pd.options.display.float_format = "{:,.2f}".format
|
|
134 |
_ = dict(
|
135 |
beetype="ezbee",
|
136 |
sourcetype="upload",
|
|
|
137 |
src_filename="",
|
138 |
tgt_filename="",
|
139 |
src_fileio=b"",
|
@@ -179,7 +180,10 @@ def main():
|
|
179 |
# The main app
|
180 |
app.run()
|
181 |
|
182 |
-
st.markdown(f"""<div class="text"> run: {state.ns.count}</div>""", unsafe_allow_html=True)
|
|
|
|
|
|
|
183 |
loggu.debug(f" run: {state.ns.count}")
|
184 |
state.ns.count += 1
|
185 |
|
|
|
118 |
|
119 |
# from PIL import Image
|
120 |
# page_icon=Image.open("icon.ico"),
|
121 |
+
st.set_page_config( # type: ignore
|
122 |
page_title=f"litbee v{__version__}",
|
123 |
# page_icon="π§",
|
124 |
page_icon="π",
|
125 |
+
# layout="wide",
|
126 |
initial_sidebar_state="auto", # "auto" or "expanded" or "collapsed",
|
127 |
menu_items=menu_items,
|
128 |
)
|
|
|
134 |
_ = dict(
|
135 |
beetype="ezbee",
|
136 |
sourcetype="upload",
|
137 |
+
sourcecount=2,
|
138 |
src_filename="",
|
139 |
tgt_filename="",
|
140 |
src_fileio=b"",
|
|
|
180 |
# The main app
|
181 |
app.run()
|
182 |
|
183 |
+
# st.markdown(f"""<div class="text"> run: {state.ns.count}</div>""", unsafe_allow_html=True)
|
184 |
+
|
185 |
+
if set_loglevel() <= 10:
|
186 |
+
st.markdown(state.ns.count)
|
187 |
loggu.debug(f" run: {state.ns.count}")
|
188 |
state.ns.count += 1
|
189 |
|
litbee/fetch_upload.py
CHANGED
@@ -240,12 +240,12 @@ def fetch_upload(): # noqa
|
|
240 |
|
241 |
else:
|
242 |
try:
|
243 |
-
filename = inspect.currentframe().f_code.co_filename
|
244 |
except Exception as e:
|
245 |
logger.error(e)
|
246 |
filename = ""
|
247 |
try:
|
248 |
-
lineno = inspect.currentframe().f_lineno
|
249 |
except Exception as e:
|
250 |
logger.error(e)
|
251 |
lineno = ""
|
|
|
240 |
|
241 |
else:
|
242 |
try:
|
243 |
+
filename = inspect.currentframe().f_code.co_filename # type: ignore
|
244 |
except Exception as e:
|
245 |
logger.error(e)
|
246 |
filename = ""
|
247 |
try:
|
248 |
+
lineno = inspect.currentframe().f_lineno # type: ignore
|
249 |
except Exception as e:
|
250 |
logger.error(e)
|
251 |
lineno = ""
|
litbee/home.py
CHANGED
@@ -240,12 +240,12 @@ def home(): # noqa
|
|
240 |
|
241 |
else:
|
242 |
try:
|
243 |
-
filename = inspect.currentframe().f_code.co_filename
|
244 |
except Exception as e:
|
245 |
logger.error(e)
|
246 |
filename = ""
|
247 |
try:
|
248 |
-
lineno = inspect.currentframe().f_lineno
|
249 |
except Exception as e:
|
250 |
logger.error(e)
|
251 |
lineno = ""
|
|
|
240 |
|
241 |
else:
|
242 |
try:
|
243 |
+
filename = inspect.currentframe().f_code.co_filename # type: ignore
|
244 |
except Exception as e:
|
245 |
logger.error(e)
|
246 |
filename = ""
|
247 |
try:
|
248 |
+
lineno = inspect.currentframe().f_lineno # type: ignore
|
249 |
except Exception as e:
|
250 |
logger.error(e)
|
251 |
lineno = ""
|
litbee/settings.py
CHANGED
@@ -21,40 +21,60 @@ def settings():
|
|
21 |
beetype_list = ["ezbee", "dzbee", "debee", "xbee"]
|
22 |
|
23 |
# col1, col2 = st.columns([24, 21]) # 4*6, 3*7
|
24 |
-
col1, col2 = st.columns(2)
|
25 |
-
|
26 |
-
with col1:
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
sourcetype
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
# show state.ns[:6]
|
54 |
loggu.debug(f" state.ns.list: {state.ns.list}")
|
55 |
|
56 |
-
# beetype, sourcetype, filename1, filename2
|
57 |
-
_ = map(partial(getattr, state.ns), state.ns.list[:
|
58 |
logger.debug(" state.ns.list[:3]: %s", str([*_]))
|
59 |
|
60 |
# st.write(f"run: {state.ns.count}")
|
|
|
21 |
beetype_list = ["ezbee", "dzbee", "debee", "xbee"]
|
22 |
|
23 |
# col1, col2 = st.columns([24, 21]) # 4*6, 3*7
|
24 |
+
# col1, col2 = st.columns(2)
|
25 |
+
|
26 |
+
# with col1:
|
27 |
+
try:
|
28 |
+
index = beetype_list.index(state.ns.beetype)
|
29 |
+
except Exception as e:
|
30 |
+
logger.error("beetype index error: %s, setting to 0", e)
|
31 |
+
index = 0
|
32 |
+
beetype = st.radio(
|
33 |
+
"Pick a bee",
|
34 |
+
beetype_list,
|
35 |
+
index=index,
|
36 |
+
format_func=lambda x: f"{x:<7} |",
|
37 |
+
help="ezbee: english-chinese; dzbee: german-chinese, debee: german-english",
|
38 |
+
)
|
39 |
+
state.ns.beetype = beetype
|
40 |
+
|
41 |
+
# with col2:
|
42 |
+
try:
|
43 |
+
index = sourcetype_list.index(state.ns.sourcetype)
|
44 |
+
except Exception as e:
|
45 |
+
logger.error("sourcetype index error: %s, setting to 0", e)
|
46 |
+
index = 0
|
47 |
+
sourcetype = st.radio(
|
48 |
+
"Source",
|
49 |
+
sourcetype_list,
|
50 |
+
index=index,
|
51 |
+
format_func=lambda x: f"{x:<8} |",
|
52 |
+
help="upload: one or two files; paste: from clipboard; urls: from the net",
|
53 |
+
disabled=True,
|
54 |
+
)
|
55 |
+
state.ns.sourcetype = sourcetype
|
56 |
+
|
57 |
+
sourcecount_list = [2, 1]
|
58 |
+
try:
|
59 |
+
index = sourcecount_list.index(state.ns.sourcecount)
|
60 |
+
except Exception as e:
|
61 |
+
logger.error("sourcecount index error: %s, setting to 0", e)
|
62 |
+
index = 0
|
63 |
+
sourcecount = st.radio(
|
64 |
+
"Source Count",
|
65 |
+
sourcecount_list,
|
66 |
+
index=index,
|
67 |
+
format_func=lambda x: f"{x:<3} |",
|
68 |
+
help="2: two separate sources (files/paste/urls), each containing one language; 1: one mixed source (file/pate/url) containing both languages",
|
69 |
+
disabled=True,
|
70 |
+
)
|
71 |
+
state.ns.sourcecount = sourcecount
|
72 |
|
73 |
# show state.ns[:6]
|
74 |
loggu.debug(f" state.ns.list: {state.ns.list}")
|
75 |
|
76 |
+
# beetype, sourcetype, sourcecount, filename1, filename2
|
77 |
+
_ = map(partial(getattr, state.ns), state.ns.list[:5])
|
78 |
logger.debug(" state.ns.list[:3]: %s", str([*_]))
|
79 |
|
80 |
# st.write(f"run: {state.ns.count}")
|