image-viewer: fix load_next_image and load_prev_image

Signed-off-by: Mingde (Matthew) Zeng <matthewzmd@posteo.net>
master
Mingde (Matthew) Zeng 6 years ago
parent c2fc51c8a4
commit d69e31e102
  1. 10
      app/image-viewer/buffer.py
  2. 4
      app/interleave/eaf-interleave.el
  3. 4
      eaf.el

@ -39,7 +39,7 @@ class AppBuffer(BrowserBuffer):
self.buffer_widget.setUrl(QUrl("file://" + self.url))
def is_image_file(self, f):
return Path(f).suffix.lower() in ["jpg", "jpeg", "png", "bmp", "gif", "svg", "webp"]
return Path(f).suffix[1:].lower() in ["jpg", "jpeg", "png", "bmp", "gif", "svg", "webp"]
def get_same_dir_images(self):
files = [f for f in os.listdir(self.parent_dir) if os.path.isfile(os.path.join(self.parent_dir, f))]
@ -54,7 +54,9 @@ class AppBuffer(BrowserBuffer):
else:
image_index += 1
self.load_image(os.path.join(self.parent_dir, images[image_index]))
self.image_name = images[image_index]
self.load_image(os.path.join(self.parent_dir, self.image_name))
self.change_title(self.image_name)
def load_prev_image(self):
images = self.get_same_dir_images()
@ -65,4 +67,6 @@ class AppBuffer(BrowserBuffer):
else:
image_index -= 1
self.load_image(os.path.join(self.parent_dir, images[image_index]))
self.image_name = images[image_index]
self.load_image(os.path.join(self.parent_dir, self.image_name))
self.change_title(self.image_name)

@ -193,7 +193,7 @@ buffer."
))
(defun eaf-interleave-add-file-url ()
"Add new url on note if property is none. else modify current url"
"Add a new url on note if the property is none, else modify current url."
(interactive)
(let ((url (read-file-name "Please specify path: " nil nil t)))
(org-entry-put (point) eaf-interleave--url-prop url)))
@ -212,7 +212,7 @@ This show the previous notes and synchronizes the PDF to the right page number."
(eaf-interleave-sync-current-note))
(defun eaf-interleave-open-notes-file ()
"Find current EAF url corresponding note files if exists"
"Find current EAF url corresponding note files if it exists."
(interactive)
(if (derived-mode-p 'eaf-mode)
(cond ((equal eaf--buffer-app-name "pdf-viewer")

@ -7,7 +7,7 @@
;; Copyright (C) 2018, Andy Stewart, all rights reserved.
;; Created: 2018-06-15 14:10:12
;; Version: 0.5
;; Last-Updated: Sat Sep 12 18:56:21 2020 (-0400)
;; Last-Updated: Sun Sep 13 23:07:25 2020 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: http://www.emacswiki.org/emacs/download/eaf.el
;; Keywords:
@ -1757,7 +1757,7 @@ This function works best if paired with a fuzzy search package."
(if history-file-exists
(mapcar
(lambda (h) (when (string-match history-pattern h)
(format "[%s] ⇰ %s" (match-string 1 h) (match-string 2 h))))
(format "[%s] ⇰ %s" (match-string 1 h) (match-string 2 h))))
(with-temp-buffer (insert-file-contents browser-history-file-path)
(split-string (buffer-string) "\n" t)))
nil)))

Loading…
Cancel
Save