diff options
author | Ariel Calzada <ariel@acivitycentral.com> | 2013-01-03 16:16:33 (GMT) |
---|---|---|
committer | Ariel Calzada <ariel@acivitycentral.com> | 2013-01-03 16:16:33 (GMT) |
commit | e4b78ea13c1980f4560bfb568b9476ef1abbd470 (patch) | |
tree | e5fade2e07650596f817c91810b6dc601b7722da /browser.py | |
parent | 7b33af5cf841faef274a6511d94ec5a2c584fe1d (diff) |
sdxo #310 Custom start/home page in Browse and #2769 Applying downstream changes to Browse-webkit
Diffstat (limited to 'browser.py')
-rw-r--r-- | browser.py | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -342,12 +342,37 @@ class TabbedView(BrowserNotebook): if os.path.isfile(_LIBRARY_PATH): browser.load_uri('file://' + _LIBRARY_PATH) + + elif os.path.isfile(activity.get_bundle_path() + "/data/homepage.conf"): + confFile = os.path.join(activity.get_bundle_path(),"data/homepage.conf") + f = open(confFile,"r") + contents = f.read().strip() + f.close() + + if contents != "": + default_page = contents + else: + default_page = os.path.join(activity.get_bundle_path(),"data/index.html") + + browser.load_uri(default_page) else: default_page = os.path.join(activity.get_bundle_path(), "data/index.html") browser.load_uri('file://' + default_page) + browser.grab_focus() + def change_homepage(self): + """ Change data/homepage.conf with current URL + """ + confFile = os.path.join(activity.get_bundle_path(),"data/homepage.conf") + index = self.get_current_page() + ui_uri = self.get_nth_page(index).browser.get_uri() + + f = open ( confFile,"w") + f.write(ui_uri) + f.close() + def _get_current_browser(self): if self.get_n_pages(): return self.get_nth_page(self.get_current_page()).browser |