Remove xdg-utils dependency
This commit is contained in:
parent
9bb252e405
commit
727139f817
@ -26,7 +26,6 @@ The following three packages with GObject Introspection bindings (the gi package
|
|||||||
* **pangocairo** - Allows you to use Pango with Cairo http://www.pango.org/
|
* **pangocairo** - Allows you to use Pango with Cairo http://www.pango.org/
|
||||||
|
|
||||||
* **librsvg2** - (SVG icon view) a library to render SVG files using cairo. http://live.gnome.org/LibRsvg
|
* **librsvg2** - (SVG icon view) a library to render SVG files using cairo. http://live.gnome.org/LibRsvg
|
||||||
* **xdg-utils** - Desktop integration utilities from freedesktop.org
|
|
||||||
* **bsddb3** - Python bindings for Oracle Berkeley DB https://pypi.python.org/pypi/bsddb3/
|
* **bsddb3** - Python bindings for Oracle Berkeley DB https://pypi.python.org/pypi/bsddb3/
|
||||||
* **sqlite3** - Python bindings for SQLite Database library
|
* **sqlite3** - Python bindings for SQLite Database library
|
||||||
|
|
||||||
|
1
debian/control
vendored
1
debian/control
vendored
@ -34,7 +34,6 @@ Depends:
|
|||||||
python3-gi (>= 3.12.0),
|
python3-gi (>= 3.12.0),
|
||||||
python3-gi-cairo,
|
python3-gi-cairo,
|
||||||
python3-bsddb3,
|
python3-bsddb3,
|
||||||
xdg-utils,
|
|
||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
${python3:Depends}
|
${python3:Depends}
|
||||||
Recommends:
|
Recommends:
|
||||||
|
@ -29,7 +29,6 @@ Utility functions that depend on GUI components or for GUI components
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
|
||||||
import threading
|
import threading
|
||||||
# gtk is not included here, because this file is currently imported
|
# gtk is not included here, because this file is currently imported
|
||||||
# by code that needs to run without the DISPLAY variable (eg, in
|
# by code that needs to run without the DISPLAY variable (eg, in
|
||||||
@ -45,6 +44,7 @@ gi.require_version('PangoCairo', '1.0')
|
|||||||
from gi.repository import PangoCairo
|
from gi.repository import PangoCairo
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import Gio
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -368,7 +368,7 @@ class SystemFonts:
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def display_error_dialog (index, errorstrings, uistate=None):
|
def display_error_dialog (index, errorstrings, uistate=None):
|
||||||
"""
|
"""
|
||||||
Display a message box for errors resulting from xdg-open/open
|
Display a message box for errors resulting from open
|
||||||
"""
|
"""
|
||||||
from .dialog import ErrorDialog
|
from .dialog import ErrorDialog
|
||||||
error = _("The external program failed to launch or experienced an error")
|
error = _("The external program failed to launch or experienced an error")
|
||||||
@ -384,28 +384,6 @@ def display_error_dialog (index, errorstrings, uistate=None):
|
|||||||
ErrorDialog(_("Error from external program"),
|
ErrorDialog(_("Error from external program"),
|
||||||
error, parent=uistate.window)
|
error, parent=uistate.window)
|
||||||
|
|
||||||
def poll_external (args):
|
|
||||||
"""
|
|
||||||
Check the for completion of a task launched with
|
|
||||||
subprocess.Popen(). This function is intended to be passed to
|
|
||||||
GLib.timeout_add_seconds, so the arguments are in a tuple because that
|
|
||||||
function takes only a single data argument.
|
|
||||||
|
|
||||||
:param proc: the process, returned from subprocess.Popen()
|
|
||||||
:param errorstrings: a dict of possible response values and the
|
|
||||||
corresponding messages to display.
|
|
||||||
:return: bool returned to timeout_add_seconds: should this function be
|
|
||||||
called again?
|
|
||||||
"""
|
|
||||||
(proc, errorstrings, uistate) = args
|
|
||||||
resp = proc.poll()
|
|
||||||
if resp is None:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if resp != 0:
|
|
||||||
display_error_dialog(resp, errorstrings, uistate)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def open_file_with_default_application(path, uistate):
|
def open_file_with_default_application(path, uistate):
|
||||||
"""
|
"""
|
||||||
Launch a program to open an arbitrary file. The file will be opened using
|
Launch a program to open an arbitrary file. The file will be opened using
|
||||||
@ -418,8 +396,6 @@ def open_file_with_default_application(path, uistate):
|
|||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
|
|
||||||
errstrings = None
|
|
||||||
|
|
||||||
norm_path = os.path.normpath(path)
|
norm_path = os.path.normpath(path)
|
||||||
if not os.path.exists(norm_path):
|
if not os.path.exists(norm_path):
|
||||||
display_error_dialog(0, _("File %s does not exist") % norm_path,
|
display_error_dialog(0, _("File %s does not exist") % norm_path,
|
||||||
@ -435,20 +411,12 @@ def open_file_with_default_application(path, uistate):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if mac():
|
if not norm_path.startswith('file://'):
|
||||||
utility = '/usr/bin/open'
|
norm_path = 'file://' + norm_path
|
||||||
else:
|
try:
|
||||||
utility = 'xdg-open'
|
Gio.AppInfo.launch_default_for_uri(norm_path)
|
||||||
errstrings = {1:'Error in command line syntax.',
|
except GLib.Error as error:
|
||||||
2:'One of the files passed on the command line did not exist.',
|
display_error_dialog(0, str(error), uistate)
|
||||||
3:' A required tool could not be found.',
|
|
||||||
4:'The action failed.'}
|
|
||||||
|
|
||||||
proc = subprocess.Popen([utility, norm_path], stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
from gi.repository import GLib
|
|
||||||
GLib.timeout_add_seconds(1, poll_external, (proc, errstrings, uistate))
|
|
||||||
return
|
|
||||||
|
|
||||||
def process_pending_events(max_count=20):
|
def process_pending_events(max_count=20):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user