2 # -*- coding: utf-8 -*-
4 # Project: J-Ben, Python front-end
5 # File: dialog_preferences.py
7 # Created on: 28 Nov 2008
12 from widget_storedsize
import StoredSizeDialog
13 from tab_prefskanjidict
import TabPrefsKanjiDict
14 from tab_prefsfonts
import TabPrefsFonts
15 from tab_prefskanjitest
import TabPrefsKanjiTest
16 from tab_prefsother
import TabPrefsOther
18 class DialogPreferences(StoredSizeDialog
):
19 def __init__(self
, parent
):
20 StoredSizeDialog
.__init
__(self
, "gui.preferences.size", -1, -1,
21 _("Preferences Editor"), parent
)
22 self
.set_border_width(5)
24 self
.tab_kanjidict
= TabPrefsKanjiDict()
25 self
.tab_fonts
= TabPrefsFonts()
26 self
.tab_kanjitest
= TabPrefsKanjiTest()
29 tabs
.append_page(self
.tab_kanjidict
, gtk
.Label(_("Kanji Dictionary")))
30 tabs
.append_page(self
.tab_fonts
, gtk
.Label(_("Fonts")))
31 tabs
.append_page(self
.tab_kanjitest
, gtk
.Label(_("Kanji test")))
33 # Not sure what the os.name is under windows; the below is temporary.
35 self
.tab_other
= TabPrefsOther()
36 tabs
.append_page(self
.tab_other
, gtk
.Label("Other"))
38 self
.vbox
.set_spacing(5)
39 self
.vbox
.pack_start(tabs
)
42 self
.ok_button
= gtk
.Button(stock
= gtk
.STOCK_OK
)
43 self
.ok_button
.connect("clicked", self
.on_ok_clicked
)
44 self
.cancel_button
= gtk
.Button(stock
= gtk
.STOCK_CANCEL
)
45 self
.cancel_button
.connect("clicked", self
.on_cancel_clicked
)
47 self
.action_area
.pack_start(self
.cancel_button
)
48 self
.action_area
.pack_start(self
.ok_button
)
49 self
.action_area
.show_all()
51 self
.set_has_separator(False)
53 # Needed: Update function. Updates selected options depending on
54 # currently stored preferences.
57 def on_cancel_clicked(self
, widget
):
58 print "DialogPreferences.on_cancel_clicked"
59 self
.response(gtk
.RESPONSE_CANCEL
)
61 def on_ok_clicked(self
, widget
):
62 print "DialogPreferences.on_ok_clicked"
64 self
.response(gtk
.RESPONSE_OK
)
66 def update_prefs(self
):
67 self
.tab_kanjidict
.update_prefs()
68 self
.tab_fonts
.update_prefs()
69 self
.tab_kanjitest
.update_prefs()
71 self
.tab_other
.update_prefs()
75 # chkMobile.set_active(prefs->GetSetting("config_save_target") == "mobile");