Remove pymediainfo dependence and add qrcode dependence.

Use try...except to import application module.
Update README.
master
Andy Stewart 8 years ago
parent 575a7b460f
commit 44dab51a23
  1. 18
      README.md
  2. 2
      eaf.el
  3. 5
      eaf.py

@ -29,17 +29,17 @@ Using this framework, you can use PyQt develop powerful graphics programs to ext
1. Install python libraries: 1. Install python libraries:
```Bash ```Bash
sudo pacman -S python-xlib python-pyqt5 python-pymediainfo sudo pacman -S python-xlib python-pyqt5
sudo pip install PyMuPDF grip sudo pip install PyMuPDF grip qrcode
``` ```
| Package | Use for | | Package | Use for |
| :-------- | :---- | | :-------- | :---- |
| python-xlib | Stick app window into emacs frame | | python-xlib | Stick app window into emacs frame |
| python-pyqt5 | GUI library required for application development | | python-pyqt5 | GUI library required for application development |
| python-pymediainfo | Detect file type, then choose the right application to open | | PyMuPDF | Render engine required for PDF Viewer |
| PyMuPDF | Render engine required for PDF Viewer | | grip | Markdown render server for Markdown Previewer |
| grip | Markdown render server for Markdown Previewer | | qrcode | Render local file QR code |
2. Clone this repository and add below code in your ~/.emacs 2. Clone this repository and add below code in your ~/.emacs
```Elisp ```Elisp

@ -138,7 +138,7 @@
(apply 'start-process (apply 'start-process
eaf-name eaf-name
eaf-name eaf-name
"python" (append (list eaf-python-file (eaf-get-emacs-xid)) (eaf-get-render-size)) "python3" (append (list eaf-python-file (eaf-get-emacs-xid)) (eaf-get-render-size))
)) ))
(set-process-query-on-exit-flag eaf-process nil) (set-process-query-on-exit-flag eaf-process nil)
(set-process-sentinel (set-process-sentinel

@ -24,7 +24,6 @@ from core.fake_key_event import fake_key_event
from core.utils import file_is_image, file_is_video from core.utils import file_is_image, file_is_video
from core.view import View from core.view import View
from dbus.mainloop.glib import DBusGMainLoop from dbus.mainloop.glib import DBusGMainLoop
from pymediainfo import MediaInfo
import importlib import importlib
import dbus import dbus
import dbus.service import dbus.service
@ -55,12 +54,12 @@ class EAF(dbus.service.Object):
return self.create_app(buffer_id, str(url), "app.{0}.buffer".format(str(app_name))) return self.create_app(buffer_id, str(url), "app.{0}.buffer".format(str(app_name)))
def create_app(self, buffer_id, url, module_path): def create_app(self, buffer_id, url, module_path):
if importlib.util.find_spec(module_path) is not None: try:
module = importlib.import_module(module_path) module = importlib.import_module(module_path)
self.create_buffer(buffer_id, module.AppBuffer(buffer_id, url)) self.create_buffer(buffer_id, module.AppBuffer(buffer_id, url))
return "" return ""
else: except ImportError:
return "Something wrong when import {0}".format(module_path) return "Something wrong when import {0}".format(module_path)
def create_buffer(self, buffer_id, app_buffer): def create_buffer(self, buffer_id, app_buffer):

Loading…
Cancel
Save