Remove Canvas* widgets and other hippo-canvas using parts
hippo-canvas isn't available in the GTK3 world, so we need to remove anything that depends on it. Activities that still use it will need replace hippo-canvas based widgets with native GTK ones before they can be ported to GTK3. [replaced description] Signed-off-by: Sascha Silbe <silbe@activitycentral.com>master
parent
1edc6ca1b1
commit
9cb18cdcf3
@ -1,41 +0,0 @@
|
||||
# Copyright (C) 2008 One Laptop Per Child
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
import gtk
|
||||
import hippo
|
||||
|
||||
from sugar3.graphics import style
|
||||
|
||||
|
||||
class CanvasTextView(hippo.CanvasWidget):
|
||||
|
||||
def __init__(self, text, **kwargs):
|
||||
hippo.CanvasWidget.__init__(self, **kwargs)
|
||||
self.text_view_widget = gtk.TextView()
|
||||
self.text_view_widget.props.buffer.props.text = text
|
||||
self.text_view_widget.props.left_margin = style.DEFAULT_SPACING
|
||||
self.text_view_widget.props.right_margin = style.DEFAULT_SPACING
|
||||
self.text_view_widget.props.wrap_mode = gtk.WRAP_WORD
|
||||
self.text_view_widget.show()
|
||||
|
||||
# TODO: These fields should expand vertically instead of scrolling
|
||||
scrolled_window = gtk.ScrolledWindow()
|
||||
scrolled_window.set_shadow_type(gtk.SHADOW_OUT)
|
||||
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
|
||||
scrolled_window.add(self.text_view_widget)
|
||||
|
||||
self.props.widget = scrolled_window
|
@ -1,41 +0,0 @@
|
||||
# Copyright (C) 2007, Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
STABLE.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
import hippo
|
||||
|
||||
|
||||
class CanvasEntry(hippo.CanvasEntry):
|
||||
|
||||
def set_background(self, color_spec):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
color_spec :
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
|
||||
"""
|
||||
color = gtk.gdk.color_parse(color_spec)
|
||||
self.props.widget.modify_bg(gtk.STATE_INSENSITIVE, color)
|
||||
self.props.widget.modify_base(gtk.STATE_INSENSITIVE, color)
|
@ -1,71 +0,0 @@
|
||||
# Copyright (C) 2006-2007 Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
STABLE.
|
||||
"""
|
||||
|
||||
import math
|
||||
|
||||
import hippo
|
||||
|
||||
from sugar3.graphics import style
|
||||
|
||||
|
||||
class CanvasRoundBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
__gtype_name__ = 'SugarRoundBox'
|
||||
|
||||
_BORDER_DEFAULT = style.LINE_WIDTH
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
hippo.CanvasBox.__init__(self, **kwargs)
|
||||
|
||||
# TODO: we should calculate radius depending on the height of the box.
|
||||
self._radius = style.zoom(10)
|
||||
|
||||
self.props.orientation = hippo.ORIENTATION_HORIZONTAL
|
||||
self.props.border = self._BORDER_DEFAULT
|
||||
self.props.border_left = self._radius
|
||||
self.props.border_right = self._radius
|
||||
self.props.border_color = style.COLOR_BLACK.get_int()
|
||||
|
||||
def do_paint_background(self, cr, damaged_box):
|
||||
[width, height] = self.get_allocation()
|
||||
|
||||
x = self._BORDER_DEFAULT / 2
|
||||
y = self._BORDER_DEFAULT / 2
|
||||
width -= self._BORDER_DEFAULT
|
||||
height -= self._BORDER_DEFAULT
|
||||
|
||||
cr.move_to(x + self._radius, y)
|
||||
cr.arc(x + width - self._radius, y + self._radius,
|
||||
self._radius, math.pi * 1.5, math.pi * 2)
|
||||
cr.arc(x + width - self._radius, x + height - self._radius,
|
||||
self._radius, 0, math.pi * 0.5)
|
||||
cr.arc(x + self._radius, y + height - self._radius,
|
||||
self._radius, math.pi * 0.5, math.pi)
|
||||
cr.arc(x + self._radius, y + self._radius, self._radius,
|
||||
math.pi, math.pi * 1.5)
|
||||
|
||||
hippo.cairo_set_source_rgba32(cr, self.props.background_color)
|
||||
cr.fill_preserve()
|
||||
|
||||
# TODO: we should be more consistent here with the border properties.
|
||||
if self.props.border_color:
|
||||
hippo.cairo_set_source_rgba32(cr, self.props.border_color)
|
||||
cr.set_line_width(self.props.border_top)
|
||||
cr.stroke()
|
@ -1,51 +0,0 @@
|
||||
import hippo
|
||||
import gtk
|
||||
import gobject
|
||||
|
||||
from sugar3.graphics.icon import CanvasIcon
|
||||
from sugar3.graphics.roundbox import CanvasRoundBox
|
||||
|
||||
import common
|
||||
|
||||
test = common.Test()
|
||||
|
||||
canvas = hippo.Canvas()
|
||||
test.pack_start(canvas)
|
||||
canvas.show()
|
||||
|
||||
scrollbars = hippo.CanvasScrollbars()
|
||||
canvas.set_root(scrollbars)
|
||||
|
||||
box = hippo.CanvasBox(padding=10, spacing=10)
|
||||
scrollbars.set_root(box)
|
||||
|
||||
|
||||
def idle_cb():
|
||||
global countdown
|
||||
|
||||
for i in range(0, 100):
|
||||
entry = hippo.CanvasBox(border=2, border_color=0x000000ff,
|
||||
orientation=hippo.ORIENTATION_HORIZONTAL,
|
||||
padding=10, spacing=10)
|
||||
|
||||
for j in range(0, 3):
|
||||
icon = CanvasIcon(icon_name='go-left')
|
||||
entry.append(icon)
|
||||
|
||||
for j in range(0, 2):
|
||||
text = hippo.CanvasText(text='Text %s %s' % (countdown, j))
|
||||
entry.append(text)
|
||||
|
||||
box.append(entry)
|
||||
|
||||
countdown -= 1
|
||||
|
||||
return countdown > 0
|
||||
|
||||
countdown = 1000
|
||||
gobject.idle_add(idle_cb)
|
||||
|
||||
test.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.main(test)
|
Loading…
Reference in New Issue