diff options
author | Lucian Branescu Mihaila <lucian.branescu@gmail.com> | 2009-08-10 11:19:45 (GMT) |
---|---|---|
committer | Lucian Branescu Mihaila <lucian.branescu@gmail.com> | 2009-08-10 11:19:45 (GMT) |
commit | 7005fb13a31f26704ec561d8e71bb4f82274fb3c (patch) | |
tree | c29e4f99dd5d9b8b85bcdb826a3318cf8e7c32c9 /usercode.py | |
parent | 25450e1f18701402eb3bdba3a7c3297f61ac752a (diff) |
Proof of concept 'save complete page'
Diffstat (limited to 'usercode.py')
-rw-r--r-- | usercode.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/usercode.py b/usercode.py index 1abecc4..3d0fedc 100644 --- a/usercode.py +++ b/usercode.py @@ -196,9 +196,7 @@ class ScriptEditor(Dialog): def __file_selected_cb(self, view, file_path): self._editor.file_path = self._fileview.get_selected_file() -def add_script(location): - '''Inspired by https://developer.mozilla.org/en/nsIWebBrowserPersist''' - +def add_script(location): cls = components.classes[ \ '@mozilla.org/embedding/browser/nsWebBrowserPersist;1'] persist = cls.createInstance(interfaces.nsIWebBrowserPersist) @@ -226,27 +224,7 @@ def script_exists(location): script_name = os.path.basename(urlparse(location).path) return os.path.isfile(os.path.join(SCRIPTS_PATH, script_name)) - -def save_document(browser): - cls = components.classes[ \ - '@mozilla.org/embedding/browser/nsWebBrowserPersist;1'] - persist = cls.createInstance(interfaces.nsIWebBrowserPersist) - persist.persistFlags = interfaces.nsIWebBrowserPersist \ - .PERSIST_FLAGS_REPLACE_EXISTING_FILES - - local = components.classes["@mozilla.org/file/local;1"] - local_file = local.createInstance(interfaces.nsILocalFile) - local_data = local.createInstance(interfaces.nsILocalFile) - - file_path = '/media/desktop/saved/x.html' - local_file.initWithPath(file_path) - data_path = '/media/desktop/saved/x' - local_data.initWithPath(data_path) - - - persist.saveDocument(browser.dom_window.document, - local_file, local_data, None, 0, 0) class Injector(): _com_interfaces_ = interfaces.nsIDOMEventListener |