diff --git a/qubesmanager/qvm_template_gui.py b/qubesmanager/qvm_template_gui.py index 5c5b78d9..1bdc3907 100644 --- a/qubesmanager/qvm_template_gui.py +++ b/qubesmanager/qvm_template_gui.py @@ -15,7 +15,7 @@ #pylint: disable=invalid-name -BASE_CMD = ['qvm-template', '--enablerepo=*', '--yes', '--quiet'] +BASE_CMD = ['qvm-template', '--enablerepo=*', '--yes'] class Template(typing.NamedTuple): status: str @@ -291,6 +291,19 @@ def __init__(self, actions): self.actions = actions self.buttonBox.hide() + @staticmethod + def _process_cr(text): + """Reduce lines replaced using CR character (\r)""" + while '\r' in text: + prefix, suffix = text.rsplit('\r', 1) + if '\n' in prefix: + prefix, lastline = prefix.rsplit('\n', 1) + prefix += '\n' + else: + prefix, lastline = '', prefix + text = prefix + suffix + return text + def install(self): async def coro(): self.actions.sort() @@ -313,12 +326,14 @@ async def coro(): stderr=asyncio.subprocess.STDOUT, env=envs) #pylint: disable=cell-var-from-loop + status_text = '' while True: - line = await proc.stdout.readline() + line = await proc.stdout.read(100) if line == b'': break - line = line.decode('ASCII') - self.textEdit.append(line.rstrip()) + line = line.decode('UTF-8') + status_text = self._process_cr(status_text + line) + self.textEdit.setPlainText(status_text) if await proc.wait() != 0: self.buttonBox.show() self.progressBar.setMaximum(100) diff --git a/ui/templateinstallprogressdlg.ui b/ui/templateinstallprogressdlg.ui index 5cc77915..3f980820 100644 --- a/ui/templateinstallprogressdlg.ui +++ b/ui/templateinstallprogressdlg.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 840 + 260