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