Add custom error message if Twisted is not installed

Fixes #206.
This commit is contained in:
albertosottile 2018-10-29 15:39:46 +01:00
parent cb33724784
commit 6f840e4b4c
5 changed files with 9 additions and 0 deletions

View File

@ -116,6 +116,7 @@ de = {
"empty-error": "{} darf nicht leer sein", # Configuration
"media-player-error": "Player-Fehler: \"{}\"", # Error line
"unable-import-gui-error": "Konnte die GUI-Bibliotheken nicht importieren. PySide muss installiert sein, damit die grafische Oberfläche funktioniert.",
"unable-import-twisted-error": "Could not import Twisted. Please install Twisted v12.1.0 or later.", #To do: translate
"arguments-missing-error": "Notwendige Argumente fehlen, siehe --help",

View File

@ -115,6 +115,7 @@ en = {
"empty-error": "{} can't be empty", # Configuration
"media-player-error": "Media player error: \"{}\"", # Error line
"unable-import-gui-error": "Could not import GUI libraries. If you do not have PySide installed then you will need to install it for the GUI to work.",
"unable-import-twisted-error": "Could not import Twisted. Please install Twisted v12.1.0 or later.",
"arguments-missing-error": "Some necessary arguments are missing, refer to --help",

View File

@ -115,6 +115,7 @@ it = {
"empty-error": "Il campo {} non può esssere vuoto", # Configuration
"media-player-error": "Errore media player: \"{}\"", # Error line
"unable-import-gui-error": "Non è possibile importare le librerie di interfaccia grafica. Hai bisogno di PySide per poter utilizzare l'interfaccia grafica.",
"unable-import-twisted-error": "Non è possibile importare Twisted. Si prega di installare Twisted v12.1. o superiore.",
"arguments-missing-error": "Alcuni argomenti obbligatori non sono stati trovati. Fai riferimento a --help",

View File

@ -116,6 +116,7 @@ ru = {
"empty-error": "{} не может быть пустым.", # Configuration
"media-player-error": "Ошибка проигрывателя: \"{}\"", # Error line
"unable-import-gui-error": "Невозможно импортировать библиотеки GUI (графического интерфейса). Необходимо установить PySide, иначе графический интерфейс не будет работать.",
"unable-import-twisted-error": "Could not import Twisted. Please install Twisted v12.1.0 or later.", #To do: translate
"arguments-missing-error": "Некоторые необходимые аргументы отсутствуют, обратитесь к --help",

View File

@ -496,6 +496,11 @@ class ConfigurationGetter(object):
import appnope
appnope.nope()
except ImportError:
try:
from twisted.trial import unittest
except:
print(getMessage("unable-import-twisted-error"))
sys.exit()
print(getMessage("unable-import-gui-error"))
self._config['noGui'] = True
if self._config['file'] and self._config['file'][:2] == "--":