diff --git a/app/rss-reader/buffer.py b/app/rss-reader/buffer.py index a504656..de8bdc0 100644 --- a/app/rss-reader/buffer.py +++ b/app/rss-reader/buffer.py @@ -71,7 +71,7 @@ class RSSReaderWidget(QWidget): def __init__(self, config_dir): super(RSSReaderWidget, self).__init__() - self.feed_file_path = os.path.join(config_dir, "eaf", "rss-reader", "feeds.json") + self.feed_file_path = os.path.join(config_dir, "rss-reader", "feeds.json") self.feed_area = QWidget() self.feed_list = QListWidget() diff --git a/core/browser.py b/core/browser.py index e59780e..64885bf 100644 --- a/core/browser.py +++ b/core/browser.py @@ -229,7 +229,7 @@ class WebHitTestResult(): class BrowserCookieStorage: def __init__(self, config_dir): - self.cookie_file = os.path.join(config_dir, "eaf", "browser", "cookie", "cookie") + self.cookie_file = os.path.join(config_dir, "browser", "cookie", "cookie") touch(self.cookie_file) diff --git a/eaf.el b/eaf.el index 3ea4b8f..af474c3 100644 --- a/eaf.el +++ b/eaf.el @@ -7,7 +7,7 @@ ;; Copyright (C) 2018, Andy Stewart, all rights reserved. ;; Created: 2018-06-15 14:10:12 ;; Version: 0.5 -;; Last-Updated: Sun Dec 29 11:46:35 2019 (-0500) +;; Last-Updated: Sat Jan 4 21:55:30 2020 (-0500) ;; By: Mingde (Matthew) Zeng ;; URL: http://www.emacswiki.org/emacs/download/eaf.el ;; Keywords: @@ -325,11 +325,6 @@ Try not to modify this alist directly. Use `eaf-setq' to modify instead." "The extension list of org previewer application." :type 'cons) -(defcustom eaf-config-dir - user-emacs-directory - "The directory use for store eaf applicatin config." - :type 'string) - (defvar eaf-app-binding-alist '(("browser" . eaf-browser-keybinding) ("pdf-viewer" . eaf-pdf-viewer-keybinding) @@ -450,8 +445,8 @@ For now only EAF browser app is supported." (apply #'start-process eaf-name eaf-name - eaf-python-command (append (list eaf-python-file) (eaf-get-render-size) (list eaf-http-proxy-host eaf-http-proxy-port eaf-config-dir)) - )) + eaf-python-command (append (list eaf-python-file) (eaf-get-render-size) + (list eaf-http-proxy-host eaf-http-proxy-port (concat user-emacs-directory "eaf"))))) (set-process-query-on-exit-flag eaf-process nil) (set-process-sentinel eaf-process diff --git a/eaf.py b/eaf.py index 501a646..991d2d4 100755 --- a/eaf.py +++ b/eaf.py @@ -39,7 +39,7 @@ EAF_OBJECT_NAME = "/com/lazycat/eaf" class EAF(dbus.service.Object): def __init__(self, args): - global emacs_width, emacs_height, emacs_config_dir + global emacs_width, emacs_height, eaf_config_dir dbus.service.Object.__init__( self, @@ -49,14 +49,14 @@ class EAF(dbus.service.Object): (emacs_width, emacs_height, proxy_host, proxy_port, config_dir) = args emacs_width = int(emacs_width) emacs_height = int(emacs_height) - emacs_config_dir = os.path.expanduser(config_dir) + eaf_config_dir = os.path.expanduser(config_dir) self.buffer_dict = {} self.view_dict = {} self.start_finish() - self.session_file_path = os.path.join(emacs_config_dir, "eaf", "session.json") + self.session_file = os.path.join(eaf_config_dir, "session.json") # Set HTTP proxy. if proxy_host != "" and proxy_port != "": @@ -121,11 +121,11 @@ class EAF(dbus.service.Object): return "EAF: Something went wrong when trying to import {0}".format(module_path) def create_buffer(self, buffer_id, url, module_path, arguments): - global emacs_width, emacs_height, emacs_config_dir + global emacs_width, emacs_height, eaf_config_dir # Create application buffer. module = importlib.import_module(module_path) - app_buffer = module.AppBuffer(buffer_id, url, emacs_config_dir, arguments) + app_buffer = module.AppBuffer(buffer_id, url, eaf_config_dir, arguments) app_buffer.module_path = module_path # Add buffer to buffer dict. @@ -350,20 +350,20 @@ class EAF(dbus.service.Object): def save_buffer_session(self, buf): # Create config file it not exist. - if not os.path.exists(self.session_file_path): - basedir = os.path.dirname(self.session_file_path) + if not os.path.exists(self.session_file): + basedir = os.path.dirname(self.session_file) if not os.path.exists(basedir): os.makedirs(basedir) - with open(self.session_file_path, 'a'): - os.utime(self.session_file_path, None) + with open(self.session_file, 'a'): + os.utime(self.session_file, None) - print("Create session file %s" % (self.session_file_path)) + print("Create session file %s" % (self.session_file)) # Save buffer session to file. buf_session_data = buf.save_session_data() if buf_session_data != "": - with open(self.session_file_path, "r+") as session_file: + with open(self.session_file, "r+") as session_file: # Init session dict. session_dict = {} try: @@ -386,8 +386,8 @@ class EAF(dbus.service.Object): print("Saved session: ", buf.module_path, buf.url, buf_session_data) def restore_buffer_session(self, buf): - if os.path.exists(self.session_file_path): - with open(self.session_file_path, "r+") as session_file: + if os.path.exists(self.session_file): + with open(self.session_file, "r+") as session_file: session_dict = {} try: session_dict = json.load(session_file) @@ -417,7 +417,7 @@ if __name__ == "__main__": print("EAF process is already running.") else: emacs_width = emacs_height = 0 - emacs_config_dir = "" + eaf_config_dir = "" app = QApplication(sys.argv)