2
# PyNotConfig - Awn Notification/system tray config manager.
4
# Copyright (C) 2008 Nathan Howard (triggerhapp@googlemail.com)
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
28
glade_file = os.path.join(os.path.dirname(__file__), "pynot-rgba.glade")
30
global D_CUSTOM_Y, D_HIGH, D_ICONSIZE
35
awn_options = awn.Config("pynot-rgba", None)
37
CUSTOM_Y = awn_options.get_int(awn.CONFIG_DEFAULT_GROUP, "CUSTOM_Y")
38
HIGH = awn_options.get_int(awn.CONFIG_DEFAULT_GROUP, "HIGH")
39
ICONSIZE = awn_options.get_int(awn.CONFIG_DEFAULT_GROUP, "ICONSIZE")
45
awn_options.set_int(awn.CONFIG_DEFAULT_GROUP, "CUSTOM_Y", CUSTOM_Y)
46
awn_options.set_int(awn.CONFIG_DEFAULT_GROUP, "HIGH", HIGH)
47
awn_options.set_int(awn.CONFIG_DEFAULT_GROUP, "ICONSIZE", ICONSIZE)
53
class PreferencesDialog(gtk.Dialog):
55
"""A Dialog window that has the title "PyNot Preferences",
56
uses the applet's logo as its icon and has a Close button.
61
gtk.Dialog.__init__(self, flags=gtk.DIALOG_NO_SEPARATOR)
63
self.set_resizable(False)
64
self.set_border_width(5)
66
self.set_title("PyNot Preferences")
67
self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
69
self.set_icon(gtk.gdk.pixbuf_new_from_file_at_size(
70
os.path.dirname(__file__)+"/PyNot.png", 48, 48))
72
self.connect("response", self.response_event)
74
def response_event(self, widget, response):
79
dialog = PreferencesDialog()
81
prefs = glade.XML(glade_file)
82
prefs.get_widget("vbox-preferences").reparent(dialog.vbox)
84
spinbutton_column = prefs.get_widget("spinbutton-icons-per-column")
85
spinbutton_column.set_value(HIGH)
86
def column_value_changed_cb(widget):
87
awn_options.set_int(awn.CONFIG_DEFAULT_GROUP, "HIGH", widget.get_value_as_int())
88
spinbutton_column.connect("value-changed", column_value_changed_cb)
90
spinbutton_offset = prefs.get_widget("spinbutton-offset-from-bottom")
91
spinbutton_offset.set_value(CUSTOM_Y)
92
def offset_value_changed_cb(widget):
93
awn_options.set_int(awn.CONFIG_DEFAULT_GROUP, "CUSTOM_Y", widget.get_value_as_int())
94
spinbutton_offset.connect("value-changed", offset_value_changed_cb)
96
spinbutton_size = prefs.get_widget("spinbutton-size-of-icons")
97
spinbutton_size.set_value(ICONSIZE)
98
def size_value_changed_cb(widget):
99
awn_options.set_int(awn.CONFIG_DEFAULT_GROUP, "ICONSIZE", widget.get_value_as_int())
100
spinbutton_size.connect("value-changed", size_value_changed_cb)