This commit is contained in:
AlexVeeBee 2024-01-22 12:57:10 +00:00
parent 90b1b125c0
commit a5106b4c14
7 changed files with 134 additions and 39 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
build/ build/
dist/ dist/
__pycache__/
*.spec

View File

@ -49,6 +49,10 @@ except Exception as e:
print("Error: ") print("Error: ")
print(e) print(e)
def downloadProject(pathToFile):
pass
def main(): def main():
# define the window layout # define the window layout
@ -90,7 +94,8 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
try: try:
main() main()
print("Close") print("Goodbye")
exit(0)
except Exception as e: except Exception as e:
print('Error: ', end='') print('Error: ', end='')
print(e) print(e)

View File

@ -1,37 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['appmanager\\projects.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='projects',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)

8
terminalUi/app.tcss Normal file
View File

@ -0,0 +1,8 @@
MyApp {
layout: horizontal;
background: #000000;
}
ProjectItem {
layout: horizontal;
}

31
terminalUi/customlog.py Normal file
View File

@ -0,0 +1,31 @@
terminal_colors = {
"RESET": "\033[0m",
"RED": "\033[1;31;40m",
"GREEN": "\033[1;32;40m",
"YELLOW": "\033[1;33;40m",
"BLUE": "\033[1;34;40m",
}
terminal_status = {
"ERROR": "RED",
"SUCCESS": "GREEN",
"WARNING": "YELLOW",
"INFO": "BLUE",
}
config = {
"date&time": True,
"format": "%H:%M:%S"
}
def customPrint(text, status):
print_start = f"{terminal_colors[terminal_status[status]]}{status}{terminal_colors['RESET']}: "
if config["date&time"]:
import datetime
now = datetime.datetime.now()
date_time = now.strftime(config["format"])
print_start = f"{terminal_colors[terminal_status[status]]}[{date_time}] {status}{terminal_colors['RESET']} : "
print_end = f"{terminal_colors['RESET']}"
print(f"{print_start}{text}{print_end}")
customPrint("Custom print function loaded", "INFO")

View File

@ -0,0 +1,56 @@
import argparse
import sys, os
import threading
import customlog as log
log.customPrint("Preparing", "INFO")
import TermTk as ttk
# Create a new application
def checkApps(root=None):
git = os.system("git --version")
if git != 0:
log.customPrint("Git is not installed", "ERROR")
raise Exception("Git is not installed")
node = os.system("node --version")
if node != 0:
log.customPrint("Node is not installed", "ERROR")
raise Exception("Node is not installed")
pass
# def drawMain(root=None, border=True):
# spliter = ttk.TTkLabel(parent=root, text="Getting Ready", border=border)
# root.layout().addWidget(spliter)
def main():
log.customPrint("Starting PyTermTK", "INFO")
root = ttk.TTk(title="PyTermTK", layout=ttk.TTkGridLayout(), mouseTrack=True)
tab = ttk.TTkTabWidget(parent=root)
maintab = ttk.TTkTabWidget(parent=tab, title="Main")
maintab.layout().addWidget(ttk.TTkLabel(parent=maintab, text="Getting Ready", border=True))
quitButton = ttk.TTkButton(parent=maintab, text="Quit", layout=ttk.TTkGridLayout())
tab.addTab( maintab, "Main" )
quitButton.clicked.connect(ttk.TTkHelper.quit)
root.mainloop()
os.system('cls' if os.name == 'nt' else 'clear')
pass
if __name__ == "__main__":
try:
checkApps()
import time
time.sleep(1)
main()
exit(0)
except Exception as e:
import traceback
log.customPrint("Unexpected error", "ERROR")
print("Error: ")
print()
traceback.print_exc()
exit(1)

View File

@ -0,0 +1,29 @@
from textual.app import App, ComposeResult
from textual.containers import ScrollableContainer
from textual.widgets import Header, Footer, Button, Static, DirectoryTree
class ProjectItem(Static):
def compose(self) -> ComposeResult:
yield Button("HHHH", id="project_name")
yield DirectoryTree("./")
class MyApp(App):
CSS_PATH = "app.tcss"
BINDINGS = [
("d", "toggle_dark", "Toggle dark mode")
]
def compose(self) -> ComposeResult:
yield Footer()
yield Header()
yield ProjectItem()
def action_toggle_dark(self):
self.dark = not self.dark
# --
if __name__ == "__main__":
app = MyApp()
app.run()