Skip to content

Commit

Permalink
Added terminal multiplexer
Browse files Browse the repository at this point in the history
  • Loading branch information
ceccopierangiolieugenio committed Mar 2, 2024
1 parent 27c42b7 commit 69b8581
Showing 1 changed file with 19 additions and 48 deletions.
67 changes: 19 additions & 48 deletions tests/stress/03.parallax.03.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,46 +207,13 @@ def __init__(self, *args, **kwargs):
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))

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):
Expand All @@ -266,22 +233,26 @@ def _drawLayer(_l,_d,canvas=canvas):
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()

0 comments on commit 69b8581

Please sign in to comment.