/usr/share/pyshared/timerapplet/ui/StatusButton.py is in timer-applet 2.1.2-4.
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 | # Copyright (C) 2008 Jimmy Do <jimmydo@users.sourceforge.net>
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import gtk
from PulseButton import PulseButton
from PieMeter import PieMeter
class StatusButton(PulseButton):
def __init__(self):
PulseButton.__init__(self)
self._tooltips = gtk.Tooltips()
self._icon_widget = gtk.Image()
self._pie_meter = PieMeter()
self._label_widget = gtk.Label()
self._visual_box = gtk.HBox()
self._visual_box.pack_start(self._icon_widget)
self._visual_box.pack_start(self._pie_meter)
self._layout_box = None
self._use_vertical = None
self.set_use_vertical_layout(False)
# _pie_meter will default to visible while
# _icon_widget will default to hidden.
self._pie_meter.show()
self._visual_box.show()
self._label_widget.show()
def set_tooltip(self, tip_text):
self._tooltips.set_tip(self, tip_text)
def set_label(self, text):
self._label_widget.set_text(text)
def set_icon(self, image_path):
self._icon_widget.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(image_path, -1, 20))
#elf._icon_widget.set_from_file(image_path)
def set_use_icon(self, use_icon):
if use_icon:
self._pie_meter.hide()
self._icon_widget.show()
else:
self._pie_meter.show()
self._icon_widget.hide()
def set_sensitized(self, sensitized):
self._label_widget.props.sensitive = sensitized
def set_show_remaining_time(self, show_remaining_time):
if show_remaining_time:
self._label_widget.show()
else:
self._label_widget.hide()
def set_progress(self, progress):
self._pie_meter.set_progress(progress)
def set_use_vertical_layout(self, use_vertical):
if self._use_vertical == use_vertical:
return
self._use_vertical = use_vertical
if self._layout_box is not None:
self._layout_box.remove(self._visual_box)
self._layout_box.remove(self._label_widget)
self.remove(self._layout_box)
self._layout_box.destroy()
self._layout_box = None
new_layout_box = None
if self._use_vertical:
new_layout_box = gtk.VBox(False, 2)
else:
new_layout_box = gtk.HBox(False, 2)
new_layout_box.pack_start(self._visual_box, True, True, 0)
new_layout_box.pack_start(self._label_widget, False, False, 0)
self._layout_box = new_layout_box
self.add(self._layout_box)
self._layout_box.show()
def set_pie_fill_color(self, red, green, blue):
self._pie_meter.set_fill_color(red, green, blue)
|