Update app.py
Browse files5 unmodified lines678991011121 unmodified line141516171718192021212223232425263 unmodified lines303132333334353536373839404140414243444445454647484950515253545556575859606162636465666751686970717273567475767760787980814 unmodified lines868788899091929394959697989 unmodified lines108109110861111121131144 unmodified lines1191201219712212312412512610212712812913013110713213313413513611211313713813914015 unmodified lines15615715815916016116213516316416516616716816917014117117217317430 unmodified lines20520620717820820921021121221321421521621721821922022122222322422522618422722822923023118919023223323419223523623719523823924024124220124324424524686 unmodified lines3333343352943363373385 unmodified linesapp = Flask(__name__)
# ==========================================# FRONTEND: Pure IDE, Cinematic Animations & Resizer# FRONTEND: The Ultimate Cinematic IDE# ==========================================HTML_TEMPLATE = """<!DOCTYPE html>1 unmodified line<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Twenty IDE | Pure Environment</title> <title>Twenty IDE | Pure Cinematic Environment</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> :root { --bg-dark: #030305; --bg-dark: #020203; --bg-panel: #0a0a0f; --bg-terminal: #01111d; /* Tünd Göy PowerShell */ --bg-terminal: #010f1a; --border-glass: rgba(255, 255, 255, 0.08); --text-main: #f4f4f5; --text-muted: #7a7a8c;3 unmodified lines * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; } body { background-color: var(--bg-dark); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
/* --- SPLASH EKRANI --- */ /* --- SİRR Lİ KÖLGƏ SPLASH EKRANI --- */ #splash { position: fixed; inset: 0; background: #030305; position: fixed; inset: 0; background: #020203; z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 1s ease-in-out; } .splash-text { font-size: 60px; font-weight: 200; letter-spacing: 30px; color: var(--color-white); text-shadow: 0 0 40px rgba(255,255,255,0.3); margin-left: 30px; font-size: 65px; font-weight: 100; letter-spacing: 35px; color: transparent; margin-left: 35px; /* Hərfləri mərkəzləşdirmək üçün */ animation: shadowMelt 3.5s ease-in-out forwards; } .splash-sub { font-size: 13px; color: var(--text-muted); letter-spacing: 15px; margin-top: 20px; text-transform: uppercase; margin-left: 15px; font-size: 13px; color: var(--accent); letter-spacing: 15px; margin-top: 20px; text-transform: uppercase; margin-left: 15px; opacity: 0; animation: subFade 3.5s ease-in-out forwards; }
/* Kino effekti: Kölgədən çıxıb kölgəyə qayıtmaq */ @keyframes shadowMelt { 0% { opacity: 0; filter: blur(30px); text-shadow: 0 0 0px rgba(0, 242, 254, 0); transform: scale(1.1); color: #000; } 30% { opacity: 1; filter: blur(0px); text-shadow: 0 0 50px rgba(0, 242, 254, 0.6); transform: scale(1); color: var(--color-white); } 70% { opacity: 1; filter: blur(0px); text-shadow: 0 0 50px rgba(0, 242, 254, 0.6); transform: scale(1); color: var(--color-white); } 100% { opacity: 0; filter: blur(30px); text-shadow: 0 0 0px rgba(0, 242, 254, 0); transform: scale(0.9); color: #000; } } @keyframes subFade { 0% { opacity: 0; filter: blur(10px); } 30% { opacity: 0.8; filter: blur(0px); } 70% { opacity: 0.8; filter: blur(0px); } 100% { opacity: 0; filter: blur(10px); } }
/* --- BAŞLANĞICDA GİZLİ PANELLƏR --- */ #top-bar { transform: translateY(-100%); opacity: 0; } #sidebar-left { transform: translateX(-50px); opacity: 0; } /* Orta panel artıq yuxarıdan gələcək deyə -50px edirik */ #center-panel { transform: translateY(50px); opacity: 0; } #center-panel { transform: translateY(-50px); opacity: 0; }
/* --- SİNXRON ANİMASİYALAR --- */ .anim-top { animation: slideInTop 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; } .anim-left { animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s; } /* Orta panel üçün yeni yuxarıdan sürüşmə animasiyası */ .anim-center { animation: slideInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s; } .anim-center-down { animation: slideInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s; }
@keyframes slideInTop { to { transform: translateY(0); opacity: 1; } } @keyframes slideInLeft { to { transform: translateX(0); opacity: 1; } } @keyframes slideInUp { to { transform: translateY(0); opacity: 1; } } @keyframes slideInDown { to { transform: translateY(0); opacity: 1; } }
/* --- ÜST PANEL --- */ .top-bar { 4 unmodified lines .brand i { color: var(--accent); } .controls { display: flex; align-items: center; gap: 15px; } .lang-select { background: transparent; color: var(--text-muted); border: 1px solid var(--border-glass); padding: 6px 10px; border-radius: 4px; cursor: pointer; outline: none; transition: 0.3s; font-size: 13px; letter-spacing: 1px; } .lang-select:hover { color: white; border-color: rgba(255,255,255,0.3); }
.run-btn { background: var(--text-main); color: #000; border: none; padding: 8px 25px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: 0.3s; display: flex; align-items: center; gap: 8px;9 unmodified lines .panel { background: var(--bg-panel); display: flex; flex-direction: column; } .panel-title { padding: 15px 20px; font-size: 11px; text-transform: uppercase; letter-spacing: 3px; color: var(--text-muted); border-bottom: 1px solid var(--border-glass); background: rgba(0,0,0,0.4); }
/* Sol Panel (Zəngin Fayl Sistemi) */ /* Sol Panel */ .sidebar-left { width: 280px; border-right: 1px solid var(--border-glass); transition: width 0.4s; } .sidebar-left.collapsed { width: 0; border: none; overflow: hidden; opacity: 0; } .file-list { padding: 20px; flex: 1; overflow-y: auto; font-size: 14px; }4 unmodified lines .file-item:hover { color: white; background: rgba(255,255,255,0.05); } .file-item.active { color: white; background: rgba(255,255,255,0.08); border-left: 2px solid var(--accent); }
/* Orta Panel (Editor + Resizer + Terminal) */ /* Orta Panel */ .center-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #000; } #editor-container { flex: 1; min-height: 100px; } /* DRAG RESİZER (Sürüşdürücü Xətt) */ /* DRAG RESİZER */ .resizer { height: 6px; background: #15151e; cursor: ns-resize; display: flex; justify-content: center; align-items: center; transition: 0.2s; z-index: 50; border-top: 1px solid #000; border-bottom: 1px solid #000; } .resizer:hover, .resizer:active { background: var(--accent); } .resizer::after { content: ""; width: 50px; height: 2px; background: rgba(255,255,255,0.2); border-radius: 2px; }
/* Terminal (Sola yaslanmış, böyük şrift) */ /* Terminal */ .terminal-wrapper { height: 300px; min-height: 100px; background: var(--bg-terminal); display: flex; flex-direction: column; } .terminal-header { background: rgba(0,0,0,0.6); padding: 10px 20px; font-size: 12px; color: #888; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); } #terminal-output { flex: 1; padding: 20px; font-family: 'Consolas', monospace; font-size: 15px; color: #d1d1d1; overflow-y: auto; white-space: pre-wrap; line-height: 1.6; text-align: left; /* Tam sola yaslandı */ color: #d1d1d1; overflow-y: auto; white-space: pre-wrap; line-height: 1.6; text-align: left; } .ps-prompt { color: #82aaff; font-weight: bold; } .ps-success { color: #c3e88d; }15 unmodified lines <i class="fa-solid fa-code"></i> TWENTY IDE </div> <div class="controls"> <select class="lang-select" id="lang-select" onchange="changeLanguage()"> <option value="az">AZ</option> <option value="en">EN</option> </select> <button class="run-btn" onclick="runCode()" id="btn-run"><i class="fa-solid fa-play"></i> İcra Et</button> <button class="run-btn" onclick="runCode()" id="btn-run"> <i class="fa-solid fa-play"></i> <span id="t-run">İcra Et</span> </button> </div> </div>
<div class="main-layout"> <div class="panel sidebar-left" id="sidebar-left"> <div class="panel-title">LAYİHƏ STRUKTURU</div> <div class="panel-title" id="t-explorer">LAYİHƏ STRUKTURU</div> <div class="file-list"> <div class="folder"> <div class="folder-name"><i class="fa-solid fa-folder-open" style="color:#eac54f;"></i> src</div>30 unmodified lines </div>
<script> // --- KİNO (CINEMATIC) GİRİŞ ANİMASİYASI --- // --- DİL DƏYİŞDİRMƏ SİSTEMİ --- function changeLanguage() { const lang = document.getElementById('lang-select').value; if(lang === 'az') { document.getElementById('t-run').innerText = 'İcra Et'; document.getElementById('t-explorer').innerText = 'LAYİHƏ STRUKTURU'; } else { document.getElementById('t-run').innerText = 'Run Code'; document.getElementById('t-explorer').innerText = 'PROJECT STRUCTURE'; } }
// --- KİNO GİRİŞİ VƏ YUXARIDAN SÜRÜŞMƏ --- window.onload = () => { // Animasiyamız 3.5 saniyədir. Tam yox olanda panelləri gətiririk. setTimeout(() => { const splash = document.getElementById('splash'); splash.style.opacity = '0'; // Splash tam solandan sonra panelləri gətiririk (1 saniyə sonra) setTimeout(() => { splash.remove(); document.getElementById('top-bar').classList.add('anim-top'); document.getElementById('sidebar-left').classList.add('anim-left'); // Orta panel artıq yuxarıdan gəlir! document.getElementById('center-panel').classList.add('anim-center'); }, 1000); document.getElementById('center-panel').classList.add('anim-center-down'); }, 800); }, 2000); // Ekran 2 saniyə dumanlı qalır }, 3500); // 3.5 saniyə shadowMelt animasiyası gözləyir };
// --- SOL PANELİ AÇ/BAĞLA --- function togglePanel(side) { document.getElementById(`sidebar-${side}`).classList.toggle('collapsed'); if(editor) setTimeout(() => editor.layout(), 400); }
// --- SÜRÜŞDÜRÜCÜ (RESIZER) MƏNTİQİ --- // --- SÜRÜŞDÜRÜCÜ (RESIZER) --- const resizer = document.getElementById('resizer'); const terminalWrapper = document.getElementById('terminal-wrapper'); let isResizing = false;86 unmodified lines temp_file.write(code) temp_filepath = temp_file.name try: # Kodun icra olunması result = subprocess.run(['python', temp_filepath], capture_output=True, text=True, timeout=10) if result.returncode == 0: return jsonify({"status": "success", "output": result.stdout})app.py+70-29