diff --git a/PDK_libs/primitives/edge_couplers/EC_SiN400_1310_1p0dB_L635_A0_QY_202604/EC_SiN400_1310_1p0dB_L635_A0_QY_202604.png b/PDK_libs/primitives/edge_couplers/EC_SiN400_1310_1p0dB_L635_A0_QY_202604/EC_SiN400_1310_1p0dB_L635_A0_QY_202604.png deleted file mode 100644 index 5208d8c..0000000 Binary files a/PDK_libs/primitives/edge_couplers/EC_SiN400_1310_1p0dB_L635_A0_QY_202604/EC_SiN400_1310_1p0dB_L635_A0_QY_202604.png and /dev/null differ diff --git a/PDK_libs/primitives/edge_couplers/EC_SiN400_1310_1p0dB_L635_A0_QY_202604/EC_SiN400_1310_1p0dB_L635_A0_QY_202604.yml b/PDK_libs/primitives/edge_couplers/EC_SiN400_1310_1p0dB_L635_A0_QY_202604/EC_SiN400_1310_1p0dB_L635_A0_QY_202604.yml deleted file mode 100644 index d701aa5..0000000 --- a/PDK_libs/primitives/edge_couplers/EC_SiN400_1310_1p0dB_L635_A0_QY_202604/EC_SiN400_1310_1p0dB_L635_A0_QY_202604.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: EC_SiN400_1310_1p0dB_L635_A0_QY_202604 -foundry: Silterra -process: EMO1_2ML_Cu_RDL -year: '2026' -type: primitive -dependency: None -maturity: development -tapeout_history: -- run: Silterra_EMO1_2ML_Cu_RDL_2026_Q2 - status: Pending testing -center_wavelength: 1310 -version: 1.0 -designer: Qin Yue -update_notes: New SiN edge couplers with high efficiency -ports: - a1: - x: -642.6 - y: 0.0 - a: 180.0 - width: 0.7 - b0: - x: 0.0 - y: 0.0 - a: 0.0 - width: None - a0: - x: 0.0 - y: 0.0 - a: 180.0 - width: 0.0 -time: 20260505-170136 -box_size: -- 646.0 -- 75.0 -file_size: 1.36 KB diff --git a/backend/__pycache__/database.cpython-39.pyc b/backend/__pycache__/database.cpython-39.pyc deleted file mode 100644 index 12c35bd..0000000 Binary files a/backend/__pycache__/database.cpython-39.pyc and /dev/null differ diff --git a/backend/database.py b/backend/database.py index ac5a6fd..3a5eafd 100644 --- a/backend/database.py +++ b/backend/database.py @@ -4,7 +4,7 @@ import os from werkzeug.security import generate_password_hash # Save the database in the backend folder -DB_FILE = os.path.join(os.path.dirname(__file__), "mxpic_data.db") +DB_FILE = os.path.join(os.path.dirname(__file__), "..\\database\\mxpic_data.db") def init_db(): conn = sqlite3.connect(DB_FILE) diff --git a/backend/dir_test.py b/backend/dir_test.py deleted file mode 100644 index bdfc7ff..0000000 --- a/backend/dir_test.py +++ /dev/null @@ -1,110 +0,0 @@ -import os -import yaml -from collections import OrderedDict -from flask import Flask, jsonify, send_from_directory, request, redirect, url_for, session, render_template -from werkzeug.security import check_password_hash -import database # Imports the database.py you created earlier - -# --- Path Configurations --- -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -FRONTEND_DIR = os.path.join(BASE_DIR, '..', 'frontend') -YML_PATH = os.path.join(BASE_DIR, '..\\mxpic\\PDKs\\Silterra\\directories.yaml') -COMPS_ROOT = os.path.join(BASE_DIR, '..\\mxpic\\PDKs\\Silterra') - -# --- YAML & PDK Parsing Helper Functions (Unchanged) --- -def countSpaces(line): - """Count leading spaces (tab=4).""" - expanded = line.expandtabs(4) - return len(expanded) - len(expanded.lstrip(' ')) - -def buildTree(filepath): - """Build nested tree from indented yaml.""" - if not os.path.exists(filepath): - return OrderedDict() - - with open(filepath, 'r', encoding='utf-8') as f: - lines = f.readlines() - - rootIdx = None - for i, line in enumerate(lines): - if line.strip().startswith('root') and ':' in line.strip(): - rootIdx = i - break - if rootIdx is None: - return OrderedDict() - - entries = [] - for line in lines[rootIdx + 1:]: - stripped = line.strip() - if not stripped or stripped.startswith('#'): - continue - if stripped.startswith('- '): - spaceNum = countSpaces(line) - name = stripped[2:].strip() - if name.strip(): - entries.append((spaceNum, name)) - - if not entries: - return OrderedDict() - - minIndent = min(indent for indent, _ in entries) - nest = OrderedDict() - levelStack = [(minIndent - 1, nest)] - - for spaceNum, name in entries: - while levelStack and levelStack[-1][0] >= spaceNum: - levelStack.pop() - parent = levelStack[-1][1] - child = OrderedDict() - parent[name] = child - levelStack.append((spaceNum, child)) - - return nest - -def findComps(baseDir): - """Scan component folders, return map of paths -> component info.""" - compMap = {} - refDir = os.path.dirname(baseDir) - for root, dirs, files in os.walk(baseDir): - ymlFiles = [f for f in files if f.endswith('.yml')] - if ymlFiles: - parentDir = os.path.dirname(root) - relPath = os.path.relpath(parentDir, refDir) - parts = () if relPath == '.' else tuple(relPath.split(os.sep)) - compName = os.path.basename(root) - compMap[parts] = { - 'folder': compName, - 'yml': ymlFiles[0] - } - dirs.clear() - return compMap - -def addCompsToTree(tree, compMap): - """Insert component nodes into the tree.""" - for pathSeg, compItem in compMap.items(): - compName = compItem['folder'] - curNode = tree - try: - for seg in pathSeg: - curNode = curNode[seg] - except KeyError: - continue - curNode[compName] = OrderedDict({ - "__type__": "component", - "__name__": compName, - "__yml__": compItem['yml'] - }) - return tree - -def readCompYaml(compName): - """Load YAML from component folder.""" - for root, dirs, files in os.walk(COMPS_ROOT): - if os.path.basename(root) == compName: - dirs.clear() - ymlFiles = [f for f in files if f.endswith('.yml')] - if ymlFiles: - ymlPath = os.path.join(root, ymlFiles[0]) - with open(ymlPath, 'r', encoding='utf-8') as f: - return yaml.safe_load(f) - return None - diff --git a/backend/server.py b/backend/server.py index 3133cb7..10741f2 100644 --- a/backend/server.py +++ b/backend/server.py @@ -27,50 +27,6 @@ def countSpaces(line): expanded = line.expandtabs(4) return len(expanded) - len(expanded.lstrip(' ')) -# def buildTree(filepath): -# """Build nested tree from indented yaml.""" -# if not os.path.exists(filepath): -# return OrderedDict() - -# with open(filepath, 'r', encoding='utf-8') as f: -# lines = f.readlines() - -# rootIdx = None -# for i, line in enumerate(lines): -# if line.strip().startswith('root') and ':' in line.strip(): -# rootIdx = i -# break -# if rootIdx is None: -# return OrderedDict() - -# entries = [] -# for line in lines[rootIdx + 1:]: -# stripped = line.strip() -# if not stripped or stripped.startswith('#'): -# continue -# if stripped.startswith('- '): -# spaceNum = countSpaces(line) -# name = stripped[2:].strip() -# if name.strip(): -# entries.append((spaceNum, name)) - -# if not entries: -# return OrderedDict() - -# minIndent = min(indent for indent, _ in entries) -# nest = OrderedDict() -# levelStack = [(minIndent - 1, nest)] - -# for spaceNum, name in entries: -# while levelStack and levelStack[-1][0] >= spaceNum: -# levelStack.pop() -# parent = levelStack[-1][1] -# child = OrderedDict() -# parent[name] = child -# levelStack.append((spaceNum, child)) - -# return nest - def buildTree(filepath): """Build nested tree from indented yaml.""" if not os.path.exists(filepath): @@ -116,25 +72,52 @@ def buildTree(filepath): return nest -def addCompsToTree(tree, compMap): - """Insert component nodes into the tree.""" +# def addCompsToTree(tree, compMap): +# """Insert component nodes into the tree.""" +# for pathSeg, compItem in compMap.items(): +# compName = compItem['folder'] +# curNode = tree + +# # FIX 2: Automatically build missing folder paths +# for seg in pathSeg: +# if seg not in curNode: +# # If a folder like MZM_1600G isn't in the YAML, gracefully auto-create it +# curNode[seg] = OrderedDict() +# curNode = curNode[seg] + +# curNode[compName] = OrderedDict({ +# "__type__": "component", +# "__name__": compName, +# "__yml__": compItem['yml'] +# }) +# return tree + +def addCompsToTree(compMap): + """ + Build a completely fresh tree from scratch and insert component nodes. + No previous tree object or inspection required. + """ + # Initialize a clean, empty root tree + fresh_tree = OrderedDict() + for pathSeg, compItem in compMap.items(): compName = compItem['folder'] - curNode = tree + curNode = fresh_tree - # FIX 2: Automatically build missing folder paths + # Sequentially build the nested path segments dynamically for seg in pathSeg: if seg not in curNode: - # If a folder like MZM_1600G isn't in the YAML, gracefully auto-create it curNode[seg] = OrderedDict() curNode = curNode[seg] + # Place the component metadata dictionary into its leaf node curNode[compName] = OrderedDict({ "__type__": "component", "__name__": compName, "__yml__": compItem['yml'] }) - return tree + + return fresh_tree def findComps(baseDir): """Scan component folders, return map of paths -> component info.""" @@ -238,8 +221,10 @@ def getLib(): tree = buildTree(YML_PATH) if os.path.isdir(COMPS_ROOT): compMap = findComps(COMPS_ROOT) - addCompsToTree(tree, compMap) - return jsonify(tree) + fresh_tree = addCompsToTree(compMap) + return jsonify(fresh_tree) + + @app.route('/api/component/') def getComp(component_name): diff --git a/backend/mxpic_data.db b/database/mxpic_data.db similarity index 100% rename from backend/mxpic_data.db rename to database/mxpic_data.db diff --git a/frontend/canvas.html b/frontend/canvas.html index 7fcaebd..7431059 100644 --- a/frontend/canvas.html +++ b/frontend/canvas.html @@ -5,13 +5,26 @@ - Canvas with PDK Library – Component Name & Rotation + mxPIC Core - Canvas + @@ -128,6 +196,7 @@ useUpdateNodeInternals, } = window.ReactFlow; + // --- NODE DESIGN (Dark CAD Style) --- const RotatableNode = ({ id, data, selected }) => { const updateNodeInternals = useUpdateNodeInternals(); useEffect(() => { @@ -135,9 +204,9 @@ }, [data.rotation, updateNodeInternals, id]); const baseHandleStyle = { - width: 14, height: 14, - background: '#555', - border: 'none', + width: 10, height: 10, + background: 'var(--bg-main)', + border: '2px solid var(--accent)', borderRadius: '50%', }; const leftTopPort = { ...baseHandleStyle, top: '24%', transform: 'translate(-50%, -50%)' }; @@ -147,11 +216,18 @@ return (
{data.componentDisplayName}
@@ -175,7 +251,7 @@ }; return (
- 🔷 {name} + {name}
); } @@ -197,8 +273,8 @@ const LeftPanel = ({ library, treeKey, expanded, onToggle, treeRef, width }) => (
-
Routing selections
+
Routing modes
-
    +
    • Single mode wires
    • Multi-mode wires
    • DC electrical wires
    • @@ -232,11 +308,14 @@
-
User info
-
-
Name: XXXXXX
-
ID: 12345678
- +
Session
+
+
Name: XXXXXX
+
ID: 12345678
+
@@ -330,16 +409,16 @@ return (