AIwriter

主机

运行环境放虚拟机方便维护,用win11精简版试试,16G4核

环境部署

  • 安装python3.8:py38_22.11.1-1-Windows-x86_64.exe 安装到user
  • 修改PIP源为国内:pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
  • 安装PyQt核Qt Designer:pip install PyQt5 PyQt5-tools PyQt5designer
  • 确认pyuic5.exe可执行:如果不可执行,将C:\Users\Administrator\miniconda3\Scripts路径添加到path环境变量里
C:\Users\Administrator>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Writing to C:\Users\Administrator\AppData\Roaming\pip\pip.ini

C:\Users\Administrator>pip install PyQt5 PyQt5-tools PyQt5designer
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting PyQt5
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ca/ac/596e8ca16fd0634542d874c0d79219fc527ea7de73a5000092f60ecbf6e9/PyQt5-5.15.10-cp37-abi3-win_amd64.whl (6.8 MB)
     ---------------------------------------- 6.8/6.8 MB 11.8 MB/s eta 0:00:00
Collecting PyQt5-tools
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/11/7e/3a5bce0e31650e091a16826d7a588be8bd56c2ac30871286b6c90d68ceeb/pyqt5_tools-5.15.9.3.3-py3-none-any.whl (29 kB)
Collecting PyQt5designer
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ec/14/bd55fc528ad766a8c4f1fd45c1dff571a85c391edb4310428c654034b814/PyQt5Designer-5.14.1-py3-none-win_amd64.whl (40.8 MB)
     ---------------------------------------- 40.8/40.8 MB 10.4 MB/s eta 0:00:00
Collecting PyQt5-sip<13,>=12.13
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/88/cd/dd21cdb92d053ca71c02c75ab7bd32874b82b33bef61d6d70b5d898e684b/PyQt5_sip-12.13.0-cp38-cp38-win_amd64.whl (78 kB)
     ---------------------------------------- 78.3/78.3 kB ? eta 0:00:00
Collecting PyQt5-Qt5>=5.15.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/37/97/5d3b222b924fa2ed4c2488925155cd0b03fd5d09ee1cfcf7c553c11c9f66/PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB)
     ---------------------------------------- 50.1/50.1 MB 10.5 MB/s eta 0:00:00
Collecting pyqt5-plugins<5.15.9.3,>=5.15.9.2.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ca/35/a9bdf51500444ef9121e1b3c97746dc405c1033fbbe4293d4c84867220a6/pyqt5_plugins-5.15.9.2.3-cp38-cp38-win_amd64.whl (66 kB)
     ---------------------------------------- 66.8/66.8 kB ? eta 0:00:00
Collecting click
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl (97 kB)
     ---------------------------------------- 97.9/97.9 kB ? eta 0:00:00
Collecting PyQt5
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/5d/8df8a2aa0de6588965d048fca9306cf15a5801be3078f195e8f8f41fa863/PyQt5-5.15.9-cp37-abi3-win_amd64.whl (6.8 MB)
     ---------------------------------------- 6.8/6.8 MB 12.9 MB/s eta 0:00:00
Collecting python-dotenv
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6a/3e/b68c118422ec867fa7ab88444e1274aa40681c606d59ac27de5a5588f082/python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Collecting qt5-tools<5.15.2.2,>=5.15.2.1.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e2/45/3062d0df2bbc88ee4ea04b1073072b337b9e287c0b4ac12109729b413e2e/qt5_tools-5.15.2.1.3-py3-none-any.whl (13 kB)
Requirement already satisfied: colorama in c:\users\administrator\miniconda3\lib\site-packages (from click->PyQt5-tools) (0.4.5)
Collecting qt5-applications<5.15.2.3,>=5.15.2.2.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ae/a9/cd64cda6f58321c4a0021ced80117b225562efc42f1318ff2cea69c23eb7/qt5_applications-5.15.2.2.3-py3-none-win_amd64.whl (64.5 MB)
     ---------------------------------------- 64.5/64.5 MB 9.3 MB/s eta 0:00:00
Installing collected packages: PyQt5designer, PyQt5-Qt5, qt5-applications, python-dotenv, PyQt5-sip, click, qt5-tools, PyQt5, pyqt5-plugins, PyQt5-tools
Successfully installed PyQt5-5.15.9 PyQt5-Qt5-5.15.2 PyQt5-sip-12.13.0 PyQt5-tools-5.15.9.3.3 PyQt5designer-5.14.1 click-8.1.7 pyqt5-plugins-5.15.9.2.3 python-dotenv-1.0.1 qt5-applications-5.15.2.2.3 qt5-tools-5.15.2.1.3

C:\Users\Administrator>pyuic5.exe --help
Usage: pyuic5 [options] <ui-file>

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -p, --preview         show a preview of the UI instead of generating code
  -o FILE, --output=FILE
                        write generated code to FILE instead of stdout
  -x, --execute         generate extra code to test and display the class
  -d, --debug           show debug output
  -i N, --indent=N      set indent width to N spaces, tab if N is 0 [default:
                        4]

  Code generation options:
    --import-from=PACKAGE
                        generate imports of pyrcc5 generated modules in the
                        style 'from PACKAGE import ...'
    --from-imports      the equivalent of '--import-from=.'
    --resource-suffix=SUFFIX
                        append SUFFIX to the basename of resource files
                        [default: _rc]

编辑器组件UI

  • 模板UI
    • AI_Writer\resources\templates\customized\characters\内置默认页面.ui
  • 修改UI
    • notepad++修改
  • 加载UI
    • 打开Qt Designer C:\Users\Administrator\miniconda3\Lib\site-packages\qt5_applications\Qt\bin\designer.exe
    • 从软件界面,打开加载ini,查看UI布局效果
    • 因为Qt软件提供的控件,在AIwriter里不支持,所以不要在软件里修改UI,与AIwriter不适配。通过修改ini文件即可
  • 编译UI
    • pyuic5 xxx.ui -o xxx.py
    • xxx.py 拷贝到AI_Writer\resources\templates\customized\characters 或worlds
  • 使用UI
    • 运行AIwriter
    • 角色/情节/世界的“自定义” > 设置 > 选择UI.py > 保存 > 重启生肖