1
0

AppImage: Fix webbrowser.open not opening links

There was an issue where webbrowser.open would invoke a program like
kde-open5 that loaded the systems libQt5DBus, which was not satisfied
with the AppImage's libdbus. To fix this we fork the process, unset
LD_LIBRARY_PATH and then open the URL.

fixes #5425

-----

taken from Electron-Cash/Electron-Cash@00939aafd1
This commit is contained in:
Axel Gembe
2019-07-05 00:02:26 +02:00
committed by SomberNight
parent 69b673b8a1
commit fc65cdaa8a
5 changed files with 24 additions and 13 deletions

View File

@@ -23,7 +23,6 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import webbrowser
from enum import IntEnum
from PyQt5.QtGui import QStandardItemModel, QStandardItem
@@ -35,7 +34,7 @@ from electrum.bitcoin import is_address
from electrum.util import block_explorer_URL
from electrum.plugin import run_hook
from .util import MyTreeView, import_meta_gui, export_meta_gui
from .util import MyTreeView, import_meta_gui, export_meta_gui, webopen
class ContactList(MyTreeView):
@@ -97,7 +96,7 @@ class ContactList(MyTreeView):
menu.addAction(_("Delete"), lambda: self.parent.delete_contacts(selected_keys))
URLs = [block_explorer_URL(self.config, 'addr', key) for key in filter(is_address, selected_keys)]
if URLs:
menu.addAction(_("View on block explorer"), lambda: [webbrowser.open(u) for u in URLs])
menu.addAction(_("View on block explorer"), lambda: [webopen(u) for u in URLs])
run_hook('create_contact_menu', menu, selected_keys)
menu.exec_(self.viewport().mapToGlobal(position))