~sir-rainbow/+junk/scribes-on-win

« back to all changes in this revision

Viewing changes to plugins/Preferences/SpellCheckButton.py

  • Committer: lateef
  • Date: 2009-11-07 22:21:32 UTC
  • Revision ID: teef@submission-20091107222132-sfz2ji4nzk130wth
Customize preferences based on source code type. Press F12 to show the new preferences GUI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
class Button(object):
2
 
 
3
 
        def __init__(self, manager, editor):
4
 
                self.__init_attributes(manager, editor)
5
 
                self.__sigid1 = self.__button.connect("toggled", self.__toggled_cb)
6
 
                self.__sigid2 = self.__manager.connect("destroy", self.__destroy_cb)
7
 
                self.__sigid3 = self.__manager.connect("database-update", self.__update_cb)
8
 
                self.__set_properties()
9
 
 
10
 
        def __init_attributes(self, manager, editor):
11
 
                self.__editor = editor
12
 
                self.__manager = manager
13
 
                self.__button = manager.gui.get_widget("SpellCheckButton")
14
 
                return
15
 
 
16
 
        def __destroy(self):
17
 
                self.__editor.disconnect_signal(self.__sigid1, self.__button)
18
 
                self.__editor.disconnect_signal(self.__sigid2, self.__manager)
19
 
                self.__editor.disconnect_signal(self.__sigid3, self.__manager)
20
 
                self.__button.destroy()
21
 
                del self
22
 
                self = None
23
 
                return False
24
 
 
25
 
        def __update(self):
26
 
                self.__button.handler_block(self.__sigid1)
27
 
                from SpellCheckMetadata import get_value
28
 
                self.__button.set_active(get_value())
29
 
                self.__button.handler_unblock(self.__sigid1)
30
 
                return 
31
 
 
32
 
        def __set(self):
33
 
                from SpellCheckMetadata import set_value
34
 
                set_value(self.__button.get_active())
35
 
                return 
36
 
 
37
 
        def __set_properties(self):
38
 
                self.__update()
39
 
                return
40
 
 
41
 
        def __toggled_cb(self, *args):
42
 
                self.__set()
43
 
                return True
44
 
 
45
 
        def __update_cb(self, *args):
46
 
                self.__update()
47
 
                return False
48
 
 
49
 
        def __destroy_cb(self, *args):
50
 
                self.__destroy()
51
 
                return