data_process_ui/app/main.py

40 lines
961 B
Python
Raw Permalink Normal View History

2026-01-12 09:21:42 +08:00
# -*- encoding: utf-8 -*-
import os
import sys
import argparse
from IPython.terminal.embed import InteractiveShellEmbed as interactive_shell_embed
import IPython.core.page
import config
from main_window import main_window
from main_app import main_app
def page_printer(data, start = 0, screen_lines = 0, pager_cmd = None):
if isinstance(data, dict):
data = data["text/plain"]
print(data)
IPython.core.page.page = page_printer
ipshell = interactive_shell_embed(
user_ns = globals(), colors = "Linux",
)
parser = argparse.ArgumentParser(
prog = "道路数据处理",
description = "",
# epilog = "Text at the bottom of help",
)
parser.add_argument("-f", "--file", type = str, help = "启动前加载的Python脚本文件", default = "")
arg = parser.parse_args()
if __name__ == "__main__":
app = main_app(sys.argv)
window = main_window(ipshell)
window.show()
window.redirect()
if arg.file:
window.load_script(arg.file)
sys.exit(app.exec())