3
# Copyright (C) 2007 Neil Jagdish Patel <njpatel@gmail.com>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
# Author: Ryan Rushton <ryan@rrdesign.ca>
21
# Notes: Avant Window Navigator Manager
25
PKGDATA = "@DATADIR@" + "/avant-window-navigator/awn-manager"
26
sys.path.append (PKGDATA)
37
sys.stderr.write(str(e) + '\n')
44
from awnTheme import AwnThemeManager
45
from awnPreferences import awnPreferences
46
from awnApplet import awnApplet
47
from awnLauncher import awnLauncher
49
APP = 'avant-window-navigator'
50
DIR = "@DATADIR@" + "/locale"
51
I18N_DOMAIN = "avant-window-navigator"
55
locale.setlocale(locale.LC_ALL, '')
56
gettext.bindtextdomain(APP, DIR)
57
gettext.textdomain(APP)
65
self.AWN_CONFIG_DIR = os.path.join(os.path.expanduser('~'),'.config/awn')
66
if not os.path.exists(self.AWN_CONFIG_DIR):
67
os.makedirs(self.AWN_CONFIG_DIR)
68
self.GLADE_PATH = os.path.join(PKGDATA, "window.glade")
69
gtk.glade.bindtextdomain(APP, DIR)
70
gtk.glade.textdomain(APP)
72
self.wTree = gtk.glade.XML(self.GLADE_PATH, domain=I18N_DOMAIN)
74
self.window = self.wTree.get_widget("main_window")
75
self.window.connect("delete-event", gtk.main_quit)
77
refresh = self.wTree.get_widget("refreshbutton")
78
refresh.connect("clicked", self.refresh)
80
about = self.wTree.get_widget("aboutbutton")
81
about.connect("clicked", self.about)
83
close = self.wTree.get_widget("closebutton")
84
close.connect("clicked", gtk.main_quit)
87
self.treeview = self.wTree.get_widget("view_menu")
88
self.treeview.get_selection().connect("changed", self.menu_row_clicked)
89
self.make_menu_model()
92
self.themeManager = AwnThemeManager(self.wTree, self.AWN_CONFIG_DIR)
95
self.appletManager = awnApplet(self.wTree)
98
self.launchManager = awnLauncher(self.wTree, self.AWN_CONFIG_DIR)
101
self.prefManager = awnPreferences(self.wTree)
103
def menu_row_clicked(self, data=None):
104
selection = self.treeview.get_selection()
105
(model, iter) = selection.get_selected()
107
self.show_panel(model.get_path(iter)[0])
109
def show_panel(self, index):
110
for panel in ['panel_preferences','panel_applets','panel_launchers','panel_themes']:
111
self.wTree.get_widget(panel).hide()
113
self.wTree.get_widget('panel_preferences').show()
115
self.wTree.get_widget('panel_applets').show()
117
self.wTree.get_widget('panel_launchers').show()
119
self.wTree.get_widget('panel_themes').show()
122
def make_menu_model (self):
123
self.model = model = gtk.ListStore(gdk.Pixbuf, str, str, str)
124
self.treeview.set_model (model)
126
ren = gtk.CellRendererPixbuf()
127
col = gtk.TreeViewColumn ("Pixbuf", ren, pixbuf=0)
128
self.treeview.append_column (col)
130
ren = gtk.CellRendererText()
131
col = gtk.TreeViewColumn ("Name", ren, markup=1)
132
self.treeview.append_column (col)
134
theme = gtk.icon_theme_get_default()
136
row = self.model.append ()
137
self.model.set_value (row, 0, theme.load_icon (gtk.STOCK_PREFERENCES, 32, 0))
138
self.model.set_value (row, 1, "General")
140
row = self.model.append ()
141
self.model.set_value (row, 0, theme.load_icon (gtk.STOCK_SORT_ASCENDING, 32, 0))
142
self.model.set_value (row, 1, "Applets")
144
row = self.model.append ()
145
self.model.set_value (row, 0, theme.load_icon (gtk.STOCK_FULLSCREEN, 32, 0))
146
self.model.set_value (row, 1, "Launchers")
148
row = self.model.append ()
149
self.model.set_value (row, 0, theme.load_icon (gtk.STOCK_HOME, 32, 0))
150
self.model.set_value (row, 1, "Themes")
152
path = self.model.get_path(self.model.get_iter_first())
153
self.treeview.set_cursor(path, focus_column=None, start_editing=False)
155
def refresh(self, button):
158
w.set_icon(i.load_icon("gtk-refresh", 48, gtk.ICON_LOOKUP_FORCE_SVG))
160
l = gtk.Label("Refreshed")
161
b = gtk.Button(stock="gtk-close")
162
b.connect("clicked", self.win_destroy, w)
163
v.pack_start(l, True, True, 2)
169
def about(self, button):
170
self.about = gtk.AboutDialog()
171
self.about.set_name("Avant Window Navigator")
172
self.about.set_version("0.2.1")
173
self.about.set_copyright("Copyright (C) 2007 Neil Jagdish Patel <njpatel@gmail.com>")
174
self.about.set_authors(["Neil Jagdish Patel <njpatel@gmail.com>", "haytjes <hv1989@gmail.com>", "Miika-Petteri Matikainen <miikapetteri@gmail.com>", "Anthony Arobone <aarobone@gmail.com>", "Ryan Rushton <ryan@rrdesign.ca>", "Michal Hruby <michal.mhr@gmail.com>", "Julien Lavergne <julien.lavergne@gmail.com>"])
175
self.about.set_comments("Fully customisable dock-like window navigator for GNOME.")
176
self.about.set_license('''
177
This program 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; either version 2 of the License, or (at your option) any later version.
179
This program 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.
181
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.''')
182
self.about.set_wrap_license(True)
183
self.about.set_website("http://www.planetblur.org/hosted/awnforum/")
184
#self.about.set_logo_icon_name(gtk.STOCK_ABOUT)
185
self.about.set_documenters(["More to come..."])
186
self.about.set_artists(["More to come..."])
187
#self.about.set_translator_credits()
191
def win_destroy(self, button, w):
197
if __name__ == "__main__":
198
gettext.textdomain(I18N_DOMAIN)
199
gtk.glade.bindtextdomain(I18N_DOMAIN, "/usr/share/locale")
200
awnmanager = AwnManager()