Skip to content

Commit

Permalink
Improve database schema and usability
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Sep 11, 2024
1 parent 9c9925d commit 031b6e2
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 116 deletions.
4 changes: 2 additions & 2 deletions language-practice
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ Inflection charts are pulled from wiktionary.
import argparse
import sys

from language_practice.gui import GuiApplication
from language_practice.sqlite import SqliteHandle
from language_practice.terminal import TerminalApplication


class Once(argparse.Action):
Expand Down Expand Up @@ -53,9 +51,11 @@ def main():
try:
all_sets = handle.get_all_sets()
if args.gui:
from language_practice.gui import GuiApplication # pylint: disable=import-outside-toplevel
gui = GuiApplication(handle, all_sets)
gui.run()
else:
from language_practice.terminal import TerminalApplication # pylint: disable=import-outside-toplevel
tui = TerminalApplication(handle, all_sets)
tui.run()
except Exception as err: # pylint: disable=broad-exception-caught
Expand Down
4 changes: 2 additions & 2 deletions language_practice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(
aspect: str | None,
usage: str | None,
part_of_speech: str | None,
charts: list[list[list[str]]] | None,
charts: list[list[str]] | None,
repetition: WordRepetition,
):
self.word = word
Expand Down Expand Up @@ -72,7 +72,7 @@ def get_part_of_speech(self) -> str | None:
"""
return self.part_of_speech

def get_charts(self) -> list[list[list[str]]] | None:
def get_charts(self) -> list[list[str]] | None:
"""
Get charts.
"""
Expand Down
5 changes: 4 additions & 1 deletion language_practice/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def delete_flashcard_set(self, button: Gtk.Button):
"""
Handle deleting flashcard set on button press.
"""
self.handle.delete_set(button.get_prev_sibling().get_text())
set_id = self.handle.get_id_from_file_name(button.get_prev_sibling().get_text())
if set_id is not None:
self.handle.delete_set(set_id)
self.flashcard_set_grid.delete_row(button)

def handle_files(self, dialog: Gtk.FileDialog, task: Gio.Task):
Expand Down Expand Up @@ -184,6 +186,7 @@ def delete_row(self, contains_child: Gtk.Button):
"""
info = self.query_child(contains_child)
self.remove_row(info.row)
self.num_rows -= 1

# pylint: disable=unused-argument
def select_all(self, button: Gtk.Button):
Expand Down
Loading

0 comments on commit 031b6e2

Please sign in to comment.