coptic-translation-interface / coptic_keyboard.py
Rogaton
fix: Add missing coptic_keyboard module and update UI with LFS
c0bf168
import streamlit as st
COPTIC_LETTERS = [
['Ⲁ', 'Ⲃ', 'Ⲅ', 'Ⲇ', 'Ⲉ', 'Ⲋ', 'Ⲏ', 'Ⲑ', 'Ⲓ', 'Ⲕ'],
['Ⲗ', 'Ⲙ', 'Ⲛ', 'Ⲝ', 'Ⲟ', 'Ⲡ', 'Ⲣ', 'Ⲥ', 'Ⲧ', 'Ⲩ'],
['Ⲫ', 'Ⲭ', 'Ⲯ', 'Ⲱ', 'Ϣ', 'Ϥ', 'Ϧ', 'Ϩ', 'Ϫ', 'Ϭ', 'Ϯ'],
['ⲁ', 'ⲃ', 'ⲅ', 'ⲇ', 'ⲉ', 'ⲋ', 'ⲏ', 'ⲑ', 'ⲓ', 'ⲕ'],
['ⲗ', 'ⲙ', 'ⲛ', 'ⲝ', 'ⲟ', 'ⲡ', 'ⲣ', 'ⲥ', 'ⲧ', 'ⲩ'],
['ⲫ', 'ⲭ', 'ⲯ', 'ⲱ', 'ϣ', 'ϥ', 'ϧ', 'ϩ', 'ϫ', 'ϭ', 'ϯ']
]
def coptic_keyboard(target_key):
if target_key not in st.session_state:
st.session_state[target_key] = ""
for i, row in enumerate(COPTIC_LETTERS):
cols = st.columns(len(row))
for j, letter in enumerate(row):
with cols[j]:
if st.button(letter, key=f"kb_{i}_{j}"):
st.session_state[target_key] += letter
st.rerun()
col1, col2, col3 = st.columns(3)
with col1:
if st.button("Space"):
st.session_state[target_key] += " "
st.rerun()
with col2:
if st.button("⌫"):
st.session_state[target_key] = st.session_state[target_key][:-1]
st.rerun()
with col3:
if st.button("Clear"):
st.session_state[target_key] = ""
st.rerun()