Skip to content

Commit

Permalink
Added tags feature and many fixes + improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedmujtabaraza committed Apr 7, 2022
1 parent da570db commit 245c95c
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 58 deletions.
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# /storage/emulate/0/Download
# '/storage/emulated/0/Android/data/org.test.vocabtoanki/files/media/'
# settings_path /data/user/0/org.test.vocabtoanki/files
# /data/user/0/org.test.vocabtoanki/files
# https://pyjnius.readthedocs.io/en/stable/android.html
# plyer
# https://python-for-android.readthedocs.io/en/latest/apis/
Expand Down Expand Up @@ -53,8 +54,10 @@
import ssl

from src.app import MyApp
from src.db import connection
from src.lib.helpers import get_root_path


if __name__ == '__main__':
if 'ANDROID_STORAGE' in os.environ:
try:
Expand All @@ -72,3 +75,5 @@
for f in mp3_files:
os.remove(f)
os.remove(root_path + 'output.apkg')

connection.close()
Binary file modified src/__pycache__/app.cpython-38.pyc
Binary file not shown.
75 changes: 55 additions & 20 deletions src/app.kv
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ScreenManager:
id: dict_dropdown
text: get_text("browse_button")
font_style: 'Button'
pos_hint: {"center_x": 0.5, 'center_y': 0.85}
on_release: root.open_dropdown(dict_dropdown=True)
pos_hint: {"center_x": 0.5, 'center_y': 0.89}
on_release: root.open_dictionary_dropdown()
MDTextField:
id: word_input
text: get_text("sample_url")
Expand All @@ -59,40 +59,70 @@ ScreenManager:
# icon_right: get_text('paste_icon')
# icon_right_color: app.theme_cls.primary_color
size_hint: (.75, .1)
pos_hint: {'center_x': 0.45, 'center_y': 0.7}
pos_hint: {'center_x': 0.45, 'center_y': 0.72}
MDIconButton:
icon: get_text('paste_icon')
pos_hint: {"center_x": .9, "center_y": .7}
pos_hint: {"center_x": .9, "center_y": .72}
on_release: word_input.text = Clipboard.paste()
# MDLabel:
# text: get_text("chose_accent")
# theme_text_color: 'Primary'
# font_style: 'Body1'
# halign: 'center'
# pos_hint: {'center_x': 0.5, 'center_y': 0.58}
GridLayout:
cols: 2
row_force_default: True
row_default_height: 40
col_force_default: True
col_default_width: 180
pos_hint: {'center_x': 0.39, 'center_y': 0.5}
size_hint: (None, .1)
MDLabel:
text: get_text("en_uk")
# GridLayout:
# cols: 2
# row_force_default: True
# row_default_height: 40
# col_force_default: True
# col_default_width: 180
# pos_hint: {'center_x': 0.39, 'center_y': 0.5}
# size_hint: (None, .1)
MDTextField:
id: tags_input
padding: "10dp"
multiline: False
hint_text: get_text("tag_info")
helper_text: f"ex: {get_text('sample_tags')}"
helper_text_mode: "on_focus"
icon_left: get_text('tag_icon')
# icon_left_color: 'red'
size_hint: (.75, .1)
pos_hint: {'center_x': 0.45, 'center_y': 0.58}
on_focus: root.tags_input_focus_mode(self.focus)
BoxLayout:
orientation: 'horizontal'
size_hint: (.9, .3)
pos_hint: {"center_x": .54, "center_y": .42}
Check:
id: check_uk
width: 36
pos_hint: {"center_x": .12, "center_y": .4}
on_active: root.checkbox_click(self, self.active, "co.uk")
MDLabel:
text: get_text("en_us")
width: 152
pos_hint: {"center_x": .12, "center_y": .4}
text: f'[ref=uk]{get_text("en_uk")}[/ref]'
markup: True
on_ref_press: root.check_it_down(*args)
Check:
id: check_us
width: 36
pos_hint: {"center_x": .25, "center_y": .4}
active: True
on_active: root.checkbox_click(self, self.active, "com")
MDLabel:
width: 152
pos_hint: {"center_x": .25, "center_y": .4}
text: f'[ref=us]{get_text("en_us")}[/ref]'
markup: True
on_ref_press: root.check_it_down(*args)
MDRectangleFlatButton:
text: get_text("generate_flashcards")
font_style: 'Button'
pos_hint: {'center_x': 0.5, 'center_y': 0.25}
pos_hint: {'center_x': 0.5, 'center_y': 0.2}
on_press: root.dialog_popup(get_text("finding_meanings"), choice(get_text("funny_loading_messages")))
on_release: root.show_data()
on_release: root.show_meanings()


<MeaningsScreen>:
Expand Down Expand Up @@ -143,8 +173,13 @@ ScreenManager:
adaptive_height: True

<MeaningMDCheckbox>
size_hint: (None, 1)
size: (48, 74)
width: 74
size_hint: (.12, 1)
# size: (48, 74)
# width: 74
pos_hint: {'center_x': .5, 'center_y': .5}
on_active: root.on_checkbox_active(*args)

<IconListItem>

IconLeftWidget:
icon: root.icon
Loading

0 comments on commit 245c95c

Please sign in to comment.