summaryrefslogtreecommitdiff
path: root/plugins/externaltools/tools/filelookup.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/externaltools/tools/filelookup.py')
-rwxr-xr-xplugins/externaltools/tools/filelookup.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/externaltools/tools/filelookup.py b/plugins/externaltools/tools/filelookup.py
index ce4961f9..aa5abf9b 100755
--- a/plugins/externaltools/tools/filelookup.py
+++ b/plugins/externaltools/tools/filelookup.py
@@ -17,8 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
-import gio
-import pluma
+from gi.repository import Gio, Pluma
class FileLookup:
"""
@@ -73,7 +72,7 @@ class AbsoluteFileLookupProvider(FileLookupProvider):
def lookup(self, path):
if os.path.isabs(path) and os.path.isfile(path):
- return gio.File(path)
+ return Gio.file_new_for_path(path)
else:
return None
@@ -93,7 +92,7 @@ class CwdFileLookupProvider(FileLookupProvider):
real_path = os.path.join(cwd, path)
if os.path.isfile(real_path):
- return gio.File(real_path)
+ return Gio.file_new_for_path(real_path)
else:
return None
@@ -110,14 +109,14 @@ class OpenDocumentRelPathFileLookupProvider(FileLookupProvider):
if path.startswith('/'):
return None
- for doc in pluma.app_get_default().get_documents():
+ for doc in Pluma.App.get_default().get_documents():
if doc.is_local():
location = doc.get_location()
if location:
rel_path = location.get_parent().get_path()
joined_path = os.path.join(rel_path, path)
if os.path.isfile(joined_path):
- return gio.File(joined_path)
+ return Gio.file_new_for_path(joined_path)
return None
@@ -135,7 +134,7 @@ class OpenDocumentFileLookupProvider(FileLookupProvider):
if path.startswith('/'):
return None
- for doc in pluma.app_get_default().get_documents():
+ for doc in Pluma.App.get_default().get_documents():
if doc.is_local():
location = doc.get_location()
if location and location.get_uri().endswith(path):