diff options
author | Gonzalo Odiard <godiard@sugarlabs.org> | 2014-04-11 05:41:39 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2014-05-14 21:21:41 (GMT) |
commit | de4585527c085ef0018b4f1e1f900e3289921506 (patch) | |
tree | e71a5d1b095be5dadb53ac3bf7b25d527a384ab3 | |
parent | a21b3c2af2d766d3394926802ae8873ee140511f (diff) |
port to gtk3: replace window by get_window
-rw-r--r-- | dialogs.py | 6 | ||||
-rw-r--r-- | mapnav.py | 9 | ||||
-rw-r--r-- | questions.py | 13 |
3 files changed, 13 insertions, 15 deletions
@@ -64,7 +64,7 @@ class _DialogWindow(Gtk.Window): def _realize_cb(self, source): self.set_type_hint(Gdk.WindowTypeHint.DIALOG) - self.window.set_accept_focus(True) + self.get_window().set_accept_focus(True) class _DialogToolbar(Gtk.Toolbar): @@ -206,7 +206,7 @@ class QuestionDialog(_DialogWindow): def _change_page(self): self.notebook.set_current_page(1) - self.window.set_cursor(None) + self.get_window().set_cursor(None) # wait 3 seconds #report and close GObject.timeout_add_seconds(3, self._close_all) @@ -216,7 +216,7 @@ class QuestionDialog(_DialogWindow): def _show_reply_feedback(self, valid_reply): # load smiley image - self.window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) + self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) if valid_reply: smiley = random.choice(questions.SMILIES_OK) else: @@ -286,14 +286,14 @@ class MapNavView(Gtk.DrawingArea): info_walls = self.get_information_walls(self.x, self.y, self.direction) if self._check_over_door(info_walls, event.x, event.y): - self.window.set_cursor(Gdk.Cursor.new(Gdk.SB_UP_ARROW)) + self.get_window().set_cursor(Gdk.Cursor.new(Gdk.SB_UP_ARROW)) # verify lateral walls elif self._check_left_wall(event.x): - self.window.set_cursor(Gdk.Cursor.new(Gdk.SB_LEFT_ARROW)) + self.get_window().set_cursor(Gdk.Cursor.new(Gdk.SB_LEFT_ARROW)) elif self._check_right_wall(event.x): - self.window.set_cursor(Gdk.Cursor.new(Gdk.SB_RIGHT_ARROW)) + self.get_window().set_cursor(Gdk.Cursor.new(Gdk.SB_RIGHT_ARROW)) else: - self.window.set_cursor(None) + self.get_window().set_cursor(None) def __button_release_event_cb(self, widget, event): if self.selected is not None: @@ -333,7 +333,6 @@ class MapNavView(Gtk.DrawingArea): self._door_height = 6 def __draw_cb(self, widget, ctx): - ctx = widget.window.cairo_create() rect = self.get_allocation() # set a clip region for the expose event #ctx.rectangle(event.area.x, event.area.y, event.area.width, diff --git a/questions.py b/questions.py index 0233af8..74ccc0f 100644 --- a/questions.py +++ b/questions.py @@ -61,7 +61,7 @@ class DrawReplyArea(Gtk.DrawingArea): def setup(self): """Configure the Area object.""" logging.debug('Area.setup: w=%s h=%s' % (self._width, self._height)) - win = self.window + win = self.get_window() self.background = Gdk.Pixmap(win, self._width, self._height, -1) self.gc = win.new_gc() self.pixbuf.render_to_drawable(self.background, self.gc, 0, 0, 0, 0, @@ -75,14 +75,13 @@ class DrawReplyArea(Gtk.DrawingArea): if self.background is None: self.setup() x, y, width, height = ctx.clip_extents() - widget.window.draw_drawable(widget.get_style().fg_gc[Gtk.StateType.NORMAL], + widget.get_window().draw_drawable(widget.get_style().fg_gc[Gtk.StateType.NORMAL], self.background, x, y, x, y, width, height) if self._edit: - cr = widget.window.cairo_create() - cr.rectangle(x, y, width, height) - cr.clip() - cr.set_source_surface(self.reply_surface) - cr.paint() + ctx.rectangle(x, y, width, height) + ctx.clip() + ctx.set_source_surface(self.reply_surface) + ctx.paint() return False |