Merge branch 'master' of git+ssh://j5@dev.laptop.org/git/sugar
This commit is contained in:
@@ -14,13 +14,13 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics.palette import Palette
|
||||
from view.BuddyMenu import BuddyMenu
|
||||
|
||||
class BuddyIcon(CanvasIcon):
|
||||
def __init__(self, shell, buddy):
|
||||
CanvasIcon.__init__(self, icon_name='theme:computer-xo',
|
||||
CanvasIcon.__init__(self, icon_name='computer-xo',
|
||||
xo_color=buddy.get_color())
|
||||
|
||||
self._shell = shell
|
||||
|
||||
@@ -20,7 +20,7 @@ from gettext import gettext as _
|
||||
|
||||
import gobject
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from view.clipboardmenu import ClipboardMenu
|
||||
from sugar.graphics.xocolor import XoColor
|
||||
from sugar.graphics import style
|
||||
@@ -88,7 +88,7 @@ class ClipboardIcon(CanvasIcon):
|
||||
if icon_name:
|
||||
self.props.icon_name = icon_name
|
||||
else:
|
||||
self.props.icon_name = 'theme:application-octet-stream'
|
||||
self.props.icon_name = 'application-octet-stream'
|
||||
|
||||
self._name = name
|
||||
self._percent = percent
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from gettext import gettext as _
|
||||
|
||||
import gtk
|
||||
|
||||
from gettext import gettext as _
|
||||
from sugar.graphics import canvasicon
|
||||
from sugar import profile
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics.icon import get_icon_state
|
||||
from sugar.graphics import style
|
||||
from sugar.graphics.palette import Palette
|
||||
|
||||
@@ -27,9 +30,10 @@ _STATUS_CHARGING = 0
|
||||
_STATUS_DISCHARGING = 1
|
||||
_STATUS_FULLY_CHARGED = 2
|
||||
|
||||
class DeviceView(canvasicon.CanvasIcon):
|
||||
class DeviceView(CanvasIcon):
|
||||
def __init__(self, model):
|
||||
canvasicon.CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE)
|
||||
CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
|
||||
xo_color=profile.get_color())
|
||||
self._model = model
|
||||
self._palette = BatteryPalette(_('My Battery life'))
|
||||
self.set_palette(self._palette)
|
||||
@@ -40,13 +44,13 @@ class DeviceView(canvasicon.CanvasIcon):
|
||||
self._update_info()
|
||||
|
||||
def _update_info(self):
|
||||
self.props.icon_name = canvasicon.get_icon_state(
|
||||
_ICON_NAME, self._model.props.level)
|
||||
name = get_icon_state(_ICON_NAME, self._model.props.level)
|
||||
self.props.icon_name = name
|
||||
|
||||
# Update palette
|
||||
if self._model.props.charging:
|
||||
status = _STATUS_CHARGING
|
||||
self.props.badge_name = 'theme:badge-charging'
|
||||
self.props.badge_name = 'badge-charging'
|
||||
elif self._model.props.discharging:
|
||||
status = _STATUS_DISCHARGING
|
||||
self.props.badge_name = None
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
|
||||
def create(model):
|
||||
name = 'view.devices.' + model.get_type()
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from sugar import profile
|
||||
from sugar.graphics import canvasicon
|
||||
from sugar.graphics import style
|
||||
from model.devices import device
|
||||
@@ -22,7 +23,7 @@ from model.devices import device
|
||||
class DeviceView(canvasicon.CanvasIcon):
|
||||
def __init__(self, model):
|
||||
canvasicon.CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
|
||||
icon_name='theme:network-mesh')
|
||||
icon_name='network-mesh')
|
||||
self._model = model
|
||||
|
||||
model.connect('notify::state', self._state_changed_cb)
|
||||
@@ -35,11 +36,10 @@ class DeviceView(canvasicon.CanvasIcon):
|
||||
# FIXME Change icon colors once we have real icons
|
||||
state = self._model.props.state
|
||||
if state == device.STATE_ACTIVATING:
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
|
||||
elif state == device.STATE_ACTIVATED:
|
||||
self.props.fill_color = None
|
||||
self.props.stroke_color = None
|
||||
self.props.xo_color = profile.get_color()
|
||||
elif state == device.STATE_INACTIVE:
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
|
||||
|
||||
@@ -19,4 +19,4 @@ from view.devices import deviceview
|
||||
class DeviceView(deviceview.DeviceView):
|
||||
def __init__(self, model):
|
||||
deviceview.DeviceView.__init__(self, model)
|
||||
self.props.icon_name = 'theme:network-wired'
|
||||
self.props.icon_name = 'network-wired'
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from sugar.graphics import canvasicon
|
||||
from sugar.graphics import style
|
||||
from sugar.graphics.icon import get_icon_state
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics import style
|
||||
|
||||
from model.devices.network import wireless
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from model.devices import device
|
||||
|
||||
_ICON_NAME = 'network-wireless'
|
||||
@@ -47,8 +47,7 @@ class DeviceView(CanvasIcon):
|
||||
self._update_state()
|
||||
|
||||
def _update_icon(self):
|
||||
icon_name = canvasicon.get_icon_state(
|
||||
_ICON_NAME, self._model.props.strength)
|
||||
icon_name = get_icon_state(_ICON_NAME, self._model.props.strength)
|
||||
if icon_name:
|
||||
self.props.icon_name = icon_name
|
||||
|
||||
@@ -56,11 +55,11 @@ class DeviceView(CanvasIcon):
|
||||
# FIXME Change icon colors once we have real icons
|
||||
state = self._model.props.state
|
||||
if state == device.STATE_ACTIVATING:
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
|
||||
elif state == device.STATE_ACTIVATED:
|
||||
self.props.fill_color = None
|
||||
self.props.stroke_color = None
|
||||
elif state == device.STATE_INACTIVE:
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
|
||||
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
|
||||
|
||||
@@ -28,9 +28,9 @@ from frameinvoker import FrameCanvasInvoker
|
||||
|
||||
class ActivityButton(IconButton):
|
||||
def __init__(self, activity_info):
|
||||
IconButton.__init__(self, icon_name=activity_info.icon,
|
||||
stroke_color=style.COLOR_WHITE,
|
||||
fill_color=style.COLOR_TRANSPARENT)
|
||||
IconButton.__init__(self, file_name=activity_info.icon,
|
||||
stroke_color=style.COLOR_WHITE.get_svg(),
|
||||
fill_color=style.COLOR_TRANSPARENT.get_svg())
|
||||
|
||||
palette = Palette(activity_info.name)
|
||||
palette.props.invoker = FrameCanvasInvoker(self)
|
||||
@@ -44,7 +44,7 @@ class ActivityButton(IconButton):
|
||||
|
||||
class InviteButton(IconButton):
|
||||
def __init__(self, activity_model, invite):
|
||||
IconButton.__init__(self, icon_name=activity_model.get_color())
|
||||
IconButton.__init__(self, file_name=activity_model.get_icon())
|
||||
|
||||
self.props.xo_color = activity_model.get_color()
|
||||
self._invite = invite
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import hippo
|
||||
|
||||
from sugar.graphics.palette import Palette
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics import style
|
||||
from sugar.presence import presenceservice
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class OverlayBox(hippo.CanvasBox):
|
||||
|
||||
self._shell = shell
|
||||
|
||||
icon = IconButton(icon_name='theme:stock-chat')
|
||||
icon = IconButton(icon_name='stock-chat')
|
||||
icon.connect('activated', self._overlay_clicked_cb)
|
||||
self.append(icon)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class ZoomBox(hippo.CanvasBox):
|
||||
|
||||
self._shell = shell
|
||||
|
||||
icon = IconButton(icon_name='theme:zoom-mesh')
|
||||
icon = IconButton(icon_name='zoom-mesh')
|
||||
icon.connect('activated',
|
||||
self._level_clicked_cb,
|
||||
ShellModel.ZOOM_MESH)
|
||||
@@ -41,7 +41,7 @@ class ZoomBox(hippo.CanvasBox):
|
||||
palette.set_group_id('frame')
|
||||
icon.set_palette(palette)
|
||||
|
||||
icon = IconButton(icon_name='theme:zoom-friends')
|
||||
icon = IconButton(icon_name='zoom-friends')
|
||||
icon.connect('activated',
|
||||
self._level_clicked_cb,
|
||||
ShellModel.ZOOM_FRIENDS)
|
||||
@@ -52,7 +52,7 @@ class ZoomBox(hippo.CanvasBox):
|
||||
palette.set_group_id('frame')
|
||||
icon.set_palette(palette)
|
||||
|
||||
icon = IconButton(icon_name='theme:zoom-home')
|
||||
icon = IconButton(icon_name='zoom-home')
|
||||
icon.connect('activated',
|
||||
self._level_clicked_cb,
|
||||
ShellModel.ZOOM_HOME)
|
||||
@@ -63,7 +63,7 @@ class ZoomBox(hippo.CanvasBox):
|
||||
palette.set_group_id('frame')
|
||||
icon.set_palette(palette)
|
||||
|
||||
icon = IconButton(icon_name='theme:zoom-activity')
|
||||
icon = IconButton(icon_name='zoom-activity')
|
||||
icon.connect('activated',
|
||||
self._level_clicked_cb,
|
||||
ShellModel.ZOOM_ACTIVITY)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import hippo
|
||||
import gobject
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics import style
|
||||
from sugar.presence import presenceservice
|
||||
from sugar import activity
|
||||
@@ -67,7 +67,7 @@ class FriendView(hippo.CanvasBox):
|
||||
# than hiding the icon?
|
||||
name = self._get_new_icon_name(home_activity)
|
||||
if name:
|
||||
self._activity_icon.props.icon_name = name
|
||||
self._activity_icon.props.file_name = name
|
||||
self._activity_icon.props.xo_color = buddy.get_color()
|
||||
if not self._activity_icon_visible:
|
||||
self.append(self._activity_icon, hippo.PACK_EXPAND)
|
||||
|
||||
+16
-17
@@ -21,10 +21,10 @@ import gobject
|
||||
from gettext import gettext as _
|
||||
|
||||
from sugar.graphics.spreadlayout import SpreadLayout
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics import style
|
||||
from sugar.graphics import xocolor
|
||||
from sugar.graphics import canvasicon
|
||||
from sugar.graphics.icon import get_icon_state
|
||||
from sugar.graphics import style
|
||||
from sugar import profile
|
||||
|
||||
@@ -86,8 +86,7 @@ class AccessPointView(PulsingIcon):
|
||||
self.set_tooltip(self._model.props.name)
|
||||
|
||||
def _update_icon(self):
|
||||
icon_name = canvasicon.get_icon_state(
|
||||
_ICON_NAME, self._model.props.strength)
|
||||
icon_name = get_icon_state(_ICON_NAME, self._model.props.strength)
|
||||
if icon_name:
|
||||
self.props.icon_name = icon_name
|
||||
|
||||
@@ -95,33 +94,33 @@ class AccessPointView(PulsingIcon):
|
||||
if self._model.props.state == accesspointmodel.STATE_CONNECTING:
|
||||
self.props.pulse_time = 1.0
|
||||
self.props.colors = [
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color(self._device_fill) ],
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color('#e2e2e2') ]
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
style.Color(self._device_fill).get_svg() ],
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
'#e2e2e2' ]
|
||||
]
|
||||
elif self._model.props.state == accesspointmodel.STATE_CONNECTED:
|
||||
self.props.pulse_time = 2.0
|
||||
self.props.colors = [
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color(self._device_fill) ],
|
||||
[ style.Color('#ffffff'),
|
||||
style.Color(self._device_fill) ]
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
style.Color(self._device_fill).get_svg() ],
|
||||
[ '#ffffff',
|
||||
style.Color(self._device_fill).get_svg() ]
|
||||
]
|
||||
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
|
||||
self.props.pulse_time = 0.0
|
||||
self.props.colors = [
|
||||
[ style.Color(self._device_stroke),
|
||||
style.Color(self._device_fill) ]
|
||||
[ style.Color(self._device_stroke).get_svg(),
|
||||
style.Color(self._device_fill).get_svg() ]
|
||||
]
|
||||
|
||||
|
||||
_MESH_ICON_NAME = 'theme:network-mesh'
|
||||
_MESH_ICON_NAME = 'network-mesh'
|
||||
|
||||
class MeshDeviceView(PulsingIcon):
|
||||
def __init__(self, nm_device):
|
||||
PulsingIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
|
||||
icon_name=_MESH_ICON_NAME)
|
||||
icon_name=_MESH_ICON_NAME)
|
||||
self._nm_device = nm_device
|
||||
self.set_tooltip(_("Mesh Network"))
|
||||
|
||||
@@ -177,7 +176,7 @@ class ActivityView(hippo.CanvasBox):
|
||||
self._layout = SnowflakeLayout()
|
||||
self.set_layout(self._layout)
|
||||
|
||||
self._icon = CanvasIcon(icon_name=model.get_icon_name(),
|
||||
self._icon = CanvasIcon(file_name=model.get_icon_name(),
|
||||
xo_color=model.get_color(), box_width=80)
|
||||
self._icon.connect('activated', self._clicked_cb)
|
||||
self._icon.set_tooltip(self._model.get_title())
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar import profile
|
||||
|
||||
class MyIcon(CanvasIcon):
|
||||
def __init__(self, size):
|
||||
CanvasIcon.__init__(self, size=size,
|
||||
icon_name='theme:computer-xo',
|
||||
icon_name='computer-xo',
|
||||
xo_color=profile.get_color())
|
||||
|
||||
@@ -24,7 +24,7 @@ import hippo
|
||||
import gobject
|
||||
import gtk
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics.menuitem import MenuItem
|
||||
from sugar.graphics.palette import Palette
|
||||
from sugar.graphics import style
|
||||
@@ -73,8 +73,8 @@ class ActivityIcon(CanvasIcon):
|
||||
self._level = self._level_max
|
||||
color = self._icon_colors[self._level]
|
||||
|
||||
CanvasIcon.__init__(self, icon_name=icon_name, xo_color=color,
|
||||
size=style.MEDIUM_ICON_SIZE, cache=True)
|
||||
CanvasIcon.__init__(self, file_name=icon_name, xo_color=color,
|
||||
size=style.MEDIUM_ICON_SIZE)
|
||||
|
||||
self._activity = activity
|
||||
self._pulse_id = 0
|
||||
@@ -119,8 +119,6 @@ class ActivityIcon(CanvasIcon):
|
||||
if self._pulse_id:
|
||||
gobject.source_remove(self._pulse_id)
|
||||
self._pulse_id = 0
|
||||
# dispose of all rendered icons from launch feedback
|
||||
self._clear_buffers()
|
||||
|
||||
def _compute_icon_colors(self):
|
||||
_LEVEL_MAX = 1.6
|
||||
@@ -161,6 +159,7 @@ class ActivityIcon(CanvasIcon):
|
||||
if self._pulse_id:
|
||||
return
|
||||
|
||||
self.props.cache_size = self._level_max
|
||||
self._pulse_id = gobject.timeout_add(self._INTERVAL, self._pulse_cb)
|
||||
|
||||
def _stop_pulsing(self):
|
||||
@@ -169,6 +168,7 @@ class ActivityIcon(CanvasIcon):
|
||||
|
||||
self._cleanup()
|
||||
self._level = 100.0
|
||||
self.props.cache_size = 1
|
||||
self.props.xo_color = self._orig_color
|
||||
|
||||
def _resume_activate_cb(self, menuitem):
|
||||
@@ -317,7 +317,7 @@ class ActivitiesDonut(hippo.CanvasBox, hippo.CanvasItem):
|
||||
|
||||
try:
|
||||
smaps = ProcSmaps(pid)
|
||||
_subtract_mappings(smaps, shell_mappings)
|
||||
self._subtract_mappings(smaps, shell_mappings)
|
||||
for mapping in smaps.mappings:
|
||||
if mapping.shared_clean > 0 or mapping.shared_dirty > 0:
|
||||
if num_mappings.has_key(mapping.name):
|
||||
@@ -408,7 +408,7 @@ class ActivitiesDonut(hippo.CanvasBox, hippo.CanvasItem):
|
||||
if icon.size > _MIN_WEDGE_SIZE:
|
||||
icon.size -= (icon.size - _MIN_WEDGE_SIZE) * reduction
|
||||
|
||||
def _subtract_mappings(smaps, mappings_to_remove):
|
||||
def _subtract_mappings(self, smaps, mappings_to_remove):
|
||||
for mapping in smaps.mappings:
|
||||
if mappings_to_remove.has_key(mapping.name):
|
||||
mapping.shared_clean = 0
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import gobject
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
|
||||
class PulsingIcon(CanvasIcon):
|
||||
__gproperties__ = {
|
||||
|
||||
Reference in New Issue
Block a user