Handled AttributeError when tr imported from plugin

This commit is contained in:
Dmitri Bogomolov 2017-10-07 15:50:25 +03:00
parent 0c4d4de82f
commit 460107abaa
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -17,7 +17,11 @@ def _translate(context, text, disambiguation = None, encoding = None, n = None):
return translateText(context, text, n)
def translateText(context, text, n = None):
if not shared.thisapp.daemon:
try:
is_daemon = shared.thisapp.daemon
except AttributeError: # inside the plugin
is_daemon = False
if not is_daemon:
try:
from PyQt4 import QtCore, QtGui
except Exception as err: