Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,74 +1,45 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import time
|
| 3 |
|
| 4 |
-
|
| 5 |
-
st.set_page_config(
|
| 6 |
-
page_title="Windows 模拟器",
|
| 7 |
-
page_icon="💻",
|
| 8 |
-
layout="wide"
|
| 9 |
-
)
|
| 10 |
|
| 11 |
-
#
|
| 12 |
st.markdown("""
|
| 13 |
<style>
|
| 14 |
-
|
|
|
|
| 15 |
footer {visibility: hidden;}
|
| 16 |
-
header {visibility: hidden;}
|
| 17 |
-
.stApp {background-color: #f0f2f6;}
|
| 18 |
</style>
|
| 19 |
-
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
)
|
| 29 |
-
st.divider()
|
| 30 |
-
st.info("系统状态: 运行中")
|
| 31 |
|
| 32 |
-
|
| 33 |
-
if menu == "桌面首页":
|
| 34 |
-
st.title("📺 欢迎使用 Python 桌面")
|
| 35 |
-
st.write("这是一个运行在 Hugging Face 上的 Python 模拟界面。")
|
| 36 |
-
|
| 37 |
-
col1, col2 = st.columns(2)
|
| 38 |
-
with col1:
|
| 39 |
-
with st.expander("📝 记事本", expanded=True):
|
| 40 |
-
note = st.text_area("在此输入笔记...", "Hello World!")
|
| 41 |
-
if st.button("保存文件"):
|
| 42 |
-
st.toast("文件已成功保存到虚拟磁盘!")
|
| 43 |
-
|
| 44 |
-
with col2:
|
| 45 |
-
with st.expander("📊 性能监控", expanded=True):
|
| 46 |
-
st.write("CPU 使用率")
|
| 47 |
-
st.progress(45)
|
| 48 |
-
st.write("内存占用")
|
| 49 |
-
st.progress(62)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
theme = st.selectbox("选择界面主题", ["Windows Classic", "Dark Mode", "Fluent Design"])
|
| 54 |
-
volume = st.slider("系统音量", 0, 100, 50)
|
| 55 |
-
st.toggle("开启自动更新")
|
| 56 |
|
| 57 |
-
|
| 58 |
-
st.subheader("
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
"修改日期": ["2024-01-01", "2024-02-15", "2024-03-20", "2024-04-18"]
|
| 63 |
-
}
|
| 64 |
-
st.table(files)
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
+
st.set_page_config(page_title="系统控制台", layout="wide")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
# 强制深色主题和隐藏多余元素
|
| 6 |
st.markdown("""
|
| 7 |
<style>
|
| 8 |
+
.reportview-container { background: #1e1e1e; }
|
| 9 |
+
.stDeployButton {display:none;}
|
| 10 |
footer {visibility: hidden;}
|
|
|
|
|
|
|
| 11 |
</style>
|
| 12 |
+
""", unsafe_allow_html=True)
|
| 13 |
|
| 14 |
+
# 顶部状态栏
|
| 15 |
+
col_t1, col_t2 = st.columns([8, 1])
|
| 16 |
+
with col_t1:
|
| 17 |
+
st.caption("🌐 远程服务器连接成功 | 状态: 正常 | 延迟: 24ms")
|
| 18 |
+
with col_t2:
|
| 19 |
+
if st.button("🔴 注销"):
|
| 20 |
+
st.rerun()
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
st.divider()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# 主界面分区
|
| 25 |
+
left_nav, main_window = st.columns([2, 7])
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
with left_nav:
|
| 28 |
+
st.subheader("📁 系统菜单")
|
| 29 |
+
task = st.selectbox("功能选择", ["运行中心", "安全审计", "终端命令", "网络设置"])
|
| 30 |
+
st.progress(85, text="磁盘剩余空间")
|
| 31 |
+
st.button("🔄 刷新系统")
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
with main_window:
|
| 34 |
+
if task == "运行中心":
|
| 35 |
+
st.header("🚀 自动化任务")
|
| 36 |
+
col_a, col_b = st.columns(2)
|
| 37 |
+
col_a.metric("并发连接", "128", "+12%")
|
| 38 |
+
col_b.metric("内存占用", "1.2 GB", "-5%")
|
| 39 |
+
st.line_chart([10, 25, 15, 40, 30, 60]) # 模拟波动图
|
| 40 |
+
|
| 41 |
+
elif task == "终端命令":
|
| 42 |
+
st.header("💻 系统终端")
|
| 43 |
+
cmd = st.text_input("输入 Python 命令:", "print('Hello Security')")
|
| 44 |
+
if st.button("执行"):
|
| 45 |
+
st.code(f"执行结果: \n>>> {cmd}\nSuccess.")
|