Skip to content

Commit d0ada42

Browse files
Create config.py
1 parent 1b0ccf1 commit d0ada42

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

.xquant/config.py

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
import openpyxl
2+
from openpyxl.utils import get_column_letter
3+
from openpyxl.styles import Font, Alignment, PatternFill
4+
import xlwings as xw
5+
6+
AURA_FILE = "Aura.xquant"
7+
8+
# --- Sheets Config ---
9+
core_hub = ["Simulation_Scenarios", "Visualization_Config", "Deployment",
10+
"Ethics_Notes", "Collaboration_Log"]
11+
12+
stem_sheets = ["Advanced_Mathematics", "Physics_Experiments", "Reasoning_Problems",
13+
"Genomics_Deep", "Healthcare_Analytics", "Environment_Scenarios",
14+
"AI_Results_Log"]
15+
16+
# --- Step 1: Create workbook (xlsx first) ---
17+
wb = openpyxl.Workbook()
18+
home = wb.active
19+
home.title = "Home"
20+
21+
# Title Block
22+
home.merge_cells("A1:E2")
23+
cell = home["A1"]
24+
cell.value = "🌌 Aura Hub – Research Ecosystem"
25+
cell.font = Font(size=16, bold=True, color="FFFFFF")
26+
cell.alignment = Alignment(horizontal="center", vertical="center")
27+
cell.fill = PatternFill(start_color="4F81BD", end_color="4F81BD", fill_type="solid")
28+
29+
# Navigation placeholders
30+
row = 5
31+
for s in core_hub:
32+
home[f"A{row}"].value = s
33+
home[f"A{row}"].hyperlink = f"#{s}!A1"
34+
home[f"A{row}"].style = "Hyperlink"
35+
row += 1
36+
37+
row = 5
38+
for s in stem_sheets:
39+
home[f"C{row}"].value = s
40+
home[f"C{row}"].hyperlink = f"#{s}!A1"
41+
home[f"C{row}"].style = "Hyperlink"
42+
row += 1
43+
44+
quick_actions = ["▶️ Run Simulation", "📈 View Charts", "🚀 Deploy Configs",
45+
"📒 Open Ethics Notes", "🤝 Collaboration"]
46+
row = 5
47+
for q in quick_actions:
48+
home[f"E{row}"].value = q
49+
row += 1
50+
51+
# Info Panel
52+
home.merge_cells("A15:E18")
53+
cell = home["A15"]
54+
cell.value = (
55+
"ℹ️ Aura Hub centralizes:\n"
56+
"• STEM Research Sheets (Math, Physics, Genomics, Healthcare, Environment)\n"
57+
"• AI & Quantum Simulation Results\n"
58+
"• Ethics, Economics & Deployment Tracking\n\n"
59+
"🔗 Version: 1.0 | Last Updated: 2025-09-19"
60+
)
61+
cell.alignment = Alignment(wrap_text=True, vertical="top")
62+
63+
# Adjust cols
64+
for col in range(1, 6):
65+
home.column_dimensions[get_column_letter(col)].width = 25
66+
67+
# Create other sheets
68+
for s in core_hub + stem_sheets:
69+
ws = wb.create_sheet(title=s)
70+
ws["A1"].value = f"Sheet: {s}"
71+
72+
# Save as xlsx first
73+
tmp_file = "Aura_tmp.xlsx"
74+
wb.save(tmp_file)
75+
76+
# --- Step 2: Open with xlwings and inject VBA ---
77+
app = xw.App(visible=False)
78+
book = xw.Book(tmp_file)
79+
80+
vba_code = '''
81+
Sub RunSimulation()
82+
MsgBox "🔬 Running Simulation Scenarios...", vbInformation, "Aura Hub"
83+
Sheets("Simulation_Scenarios").Activate
84+
End Sub
85+
86+
Sub ViewCharts()
87+
MsgBox "📈 Generating Charts from Visualization_Config...", vbInformation, "Aura Hub"
88+
Sheets("Visualization_Config").Activate
89+
End Sub
90+
91+
Sub DeployConfigs()
92+
MsgBox "🚀 Loading Deployment Settings...", vbInformation, "Aura Hub"
93+
Sheets("Deployment").Activate
94+
End Sub
95+
96+
Sub OpenEthics()
97+
Sheets("Ethics_Notes").Activate
98+
End Sub
99+
100+
Sub OpenCollab()
101+
Sheets("Collaboration_Log").Activate
102+
End Sub
103+
104+
Sub ResetHub()
105+
MsgBox "♻️ Aura Hub has been reset.", vbExclamation, "Aura Hub"
106+
Sheets("Home").Activate
107+
End Sub
108+
109+
Sub HubStatus()
110+
MsgBox "✅ Aura Hub is running normally.", vbInformation, "Aura Hub"
111+
End Sub
112+
113+
Sub CreateHomeButtons()
114+
Dim btn As Shape
115+
Dim i As Integer
116+
Dim actions As Variant, macros As Variant
117+
118+
actions = Array("▶️ Run Simulation", "📈 View Charts", "🚀 Deploy Configs", "📒 Open Ethics Notes", "🤝 Collaboration")
119+
macros = Array("RunSimulation", "ViewCharts", "DeployConfigs", "OpenEthics", "OpenCollab")
120+
121+
For i = LBound(actions) To UBound(actions)
122+
Set btn = Sheets("Home").Shapes.AddShape(msoShapeRoundedRectangle, 400, 80 + i * 40, 200, 30)
123+
btn.TextFrame.Characters.Text = actions(i)
124+
btn.OnAction = macros(i)
125+
btn.Fill.ForeColor.RGB = RGB(79, 129, 189)
126+
btn.TextFrame.HorizontalAlignment = xlHAlignCenter
127+
btn.TextFrame.VerticalAlignment = xlVAlignCenter
128+
btn.TextFrame.Characters.Font.Color = vbWhite
129+
btn.TextFrame.Characters.Font.Bold = True
130+
Next i
131+
End Sub
132+
'''
133+
134+
book.api.VBProject.VBComponents.Add(1).CodeModule.AddFromString(vba_code)
135+
136+
# Save as macro-enabled
137+
book.save(AURA_FILE)
138+
book.close()
139+
app.quit()
140+
141+
print(f"✅ Aura Hub with VBA saved as {AURA_FILE}")

0 commit comments

Comments
 (0)