Пример #1
0
 def getScreenshot():
     """Retorna um screenshot da tela naquele momento"""
     tela = CApplication.getDesenhoTelaAtual()
     saida = ''
     for i in range(0, len(tela), EngineConsole.width()):
         saida += tela[i:min(i+EngineConsole.width(), len(tela))] + '\n'
     return saida
Пример #2
0
    def _desenharBordaTela(tela):
        """Retorna a tela com a borda"""
        newTela = ' /' + '-'*(EngineConsole.width()-4) + '\\ '
        for linha in tela.split('\n'):
            newTela += '|{0:<{1}}|'.format(linha, EngineConsole.width()-2)

        for _i in range(EngineConsole.height()-3-len(tela.split('\n'))):
            newTela += '|{0:<{1}}|'.format('', EngineConsole.width()-2)
            
        newTela += ' \\' + '-'*(EngineConsole.width()-4) + '/'
        return newTela
Пример #3
0
 def _updateTela():
     """Atualiza a tela principal"""
     try:
         CApplication._DESENHO_TELA_ATUAL = CApplication._getDesenhoTela()
     except Exception:
         CApplication._DESENHO_TELA_ATUAL = "Exceção lançada durante a renderização da tela:\n\n{0}".format(traceback.format_exc())
     
     CApplication._INSTANCE.telaAtualizada.emit()
         
     # Atualizando a tela
     EngineConsole.clear()
     print(CApplication._DESENHO_TELA_ATUAL)
Пример #4
0
    def _getDesenhoTela():
        """Retorna a tela ja formatada para ser mostrada"""
        tam = EngineConsole.width()
        if CApplication._DESENHAR_BORDA:
            tam -= 2

        tela = CApplication._TELA_PRINCIPAL.desenhoTelaConsole(tam)
        return CApplication._ajustarTela(tela)
Пример #5
0
 def _ajustarTela(tela):
     """Ajusta a tela de acordo com o valor de _DESENHA_BORDA"""
     if CApplication._DESENHAR_BORDA:
         return CApplication._desenharBordaTela(tela)
     else:
         newTela = ''
         for linha in tela.split('\n'):
             newTela += '{0:<{1}}'.format(linha, EngineConsole.width())
         return newTela
Пример #6
0
    def run(self):
        while 1:
            if EngineConsole.kbhit():
                self._entrarTecla(EngineConsole.readkey())

            self.msleep(20)
Пример #7
0
 def _entrarTecla(self, tecla):
     if tecla.code in (0, 224):
         code = EngineConsole.readkey().code
         self._entrarTeclaEspecial(code)
     else:
         self._entrarLetra(tecla)
#-*- coding: utf-8 -*-

import sys
sys.path.append("C:/Users/infox/My Documents/Aptana Studio 3 Workspace/mensageiroConsole/src")

from engineConsole.base.engine import EngineConsole

EngineConsole.setTitle("Titulo")
print("Isso não deveria aparecer")
EngineConsole.clear()

print("Height:", EngineConsole.height(), "- Width:", EngineConsole.width())

print("Erro!")
assert EngineConsole.x() == 0
assert EngineConsole.y() == 2
EngineConsole.printxy(0, 1, "Certo!")
assert EngineConsole.x() == 0
assert EngineConsole.y() == 2

EngineConsole.ungetch("t")
t = EngineConsole.readkey()
assert t.key == "t" and t.code == 116 

print("OK")
EngineConsole.readkey()