Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-10-29 13:27:18 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-10-29 13:27:18 (GMT)
commit1a118a7cc1f333ac34239bdb3e8bda2d5e28bd69 (patch)
tree5d011184ad2da90a311d91a7e47a501d7165b39c
parentad43e82af29dccb10f2bf007fed557cd4a19557b (diff)
Fix missing imports and changes introduced through gtk3
-rw-r--r--src/sugar3/activity/widgets.py5
-rw-r--r--src/sugar3/graphics/palette.py23
-rw-r--r--src/sugar3/graphics/palettewindow.py9
-rw-r--r--src/sugar3/graphics/style.py1
-rw-r--r--src/sugar3/graphics/toolbox.py8
-rw-r--r--src/sugar3/graphics/window.py19
6 files changed, 34 insertions, 31 deletions
diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py
index 773fb21..a072a74 100644
--- a/src/sugar3/activity/widgets.py
+++ b/src/sugar3/activity/widgets.py
@@ -16,6 +16,7 @@
# Boston, MA 02111-1307, USA.
from gi.repository import Gtk
+from gi.repository import Gdk
import gettext
from gi.repository import GConf
import logging
@@ -187,7 +188,7 @@ class KeepButton(ToolButton):
class TitleEntry(Gtk.ToolItem):
def __init__(self, activity, **kwargs):
- GObject.GObject.__init__(self)
+ Gtk.ToolItem.__init__(self)
self.set_expand(False)
self.entry = Gtk.Entry(**kwargs)
@@ -244,7 +245,7 @@ class ActivityToolbar(Gtk.Toolbar):
"""
def __init__(self, activity, orientation_left=False):
- GObject.GObject.__init__(self)
+ Gtk.Toolbar.__init__(self)
self._activity = activity
diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py
index aed1744..6f6355e 100644
--- a/src/sugar3/graphics/palette.py
+++ b/src/sugar3/graphics/palette.py
@@ -30,7 +30,6 @@ from sugar3.graphics import animator
from sugar3.graphics import style
from sugar3.graphics.icon import Icon
from sugar3.graphics.palettewindow import PaletteWindow
-from gi.repository import SugarExt
# DEPRECATED
# Import these for backwards compatibility
@@ -67,8 +66,7 @@ class Palette(PaletteWindow):
primary_box.pack_start(self._icon_box, False, True, 0)
labels_box = Gtk.VBox()
- self._label_alignment = Gtk.Alignment.new(xalign=0, yalign=0.5,
- xscale=1, yscale=0.33)
+ self._label_alignment = Gtk.Alignment.new(0, 0.5, 1, 0.33)
self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
style.DEFAULT_SPACING)
self._label_alignment.add(labels_box)
@@ -350,8 +348,9 @@ class Palette(PaletteWindow):
def _update_accept_focus(self):
accept_focus = len(self._content.get_children())
- if self.window:
- self.window.set_accept_focus(accept_focus)
+ win = self.get_window()
+ if win:
+ win.set_accept_focus(accept_focus)
def __realize_cb(self, widget):
self._update_accept_focus()
@@ -396,7 +395,7 @@ class PaletteActionBar(Gtk.HButtonBox):
button.show()
-class _Menu(SugarExt.Menu):
+class _Menu(Gtk.Menu):
__gtype_name__ = 'SugarPaletteMenu'
@@ -405,17 +404,23 @@ class _Menu(SugarExt.Menu):
}
def __init__(self, palette):
- SugarExt.Menu.__init__(self)
+ Gtk.Menu.__init__(self)
self._palette = palette
+ def embed(self, *args):
+ pass
+
+ def unembed(self, *args):
+ pass
+
def do_insert(self, item, position):
- SugarExt.Menu.do_insert(self, item, position)
+ Gtk.Menu.do_insert(self, item, position)
self.emit('item-inserted')
self.show()
def attach(self, child, left_attach, right_attach,
top_attach, bottom_attach):
- SugarExt.Menu.attach(self, child, left_attach, right_attach,
+ Gtk.Menu.attach(self, child, left_attach, right_attach,
top_attach, bottom_attach)
self.emit('item-inserted')
self.show()
diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
index c1aca0e..296a0b1 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -24,8 +24,8 @@ STABLE.
import logging
from gi.repository import Gtk
+from gi.repository import Gdk
from gi.repository import GObject
-from gi.repository import Hippo
from sugar3.graphics import palettegroup
from sugar3.graphics import animator
@@ -827,11 +827,6 @@ class CanvasInvoker(Invoker):
return ()
def __motion_notify_event_cb(self, button, event):
- if event.detail == Hippo.MOTION_DETAIL_ENTER:
- self.notify_mouse_enter()
- elif event.detail == Hippo.MOTION_DETAIL_LEAVE:
- self.notify_mouse_leave()
-
return False
def __button_release_event_cb(self, button, event):
@@ -842,7 +837,7 @@ class CanvasInvoker(Invoker):
return False
def get_toplevel(self):
- return Hippo.get_canvas_for_item(self._item).get_toplevel()
+ return None
class ToolInvoker(WidgetInvoker):
diff --git a/src/sugar3/graphics/style.py b/src/sugar3/graphics/style.py
index ba42175..86287e1 100644
--- a/src/sugar3/graphics/style.py
+++ b/src/sugar3/graphics/style.py
@@ -26,6 +26,7 @@ import os
import logging
from gi.repository import Gtk
+from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import GConf
diff --git a/src/sugar3/graphics/toolbox.py b/src/sugar3/graphics/toolbox.py
index e67ff16..7959818 100644
--- a/src/sugar3/graphics/toolbox.py
+++ b/src/sugar3/graphics/toolbox.py
@@ -41,8 +41,6 @@ class Toolbox(Gtk.VBox):
self._notebook.set_tab_pos(Gtk.PositionType.BOTTOM)
self._notebook.set_show_border(False)
self._notebook.set_show_tabs(False)
- self._notebook.props.tab_vborder = style.TOOLBOX_TAB_VBORDER
- self._notebook.props.tab_hborder = style.TOOLBOX_TAB_HBORDER
self.pack_start(self._notebook, True, True, 0)
self._notebook.show()
@@ -50,7 +48,7 @@ class Toolbox(Gtk.VBox):
self._separator.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_PANEL_GREY.get_gdk_color())
self._separator.set_size_request(1, style.TOOLBOX_SEPARATOR_HEIGHT)
- self.pack_start(self._separator, False)
+ self.pack_start(self._separator, False, False, 0)
self._notebook.connect('notify::page', self._notify_page_cb)
@@ -59,8 +57,8 @@ class Toolbox(Gtk.VBox):
def add_toolbar(self, name, toolbar):
label = Gtk.Label(label=name)
- width, height_ = label.size_request()
- label.set_size_request(max(width, style.TOOLBOX_TAB_LABEL_WIDTH), -1)
+ req = label.size_request()
+ label.set_size_request(max(req.width, style.TOOLBOX_TAB_LABEL_WIDTH), -1)
label.set_alignment(0.0, 0.5)
event_box = Gtk.EventBox()
diff --git a/src/sugar3/graphics/window.py b/src/sugar3/graphics/window.py
index 0309bc4..3f6ee5b 100644
--- a/src/sugar3/graphics/window.py
+++ b/src/sugar3/graphics/window.py
@@ -22,6 +22,7 @@ STABLE.
from gi.repository import GObject
from gi.repository import Gtk
+from gi.repository import Gdk
import warnings
from sugar3.graphics.icon import Icon
@@ -45,11 +46,13 @@ class UnfullscreenButton(Gtk.Window):
self.props.accept_focus = False
#Setup estimate of width, height
- w, h = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
+ ret, w, h = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
self._width = w
self._height = h
- self.connect('size-request', self._size_request_cb)
+ #TODO: 'size-request' is not available anymore
+ # see http://developer.gnome.org/gtk3/3.2/ch25s02.html
+ #self.connect('size-request', self._size_request_cb)
screen = self.get_screen()
screen.connect('size-changed', self._screen_size_changed_cb)
@@ -191,7 +194,7 @@ class Window(Gtk.Window):
self.__vbox.remove(self._toolbar_box)
if toolbar_box:
- self.__vbox.pack_start(toolbar_box, False)
+ self.__vbox.pack_start(toolbar_box, False, False, 0)
self.__vbox.reorder_child(toolbar_box, 0)
self._toolbar_box = toolbar_box
@@ -204,18 +207,18 @@ class Window(Gtk.Window):
box.remove(self.tray)
if position == Gtk.PositionType.LEFT:
- self.__hbox.pack_start(tray, False)
+ self.__hbox.pack_start(tray, False, False, 0)
elif position == Gtk.PositionType.RIGHT:
- self.__hbox.pack_end(tray, False)
+ self.__hbox.pack_end(tray, False, False, 0)
elif position == Gtk.PositionType.BOTTOM:
- self.__vbox.pack_end(tray, False)
+ self.__vbox.pack_end(tray, False, False, 0)
self.tray = tray
def add_alert(self, alert):
self._alerts.append(alert)
if len(self._alerts) == 1:
- self.__vbox.pack_start(alert, False)
+ self.__vbox.pack_start(alert, False, False, 0)
if self._toolbar_box is not None:
self.__vbox.reorder_child(alert, 1)
else:
@@ -228,7 +231,7 @@ class Window(Gtk.Window):
if alert.get_parent() is not None:
self.__vbox.remove(alert)
if len(self._alerts) >= 1:
- self.__vbox.pack_start(self._alerts[0], False)
+ self.__vbox.pack_start(self._alerts[0], False, False, 0)
if self._toolbar_box is not None:
self.__vbox.reorder_child(self._alerts[0], 1)
else: