From aac3fb9aab434e9b0f006c4e54abd6170efee895 Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 24 Oct 2017 12:58:32 +0000 Subject: [PATCH] =?UTF-8?q?#718:=20Permitir=20caracteres=20Unicode=20y=20m?= =?UTF-8?q?ensajes=20de=20varias=20l=C3=ADneas=20en=20OGAgent=20para=20Win?= =?UTF-8?q?dows.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@5481 a21b9725-9963-47de-94b9-378ad31fedc9 --- src/OGAgentUser.py | 12 ++++++++---- src/opengnsys/windows/operations.py | 2 +- src/setup.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/OGAgentUser.py b/src/OGAgentUser.py index 4ec09ce..0a7c9ee 100644 --- a/src/OGAgentUser.py +++ b/src/OGAgentUser.py @@ -32,14 +32,13 @@ from __future__ import unicode_literals import sys -from PyQt4 import QtGui -from PyQt4 import QtCore - import time import signal import json import six import atexit +from PyQt4 import QtGui +from PyQt4 import QtCore from opengnsys import ipc from opengnsys import utils @@ -53,6 +52,11 @@ from opengnsys import VERSION from opengnsys.config import readConfig from opengnsys.loader import loadModules +# Set default characters encoding to UTF-8 +reload(sys) +if hasattr(sys, 'setdefaultencoding'): + sys.setdefaultencoding('utf-8') + trayIcon = None def sigAtExit(): @@ -309,7 +313,7 @@ class OGASystemTray(QtGui.QSystemTrayIcon): self.cleanup() self.app.quit() - def closeEvent(self,event): + def closeEvent(self, event): logger.debug("Exec closeEvent") event.accept() self.quit() diff --git a/src/opengnsys/windows/operations.py b/src/opengnsys/windows/operations.py index 4ff88c3..32ad817 100644 --- a/src/opengnsys/windows/operations.py +++ b/src/opengnsys/windows/operations.py @@ -237,5 +237,5 @@ def showPopup(title, message): ''' Displays a message box on user's session (during 1 min). ''' - return subprocess.call('mshta "javascript:var sh=new ActiveXObject(\'WScript.Shell\'); sh.Popup( \'{}\', 60, \'{}\', 64); close()"'.format(message, title), shell=True) + return subprocess.call('mshta "javascript:var sh=new ActiveXObject(\'WScript.Shell\'); sh.Popup( \'{}\', 60, \'{}\', 64); close()"'.format(message.encode('unicode_escape'), title.encode('unicode_escape')), shell=True) diff --git a/src/setup.py b/src/setup.py index c55b4aa..f80bf33 100644 --- a/src/setup.py +++ b/src/setup.py @@ -121,7 +121,7 @@ setup( 'bundle_files': 3, 'compressed': True, 'optimize': 2, - 'includes': ['sip', 'PyQt4', 'win32com.shell', 'requests'] + HIDDEN_BY_SIX, + 'includes': ['sip', 'PyQt4', 'win32com.shell', 'requests', 'encodings', 'encodings.utf_8'] + HIDDEN_BY_SIX, 'excludes': ['doctest', 'unittest'], 'dll_excludes': ['msvcp90.dll'], 'dist_dir': '..\\bin',