Skip to main content

PySide6 app framework

安装库

pip install app-page

模块说明

  • core 程序核心模块
  • animation 动画模块
  • plugins 插件模块
  • utils 工具模块

使用案例

from app_page import Page, createApp

"""
SETTING (dict): 设置参数
    stack_id (str): 栈组件id
    pages (dict): 页面字典
    pageOptionList (list): 页面配置项列表
    button_frame_id (str): 按钮框架id
    button_container_id (str): 按钮容器id
    button_close_id (str): 关闭按钮id
    button_login_id (str): 登录按钮id
    button_name_id (str): 按钮名称id
    APP_ICON_PATH (str): 应用图标路径
    APP_TITLE (str): 应用标题
    APP_VERSION (str): 应用版本
    IS_DEBUG (bool): 是否调试模式
    PING_HOST (str): 网络连接检查地址
    tips_ui (str|Ui_Form): 提示提示消息ui路径或Ui_Form类
    tipsBox_ui (str|Ui_Form): 提示提示框ui路径或Ui_Form类
    loading_icon (str): 加载图标路径
    small_page_icon (str): 缩小图标路径
    maximize_page_icon (str): 最大窗口图标路径
"""
createApp(SETTING={})

自定义页面

from app_page import Page, EventBus, createApp

# 编辑页面
class Editor(Page):
  def __init__(self):
    super().__init__("editor")
    self.template = """
    <template>
      <widget type="QWidget" style="color:#333;background-color:#fff;border-radius:10px;" height="250">
        <layout type="QVBoxLayout">
          <label text="写点东西吧(自动保存)" style="font-size:20px;color:#333;" />
          <text-edit id="editor" style="background-color:#e0e0e0;border-radius:10px;padding:10px;font-size:16px;" />
          <button id="help" text="使用说明" height="32" width="100" style="background-color:#000;color:#fff;border-radius:10px;" />
        </layout>
      </widget>
    </template>"""

  def show(self, *args):
    self.widgetIdMap["editor"].setPlainText(self.localStore.get("editor-value", ''))
    eventBus = EventBus(self.widgetIdMap)
    eventBus.register("editor", 'textChanged', lambda *args: self.textChange())
    eventBus.register("help", 'clicked', lambda *args: self.tips('没别的说明了,自己摸索一下', 'success'))

  def textChange(self):
    self.localStore.set("editor-value", self.widgetIdMap["editor"].toPlainText())

# 设置页面
class Setting(Page):
  def __init__(self):
    super().__init__("setting")
    self.template = """
    <template>
      <widget type="QWidget" style="color:#333;background-color:#fff;border-radius:10px;">
        <layout type="QVBoxLayout">
          <label text="系统设置" style="font-size:20px;color:#333;" />
        </layout>
      </widget>
    </template>"""

# 创建应用
createApp(SETTING={
  "APP_TITLE": "桌面软件",
  "pages": {"editor": Editor, "setting": Setting},
  "pageOptionList": [
    {
      "name": "随心笔记",
      "id": "editor",
      "filter": "leftBar",
      "stack_id": "app_page_editor",
    },
    {
      "name": "系统设置",
      "id": "setting",
      "filter": "leftBar",
      "stack_id": "app_page_setting",
    }
  ],
})

运行结果

app-page

Metadata

Release files for app-page 0.0.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for app-page 0.0.32
File Size Uploaded Provenance
app-page-0.0.32.tar.gz 2.9 MB Without provenance Details

Release files / app-page-0.0.32.tar.gz

Download URL app-page-0.0.32.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
a2d1278e00ab1540a44665ae01ca113f0df0d63c81f53d999f37102b3b631c01
BLAKE2b-256 checksum
How to use checksums
e824c58a07225cf840db2e10733607e34fb5250fdd61453b9bc0a02b29c907a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Security for app-page 0.0.32

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page