Merge pull request #401 from HollowMan6/duplicate-page

Browser: Support duplicating current page in new tab
master
Andy Stewart 6 years ago committed by GitHub
commit 937e5300a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/browser/buffer.py
  2. 5
      core/browser.py
  3. 1
      core/buffer.py
  4. 11
      eaf.el
  5. 5
      eaf.py

@ -49,6 +49,7 @@ class AppBuffer(BrowserBuffer):
self.buffer_widget.translate_selected_text.connect(self.translate_text)
self.buffer_widget.open_url_in_new_tab.connect(self.open_url_in_new_tab)
self.buffer_widget.duplicate_page_in_new_tab.connect(self.duplicate_page_in_new_tab)
self.buffer_widget.open_url_in_background_tab.connect(self.open_url_in_background_tab)
self.buffer_widget.urlChanged.connect(self.set_adblocker)

@ -42,6 +42,7 @@ MOUSE_FORWARD_BUTTON = 16
class BrowserView(QWebEngineView):
open_url_in_new_tab = QtCore.pyqtSignal(str)
duplicate_page_in_new_tab = QtCore.pyqtSignal(str)
open_url_in_background_tab = QtCore.pyqtSignal(str)
translate_selected_text = QtCore.pyqtSignal(str)
trigger_focus_event = QtCore.pyqtSignal(str)
@ -1348,6 +1349,10 @@ class BrowserBuffer(Buffer):
else:
self.message_to_emacs.emit("No page need recovery.")
@interactive(insert_or_do=True)
def duplicate_page(self):
self.buffer_widget.duplicate_page_in_new_tab.emit(self.current_url)
@interactive(insert_or_do=True)
def open_browser(self):
''' Open browser.'''

@ -101,6 +101,7 @@ class Buffer(QGraphicsScene):
update_buffer_details = QtCore.pyqtSignal(str, str, str)
open_url_in_new_tab = QtCore.pyqtSignal(str)
duplicate_page_in_new_tab = QtCore.pyqtSignal(str)
open_url_in_background_tab = QtCore.pyqtSignal(str)
translate_text = QtCore.pyqtSignal(str)
input_message = QtCore.pyqtSignal(str, str, str, str, str)

@ -356,6 +356,7 @@ Try not to modify this alist directly. Use `eaf-setq' to modify instead."
("M-v" . "scroll_down_page")
("M-<" . "scroll_to_begin")
("M->" . "scroll_to_bottom")
("M-p" . "duplicate_page")
("M-t" . "new_blank_page")
("SPC" . "insert_or_scroll_up_page")
("J" . "insert_or_select_left_tab")
@ -388,6 +389,7 @@ Try not to modify this alist directly. Use `eaf-setq' to modify instead."
("y" . "insert_or_download_youtube_video")
("Y" . "insert_or_download_youtube_audio")
("p" . "insert_or_toggle_device")
("P" . "insert_or_duplicate_page")
("1" . "insert_or_save_as_pdf")
("2" . "insert_or_save_as_single_file")
("v" . "insert_or_view_source")
@ -1676,6 +1678,15 @@ In that way the corresponding function will be called to retrieve the HTML
(interactive "M[EAF/browser] URL: ")
(eaf-open (eaf-wrap-url url) "browser" args))
(dbus-register-signal
:session "com.lazycat.eaf" "/com/lazycat/eaf"
"com.lazycat.eaf" "duplicate_page_in_new_tab"
#'eaf-browser--duplicate-page-in-new-tab)
(defun eaf-browser--duplicate-page-in-new-tab (url)
"Duplicate a new tab for the dedicated URL."
(eaf-open (eaf-wrap-url url) "browser" nil t))
(defun eaf-is-valid-url (url)
"Return the same URL if it is valid."
(when (and

@ -177,6 +177,7 @@ class EAF(dbus.service.Object):
app_buffer.update_buffer_details.connect(self.update_buffer_details)
app_buffer.translate_text.connect(self.translate_text)
app_buffer.open_url_in_new_tab.connect(self.open_url_in_new_tab)
app_buffer.duplicate_page_in_new_tab.connect(self.duplicate_page_in_new_tab)
app_buffer.open_url_in_background_tab.connect(self.open_url_in_background_tab)
app_buffer.goto_left_tab.connect(self.goto_left_tab)
app_buffer.goto_right_tab.connect(self.goto_right_tab)
@ -469,6 +470,10 @@ class EAF(dbus.service.Object):
def open_url_in_new_tab(self, url):
pass
@dbus.service.signal(EAF_DBUS_NAME)
def duplicate_page_in_new_tab(self, url):
pass
@dbus.service.signal(EAF_DBUS_NAME)
def open_dev_tools_page(self):
pass

Loading…
Cancel
Save