diff --git a/.gitignore b/.gitignore index 5df9179..ecb6ce6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ build/ -dist/ \ No newline at end of file +dist/ +__pycache__/ + +*.spec \ No newline at end of file diff --git a/appmanager/projects.py b/appmanager/projects.py index 1b17f8b..0bbd301 100644 --- a/appmanager/projects.py +++ b/appmanager/projects.py @@ -49,6 +49,10 @@ except Exception as e: print("Error: ") print(e) +def downloadProject(pathToFile): + + pass + def main(): # define the window layout @@ -90,7 +94,8 @@ def main(): if __name__ == '__main__': try: main() - print("Close") + print("Goodbye") + exit(0) except Exception as e: print('Error: ', end='') print(e) diff --git a/projects.spec b/projects.spec deleted file mode 100644 index c5a1cf7..0000000 --- a/projects.spec +++ /dev/null @@ -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, -) diff --git a/terminalUi/app.tcss b/terminalUi/app.tcss new file mode 100644 index 0000000..c2d11f6 --- /dev/null +++ b/terminalUi/app.tcss @@ -0,0 +1,8 @@ +MyApp { + layout: horizontal; + background: #000000; +} + +ProjectItem { + layout: horizontal; +} \ No newline at end of file diff --git a/terminalUi/customlog.py b/terminalUi/customlog.py new file mode 100644 index 0000000..dd2ea03 --- /dev/null +++ b/terminalUi/customlog.py @@ -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") diff --git a/terminalUi/local.pytermtk.py b/terminalUi/local.pytermtk.py new file mode 100644 index 0000000..2a21867 --- /dev/null +++ b/terminalUi/local.pytermtk.py @@ -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) diff --git a/terminalUi/local.textual.py b/terminalUi/local.textual.py new file mode 100644 index 0000000..40c0d93 --- /dev/null +++ b/terminalUi/local.textual.py @@ -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() +