Browse Source

Added terminal multiplexer

pull/243/head
Eugenio Parodi 2 years ago
parent
commit
69b8581f6f
  1. 67
      tests/stress/03.parallax.03.py

67
tests/stress/03.parallax.03.py

@ -207,12 +207,6 @@ class Parallax(ttk.TTkWidget):
def _refreshAnimation(self):
self.update()
# 1) 11 11 11 11-11 11 11 11-11 11 ..
# 2) 22 11 11 11-22 11 11 11-22 11 ..
# 3) 33 33 11 11-33 33 11 11-33 33 ..
# 4) 44 44 44 11-44 44 44 11-44 44 ..
# 5) 44 44 44 44-44 44 44 44-44 44 ..
def paintEvent(self, canvas: ttk.TTkCanvas):
w,h = self.size()
diff = int(200*(time.time() - self._baseTime))
@ -220,33 +214,6 @@ class Parallax(ttk.TTkWidget):
secH = h//5
# draw the bgColor
canvas.fill(pos=(0,0), size=(w,secH*4), color=Parallax.COLOR1)
# # draw the 2nd section
# for x in range(0,w+8,16):
# x += (diff%(32*4))//8
# canvas.fill(pos=(w-x, secH), size=(3,secH*3), color=Parallax.COLOR2)
# canvas.fill(pos=(w-x-2,secH+2), size=(6,secH*3), color=Parallax.COLOR2)
# canvas.fill(pos=(w-x, secH+3), size=(10,secH*3), color=Parallax.COLOR2)
# canvas.fill( pos=(0,3*secH+3), size=(w,secH*3), color=Parallax.COLOR2)
# # draw the 3nd section
# for x in range(0,w+16,32):
# x += (diff%(32*6))//6
# canvas.fill(pos=(w-x,2*secH), size=(12,secH*3), color=Parallax.COLOR3)
# canvas.fill(pos=(w-x+12,5*secH//2), size=(4,secH*3), color=Parallax.COLOR3)
# lw1,lh = self.l11.size()
# lw2,lh = self.l12.size()
# lw3,lh = self.l21.size()
# lw=lw1
# self.l11.drawInCanvas(pos=(( (-diff)//8)%(w+lw)-lw,4),canvas=canvas)
# self.l11.drawInCanvas(pos=((lw1+lw2+(-diff)//8)%(w+lw)-lw,4),canvas=canvas)
# lw=lw2
# self.l12.drawInCanvas(pos=((lw1+ (-diff)//8)%(w+lw)-lw,3),canvas=canvas)
# self.l12.drawInCanvas(pos=((2*lw1+lw2+(-diff)//8)%(w+lw)-lw,3),canvas=canvas)
# canvas.fill(pos=(0,9), size=(w,h-9), color=Parallax.COLOR2)
# lw=lw3
# self.l21.drawInCanvas(pos=(( (-diff)//4)%(w+lw)-lw,5),canvas=canvas)
# self.l21.drawInCanvas(pos=((lw3+ (-diff)//4)%(w+lw)-lw,5),canvas=canvas)
# self.l21.drawInCanvas(pos=((lw3+lw3+(-diff)//4)%(w+lw)-lw,5),canvas=canvas)
# draw the Layers:
def _drawLayer(_l,_d,canvas=canvas):
@ -266,22 +233,26 @@ class Parallax(ttk.TTkWidget):
canvas.fill(pos=(0,17), size=(w,h-17), color=Parallax.COLOR3)
_drawLayer(self._layer3,(-diff)//2)
# # draw the 4nd section
# for x in range(0,w+20,50):
# x += (diff%(50*2))//2
# canvas.fill( pos=(w-x+15,2*secH-3), color=Parallax.COLOR6, size=(1,secH*3) )
# canvas.fill( pos=(w-x+10,3*secH-4), color=Parallax.COLOR6, size=(10,secH*3) )
# canvas.drawText(pos=(w-x, 3*secH+0), color=Parallax.COLOR5, text='▀'*43)
# canvas.drawText(pos=(w-x, 3*secH+1), color=Parallax.COLOR4, text=f'┌{"─╥"*20}─┐')
# canvas.drawText(pos=(w-x, 3*secH+2), color=Parallax.COLOR4, text=f'└{"─╨"*20}─┘')
# canvas.drawText(pos=(w-x, 3*secH+3), color=Parallax.COLOR5, text=f' {"███ "*10} ')
# canvas.drawText(pos=(w-x, 3*secH+4), color=Parallax.COLOR5, text=f' {"███ "*10} ')
# canvas.fill( pos=(w-x, 3*secH+5), color=Parallax.COLOR4, size=(43,secH) )
# # draw the 5nd section
# canvas.fill(pos=(0,4*secH+2), size=(w,secH), color=Parallax.COLOR4)
root = ttk.TTk(title="TTKanabalt")
@ttk.pyTTkSlot()
def _newTerminal():
win = ttk.TTkWindow(title="Mr. Terminal 🖥",
parent=root,
pos=(3,1), size=(80+2,24+5),
flags = ttk.TTkK.WindowFlag.WindowMinMaxButtonsHint | ttk.TTkK.WindowFlag.WindowReduceButtonHint ,
layout=ttk.TTkGridLayout())
term = ttk.TTkTerminal(parent=win)
th = ttk.TTkTerminalHelper(term=term)
th.terminalClosed.connect(win.close)
term.bell.connect(lambda : ttk.TTkLog.debug("BELL!!! 🔔🔔🔔"))
term.titleChanged.connect(win.setTitle)
win.closed.connect(term.close)
term.setFocus()
term.raiseWidget()
th.runShell()
root = ttk.TTk(title="TTKanabalt")
Parallax(parent=root, pos=(5,2), size=(100,25))
Parallax(parent=root, pos=(5,3), size=(100,25))
ttk.TTkButton(parent=root, border=True, text=' 🖥 ').clicked.connect(_newTerminal)
root.mainloop()

Loading…
Cancel
Save