/usr/share/pyshared/jarabe/controlpanel/toolbar.py is in python-jarabe-0.96 0.96.1-2.1git1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 156 157 158 159 160 | # Copyright (C) 2007, 2008 One Laptop Per Child
#
# 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.
#
# 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.
#
# 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
import gtk
import gettext
import gobject
_ = lambda msg: gettext.dgettext('sugar', msg)
from sugar.graphics.icon import Icon
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics import iconentry
from sugar.graphics import style
class MainToolbar(gtk.Toolbar):
""" Main toolbar of the control panel
"""
__gtype_name__ = 'MainToolbar'
__gsignals__ = {
'stop-clicked': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([])),
'search-changed': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([str])),
}
def __init__(self):
gtk.Toolbar.__init__(self)
self._add_separator()
tool_item = gtk.ToolItem()
self.insert(tool_item, -1)
tool_item.show()
self._search_entry = iconentry.IconEntry()
self._search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
'system-search')
self._search_entry.add_clear_button()
self._search_entry.set_width_chars(25)
self._search_entry.connect('changed', self.__search_entry_changed_cb)
tool_item.add(self._search_entry)
self._search_entry.show()
self._add_separator(True)
self.stop = ToolButton(icon_name='dialog-cancel')
self.stop.set_tooltip(_('Done'))
self.stop.connect('clicked', self.__stop_clicked_cb)
self.stop.show()
self.insert(self.stop, -1)
self.stop.show()
def get_entry(self):
return self._search_entry
def _add_separator(self, expand=False):
separator = gtk.SeparatorToolItem()
separator.props.draw = False
if expand:
separator.set_expand(True)
else:
separator.set_size_request(style.DEFAULT_SPACING, -1)
self.insert(separator, -1)
separator.show()
def __search_entry_changed_cb(self, search_entry):
self.emit('search-changed', search_entry.props.text)
def __stop_clicked_cb(self, button):
self.emit('stop-clicked')
class SectionToolbar(gtk.Toolbar):
""" Toolbar of the sections of the control panel
"""
__gtype_name__ = 'SectionToolbar'
__gsignals__ = {
'cancel-clicked': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([])),
'accept-clicked': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([])),
}
def __init__(self):
gtk.Toolbar.__init__(self)
self._add_separator()
self._icon = Icon()
self._add_widget(self._icon)
self._add_separator()
self._title = gtk.Label()
self._add_widget(self._title)
self._add_separator(True)
self.cancel_button = ToolButton('dialog-cancel')
self.cancel_button.set_tooltip(_('Cancel'))
self.cancel_button.connect('clicked', self.__cancel_button_clicked_cb)
self.insert(self.cancel_button, -1)
self.cancel_button.show()
self.accept_button = ToolButton('dialog-ok')
self.accept_button.set_tooltip(_('Ok'))
self.accept_button.connect('clicked', self.__accept_button_clicked_cb)
self.insert(self.accept_button, -1)
self.accept_button.show()
def get_icon(self):
return self._icon
def get_title(self):
return self._title
def _add_separator(self, expand=False):
separator = gtk.SeparatorToolItem()
separator.props.draw = False
if expand:
separator.set_expand(True)
else:
separator.set_size_request(style.DEFAULT_SPACING, -1)
self.insert(separator, -1)
separator.show()
def _add_widget(self, widget, expand=False):
tool_item = gtk.ToolItem()
tool_item.set_expand(expand)
tool_item.add(widget)
widget.show()
self.insert(tool_item, -1)
tool_item.show()
def __cancel_button_clicked_cb(self, widget, data=None):
self.emit('cancel-clicked')
def __accept_button_clicked_cb(self, widget, data=None):
self.emit('accept-clicked')
|