Reorganize canvas items.
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
import gtk
|
||||
|
||||
from gettext import gettext as _
|
||||
from sugar.graphics import canvasicon
|
||||
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 +28,9 @@ _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)
|
||||
self._model = model
|
||||
self._palette = BatteryPalette(_('My Battery life'))
|
||||
self.set_palette(self._palette)
|
||||
@@ -40,8 +41,8 @@ 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:
|
||||
|
||||
@@ -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,11 +15,12 @@
|
||||
# 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.icon import get_icon_state
|
||||
from sugar.graphics.icon import CanvasIcon
|
||||
from sugar.graphics import style
|
||||
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 +48,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user