|
|
diff --git calculate/lib/utils/colortext/converter.py calculate/lib/utils/colortext/converter.py
|
|
|
index 541b99c..0e74599 100644
|
|
|
--- calculate/lib/utils/colortext/converter.py
|
|
|
+++ calculate/lib/utils/colortext/converter.py
|
|
|
@@ -102,7 +102,7 @@ class ConsoleCodesConverter(BaseConverter):
|
|
|
self.escSymb = escSymb
|
|
|
self.escBlock = (r"{esc}(?:\[(\d+(?:;\d+)*)m|"
|
|
|
"\]\d+;.*?\x07|\[\d*[A-D])".format(esc=escSymb))
|
|
|
- self.otherSymb = "\r*\n"
|
|
|
+ self.otherSymb = "(?:\r*\n|\t)"
|
|
|
self.reEscBlock = re.compile(self.escBlock)
|
|
|
self.reParse = re.compile(
|
|
|
"(?:{0}|({1}))?(.*?)(?=$|{0}|{1})".format(self.escBlock,
|
|
|
@@ -141,9 +141,10 @@ class ConsoleCodesConverter(BaseConverter):
|
|
|
action=self.output.setBackground)
|
|
|
newline = element(lambda code: "\r" in code or "\n" in code,
|
|
|
self.output.newLine)
|
|
|
+ tab = element(lambda code: "\t" in code, self.output.tab)
|
|
|
self.grams = [reset, bold, halfbright, underline, nounderline, normal,
|
|
|
invert, noinvert, reset_foreground, reset_background,
|
|
|
- foreground, background, newline]
|
|
|
+ foreground, background, tab, newline]
|
|
|
|
|
|
def evaluteGram(self, code, codes=None):
|
|
|
"""Выполнить грамматику"""
|
|
|
@@ -244,7 +245,8 @@ class XmlConverter(BaseConverter):
|
|
|
Tags.FONT: self.parseFont
|
|
|
}
|
|
|
self.singletagMap = {
|
|
|
- Tags.NEWLINE: self.output.newLine
|
|
|
+ Tags.NEWLINE: self.output.newLine,
|
|
|
+ Tags.TAB: self.output.tab
|
|
|
}
|
|
|
self.colorMap = {FontAttr.FOREGROUND.lower(): self.output.setForeground,
|
|
|
FontAttr.BACKGROUND.lower(): self.output.setBackground}
|
|
|
diff --git calculate/lib/utils/colortext/output.py calculate/lib/utils/colortext/output.py
|
|
|
index 461bd2f..13aff27 100644
|
|
|
--- calculate/lib/utils/colortext/output.py
|
|
|
+++ calculate/lib/utils/colortext/output.py
|
|
|
@@ -136,6 +136,12 @@ class BaseOutput(object):
|
|
|
"""
|
|
|
return "\n"
|
|
|
|
|
|
+ def tab(self):
|
|
|
+ """
|
|
|
+ Вывести символ табуляции
|
|
|
+ """
|
|
|
+ return "\t"
|
|
|
+
|
|
|
def clone(self):
|
|
|
"""
|
|
|
Создать копию объекта
|
|
|
@@ -340,6 +346,8 @@ class ColorTerminalOutput(SaveAttrOutput):
|
|
|
def newLine(self):
|
|
|
return "\n"
|
|
|
|
|
|
+ def tab(self):
|
|
|
+ return "\t"
|
|
|
|
|
|
class ColorTerminal256Output(ColorTerminalOutput):
|
|
|
"""
|
|
|
@@ -496,6 +504,9 @@ class SpanCssOutput(SaveAttrOutput):
|
|
|
def newLine(self):
|
|
|
return "<br/>"
|
|
|
|
|
|
+ def tab(self):
|
|
|
+ return "	"
|
|
|
+
|
|
|
class XmlOutput(SaveAttrOutput):
|
|
|
"""
|
|
|
Форматирует текст c описанием формата в XML для внутренней передачи
|
|
|
@@ -575,6 +586,9 @@ class XmlOutput(SaveAttrOutput):
|
|
|
def newLine(self):
|
|
|
return "<br/>"
|
|
|
|
|
|
+ def tab(self):
|
|
|
+ return "<tab/>"
|
|
|
+
|
|
|
|
|
|
class BasePositionOutput(object):
|
|
|
"""
|
|
|
diff --git calculate/lib/utils/colortext/palette.py calculate/lib/utils/colortext/palette.py
|
|
|
index f99c414..6e09a30 100644
|
|
|
--- calculate/lib/utils/colortext/palette.py
|
|
|
+++ calculate/lib/utils/colortext/palette.py
|
|
|
@@ -429,6 +429,7 @@ class XmlFormat:
|
|
|
HALFBRIGHT = "dark"
|
|
|
INVERT = "invert"
|
|
|
NEWLINE = "br"
|
|
|
+ TAB = "tab"
|
|
|
|
|
|
class FontAttributes:
|
|
|
BACKGROUND = "bgColor"
|
|
|
diff --git calculate/lib/utils/files.py calculate/lib/utils/files.py
|
|
|
index 9aafa7a..6fddc6f 100644
|
|
|
--- calculate/lib/utils/files.py
|
|
|
+++ calculate/lib/utils/files.py
|
|
|
@@ -113,7 +113,7 @@ class process:
|
|
|
else:
|
|
|
stdin=kwarg["stdin"].getStdout
|
|
|
self.stdout = kwarg.get("stdout",PIPE)
|
|
|
- self.envdict = kwarg.get("envdict",{})
|
|
|
+ self.envdict = kwarg.get("envdict",os.environ.copy())
|
|
|
if "lang" in kwarg:
|
|
|
self.envdict["LANG"] = kwarg.get('lang')
|
|
|
self.langc = "langc" in kwarg
|
|
|
@@ -1029,6 +1029,7 @@ class PercentProgress(processProgress):
|
|
|
self.cachedata = re.compile(kwargs.get("cachefilter",
|
|
|
"((?:\[31;01m\*|\[33;01m\*|error:|warning:|fatal:).*)"))
|
|
|
self.atty = kwargs.get("atty",False)
|
|
|
+ self.alldata = ""
|
|
|
|
|
|
def _open(self):
|
|
|
self.master,self.slave = None,None
|
|
|
@@ -1058,13 +1059,14 @@ class PercentProgress(processProgress):
|
|
|
self.percent = 100
|
|
|
return 100
|
|
|
|
|
|
- def processString(self,strdata):
|
|
|
+ def processString(self, strdata):
|
|
|
+ self.alldata += strdata
|
|
|
match = self.rePerc.search(strdata)
|
|
|
resSearch = self.cachedata.search(strdata)
|
|
|
if resSearch:
|
|
|
self.cacheresult.append(
|
|
|
re.sub("\[31;01m\*|\[33;01m\*|\[.*?m",
|
|
|
- "",resSearch.group(1)))
|
|
|
+ "", resSearch.group(1)))
|
|
|
if match:
|
|
|
percent = int(match.group(1))
|
|
|
if percent < self.percent:
|