You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"""
程序主入口
增加命令行参数,启动时可指定端口和用户名,便于在同一机器上开多实例测试。
"""
import sys
import os
import argparse
# 添加项目根目录到 Python 路径
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from ui.main_window import run_app
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="SecureFileProject GUI")
parser.add_argument("--sig-host", default="127.0.0.1", help="信令服务器地址")
parser.add_argument("--sig-port", type=int, default=9999, help="信令服务器端口")
parser.add_argument("--user", default="alice", help="本客户端用户名")
parser.add_argument("--listen-port", type=int, default=8001, help="P2P 监听端口")
return parser.parse_args()
def main():
"""启动白板 GUI允许通过命令行自定义端口和用户名"""
args = parse_args()
run_app(
default_sig_host=args.sig_host,
default_sig_port=args.sig_port,
default_user=args.user,
default_listen_port=args.listen_port,
)
if __name__ == "__main__":
main()