Font selection added. Preference saving/loading improved.
[jben2_gui.git] / tab_prefskanjitest.py
blob628fff36f5640942710742b5fff15b6f05b7e26c
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Project: J-Ben, Python front-end
5 # File: tab_prefskanjitest.py
6 # Author: Paul Goins
7 # Created on: 28 Nov 2008
8 # Note: Original author of this was Alain Bertrand. I fixed some bugs,
9 # ported it to Python and rearranged some things.
11 import gtk
13 class TabPrefsKanjiTest(gtk.VBox):
14 def __init__(self):
15 gtk.VBox.__init__(self, spacing=5)
17 self.chk_reading_onyomi = gtk.CheckButton(_("Show onyomi"))
18 self.chk_reading_kunyomi = gtk.CheckButton(_("Show kunyomi"))
19 self.chk_reading_english = gtk.CheckButton(_("Show English meaning"))
20 reading_vbox = gtk.VBox()
21 reading_vbox.pack_start(self.chk_reading_onyomi, expand=False)
22 reading_vbox.pack_start(self.chk_reading_kunyomi, expand=False)
23 reading_vbox.pack_start(self.chk_reading_english, expand=False)
24 reading_frame = gtk.Frame(_("Reading test"))
25 reading_frame.add(reading_vbox)
27 self.chk_writing_onyomi = gtk.CheckButton(_("Show onyomi"))
28 self.chk_writing_kunyomi = gtk.CheckButton(_("Show kunyomi"))
29 self.chk_writing_english = gtk.CheckButton(_("Show English meaning"))
30 writing_vbox = gtk.VBox()
31 writing_vbox.pack_start(self.chk_writing_onyomi, expand=False)
32 writing_vbox.pack_start(self.chk_writing_kunyomi, expand=False)
33 writing_vbox.pack_start(self.chk_writing_english, expand=False)
34 writing_frame = gtk.Frame(_("Writing test"))
35 writing_frame.add(writing_vbox)
37 label_strs = [_("Correct answer: "), _("Wrong answer: "),
38 _("Show answer: "), _("Stop drill: ")]
39 labels = []
40 for str in label_strs:
41 l = gtk.Label(str)
42 l.set_alignment(0.0, 0.5)
43 labels.append(l)
45 self.ent_correct = gtk.Entry()
46 self.ent_wrong = gtk.Entry()
47 self.ent_show = gtk.Entry()
48 self.ent_stop = gtk.Entry()
49 for o in [self.ent_correct, self.ent_wrong,
50 self.ent_show, self.ent_stop]:
51 o.set_max_length(1)
52 o.set_size_request(30, -1)
54 shortcut_table = gtk.Table(2,4)
55 shortcut_table.set_border_width(5)
56 shortcut_table.set_row_spacings(5)
57 shortcut_table.set_col_spacings(5)
58 shortcut_table.set_col_spacing(1, 20)
59 print("Col spacing: %d" % shortcut_table.get_col_spacing(1))
60 shortcut_table.attach(labels[0], 0,1,0,1, gtk.FILL, gtk.FILL)
61 shortcut_table.attach(self.ent_correct, 1,2,0,1, gtk.FILL, gtk.FILL)
62 shortcut_table.attach(labels[1], 2,3,0,1, gtk.FILL, gtk.FILL)
63 shortcut_table.attach(self.ent_wrong, 3,4,0,1, gtk.FILL, gtk.FILL)
64 shortcut_table.attach(labels[2], 0,1,1,2, gtk.FILL, gtk.FILL)
65 shortcut_table.attach(self.ent_show, 1,2,1,2, gtk.FILL, gtk.FILL)
66 shortcut_table.attach(labels[3], 2,3,1,2, gtk.FILL, gtk.FILL)
67 shortcut_table.attach(self.ent_stop, 3,4,1,2, gtk.FILL, gtk.FILL)
69 shortcut_frame = gtk.Frame(_("Keyboard shortcuts"))
70 shortcut_frame.add(shortcut_table)
72 self.pack_start(reading_frame, expand=False)
73 self.pack_start(writing_frame, expand=False)
74 self.pack_start(shortcut_frame, expand=False)
76 def update_prefs(self):
77 pass