~ubuntu-branches/ubuntu/utopic/awn-extras-applets/utopic

« back to all changes in this revision

Viewing changes to src/pynot-rgba/pynotconf.py

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-01-13 21:50:33 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100113215033-kd9otcdjrajmiag0
Tags: 0.3.9~bzr1944-0ubuntu1
* New upstream snapshot.
 - Catch error in weather applet (LP: #359668)
* debian/patches: Refresh.
* debian/*.install: 
 - Update to new location and new applets.
 - Disable dialect applet until python-xklavier is in the archive.
 - Disable MiMenu and Pandora applets, there are unmaintained and not stable.
* debian/awn-applets-c-core: Dropped, not needed.
* debian/control:
 - Update description with new applets.
 - Remove libawn-extras and python-awnlib, all merged in python-awn-extras.
 - Replace awn-manager by awn-settings.
 - Drop build-depends on libgnome-desktop-dev, python*-dev, python2.5,
   awn-manager, libglade2-dev and libgnomeui-dev.
 - Add build-depends on libdesktop-agnostic-bin and vala-awn.
 - Bump build-depends of libawn-dev (>= 0.3.9~bzr1890), valac (>= 0.7.7) and
   debhelper (>= 7.0.50~).
 - Bump Standards-Version to 3.8.3 (no change needed).
 - Demote gconf-editor to Suggest, it's only needed for very advanced
   settings.
 - Update Recommends for python applets with new applets.
 - Suggest python-gconf for notification-area and alacarte for YAMA.
 - Add a debug package for C applets.
* debian/libawn-extras*: Removed, libawn-extras was removed upstream.
* debian/python-awnlib*: Merged with python-awn-extras.
* debian/rules:
 - Rewrite to use overrides.
* debian/copyright:
 - Update copyright and licenses.
* debian/README.source: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
# PyNotConfig - Awn Notification/system tray config manager.
3
 
#
4
 
# Copyright (C) 2008 Nathan Howard (triggerhapp@googlemail.com)
5
 
#
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.
10
 
#
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.
15
 
#
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/>.
18
 
 
19
 
import os
20
 
 
21
 
import pygtk
22
 
pygtk.require("2.0")
23
 
import gtk
24
 
from gtk import glade
25
 
 
26
 
import awn
27
 
 
28
 
glade_file = os.path.join(os.path.dirname(__file__), "pynot-rgba.glade")
29
 
 
30
 
global D_CUSTOM_Y, D_HIGH, D_ICONSIZE
31
 
D_CUSTOM_Y = 10
32
 
D_HIGH = 2
33
 
D_ICONSIZE = 24
34
 
 
35
 
awn_options = awn.Config("pynot-rgba", None)
36
 
 
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")
40
 
 
41
 
if HIGH == 0:
42
 
    HIGH = D_HIGH
43
 
    CUSTOM_Y = D_CUSTOM_Y
44
 
    ICONSIZE = D_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)
48
 
 
49
 
if ICONSIZE == 0:
50
 
    ICONSIZE = D_ICONSIZE
51
 
 
52
 
 
53
 
class PreferencesDialog(gtk.Dialog):
54
 
 
55
 
    """A Dialog window that has the title "PyNot Preferences",
56
 
    uses the applet's logo as its icon and has a Close button.
57
 
 
58
 
    """
59
 
 
60
 
    def __init__(self):
61
 
        gtk.Dialog.__init__(self, flags=gtk.DIALOG_NO_SEPARATOR)
62
 
 
63
 
        self.set_resizable(False)
64
 
        self.set_border_width(5)
65
 
 
66
 
        self.set_title("PyNot Preferences")
67
 
        self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
68
 
 
69
 
        self.set_icon(gtk.gdk.pixbuf_new_from_file_at_size(
70
 
                                os.path.dirname(__file__)+"/PyNot.png", 48, 48))
71
 
 
72
 
        self.connect("response", self.response_event)
73
 
 
74
 
    def response_event(self, widget, response):
75
 
        if response < 0:
76
 
            gtk.main_quit()
77
 
 
78
 
 
79
 
dialog = PreferencesDialog()
80
 
 
81
 
prefs = glade.XML(glade_file)
82
 
prefs.get_widget("vbox-preferences").reparent(dialog.vbox)
83
 
 
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)
89
 
 
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)
95
 
 
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)
101
 
 
102
 
dialog.show_all()
103
 
gtk.main()