From b842b87d4e78181c9e54234e9c1d422d7cd51d4f Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Mon, 29 Oct 2012 09:29:16 -0300
Subject: [PATCH Browse] AttributError fixed
Avoid to change the cursor (WATCH or LEFT_PTR) if the TabbedView
widget is not attached to the main window yet.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
browser.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/browser.py b/browser.py
index fad804f..2639d0b 100644
a
|
b
|
class TabbedView(BrowserNotebook): |
197 | 197 | on the current browser. |
198 | 198 | |
199 | 199 | """ |
200 | | if self.props.current_browser != widget: |
| 200 | window = self.get_window() |
| 201 | if self.props.current_browser != widget or window is None: |
| 202 | # do not change the cursor if the browser that changes its |
| 203 | # state is not the current one OR if TabbedView is not |
| 204 | # attached to the main window yet |
201 | 205 | return |
202 | 206 | |
203 | 207 | status = widget.get_load_status() |
204 | 208 | if status in (WebKit.LoadStatus.PROVISIONAL, |
205 | 209 | WebKit.LoadStatus.COMMITTED, |
206 | 210 | WebKit.LoadStatus.FIRST_VISUALLY_NON_EMPTY_LAYOUT): |
207 | | self.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) |
| 211 | window.set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) |
208 | 212 | elif status in (WebKit.LoadStatus.FAILED, |
209 | 213 | WebKit.LoadStatus.FINISHED): |
210 | | self.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.LEFT_PTR)) |
| 214 | window.set_cursor(Gdk.Cursor(Gdk.CursorType.LEFT_PTR)) |
211 | 215 | |
212 | 216 | def add_tab(self, next_to_current=False): |
213 | 217 | browser = Browser() |