mirror of
https://github.com/lutris/lutris
synced 2024-09-15 13:59:50 +00:00
Reset LD_LIBRARY_PATH before displaying URIs (Fixes #654)
This commit is contained in:
parent
fdc5d13a7c
commit
b1d22d05cd
|
@ -1,11 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Common message dialogs"""
|
||||
import os
|
||||
from gi.repository import GLib, Gtk, Gdk, GObject
|
||||
from gi.repository import GLib, Gtk, GObject
|
||||
|
||||
from lutris import api, pga, runtime, settings
|
||||
from lutris.gui.widgets.download_progress import DownloadProgressBox
|
||||
from lutris.util import datapath
|
||||
from lutris.util.system import open_uri
|
||||
from lutris.util.log import logger
|
||||
|
||||
|
||||
|
@ -33,10 +34,7 @@ class GtkBuilderDialog(GObject.Object):
|
|||
pass
|
||||
|
||||
def on_close(self, *args):
|
||||
try:
|
||||
self.dialog.destroy()
|
||||
except:
|
||||
logger.info("Tell strider that he can't write an about dialog")
|
||||
self.dialog.destroy()
|
||||
|
||||
def on_response(self, widget, response):
|
||||
if response == Gtk.ResponseType.DELETE_EVENT:
|
||||
|
@ -340,7 +338,7 @@ class ClientUpdateDialog(GtkBuilderDialog):
|
|||
dialog_object = "client_update_dialog"
|
||||
|
||||
def on_open_downloads_clicked(self, _widget):
|
||||
Gtk.show_uri(None, "http://lutris.net", Gdk.CURRENT_TIME)
|
||||
open_uri("http://lutris.net")
|
||||
|
||||
|
||||
class NoInstallerDialog(Gtk.MessageDialog):
|
||||
|
|
|
@ -6,7 +6,7 @@ import time
|
|||
from collections import namedtuple
|
||||
from itertools import chain
|
||||
|
||||
from gi.repository import Gtk, Gdk, GLib, Gio
|
||||
from gi.repository import Gtk, GLib, Gio
|
||||
|
||||
from lutris import api, pga, settings
|
||||
from lutris.game import Game
|
||||
|
@ -16,6 +16,8 @@ from lutris.runtime import RuntimeUpdater
|
|||
from lutris.util import resources
|
||||
from lutris.util.log import logger
|
||||
from lutris.util.jobs import AsyncCall
|
||||
from lutris.util.system import open_uri
|
||||
|
||||
from lutris.util import http
|
||||
from lutris.util import datapath
|
||||
from lutris.util.steam import SteamWatcher
|
||||
|
@ -160,10 +162,10 @@ class LutrisWindow(Gtk.ApplicationWindow):
|
|||
|
||||
actions = {
|
||||
'browse-games': Action(
|
||||
lambda *x: self._open_browser('https://lutris.net/games/')
|
||||
lambda *x: open_uri('https://lutris.net/games/')
|
||||
),
|
||||
'register-account': Action(
|
||||
lambda *x: self._open_browser('https://lutris.net/user/register/')
|
||||
lambda *x: open_uri('https://lutris.net/user/register/')
|
||||
),
|
||||
|
||||
'disconnect': Action(self.on_disconnect),
|
||||
|
@ -454,10 +456,6 @@ class LutrisWindow(Gtk.ApplicationWindow):
|
|||
connection_status = "Not connected"
|
||||
self.connection_label.set_text(connection_status)
|
||||
|
||||
@staticmethod
|
||||
def _open_browser(url):
|
||||
Gtk.show_uri(None, url, Gdk.CURRENT_TIME)
|
||||
|
||||
@GtkTemplate.Callback
|
||||
def on_resize(self, widget, *args):
|
||||
"""Size-allocate signal.
|
||||
|
@ -677,7 +675,7 @@ class LutrisWindow(Gtk.ApplicationWindow):
|
|||
game = Game(self.view.selected_game)
|
||||
path = game.get_browse_dir()
|
||||
if path and os.path.exists(path):
|
||||
Gtk.show_uri(None, 'file://' + path, Gdk.CURRENT_TIME)
|
||||
open_uri('file://' + path)
|
||||
else:
|
||||
dialogs.NoticeDialog(
|
||||
"Can't open %s \nThe folder doesn't exist." % path
|
||||
|
@ -685,7 +683,7 @@ class LutrisWindow(Gtk.ApplicationWindow):
|
|||
|
||||
def on_view_game(self, widget):
|
||||
game = Game(self.view.selected_game)
|
||||
self._open_browser('https://lutris.net/games/' + game.slug)
|
||||
open_uri('https://lutris.net/games/' + game.slug)
|
||||
|
||||
def on_edit_game_configuration(self, widget):
|
||||
"""Edit game preferences."""
|
||||
|
|
|
@ -3,6 +3,7 @@ from gi.repository import Gtk, GObject, Gdk
|
|||
|
||||
from lutris import runners
|
||||
from lutris import settings
|
||||
from lutris.util.system import open_uri
|
||||
from lutris.gui.widgets.utils import get_runner_icon
|
||||
from lutris.gui.dialogs import ErrorDialog
|
||||
from lutris.gui.config_dialogs import RunnerConfigDialog
|
||||
|
@ -59,7 +60,7 @@ class RunnersDialog(Gtk.Window):
|
|||
refresh_button.show()
|
||||
refresh_button.connect('clicked', self.on_refresh_clicked)
|
||||
buttons_box.pack_start(refresh_button, False, False, 10)
|
||||
|
||||
|
||||
close_button = Gtk.Button("Close")
|
||||
close_button.show()
|
||||
close_button.connect('clicked', self.on_close_clicked)
|
||||
|
@ -179,13 +180,13 @@ class RunnersDialog(Gtk.Window):
|
|||
runner, runner_label)
|
||||
|
||||
def on_runner_open_clicked(self, widget):
|
||||
Gtk.show_uri(None, 'file://' + settings.RUNNER_DIR, Gdk.CURRENT_TIME)
|
||||
open_uri('file://' + settings.RUNNER_DIR)
|
||||
|
||||
def on_refresh_clicked(self, widget):
|
||||
for child in self.runner_listbox:
|
||||
child.destroy()
|
||||
self.populate_runners()
|
||||
|
||||
|
||||
def on_close_clicked(self, widget):
|
||||
self.destroy()
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import string
|
|||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
from gi.repository import Gtk, Gdk
|
||||
|
||||
from lutris.util.log import logger
|
||||
|
||||
|
@ -359,3 +360,11 @@ def path_is_empty(path):
|
|||
|
||||
def stacktrace():
|
||||
traceback.print_stack()
|
||||
|
||||
|
||||
def open_uri(uri):
|
||||
"""Opens a local or remote URI with the default application"""
|
||||
for key in ('LD_LIBRARY_PATH', 'LD_PRELOAD'):
|
||||
if os.environ.get(key):
|
||||
del os.environ[key]
|
||||
Gtk.show_uri(None, uri, Gdk.CURRENT_TIME)
|
||||
|
|
Loading…
Reference in a new issue