Epiphany Python Console – Open New Tab
This is a quick tip about how to open new tabs with Python code in Epiphany.
One of the available functions is provided by Epiphany’s default shell object:
epiphany.ephy_shell_get_default().new_tab( window, tab, url, flags ) |
Here follows the info on how to use it to open new tabs. Open up the Epiphany Python console and start writing:
import epiphany tab = window.get_active_tab() url = 'http://www.python.org' flags = epiphany.NEW_TAB_IN_EXISTING_WINDOW \ | epiphany.NEW_TAB_APPEND_LAST \ | epiphany.NEW_TAB_OPEN_PAGE epiphany.ephy_shell_get_default().new_tab( window, tab, url, flags ) |
For an overview of what flags are available when dealing with new tabs, issue the following statement:
import epiphany a = dir(epiphany) for k in a: if k.startswith('NEW_TAB'): print k |
Special thanks to Dieguito at the #epiphany IRC channel for directing me to the right function. The rest was really easy. I just grep-ed the epiphany-extensions source code and some examples of the usage of the new_tab() function came up. They were in C, but were really easy to understand.
The Epiphany Python Console – Open New Tab by George Notaras, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.