* fix the output problem, encode to utf-8
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
#import locale
|
import locale
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
@@ -59,7 +59,8 @@ Please file a bug report! (http://bugs.uludag.org.tr)
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#locale.setlocale(locale.LC_ALL, '')
|
|
||||||
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
|
||||||
sys.excepthook = handle_exception
|
sys.excepthook = handle_exception
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
__version__ = "1.0_alpha4"
|
__version__ = "1.0_alpha4"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import locale
|
||||||
|
|
||||||
import pisi
|
import pisi
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
@@ -32,10 +33,12 @@ class CLI(UI):
|
|||||||
|
|
||||||
def __init__(self, show_debug = False, show_verbose = False):
|
def __init__(self, show_debug = False, show_verbose = False):
|
||||||
super(CLI, self).__init__(show_debug, show_verbose)
|
super(CLI, self).__init__(show_debug, show_verbose)
|
||||||
|
#self.encoding = locale.getpreferredencoding()
|
||||||
|
#self.encoding = self.encoding.lower()
|
||||||
|
#FIXME: above code does not work for some reason on MDK!
|
||||||
|
|
||||||
def output(self, str):
|
def output(self, str):
|
||||||
sys.stdout.write(str.encode("utf-8"))
|
print str.encode('utf-8')
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
def info(self, msg, verbose = False, noln = False):
|
def info(self, msg, verbose = False, noln = False):
|
||||||
# TODO: need to look at more kinds of info messages
|
# TODO: need to look at more kinds of info messages
|
||||||
@@ -50,13 +53,16 @@ class CLI(UI):
|
|||||||
self.output(msg + msgend)
|
self.output(msg + msgend)
|
||||||
|
|
||||||
def warning(self,msg):
|
def warning(self,msg):
|
||||||
|
#self.output('Warning: ' + msg + '\n')
|
||||||
self.output(colorize('Warning:' + msg + '\n', 'purple'))
|
self.output(colorize('Warning:' + msg + '\n', 'purple'))
|
||||||
|
|
||||||
def error(self,msg):
|
def error(self,msg):
|
||||||
|
#self.output('Error:' + msg + '\n')
|
||||||
self.output(colorize('Error: ' + msg + '\n', 'red'))
|
self.output(colorize('Error: ' + msg + '\n', 'red'))
|
||||||
|
|
||||||
def action(self,msg):
|
def action(self,msg):
|
||||||
#TODO: this seems quite redundant?
|
#TODO: this seems quite redundant?
|
||||||
|
#self.output(msg + '\n', 'green')
|
||||||
self.output(colorize(msg + '\n', 'green'))
|
self.output(colorize(msg + '\n', 'green'))
|
||||||
|
|
||||||
def choose(self, msg, opts):
|
def choose(self, msg, opts):
|
||||||
|
|||||||
Reference in New Issue
Block a user