-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins.html
More file actions
1199 lines (1057 loc) · 40.2 KB
/
Copy pathplugins.html
File metadata and controls
1199 lines (1057 loc) · 40.2 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plugin Developer Guide | AstroBasics Diamond Chart Pro</title>
<meta name="description"
content="Developer documentation for creating custom plugins, mathematical analyzers, and UI modules for AstroBasics Diamond Chart Pro.">
<meta name="author" content="AstroBasics">
<link rel="icon" type="image/x-icon"
href="https://raw.githubusercontent.com/thefuzzydeveloper/Astrobasics-dist/main/icon.ico">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rozha+One&family=Yatra+One&family=Noto+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=JetBrains+Mono:wght@400;600;700&display=swap"
rel="stylesheet">
<style>
:root[data-theme="dark"] {
--bg-base: #07030A;
--bg-surface: #12071B;
--bg-card: #1A0D26;
--bg-header: rgba(7, 3, 10, 0.94);
--border-color: #C59B27;
--border-subtle: rgba(197, 155, 39, 0.25);
--text-primary: #F4EFEA;
--text-secondary: #C8BDD6;
--text-accent: #FFE885;
--accent-saffron: #E65100;
--accent-gold: #DAA520;
--accent-red: #C0392B;
--accent-green: #27AE60;
--code-bg: #0C0614;
--code-border: rgba(218, 165, 32, 0.3);
--selection-bg: #E65100;
--selection-color: #FFFFFF;
--shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
--glow: 0 0 22px rgba(218, 165, 32, 0.3);
--note-bg: rgba(218, 165, 32, 0.08);
--note-border: #DAA520;
}
:root[data-theme="light"] {
--bg-base: #FAF5E8;
--bg-surface: #F2E8D5;
--bg-card: #EADBC5;
--bg-header: rgba(250, 245, 232, 0.94);
--border-color: #A37A1E;
--border-subtle: rgba(163, 122, 30, 0.3);
--text-primary: #2C1A14;
--text-secondary: #5A483E;
--text-accent: #7A1C1C;
--accent-saffron: #B83A00;
--accent-gold: #B8860B;
--accent-red: #A82424;
--accent-green: #1E8449;
--code-bg: #E3D4BC;
--code-border: rgba(163, 122, 30, 0.4);
--selection-bg: #FFD700;
--selection-color: #000000;
--shadow: 0 8px 25px rgba(90, 72, 62, 0.15);
--glow: 0 0 18px rgba(163, 122, 30, 0.2);
--note-bg: rgba(163, 122, 30, 0.08);
--note-border: #A37A1E;
}
html {
scroll-behavior: smooth;
}
::selection {
background-color: var(--selection-bg);
color: var(--selection-color);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
body {
font-family: 'Noto Sans', sans-serif;
background-color: var(--bg-base);
color: var(--text-primary);
line-height: 1.75;
overflow-x: hidden;
position: relative;
width: 100%;
}
#bgCanvas {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: -1;
pointer-events: none;
}
h1,
h2,
h3,
h4,
.brand-title {
font-family: 'Rozha One', 'Yatra One', serif;
letter-spacing: 0.5px;
}
/* Header Navigation */
header {
background-color: var(--bg-header);
border-bottom: 2px solid var(--border-color);
position: sticky;
top: 0;
z-index: 1000;
box-shadow: var(--shadow);
backdrop-filter: blur(12px);
}
.nav-container {
max-width: 1240px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 18px;
gap: 12px;
}
.brand-logo {
display: flex;
align-items: center;
gap: 8px;
text-decoration: none;
flex-shrink: 0;
}
.brand-logo img {
width: 32px;
height: 32px;
border-radius: 6px;
border: 1px solid var(--border-color);
}
.brand-title {
font-size: 1.25rem;
color: var(--text-accent);
}
nav ul {
display: flex;
list-style: none;
gap: 16px;
align-items: center;
}
nav a {
color: var(--text-primary);
text-decoration: none;
font-weight: 600;
font-size: 0.85rem;
}
nav a:hover {
color: var(--accent-gold);
}
.theme-toggle-btn {
background: var(--bg-surface);
border: 1px solid var(--border-color);
color: var(--text-primary);
padding: 6px 12px;
border-radius: 20px;
cursor: pointer;
font-weight: 600;
font-size: 0.85rem;
}
.btn-secondary {
background: transparent;
border: 1px solid var(--border-color);
color: var(--text-primary);
padding: 6px 14px;
border-radius: 6px;
text-decoration: none;
font-weight: 600;
display: inline-flex;
align-items: center;
}
.btn-secondary:hover {
background: var(--bg-surface);
color: var(--text-accent);
}
/* Grid & Responsive Container */
.docs-container {
max-width: 1240px;
width: 100%;
margin: 0 auto;
padding: 30px 18px 80px;
display: grid;
grid-template-columns: 280px minmax(0, 1fr);
gap: 32px;
align-items: start;
}
/* Sticky Sidebar Locking */
aside {
position: sticky;
top: 75px;
align-self: start;
max-height: calc(100vh - 95px);
display: flex;
flex-direction: column;
}
.sidebar-card {
background: var(--bg-surface);
border: 1.5px solid var(--border-color);
border-radius: 8px;
padding: 16px;
box-shadow: var(--shadow);
overflow-y: auto;
max-height: inherit;
}
.sidebar-card h4 {
color: var(--text-accent);
font-size: 1.05rem;
margin-bottom: 12px;
border-bottom: 1px solid var(--border-subtle);
padding-bottom: 6px;
}
.toc-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 4px;
}
.toc-list a {
color: var(--text-secondary);
text-decoration: none;
font-size: 0.84rem;
display: block;
padding: 5px 8px;
border-radius: 4px;
line-height: 1.4;
}
.toc-list a:hover {
background: var(--bg-card);
color: var(--accent-gold);
}
.toc-list .toc-sub {
padding-left: 18px;
font-size: 0.8rem;
opacity: 0.9;
}
/* Main Content Column */
main {
min-width: 0;
max-width: 100%;
width: 100%;
}
.doc-section {
background: var(--bg-surface);
border: 1.5px solid var(--border-color);
border-radius: 10px;
padding: 30px;
margin-bottom: 30px;
box-shadow: var(--shadow);
scroll-margin-top: 85px;
width: 100%;
overflow-wrap: break-word;
}
.doc-section h2 {
color: var(--text-accent);
font-size: 1.75rem;
margin-bottom: 14px;
border-bottom: 1px solid var(--border-subtle);
padding-bottom: 8px;
scroll-margin-top: 85px;
}
.doc-section h3 {
color: var(--accent-gold);
font-size: 1.25rem;
margin: 22px 0 10px;
scroll-margin-top: 85px;
}
.doc-section p {
color: var(--text-secondary);
margin-bottom: 14px;
font-size: 0.95rem;
}
.doc-section ul,
.doc-section ol {
color: var(--text-secondary);
margin-left: 20px;
margin-bottom: 16px;
font-size: 0.93rem;
}
.doc-section li {
margin-bottom: 6px;
}
/* Code Block Horizontal Isolation */
code {
font-family: 'JetBrains Mono', monospace;
background: var(--code-bg);
border: 1px solid var(--code-border);
color: var(--text-accent);
padding: 2px 5px;
border-radius: 4px;
font-size: 0.84rem;
word-break: break-word;
}
pre {
background: var(--code-bg);
border: 1px solid var(--code-border);
border-left: 4px solid var(--accent-gold);
border-radius: 6px;
padding: 14px 18px;
overflow-x: auto;
max-width: 100%;
width: 100%;
margin: 14px 0 20px;
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}
pre code {
background: transparent;
border: none;
padding: 0;
font-size: 0.86rem;
color: var(--text-primary);
line-height: 1.6;
white-space: pre;
word-break: normal;
}
/* Tables */
.table-responsive {
width: 100%;
overflow-x: auto;
margin: 16px 0 20px;
border: 1px solid var(--border-subtle);
border-radius: 6px;
}
.custom-table {
width: 100%;
border-collapse: collapse;
background: var(--bg-card);
margin: 0;
}
.custom-table th,
.custom-table td {
border: 1px solid var(--border-subtle);
padding: 10px 12px;
text-align: left;
font-size: 0.86rem;
}
.custom-table th {
background-color: var(--bg-surface);
color: var(--text-accent);
font-family: 'Rozha One', serif;
white-space: nowrap;
}
.callout {
background: var(--note-bg);
border-left: 4px solid var(--note-border);
padding: 12px 16px;
border-radius: 4px;
margin: 16px 0;
font-size: 0.9rem;
color: var(--text-primary);
}
footer {
background-color: var(--bg-surface);
border-top: 2px solid var(--border-color);
padding: 25px 20px;
text-align: center;
color: var(--text-secondary);
font-size: 0.85rem;
}
/* Viewport Media Queries */
@media (max-width: 900px) {
.docs-container {
grid-template-columns: 1fr;
padding: 20px 14px;
}
aside {
position: static;
max-height: none;
margin-bottom: 20px;
}
.doc-section {
padding: 20px 16px;
}
}
</style>
</head>
<body>
<canvas id="bgCanvas"></canvas>
<!-- Header -->
<header>
<div class="nav-container">
<a href="index.html" class="brand-logo">
<img src="https://raw.githubusercontent.com/thefuzzydeveloper/Astrobasics-dist/main/icon.ico"
alt="AstroBasics Logo">
<span class="brand-title">AstroBasics</span>
</a>
<nav>
<ul>
<li><a href="index.html">← Back to Suite</a></li>
<li><a href="index.html#milan-spotlight">Kundali Milan</a></li>
<li><a href="portal.html">Portal</a></li>
</ul>
</nav>
<div style="display: flex; align-items: center; gap: 8px; flex-shrink: 0;">
<button class="theme-toggle-btn" id="themeToggle" onclick="toggleThemeManual()">
<span id="themeIcon">❖</span> Theme
</button>
<a href="https://github.com/thefuzzydeveloper/Astrobasics-dist" target="_blank"
class="btn-secondary" style="padding: 5px 10px; font-size: 0.8rem;">GitHub</a>
</div>
</div>
</header>
<!-- Documentation Architecture -->
<div class="docs-container">
<!-- Sticky Sidebar Navigation -->
<aside>
<div class="sidebar-card">
<h4>Documentation</h4>
<ul class="toc-list">
<li><a href="#quickstart">0. Quick Start (From 1 Line)</a></li>
<li><a href="#discovery">1. How to Discover All APIs</a></li>
<li><a href="#overview">2. Runtime Architecture</a></li>
<li><a href="#metadata">3. Metadata & Sorting</a></li>
<li><a href="#paradigms">4. Plugin Paradigms</a></li>
<li><a href="#render-hook" class="toc-sub">↳ def render(ui, chart)</a></li>
<li><a href="#astro-plugin" class="toc-sub">↳ AstroPlugin Decorators</a></li>
<li><a href="#evaluate-hook" class="toc-sub">↳ def evaluate(chart)</a></li>
<li><a href="#setup-ui" class="toc-sub">↳ def setup_ui(...)</a></li>
<li><a href="#setup-menu" class="toc-sub">↳ def setup_menu(...)</a></li>
<li><a href="#chart-context">5. ChartContext API</a></li>
<li><a href="#planet-proxy">6. PlanetProxy & DMS Math</a></li>
<li><a href="#simple-ui">7. SimplePluginUI Builder</a></li>
<li><a href="#examples">8. Practical Code Examples</a></li>
<li><a href="#checklist">9. Debugging Checklist</a></li>
</ul>
</div>
</aside>
<!-- Content Column -->
<main>
<!-- SECTION 0: QUICK START -->
<section id="quickstart" class="doc-section">
<h2>0. Quick Start Guide: Build Your First Plugin</h2>
<p>You do not need to install complex build tools or write Qt GUI code. Let us write a
working plugin starting with literally <strong>one single line of Python code</strong>.</p>
<h3>Step 1: Where to save your file</h3>
<p>Create a new text file named <code>my_tool.py</code> and save it directly inside your local application directory's
<code>my_plugins</code> folder:</p>
<pre><code>C:\Users\USER_NAME\AppData\Local\AstroBasics\
├── AstroBasics.exe
└── my_plugins/
└── my_tool.py <-- Save your file here</code></pre>
<h3>Step 2: Simple 1-line plugin</h3>
<p>Open <code>my_tool.py</code> and type this single line:</p>
<pre><code>def render(ui, chart): ui.text("Hello AstroBasics!")</code></pre>
<p>Save the file and switch to AstroBasics. Your plugin will appear in the sidebar with the text "Hello AstroBasics! (Press refresh button at top right of menu bar if plugin does not reloads automatically)".</p>
<h3>Step 3: Expanding line by line</h3>
<p>Now let us expand it line-by-line so you understand exactly what each line does:</p>
<pre><code># Line 1: Import the astrological engine library
import astro_engine
# Line 2: Name your plugin header box
PLUGIN_NAME = "My Planet Inspector"
# Line 3: Choose which sidebar group it belongs to (e.g. "Strengths", "Analysis Engine", "UTILS")
PLUGIN_GROUP = "Analysis Engine"
# Line 4: Set the priority number (lower numbers appear higher up in the list)
PLUGIN_INDEX = 10
# Line 5: Define the render function.
# - 'ui' gives you easy methods to draw text, buttons, alerts, and tables.
# - 'chart' gives you instant access to all planetary coordinates and houses.
def render(ui: astro_engine.SimplePluginUI, chart: astro_engine.ChartContext):
# Line 6: Add a heading to your plugin box
ui.heading("Live Sun Position", level=2)
# Line 7: Read the Sun's occupied zodiac sign and formatted degree
sun_sign = chart.sun.sign_name
sun_degree = chart.sun.dms_str
# Line 8: Display the information as a clean analytical card
ui.metric("Sun Placement", sun_degree, subtext=f"Placed in {sun_sign}")
# Line 9: Add a conditional alert based on real astronomical data
if chart.sun.is_exalted:
ui.alert("The Sun is currently Exalted in Aries!", level="success")
elif chart.sun.is_debilitated:
ui.alert("The Sun is currently Debilitated in Libra.", level="warning")
else:
ui.alert(f"The Sun is in {sun_sign} in House {chart.sun.house}.", level="info")
# Line 10: Add an interactive button that opens the Navamsha (D9) chart
ui.button("Open D9 Navamsha Chart", on_click=lambda current_chart: current_chart.spawn_window("D9", "Navamsha View"), variant="primary")</code></pre>
<div class="callout">
<strong>❖ Live Auto-Reloading:</strong> Keep the AstroBasics app running on your screen while
you edit <code>my_tool.py</code>. Every time you press <code>Ctrl + S</code> to save
your script, the app refreshes your plugin within 500 milliseconds.
</div>
</section>
<!-- SECTION 1: DISCOVERY -->
<section id="discovery" class="doc-section">
<h2>1. How to Discover All APIs</h2>
<p>You never have to guess what methods or properties exist on <code>chart</code>, <code>planet</code>,
or <code>ui</code>. You can discover everything dynamically right from inside Python.
</p>
<h3>Method A: Print all available methods to the terminal</h3>
<p>Add a temporary <code>print()</code> statement inside your <code>render</code> function to inspect
any object in your console:</p>
<pre><code>def render(ui, chart):
# Print every available method on the chart context
print("--- CHART METHODS ---")
print(dir(chart))
# Print every property on the Sun
print("--- PLANET PROPERTIES ---")
print(dir(chart.sun))
# Print the raw Swiss Ephemeris data dictionary
print("--- RAW PLANET DATA ---")
print(chart.sun._data)</code></pre>
<h3>Method B: Display all methods live inside the software UI</h3>
<p>If you are running the packaged executable without a terminal, you can render all available
properties into a scrollable table directly inside the application interface:</p>
<pre><code>def render(ui, chart):
ui.heading("API Explorer: chart.sun Properties", level=2)
# Extract all public properties and their current live values
inspection_rows = []
for attribute_name in dir(chart.sun):
if not attribute_name.startswith("_"): # Skip private Python internals
try:
attribute_value = str(getattr(chart.sun, attribute_name))
inspection_rows.append([attribute_name, attribute_value])
except Exception as error:
inspection_rows.append([attribute_name, f"Error: {error}"])
ui.table(headers=["Property Name", "Live Value"], rows=inspection_rows)</code></pre>
</section>
<!-- SECTION 2: ARCHITECTURE -->
<section id="overview" class="doc-section">
<h2>2. Plugin Architecture & Lifecycle</h2>
<p>AstroBasics Diamond Chart Pro features an embedded dynamic Python runtime. Scripts
dropped into either plugin directory are automatically compiled, mounted into
the sidebar, and integrated into the host event loop without application
restarts.</p>
<div class="table-responsive">
<table class="custom-table">
<thead>
<tr>
<th>Directory Type</th>
<th>Location</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>User Plugins</strong></td>
<td><code>C:\Users\USER_NAME\AppData\Local\AstroBasics\my_plugins\</code></td>
<td>Primary path for custom user extensions. Automatically created inside the AppData directory on startup.</td>
</tr>
<tr>
<td><strong>Core Modules</strong></td>
<td><code>C:\Users\USER_NAME\AppData\Local\AstroBasics\dynamic_settings_modules\</code></td>
<td>System package folder for baked-in modular application tools.</td>
</tr>
</tbody>
</table>
</div>
<div class="callout">
<strong>❖ Hot-Reloading & File Watchers:</strong> Both folders are monitored via
<code>QFileSystemWatcher</code>. Modifying any <code>.py</code> file
automatically reloads and refreshes the UI within 500 milliseconds. An immediate
hard reload can also be triggered via the 🔄 button in the top-right corner of
the menu bar.
</div>
</section>
<!-- SECTION 3: METADATA -->
<section id="metadata" class="doc-section">
<h2>3. Plugin Metadata & Navigation Hierarchy</h2>
<p>Declare top-level module constants to configure your plugin's title, group classification, and sorting
priority:</p>
<pre><code>PLUGIN_NAME = "Classical Yoga Scanner" # Title displayed on the container box
PLUGIN_GROUP = "Strengths" # Category group for sidebar & rail filtering
PLUGIN_INDEX = 10 # Sort priority (lower integers load first)</code></pre>
<h3>Side Rail Category Bindings</h3>
<p>Clicking icons on the left-hand Side Rail Bar automatically filters the sidebar to display matching
tools:</p>
<div class="table-responsive">
<table class="custom-table">
<thead>
<tr>
<th>Rail Icon</th>
<th>Category Identifier</th>
<th>Default Group Targets</th>
</tr>
</thead>
<tbody>
<tr>
<td>📍</td>
<td><code>location</code></td>
<td>Location, Date Time, Divisional Charts, Transit Constraints, BASIC
TOOLS</td>
</tr>
<tr>
<td>💪</td>
<td><code>strengths</code></td>
<td>Strengths, Yogas Visualizer, Detailed Report</td>
</tr>
<tr>
<td>🔮</td>
<td><code>tools</code></td>
<td>Kundali Milan, Horary Studio, Numerology, Muhurta, Dasha, Medical
</td>
</tr>
<tr>
<td>🧩</td>
<td><code>analysis</code></td>
<td>Analysis Engine, Custom Analysis Engine, Rectify Time, RECTIFICATION</td>
</tr>
<tr>
<td>📌</td>
<td><code>Pinned Items</code></td>
<td>UTILS, Custom Pinned Plugins</td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- SECTION 4: PARADIGMS -->
<section id="paradigms" class="doc-section">
<h2>4. The 5 Plugin Authoring Paradigms</h2>
<p>AstroBasics inspects your Python script upon discovery and mounts it using whichever pattern you
implement:</p>
<h3 id="render-hook">Paradigm 1: Declarative UI Builder via <code>def render(ui, chart)</code></h3>
<p>The standard, recommended hook for interactive panels. The host provides a
<code>SimplePluginUI</code> builder and the current <code>ChartContext</code>. When time steps
or chart parameters change, the container is cleared and <code>render</code> runs automatically:</p>
<pre><code>import astro_engine
PLUGIN_NAME = "Dignity & Placement Matrix"
PLUGIN_GROUP = "Strengths"
PLUGIN_INDEX = 15
def render(ui: astro_engine.SimplePluginUI, chart: astro_engine.ChartContext):
ui.heading("Planetary Dignity Summary", level=2)
# 1. Analytical Metric Badges
exalted_planets = [planet.name for planet in chart.planets.values() if planet.is_exalted]
debilitated_planets = [planet.name for planet in chart.planets.values() if planet.is_debilitated]
ui.metric("Exalted Planets", len(exalted_planets), subtext=", ".join(exalted_planets) if exalted_planets else "None", color="#16A34A")
ui.metric("Debilitated Planets", len(debilitated_planets), subtext=", ".join(debilitated_planets) if debilitated_planets else "None", color="#DC2626")
# 2. Status Alert Banner
if chart.sun.is_combust:
ui.alert(f"Warning: Sun is in close orb ({chart.sun.dms_str}) causing combustion.", level="warning")
else:
ui.alert("Solar combustion levels: Normal", level="success")
# 3. Interactive Data Table
table_rows = []
for planet in chart.planets.values():
table_rows.append([planet.name, planet.sign_name, planet.dms_str, f"House {planet.house}"])
ui.table(headers=["Planet", "Sign", "Position", "Bhava"], rows=table_rows)
# 4. Embedded Live Visual Chart
ui.separator()
ui.chart(div="D9", box_size=220)
ui.button("Open Full D9 Modal", on_click=lambda active_chart: active_chart.spawn_window("D9", "Navamsha View"), variant="primary")</code></pre>
<h3 id="astro-plugin">Paradigm 2: Declarative <code>AstroPlugin</code> Decorators</h3>
<p>Zero-boilerplate pattern for automated diagnostics, condition badges, and action
buttons:</p>
<pre><code>import astro_engine
PLUGIN_NAME = "Yoga Engine Pro"
PLUGIN_GROUP = "Analysis Engine"
PLUGIN_INDEX = 20
plugin = astro_engine.AstroPlugin(PLUGIN_NAME, group=PLUGIN_GROUP, index=PLUGIN_INDEX)
@plugin.rule("Gajakesari Yoga")
def check_gajakesari(chart: astro_engine.ChartContext):
if chart.jupiter.is_in_kendra_to(chart.moon):
return f"Jupiter is {chart.jupiter.house_from(chart.moon)} houses away from Moon."
return False
@plugin.action("Inspect Career (D10)", variant="primary")
def launch_d10(chart: astro_engine.ChartContext):
chart.spawn_window(div="D10", title="D10 Dashamsha Career Chart")</code></pre>
<h3 id="evaluate-hook">Paradigm 3: Pure Functional Hook via
<code>def evaluate(chart)</code></h3>
<p>Ideal for calculations, diagnostic reports, and data formatting without UI code:</p>
<pre><code>PLUGIN_NAME = "Diagnostic Reporter"
PLUGIN_GROUP = "Analysis Engine"
def evaluate(chart: astro_engine.ChartContext) -> dict:
return {
"Atmakaraka (AK)": f"{chart.ak.name} ({chart.ak.dms_str} in {chart.ak.sign_name})",
"Lagna Lord": f"{chart.house_lord(1).name} placed in House {chart.house_lord(1).house}",
"Active Dasha Sequence": " -> ".join(chart.get_dasha_sequence())
}</code></pre>
<h3 id="setup-ui">Paradigm 4: Polymorphic & Native PyQt6 (<code>def setup_ui</code>)
</h3>
<p>Supports signature introspection. If defined as <code>setup_ui(ui, chart)</code>, it
functions as a declarative builder. If defined as
<code>setup_ui(app, layout)</code>, you receive direct access to PyQt6 widgets:
</p>
<pre><code>from PyQt6.QtWidgets import QPushButton, QLabel, QVBoxLayout
import astro_engine
PLUGIN_NAME = "Native Qt Control"
def setup_ui(app, layout: QVBoxLayout):
lbl = QLabel("Native PyQt6 Controller Active")
btn = QPushButton("Calculate Panchang")
btn.clicked.connect(lambda: lbl.setText(str(astro_engine.get_active_chart("D1").get_panchang())))
layout.addWidget(lbl)
layout.addWidget(btn)</code></pre>
<h3 id="setup-menu">Paradigm 5: Menu Bar Integration (<code>def setup_menu</code>)</h3>
<p>When plugins are placed in the top menu bar via <strong>Manage Layout</strong>, this
hook populates menu actions:</p>
<pre><code>from PyQt6.QtGui import QAction
import astro_engine
def setup_menu(app, parent_menu):
act = QAction("Launch D9 Navamsha Window", app)
act.triggered.connect(lambda: astro_engine.get_active_chart("D1").spawn_window("D9", "Navamsha"))
parent_menu.addAction(act)</code></pre>
</section>
<!-- SECTION 5: CHART CONTEXT API -->
<section id="chart-context" class="doc-section">
<h2>5. <code>ChartContext</code> API Reference</h2>
<p>The <code>ChartContext</code> object provides access to all chart data:</p>
<h3>Direct Planetary Accessors</h3>
<p>Access celestial bodies as typed <code>PlanetProxy</code> objects:</p>
<p><code>chart.sun</code>, <code>chart.moon</code>, <code>chart.mars</code>,
<code>chart.mercury</code>, <code>chart.jupiter</code>,
<code>chart.venus</code>, <code>chart.saturn</code>, <code>chart.rahu</code>,
<code>chart.ketu</code>, <code>chart.ascendant</code> (or
<code>chart.lagna</code>).</p>
<h3>Jaimini Karakas (7-Karaka System)</h3>
<p><code>chart.atmakaraka</code> (<code>chart.ak</code>),
<code>chart.amatyakaraka</code> (<code>chart.amk</code>),
<code>chart.bhratrikaraka</code> (<code>chart.bk</code>),
<code>chart.matrikaraka</code> (<code>chart.mk</code>),
<code>chart.putrakaraka</code> (<code>chart.pk</code>),
<code>chart.gnatikaraka</code> (<code>chart.gk</code>),
<code>chart.darakaraka</code> (<code>chart.dk</code>).</p>
<h3>Analytical Methods</h3>
<ul>
<li><code>chart.occupants(house_num)</code>: Returns list of
<code>PlanetProxy</code> in house (1–12).</li>
<li><code>chart.house_lord(house_num)</code>: Returns ruling
<code>PlanetProxy</code> of that house.</li>
<li><code>chart.dispositor_of(planet_name)</code>: Returns sign dispositor of
target planet.</li>
<li><code>chart.is_conjunct("Mars", "Saturn")</code>: Returns boolean check.
</li>
<li><code>chart.has_parivartana("Sun", "Mars")</code>: Checks mutual sign
exchange.</li>
<li><code>chart.is_aspecting_house("Mars", 8)</code>: Evaluates
aspects.</li>
<li><code>chart.distance_between("Sun", "Moon")</code>: Shortest angular
separation (0°–180°).</li>
<li><code>chart.get_dasha_sequence()</code>: Returns active Vimshottari lords.
</li>
<li><code>chart.get_panchang()</code>: Returns dictionary of Tithi, Nakshatra,
Sunrise, Sunset.</li>
<li><code>chart.get_divisional_chart("D9")</code>: Computes isolated context for
any division.</li>
</ul>
</section>
<!-- SECTION 6: PLANET PROXY -->
<section id="planet-proxy" class="doc-section">
<h2>6. <code>PlanetProxy</code> & Degree Formatting</h2>
<p>Every celestial body returned by <code>chart.get_planet(...)</code> or direct properties like
<code>chart.mars</code> is a <code>PlanetProxy</code> object:</p>
<div class="table-responsive">
<table class="custom-table">
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Example / Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>planet.name</code> / <code>planet.sym</code></td>
<td><code>str</code></td>
<td><code>"Mars"</code> / <code>"Ma"</code></td>
</tr>
<tr>
<td><code>planet.lon</code></td>
<td><code>AstroDegree</code></td>
<td>Absolute zodiac longitude (0.0° to 359.9999°)</td>
</tr>
<tr>
<td><code>planet.degree</code> / <code>planet.deg_in_sign</code></td>
<td><code>AstroDegree</code></td>
<td>Degree within occupied sign (0.0° to 29.9999°)</td>
</tr>
<tr>
<td><code>planet.dms</code> / <code>planet.dms_str</code></td>
<td><code>tuple</code> / <code>str</code></td>
<td><code>(14, 25, 36)</code> / <code>'14° 25\' 36"'</code></td>
</tr>
<tr>
<td><code>planet.sign_num</code> / <code>planet.sign_name</code></td>
<td><code>int</code> / <code>str</code></td>
<td><code>5</code> / <code>"Leo"</code> (1-indexed sign number)</td>
</tr>
<tr>
<td><code>planet.house</code></td>
<td><code>int</code></td>
<td>Occupied house number (1–12)</td>
</tr>
<tr>
<td><code>planet.is_exalted</code> / <code>planet.is_debilitated</code></td>
<td><code>bool</code></td>
<td>Classical Parashari exaltation/debilitation flags</td>
</tr>
<tr>
<td><code>planet.is_retro</code> / <code>planet.is_combust</code></td>
<td><code>bool</code></td>
<td>Retrograde motion / Solar combustion checks</td>
</tr>
<tr>
<td><code>planet.nakshatra</code> / <code>planet.nakshatra_pada</code></td>
<td><code>str</code> / <code>int</code></td>
<td>Nakshatra name and Pada number (1–4)</td>
</tr>
</tbody>
</table>
</div>
<h3>Relational Separation & House Math</h3>
<pre><code>mars = chart.mars
angular_distance = mars.distance_to("Jupiter") # Shortest angular arc (0° to 180°)
forward_degrees = mars.forward_distance_to("Venus") # Forward zodiac count (0° to 360°)
house_from_moon = mars.house_from("Moon") # House count starting from Moon
in_kendra = mars.is_in_kendra_to("Moon") # True if in 1st, 4th, 7th, or 10th from Moon
is_shadashtaka = mars.is_in_shadashtaka("Saturn") # True if in mutual 6/8 placement</code></pre>
</section>
<!-- SECTION 7: UI BUILDER -->
<section id="simple-ui" class="doc-section">
<h2>7. <code>SimplePluginUI</code> Declarative Toolkit</h2>
<p>The declarative UI builder creates responsive, theme-adaptive widgets without direct
PyQt6 imports:</p>
<div class="table-responsive">
<table class="custom-table">
<thead>
<tr>
<th>Method</th>
<th>Parameters & Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ui.heading(text, level=2)</code></td>
<td>Renders responsive section header (level 1, 2, or
3).</td>
</tr>
<tr>
<td><code>ui.text(text, bold, italic, color)</code></td>
<td>Renders word-wrapped styled text block.</td>
</tr>
<tr>
<td><code>ui.alert(message, level)</code></td>
<td>Status banner. Levels: <code>"info"</code>,
<code>"success"</code>, <code>"warning"</code>,
<code>"danger"</code>.</td>
</tr>
<tr>
<td><code>ui.metric(label, value, subtext, color)</code>
</td>
<td>Renders high-visibility analytical KPI badge.</td>
</tr>
<tr>
<td><code>ui.progress_bar(label, value, max_val)</code>
</td>
<td>Displays progress or degree completion bar.</td>
</tr>
<tr>
<td><code>ui.table(headers, rows)</code></td>
<td>Structured scrollable data table with
auto-translated columns.</td>
</tr>
<tr>
<td><code>ui.tabs(tab_dict)</code></td>
<td>Multi-tab view mapping tab names to builder
callbacks.</td>
</tr>
<tr>
<td><code>ui.button(label, on_click, variant)</code>
</td>
<td>Button with callback. Variants:
<code>"default"</code>, <code>"primary"</code>,
<code>"danger"</code>, <code>"success"</code>.
</td>
</tr>
<tr>
<td><code>ui.dropdown(label, options, on_select)</code>
</td>
<td>Combobox select dropdown.</td>
</tr>
<tr>
<td><code>ui.input_number(label, min, max, default)</code>
</td>
<td>Integer or decimal spinbox control.</td>
</tr>
<tr>
<td><code>ui.slider(label, min, max, default)</code>
</td>
<td>Horizontal slider with live numeric readout.</td>
</tr>
<tr>
<td><code>ui.chart(div, box_size)</code></td>
<td>Embeds a live North Indian Diamond Chart widget
inside the panel.</td>
</tr>
<tr>
<td><code>ui.open_chart(div, title, modal)</code></td>