beeware打包测试

This commit is contained in:
林觅
2026-04-10 11:43:54 +08:00
parent 85d921b501
commit 96e03eaa2f
17 changed files with 573 additions and 31 deletions

67
.gitignore vendored
View File

@@ -10,6 +10,7 @@ __pycache__/
logs/
.env/
.venv/
.briefcase/
# Executables
# 媒体文件
@@ -28,3 +29,69 @@ logs/
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# OSX useful to ignore
*.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.dist-info/
*.egg-info/
.installed.cfg
*.egg
# IntelliJ Idea family of suites
.idea
*.iml
## File-based project format:
*.ipr
*.iws
## mpeltonen/sbt-idea plugin
.idea_modules/
# Briefcase log files
logs/
# Briefcase local configuratoin
.briefcase/

View File

@@ -2,10 +2,10 @@
- git init
- git checkout -b main
- git add .
- git commit -m "first commit"
- git commit -m "commit"
- git remote add origin https://gitea.vlos.net/jafar.o.jeh/owlTransmitter.git
- git push -u origin main
### 从命令行推送已经创建的仓库
- git remote add origin https://gitea.vlos.net/jafar.o.jeh/owlTransmitter.git
- git push -u origin main
- git push origin main

View File

@@ -1,29 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "a5470bfd",
"metadata": {},
"outputs": [],
"source": [
"python.exe -m venv .venv\n",
"# 激活虚拟环境\n",
".venv\\Scripts\\Activate.ps1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.13.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

108
docs/venv.ipynb Normal file
View File

@@ -0,0 +1,108 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "a5470bfd",
"metadata": {},
"outputs": [],
"source": [
"python.exe -m venv .venv\n",
"# 激活虚拟环境\n",
".venv\\Scripts\\Activate.ps1"
]
},
{
"cell_type": "markdown",
"id": "e28e227b",
"metadata": {},
"source": [
"### Install the BeeWare tools"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fbe4e77f",
"metadata": {},
"outputs": [],
"source": [
"pip install briefcase"
]
},
{
"cell_type": "markdown",
"id": "1143705e",
"metadata": {},
"source": [
"### 创建一个名为 项目"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e5634a3",
"metadata": {},
"outputs": [],
"source": [
"briefcase new"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e215d061",
"metadata": {},
"outputs": [],
"source": [
"cd pytransmitter \n",
"\n",
"# 开发者(或 dev模式启动项目\n",
"briefcase dev"
]
},
{
"cell_type": "markdown",
"id": "55dcb676",
"metadata": {},
"source": [
"### 打包/分发"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6b4b4e18",
"metadata": {},
"outputs": [],
"source": [
"briefcase create # 创建应用程序脚手架\n",
"briefcase build # 构建您的应用程序"
]
},
{
"cell_type": "markdown",
"id": "3995f193",
"metadata": {},
"source": [
"#### 构建安卓包\n",
"briefcase create android # 创建应用程序脚手架\n",
"briefcase build android # 构建您的应用程序\n",
"briefcase run android # 在虚拟设备上运行应用程序"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.13.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

65
pytransmitter/.gitignore vendored Normal file
View File

@@ -0,0 +1,65 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# OSX useful to ignore
*.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.dist-info/
*.egg-info/
.installed.cfg
*.egg
# IntelliJ Idea family of suites
.idea
*.iml
## File-based project format:
*.ipr
*.iws
## mpeltonen/sbt-idea plugin
.idea_modules/
# Briefcase log files
logs/
# Briefcase local configuratoin
.briefcase/

5
pytransmitter/CHANGELOG Normal file
View File

@@ -0,0 +1,5 @@
# pytransmitter Release Notes
## 0.0.1 (10 Apr 2026)
* Initial release

27
pytransmitter/LICENSE Normal file
View File

@@ -0,0 +1,27 @@
Copyright (c) 2026, 林觅
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

12
pytransmitter/README.rst Normal file
View File

@@ -0,0 +1,12 @@
pytransmitter
=============
**This cross-platform app was generated by** `Briefcase`_ **- part of**
`The BeeWare Project`_. **If you want to see more tools like Briefcase, please
consider** `becoming a financial member of BeeWare`_.
My first application
.. _`Briefcase`: https://briefcase.readthedocs.io/
.. _`The BeeWare Project`: https://beeware.org/
.. _`becoming a financial member of BeeWare`: https://beeware.org/contributing/membership

View File

@@ -0,0 +1,201 @@
# This project was generated with 0.4.1 using template: https://github.com/beeware/briefcase-template @ v0.4.1
[tool.briefcase]
project_name = "pytransmitter"
bundle = "net.vlos.transmit"
version = "0.0.1"
url = "https://transmit.vlos.net/pytransmitter"
license.file = "LICENSE"
author = "林觅"
author_email = "jafar0110@foxmail.com"
[tool.briefcase.app.pytransmitter]
formal_name = "pytransmitter"
description = "My first application"
long_description = """More details about the app should go here.
"""
sources = [
"src/pytransmitter",
]
test_sources = [
"tests",
]
requires = [
]
test_requires = [
"pytest",
]
[tool.briefcase.app.pytransmitter.macOS]
universal_build = true
requires = [
"toga-cocoa~=0.5.0",
"std-nslog~=1.0.3",
]
[tool.briefcase.app.pytransmitter.linux]
requires = [
"toga-gtk~=0.5.0",
# PyGObject 3.52.1 enforces a requirement on libgirepository-2.0-dev. This library
# isn't available on Debian 12/Ubuntu 22.04. If you don't need to support those (or
# older) releases, you can remove this version pin. See beeware/toga#3143.
"pygobject < 3.52.1",
]
[tool.briefcase.app.pytransmitter.linux.system.debian]
system_requires = [
# Needed to compile pycairo wheel
"libcairo2-dev",
# One of the following two packages are needed to compile PyGObject wheel. If you
# remove the pygobject pin in the requires list, you should also change to the
# version 2.0 of the girepository library. See beeware/toga#3143.
"libgirepository1.0-dev",
# "libgirepository-2.0-dev",
]
system_runtime_requires = [
# Needed to provide GTK and its GI bindings
"gir1.2-gtk-3.0",
# One of the following two packages are needed to use PyGObject at runtime. If you
# remove the pygobject pin in the requires list, you should also change to the
# version 2.0 of the girepository library. See beeware/toga#3143.
"libgirepository-1.0-1",
# "libgirepository-2.0-0",
# Dependencies that GTK looks for at runtime
"libcanberra-gtk3-module",
# Needed to provide WebKit2 at runtime
# Note: Debian 11 requires gir1.2-webkit2-4.0 instead
# "gir1.2-webkit2-4.1",
]
[tool.briefcase.app.pytransmitter.linux.system.rhel]
system_requires = [
# Needed to compile pycairo wheel
"cairo-gobject-devel",
# Needed to compile PyGObject wheel
"gobject-introspection-devel",
]
system_runtime_requires = [
# Needed to support Python bindings to GTK
"gobject-introspection",
# Needed to provide GTK
"gtk3",
# Dependencies that GTK looks for at runtime
"libcanberra-gtk3",
# Needed to provide WebKit2 at runtime
# "webkit2gtk3",
]
[tool.briefcase.app.pytransmitter.linux.system.suse]
system_requires = [
# Needed to compile pycairo wheel
"cairo-devel",
# Needed to compile PyGObject wheel
"gobject-introspection-devel",
]
system_runtime_requires = [
# Needed to provide GTK
"gtk3",
# Needed to support Python bindings to GTK
"gobject-introspection", "typelib(Gtk) = 3.0",
# Dependencies that GTK looks for at runtime
"libcanberra-gtk3-module",
# Needed to provide WebKit2 at runtime
# "libwebkit2gtk3", "typelib(WebKit2)",
]
[tool.briefcase.app.pytransmitter.linux.system.arch]
system_requires = [
# Needed to compile pycairo wheel
"cairo",
# Needed to compile PyGObject wheel
"gobject-introspection",
# Runtime dependencies that need to exist so that the
# Arch package passes final validation.
# Needed to provide GTK
"gtk3",
# Dependencies that GTK looks for at runtime
"libcanberra",
# Needed to provide WebKit2
# "webkit2gtk",
]
system_runtime_requires = [
# Needed to provide GTK
"gtk3",
# Needed to provide PyGObject bindings
"gobject-introspection-runtime",
# Dependencies that GTK looks for at runtime
"libcanberra",
# Needed to provide WebKit2 at runtime
# "webkit2gtk",
]
[tool.briefcase.app.pytransmitter.linux.appimage]
manylinux = "manylinux_2_28"
system_requires = [
# Needed to compile pycairo wheel
"cairo-gobject-devel",
# Needed to compile PyGObject wheel
"gobject-introspection-devel",
# Needed to provide GTK
"gtk3-devel",
# Dependencies that GTK looks for at runtime, that need to be
# in the build environment to be picked up by linuxdeploy
"libcanberra-gtk3",
"PackageKit-gtk3-module",
"gvfs-client",
]
linuxdeploy_plugins = [
"DEPLOY_GTK_VERSION=3 gtk",
]
[tool.briefcase.app.pytransmitter.linux.flatpak]
flatpak_runtime = "org.gnome.Platform"
flatpak_runtime_version = "48"
flatpak_sdk = "org.gnome.Sdk"
[tool.briefcase.app.pytransmitter.windows]
requires = [
"toga-winforms~=0.5.0",
]
# Mobile deployments
[tool.briefcase.app.pytransmitter.iOS]
requires = [
"toga-iOS~=0.5.0",
"std-nslog~=1.0.3",
]
[tool.briefcase.app.pytransmitter.android]
requires = [
"toga-android~=0.5.0",
]
base_theme = "Theme.MaterialComponents.Light.DarkActionBar"
build_gradle_dependencies = [
"com.google.android.material:material:1.13.0",
# Needed for DetailedList
# "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
# Needed for MapView
# "org.osmdroid:osmdroid-android:6.1.20",
# Needed for WebView
# "androidx.webkit:webkit:1.15.0",
]
# Needed for WebView
# build_gradle_extra_content="""
# chaquopy.defaultConfig.staticProxy("toga_android.widgets.internal.webview")
# """
# Web deployments
[tool.briefcase.app.pytransmitter.web]
requires = [
"toga-web~=0.5.0",
]

View File

@@ -0,0 +1,4 @@
from pytransmitter.app import main
if __name__ == "__main__":
main().main_loop()

View File

@@ -0,0 +1,42 @@
"""
My first application
"""
import toga
from toga.style.pack import COLUMN, ROW
class pytransmitter(toga.App):
def startup(self):
"""Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create a main window (with a name matching the app), and
show the main window.
"""
main_box = toga.Box()
name_label = toga.Label(
"您的姓名:",
margin=(0, 5),
)
self.name_input = toga.TextInput(flex=1)
name_box = toga.Box(direction=ROW, margin=5)
name_box.add(name_label)
name_box.add(self.name_input)
button = toga.Button(
"Say Hello!",on_press=self.say_hello,margin=5,
)
main_box.add(name_box)
main_box.add(button)
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
def say_hello(self, widget):
print(f"Hello, {self.name_input.value}")
def main():
return pytransmitter()

View File

@@ -0,0 +1,2 @@
Put any application resources (e.g., icons and resources) here;
they can be referenced in code as "resources/filename".

View File

View File

@@ -0,0 +1,35 @@
import os
import sys
import tempfile
from pathlib import Path
import pytest
def run_tests():
project_path = Path(__file__).parent.parent
os.chdir(project_path)
# Determine any args to pass to pytest. If there aren't any,
# default to running the whole test suite.
args = sys.argv[1:]
if len(args) == 0:
args = ["tests"]
returncode = pytest.main(
[
# Turn up verbosity
"-vv",
# Disable color
"--color=no",
# Overwrite the cache directory to somewhere writable
"-o",
f"cache_dir={tempfile.gettempdir()}/.pytest_cache",
] + args
)
print(f">>>>>>>>>> EXIT {returncode} <<<<<<<<<<")
if __name__ == "__main__":
run_tests()

View File

@@ -0,0 +1,3 @@
def test_first():
"""An initial test for the app."""
assert 1 + 1 == 2