Browse Source

feat(ttkode): add terminal (#393)

pull/383/head
Pier CeccoPierangioliEugenio 11 months ago committed by GitHub
parent
commit
3f2d0e0850
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      apps/ttkode/ttkode/app/ttkode.py

19
apps/ttkode/ttkode/app/ttkode.py

@ -138,7 +138,24 @@ class TTKode(ttk.TTkGridLayout):
appTemplate.setWidget(self._kodeTab, ttk.TTkAppTemplate.MAIN)
appTemplate.setItem(self._activityBar, ttk.TTkAppTemplate.LEFT, size=30)
appTemplate.setWidget(ttk.TTkLogViewer(), ttk.TTkAppTemplate.BOTTOM, title="Logs", size=3)
# Define the bottom panel, using the menu feature to add logs and terminal
bottomLayout = ttk.TTkGridLayout()
appTemplate.setItem(bottomLayout, ttk.TTkAppTemplate.BOTTOM, size=3)
appTemplate.setMenuBar(bottomMenuBar:=ttk.TTkMenuBarLayout(), ttk.TTkAppTemplate.BOTTOM)
bottomLayout.addWidget(_logViewer:=ttk.TTkLogViewer())
bottomLayout.addWidget(_terminal:=ttk.TTkTerminal(visible=False))
_th = ttk.TTkTerminalHelper(term=_terminal)
_th.runShell()
@ttk.pyTTkSlot(ttk.TTkWidget)
def _showBottomTab(wid:ttk.TTkWidget):
_logViewer.hide()
_terminal.hide()
wid.show()
bottomMenuBar.addMenu("Logs", alignment=ttk.TTkK.LEFT_ALIGN).menuButtonClicked.connect(lambda : _showBottomTab(_logViewer))
bottomMenuBar.addMenu(" Terminal", alignment=ttk.TTkK.LEFT_ALIGN).menuButtonClicked.connect(lambda : _showBottomTab(_terminal))
fileTree.fileActivated.connect(lambda x: self._openFile(x.path()))
self._kodeTab.tabAdded.connect(self._tabAdded)

Loading…
Cancel
Save