From 60613a1ed5cab70057cf47e3d967119ae8f59bb4 Mon Sep 17 00:00:00 2001 From: asamoukin Date: Mon, 11 Aug 2008 14:18:15 +0000 Subject: [PATCH] git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@124 c91db197-33c1-4113-bf15-f8a5c547ca64 --- pym/cl_profile.py | 1 + pym/cl_utils.py | 17 +++++++++-------- pym/cl_utils2.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/pym/cl_profile.py b/pym/cl_profile.py index bc55def..7501536 100644 --- a/pym/cl_profile.py +++ b/pym/cl_profile.py @@ -1601,6 +1601,7 @@ class _file(_error): fout, fin = popen2.popen2("file %s"%(nameFile)) fin.close() textLine = fout.readline() + fout.readlines() fout.close() if textLine: listTextLine = textLine.split(":") diff --git a/pym/cl_utils.py b/pym/cl_utils.py index b4285e2..4a4bc2e 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -1,13 +1,13 @@ #-*- coding: utf-8 -*- #Copyright 2008 Calculate Pack, http://www.calculate-linux.ru -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -76,7 +76,7 @@ def prettyColumnStr(*cols): partstr = cols[q][:cols[q+1]] # искать перевод строки с полученной части brfind = wherenr.search(partstr) - # если перевод строки найден, то + # если перевод строки найден, то if brfind != None: # для текущего вывода в колонку # берем часть строки до перевода @@ -227,7 +227,7 @@ def columnWrite(*cols): def justify(s,width): '''Выровнить текст по ширине - + Параметры: s выводимая строка width ширина на которую надо выровнить строку @@ -265,7 +265,7 @@ def justify(s,width): def runOsCommand(cmd, inStr=None, ret_first=None): """Выполняет внешнюю программу - + Параметры: cmdStrProg внешняя программа inStr данные передаваемые программе на страндартный вход. @@ -279,6 +279,7 @@ def runOsCommand(cmd, inStr=None, ret_first=None): fin.write(inStr) fin.close() res = fout.readlines() + fout.close() if res: if len(res) > 1: if ret_first: @@ -291,10 +292,10 @@ def runOsCommand(cmd, inStr=None, ret_first=None): def genpassword(passlen=9): '''Вернуть случайный пассворд указанной длины - + Параметры: passlen длина пароля который нужно сгенерировать - + Возвращаемые параметры: Сгенерированный пароль указанной длины ''' diff --git a/pym/cl_utils2.py b/pym/cl_utils2.py index ce09d5c..be17536 100644 --- a/pym/cl_utils2.py +++ b/pym/cl_utils2.py @@ -70,7 +70,7 @@ class cl_params: else: longOption = par["longOption"] numChapter = self.getChapterNumber(par['helpChapter']) - helpTxt = pcs( + helpTxt = pcs( " -%s, --%s "%(par["shortOption"],longOption), self.column_width, par['help'], CONWIDTH-self.column_width) @@ -185,7 +185,7 @@ def colorstr(s, *attrs): return "\033[%sm" % ";".join(attrs) + s def colorwrite(s, *attrs): - print colorstr(s, *attrs) + print colorstr(s, *attrs) class cl_smartconsole: def printRight(self, offsetLeft, offsetRight): @@ -351,5 +351,11 @@ class cl_smartconsole: (('',''), ) ) - - + def printSUCCESS(self, string): + """Вывод на печать в случае успеха без [ok] справа""" + self.printLine((('greenBr',' * '), + ('',string), + ), + (('',''), + ) + )