Skip to content

Commit fafc35f

Browse files
author
Linus Tibert
committed
import gtk3 if args are supplied, import system version otherwise to avoid errors
1 parent b5e2a71 commit fafc35f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nautilus-fileconverter.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
#! /usr/bin/python3 -OOt
22

33
# --- Version number ---
4-
converterVersion = "001003003" # Change the number if you want to trigger an update.
4+
converterVersion = "001003004" # Change the number if you want to trigger an update.
55
# --- Variable to enable debug mode ---
66
development_version = False
77

88
# --- Imports ---
9+
import sys
910
import gi
10-
from gi.repository import GObject, Gtk, Nautilus
11+
_nemoArgs = sys.argv[1:len(sys.argv)]
12+
if len(sys.argv) > 1:
13+
gi.require_version("Gtk", "3.0")
14+
from gi.repository import Gtk
15+
else:
16+
from gi.repository import Gtk
17+
from gi.repository import GObject, Nautilus
1118
from typing import List
1219
from PIL import Image, UnidentifiedImageError
1320
from urllib.parse import urlparse, unquote
@@ -18,7 +25,6 @@
1825
import os, shlex
1926
import urllib.request
2027
import json
21-
import sys
2228
import ast
2329
import re
2430
from multiprocessing import Process
@@ -537,4 +543,4 @@ def openPatchNotes(self, menu):
537543
os.system(f"nohup xdg-open \"https://github.com/Lich-Corals/linux-file-converter-addon/releases\" &")
538544

539545
def openConfigHint(self, menu):
540-
os.system(f"nohup xdg-open \"https://github.com/Lich-Corals/linux-file-converter-addon?tab=readme-ov-file#3-configuration\" &")
546+
os.system(f"nohup xdg-open \"https://github.com/Lich-Corals/linux-file-converter-addon?tab=readme-ov-file#3-configuration\" &")

0 commit comments

Comments
 (0)