2 # -*- coding: utf-8 -*-
4 # Project: J-Ben, Python front-end
5 # File: dialog_vocablisteditor.py
7 # Created on: 26 Nov 2008
10 from widget_storedsize
import StoredSizeDialog
12 class DialogVocabListEditor(StoredSizeDialog
):
13 def __init__(self
, parent
):
14 StoredSizeDialog
.__init
__(self
, "gui.vocablisteditor.size", -1, -1,
15 _("Vocab List Editor"), parent
)
17 self
.edit_box
= gtk
.TextView()
18 self
.edit_box
.set_accepts_tab(False)
19 self
.edit_box
.set_wrap_mode(gtk
.WRAP_WORD_CHAR
)
20 self
.edit_box
.get_buffer().connect("changed", self
.on_text_changed
)
22 edit_window
= gtk
.ScrolledWindow()
23 edit_window
.set_shadow_type(gtk
.SHADOW_IN
)
24 edit_window
.set_policy(gtk
.POLICY_AUTOMATIC
, gtk
.POLICY_AUTOMATIC
)
25 edit_window
.add(self
.edit_box
)
27 self
.vbox
.set_spacing(5)
28 self
.vbox
.pack_start(edit_window
)
31 self
.ok_button
= gtk
.Button(stock
= gtk
.STOCK_OK
)
32 self
.ok_button
.connect("clicked", self
.on_ok_clicked
)
33 self
.cancel_button
= gtk
.Button(stock
= gtk
.STOCK_CANCEL
)
34 self
.cancel_button
.connect("clicked", self
.on_cancel_clicked
)
35 self
.apply_button
= gtk
.Button(stock
= gtk
.STOCK_APPLY
)
36 self
.apply_button
.connect("clicked", self
.on_apply_clicked
)
38 self
.action_area
.pack_start(self
.cancel_button
)
39 self
.action_area
.pack_start(self
.apply_button
)
40 self
.action_area
.pack_start(self
.ok_button
)
41 self
.action_area
.show_all()
43 self
.set_has_separator(False)
45 def on_text_changed(self
, widget
):
46 print "DialogVocabListEditor.on_text_changed"
48 def on_cancel_clicked(self
, widget
):
49 print "DialogVocabListEditor.on_cancel_clicked"
50 self
.response(gtk
.RESPONSE_CANCEL
)
52 def on_apply_clicked(self
, widget
):
53 print "DialogVocabListEditor.on_apply_clicked"
55 def on_ok_clicked(self
, widget
):
56 print "DialogVocabListEditor.on_ok_clicked"
57 self
.response(gtk
.RESPONSE_OK
)