Skip to main content

PySide6 page application framework

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

app-page-0.0.32.tar.gz (2.9 MB view details)

Uploaded Source

File details

Details for the file app-page-0.0.32.tar.gz.

File metadata

  • Download URL: app-page-0.0.32.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for app-page-0.0.32.tar.gz
Algorithm Hash digest
SHA256 a2d1278e00ab1540a44665ae01ca113f0df0d63c81f53d999f37102b3b631c01
MD5 bd93aa3a17bf292821df0b01a26d4fe4
BLAKE2b-256 e824c58a07225cf840db2e10733607e34fb5250fdd61453b9bc0a02b29c907a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page