~ubuntu-branches/ubuntu/saucy/unity-tweak-tool/saucy-proposed

« back to all changes in this revision

Viewing changes to UnityTweakTool/section/sphagetti/start.py

  • Committer: Package Import Robot
  • Author(s): Barneedhar Vigneshwar
  • Date: 2013-02-15 20:33:41 UTC
  • Revision ID: package-import@ubuntu.com-20130215203341-yqrfr9df488k41am
Tags: 0.0.3
* New upstream release
* Closes needs-packaging bug (LP: #1126433)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
# -*- coding: utf-8 -*-
 
3
#
 
4
# Team:
 
5
#   J Phani Mahesh <phanimahesh@gmail.com> 
 
6
#   Barneedhar (jokerdino) <barneedhar@ubuntu.com> 
 
7
#   Amith KK <amithkumaran@gmail.com>
 
8
#   Georgi Karavasilev <motorslav@gmail.com>
 
9
#   Sam Tran <samvtran@gmail.com>
 
10
#   Sam Hewitt <hewittsamuel@gmail.com>
 
11
#   Angel Araya <al.arayaq@gmail.com>
 
12
#
 
13
# Description:
 
14
#   A One-stop configuration tool for Unity.
 
15
#
 
16
# Legal Stuff:
 
17
#
 
18
# This file is a part of Unity Tweak Tool
 
19
#
 
20
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
 
21
# the terms of the GNU General Public License as published by the Free Software
 
22
# Foundation; version 3.
 
23
#
 
24
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
 
25
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
26
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
27
# details.
 
28
#
 
29
# You should have received a copy of the GNU General Public License along with
 
30
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
 
31
 
 
32
import os, os.path
 
33
 
 
34
from gi.repository import Gtk, Gio
 
35
 
 
36
from UnityTweakTool.config.ui import ui
 
37
from . import unitytweakconfig
 
38
 
 
39
class Startpage ():
 
40
    def __init__(self, container, notebook):
 
41
        '''Handler Initialisations.
 
42
        Obtain all references here.'''
 
43
        self.builder = Gtk.Builder()
 
44
        self.container = container
 
45
        self.notebook = notebook
 
46
        self.glade = (os.path.join(unitytweakconfig.get_data_path(), 
 
47
                                   'startpage.ui'))
 
48
        self.builder.add_from_file(self.glade)
 
49
        self.ui = ui(self.builder)
 
50
        self.page = self.ui['box_startpage']
 
51
        self.page.unparent()
 
52
        self.builder.connect_signals(self)
 
53
 
 
54
        # Symbolic icons
 
55
        self.icons = Gtk.IconTheme.get_default()
 
56
        self.style_context = self.ui['startpage_window'].get_style_context()
 
57
        self.style_context.connect('changed', self.on_style_context_change)
 
58
 
 
59
    # Unity settings buttons on start page
 
60
    def on_tool_launcher_clicked(self, udata):
 
61
        self.notebook.set_current_page(1)
 
62
        self.notebook.get_nth_page(1).set_current_page(0)
 
63
    def on_tool_dash_clicked(self, udata):
 
64
        self.notebook.set_current_page(1)
 
65
        self.notebook.get_nth_page(1).set_current_page(1)
 
66
    def on_tool_panel_clicked(self, udata):
 
67
        self.notebook.set_current_page(1)
 
68
        self.notebook.get_nth_page(1).set_current_page(2)
 
69
    def on_tool_unity_switcher_clicked(self, udata):
 
70
        self.notebook.set_current_page(1)
 
71
        self.notebook.get_nth_page(1).set_current_page(3)
 
72
    def on_tool_unity_webapps_clicked(self, udata):
 
73
        self.notebook.set_current_page(1)
 
74
        self.notebook.get_nth_page(1).set_current_page(4)
 
75
    def on_tool_additional_clicked(self, udata):
 
76
        self.notebook.set_current_page(1)
 
77
        self.notebook.get_nth_page(1).set_current_page(5)
 
78
 
 
79
    # Compiz settings buttons on start page
 
80
    def on_tool_general_clicked(self, udata):
 
81
        self.notebook.set_current_page(2)
 
82
        self.notebook.get_nth_page(2).set_current_page(0)
 
83
    def on_tool_compiz_switcher_clicked(self, udata):
 
84
        self.notebook.set_current_page(2)
 
85
        self.notebook.get_nth_page(2).set_current_page(1)
 
86
    def on_tool_windows_spread_clicked(self, udata):
 
87
        self.notebook.set_current_page(2)
 
88
        self.notebook.get_nth_page(2).set_current_page(2)
 
89
    def on_tool_windows_snapping_clicked(self, udata):
 
90
        self.notebook.set_current_page(2)
 
91
        self.notebook.get_nth_page(2).set_current_page(3)
 
92
    def on_tool_hotcorners_clicked(self, udata):
 
93
        self.notebook.set_current_page(2)
 
94
        self.notebook.get_nth_page(2).set_current_page(4)
 
95
    def on_tool_wm_additional_clicked(self, udata):
 
96
        self.notebook.set_current_page(2)
 
97
        self.notebook.get_nth_page(2).set_current_page(5)
 
98
 
 
99
    # Theme settings on Start page
 
100
    def on_tool_system_clicked(self, udata):
 
101
        self.notebook.set_current_page(3)
 
102
        self.notebook.get_nth_page(3).set_current_page(0)
 
103
    def on_tool_icons_clicked(self, udata):
 
104
        self.notebook.set_current_page(3)
 
105
        self.notebook.get_nth_page(3).set_current_page(1)
 
106
    def on_tool_cursors_clicked(self, udata):
 
107
        self.notebook.set_current_page(3)
 
108
        self.notebook.get_nth_page(3).set_current_page(2)
 
109
    def on_tool_fonts_clicked(self, udata):
 
110
        self.notebook.set_current_page(3)
 
111
        self.notebook.get_nth_page(3).set_current_page(3)
 
112
    def on_tool_window_controls_clicked(self, udata):
 
113
        self.notebook.set_current_page(3)
 
114
        self.notebook.get_nth_page(3).set_current_page(4)
 
115
 
 
116
    # Desktop settings on start page
 
117
    def on_tool_desktop_icons_clicked(self, udata):
 
118
        self.notebook.set_current_page(4)
 
119
        self.notebook.get_nth_page(4).set_current_page(0)
 
120
    def on_tool_desktop_security_clicked(self, udata):
 
121
        self.notebook.set_current_page(4)
 
122
        self.notebook.get_nth_page(4).set_current_page(1)
 
123
    def on_tool_desktop_scrolling_clicked(self, udata):
 
124
        self.notebook.set_current_page(4)
 
125
        self.notebook.get_nth_page(4).set_current_page(2)
 
126
 
 
127
    # Symbolic icons
 
128
    def on_style_context_change(self, widget):
 
129
        self.symbolic_color = self.style_context.get_color(Gtk.StateFlags.ACTIVE)
 
130
 
 
131
        appearance_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-appearance-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE)
 
132
        if appearance_symbolic_icon:
 
133
            appearance_symbolic_icon_pixbuf, was_sym = appearance_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None)
 
134
            self.ui['image_start_theme'].set_from_pixbuf(appearance_symbolic_icon_pixbuf)
 
135
 
 
136
        unity_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-unity-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE)
 
137
        if unity_symbolic_icon:
 
138
            unity_symbolic_icon_pixbuf, was_sym = unity_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None)
 
139
            self.ui['image_box_start_unity'].set_from_pixbuf(unity_symbolic_icon_pixbuf)
 
140
 
 
141
        system_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-system-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE)
 
142
        if system_symbolic_icon:
 
143
            system_symbolic_icon_pixbuf, was_sym = system_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None)
 
144
            self.ui['image_start_desktop'].set_from_pixbuf(system_symbolic_icon_pixbuf)
 
145
 
 
146
        wm_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-wm-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE)
 
147
        if wm_symbolic_icon:
 
148
            wm_symbolic_icon_pixbuf, was_sym = wm_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None)
 
149
            self.ui['image_box_start_compiz'].set_from_pixbuf(wm_symbolic_icon_pixbuf)
 
150
 
 
151
 
 
152
if __name__ == '__main__':
 
153
# Fire up the Engines
 
154
    Startpage()
 
155
# FIXME : This should fail. 2 missing arguments.