Skip to content

Commit 1b221ff

Browse files
committed
making bundle usage
1 parent f1842cb commit 1b221ff

File tree

5 files changed

+100
-175
lines changed

5 files changed

+100
-175
lines changed

aloo-edit/styles/colors.css

-111
This file was deleted.

aloo-edit/styles/material.bundle.min.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aloo-edit/styles/material.css

-57
This file was deleted.

scripts/src/aloocli.py

+97-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python3
22
import os
33
import sys
4-
from typing import Union, Optional, Callable
54
import yaml
65
import threading
76
import time
@@ -25,7 +24,101 @@ def alooHelp() -> None:
2524

2625

2726
def createApp(projectOption: str) -> None:
28-
pass
27+
projectName = ""
28+
projectPath = ""
29+
if projectOption == "--path":
30+
projectName = os.getcwd()
31+
else:
32+
projectName = input("Project Name \x1b[90m[aloo-project]: ") or "aloo-project"
33+
os.system(f"mkdir {projectName}")
34+
projectPath = projectName + "/"
35+
appName = input("App Description \x1b[90m[Example App]: ") or "Example App"
36+
appDesc = (
37+
input("App Description \x1b[90m[An default template app for aloo project]: ")
38+
or "An default template app for aloo project"
39+
)
40+
41+
currFilePath = "/".join(__file__.split("/")[:-1])
42+
if currFilePath.endswith("bin"):
43+
currFilePath = "/".join(__file__.split("/")[:-2]) + "/etc/aloo/"
44+
45+
if "aloo.config.yaml" in os.listdir(os.getcwd()):
46+
os.system("clear")
47+
raise FileExistsError("'aloo.config.yaml' already exist")
48+
appInfo = yaml.dump(
49+
{"app-name": appName, "description": appDesc, "project-name": projectName},
50+
open(projectPath + "aloo.config.yaml", "w"),
51+
)
52+
53+
os.mkdir(projectPath + "src")
54+
os.mkdir(projectPath + "test")
55+
os.system("clear")
56+
57+
mainC = open(projectPath + "src/main.c", "w+")
58+
testC = open(projectPath + "test/main.c", "w+")
59+
CMakeFile = open(projectPath + "CMakeLists.txt", "w+")
60+
61+
mainCSample = open(
62+
currFilePath + "main.c",
63+
"r",
64+
).read()
65+
66+
testCSample = open(
67+
currFilePath + "test.c",
68+
"r",
69+
).read()
70+
71+
CMakeSample = open(
72+
currFilePath + "CMakeLists.txt",
73+
"r",
74+
).read()
75+
alooDir = currFilePath.removesuffix("scripts/src/")
76+
77+
mainCSample = mainCSample.replace("$projectName", projectName).replace(
78+
"$appName", appName
79+
)
80+
mainC.write(mainCSample)
81+
82+
testCSample = testCSample.replace("$projectName", projectName).replace(
83+
"$appName", appName
84+
)
85+
testC.write(testCSample)
86+
87+
CMakeSample = CMakeSample.replace("$appName", appName).replace(
88+
"$include_dir", alooDir + "include"
89+
)
90+
CMakeSample = CMakeSample.replace("$libaloo", alooDir + "lib").replace(
91+
"$libaloo", alooDir + "lib"
92+
)
93+
CMakeFile.write(CMakeSample)
94+
95+
colorsCSS = open(
96+
currFilePath + "styles/colors.css",
97+
"r",
98+
).read()
99+
materialCSS = open(
100+
currFilePath + "styles/material.css",
101+
"r",
102+
).read()
103+
104+
while colorsCSS.index("\t") != -1:
105+
colorsCSS = colorsCSS.replace("\t", "")
106+
while colorsCSS.index("\n") != -1:
107+
colorsCSS = colorsCSS.replace("\n", "")
108+
109+
while materialCSS.index("\t") != -1:
110+
materialCSS = materialCSS.replace("\t", "")
111+
while materialCSS.index("\n") != -1:
112+
materialCSS = materialCSS.replace("\n", "")
113+
114+
os.mkdir(projectPath + "styles")
115+
cssBundle = open(
116+
projectPath + "styles/material.bundle.min.css",
117+
"w+",
118+
)
119+
cssBundle.write(materialCSS + colorsCSS)
120+
121+
print("\t\033[1;32m󰄭 Aloo project created successfully\033[0m")
29122

30123

31124
def loader(i: int):
@@ -102,9 +195,9 @@ def run(runWhat_App_Test: str) -> None:
102195
alooHelp()
103196
case "create-app":
104197
if sys.argv.__len__() == 2:
105-
print("Please give with one of the options: [app | test]")
198+
print("Please give with one of the options: [--name | --path]")
106199
exit(1)
107-
elif sys.argv[2] != "app" and sys.argv[2] != "test":
200+
elif sys.argv[2] != "--name" and sys.argv[2] != "--path":
108201
print("Option must be either --name or --path")
109202
exit(1)
110203
else:

src/common/window.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
#include "common/window.h"
12
#include "common/style.h"
23
#include "common/widget.h"
3-
#include "common/window.h"
44
#include "utils/error.h"
55

66
AlooWidget *__alooSetWindowChild(AlooWidget *window, AlooWidget *child) {
@@ -16,8 +16,7 @@ AlooWidget *__alooPresentWindow(AlooWidget *window) {
1616
}
1717

1818
AlooWidget *__alooApplicationNewWindow(AlooApplication *app) {
19-
CSS.importPath("styles/material.css");
20-
CSS.importPath("styles/colors.css");
19+
CSS.importPath("styles/material.bundle.min.css");
2120
return Widget.gtk_to_aloo(gtk_application_window_new(app->app));
2221
}
2322
AlooWidget *__alooSetWindowTitle(AlooWidget *window, const char *title) {

0 commit comments

Comments
 (0)