Changed the project to python TUI

This commit is contained in:
Ricardo
2022-05-28 09:46:14 +00:00
parent bb401cf087
commit 8ea3ad9525
6 changed files with 36 additions and 70 deletions

View File

@@ -1,51 +0,0 @@
# GNU/Linux specific Make directives.
# Declare tools.
SHELL = /bin/sh
CC = clang++
LD = clang++
ECHO = @echo
CFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter
LDFLAGS = -lncurses
EXECUTABLE = Sparks
SOURCES = main.cpp functions.cpp
OBJECTS = $(SOURCES:.cpp=.out)
CLEANFILES = *.out
# To get a fully verbose make output do declare 'AT' at the command line like so: 'make AT='.
# By default AT is undefined and thus assigned the string '@' which suppresses output from commands.
AT ?= @
# Colors and efects
#######################################
NORMAL = \033[m
FG_DKGREEN = \033[32;7m
FG_REDFULL = \033[31;7m
FG_YELLOW = \033[33;7m
FG_BLUE = \033[34;7m
##########################################
.SUFFIXES: .cpp .out
.PHONY: clean
# Compile
all: $(EXECUTABLE)
.cpp.out:
$(ECHO) "[$(FG_BLUE)COMPILING$(NORMAL)] $@"
$(AT) $(CC) $(CFLAGS) -o $*.out -c $<
$(EXECUTABLE): $(OBJECTS)
$(ECHO) "[$(FG_YELLOW)LINKING$(NORMAL)] $(EXECUTABLE)"
$(AT) $(LD) $(LDFLAGS) $(OBJECTS) -o $(EXECUTABLE)
$(ECHO) "[$(FG_DKGREEN)SUCCESS$(NORMAL)] Run ./$(EXECUTABLE) to start your application, Enjoy :)"
clean:
$(ECHO) "[$(FG_REDFULL)CLEANED$(NORMAL)] $(CLEANFILES)"
$(AT) rm -rf $(CLEANFILES)

BIN
Sparks

Binary file not shown.

View File

View File

@@ -1,10 +0,0 @@
#ifndef __CHCOUNT_H__
#define __CHCOUNT_H__
#include <iostream>
#include <ncurses.h>
#endif

View File

@@ -1,9 +0,0 @@
#include "include/main.h"
int main () {
std::cout << "Greetings, Aliens!!!!" << std::endl;
}

36
main.py Normal file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python3
import sys
import pytermgui as ptg
# Define empty config as the base
#
# Note that we define markup tags as empty.
# markup tags **need** to be defined for program
# execution.
PTG_CONFIG = """\
config: {}
markup:
title: 210 bold
body: 245 italic
"""
with ptg.WindowManager() as manager:
# Initialize a loader, and load our config
loader = ptg.YamlLoader()
loader.load(PTG_CONFIG)
# Create a test window
manager.add(
ptg.Window()
+ "[title]This is our title"
+ ""
+ {"[body]First key": ['First button']}
+ {"[body]Second key": ['Second button']}
+ {"[body]Third key": ['Third button']}
+ ""
+ ["Exit", lambda *_: manager.exit()]
)
manager.run()