Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/browser.py
diff options
context:
space:
mode:
authorAriel Calzada <ariel@acivitycentral.com>2013-01-03 16:16:33 (GMT)
committer Ariel Calzada <ariel@acivitycentral.com>2013-01-03 16:16:33 (GMT)
commite4b78ea13c1980f4560bfb568b9476ef1abbd470 (patch)
treee5fade2e07650596f817c91810b6dc601b7722da /browser.py
parent7b33af5cf841faef274a6511d94ec5a2c584fe1d (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.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/browser.py b/browser.py
index 7419d2d..80936fa 100644
--- a/browser.py
+++ b/browser.py
@@ -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