From 1940fa9256365d839afa9820af7a8c3b48240984 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Mon, 19 Nov 2012 11:51:12 -0300
Subject: [PATCH Browse] Hanlde focus properly on each tab SL #4200
The focus is grabbed after loading the 'Home page' and when the
session is restored from a previous one by the current browser that
it's being shown to the user.
This patch allow us to show the OSK when it's needed and to be able to
start typing with the hardware keyboard.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
browser.py | 1 +
webactivity.py | 2 ++
2 files changed, 3 insertions(+)
diff --git a/browser.py b/browser.py
index 76756f2..a97e736 100644
a
|
b
|
class TabbedView(BrowserNotebook): |
317 | 317 | default_page = os.path.join(activity.get_bundle_path(), |
318 | 318 | "data/index.html") |
319 | 319 | browser.load_uri('file://' + default_page) |
| 320 | browser.grab_focus() |
320 | 321 | |
321 | 322 | def _get_current_browser(self): |
322 | 323 | if self.get_n_pages(): |
diff --git a/webactivity.py b/webactivity.py
index 6dbd222..780b87f 100644
a
|
b
|
class WebActivity(activity.Activity): |
409 | 409 | for number, tab in enumerate(self.model.data['currents']): |
410 | 410 | tab_page = self._tabbed_view.get_nth_page(number) |
411 | 411 | tab_page.browser.set_history_index(tab['history_index']) |
| 412 | tab_page.browser.grab_focus() |
412 | 413 | |
413 | 414 | self._tabbed_view.set_current_page(self.model.data['current_tab']) |
414 | 415 | elif self.metadata['mime_type'] == 'text/uri-list': |
… |
… |
class WebActivity(activity.Activity): |
422 | 423 | else: |
423 | 424 | file_uri = 'file://' + file_path |
424 | 425 | self._tabbed_view.props.current_browser.load_uri(file_uri) |
| 426 | self._tabbed_view.props.current_browser.grab_focus() |
425 | 427 | |
426 | 428 | def write_file(self, file_path): |
427 | 429 | if not self.metadata['mime_type']: |