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