Skip to content

Commit

Permalink
Update v4.5p final
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatDamon committed Jul 31, 2023
1 parent a3de9e2 commit 7962615
Show file tree
Hide file tree
Showing 14 changed files with 700 additions and 328 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Bug-Report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🪲报告 BUG
description: 报告一个 BUG, 来帮助我们改进该程序。
title: "[Bug]: "
labels: ["bug"]
labels: ["🪲bug"]
assignees:
- octocat
body:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Feature-Request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 📣新功能请求
description: 提交一个新功能, 来帮助我们改进该程序。
title: "[Feature Request]: "
labels: ["enhancement"]
labels: ["📣enhancement"]
assignees:
- octocat
body:
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/build_x86.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is a workflow for building the kasa_cli executable on all three major platforms.

name: Build-All-Platforms-x86

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Check-out repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x86' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install Dependencies
run: |
pip install -r requirements.txt
- name: Build Executable (Standard) - x86
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: pslo.pyw
onefile: true
standalone: true
disable-console: true
windows-icon-from-ico: ./icon/pslo_icon.ico
macos-create-app-bundle: true
macos-app-icon: ./icon/pslo_icon_mac.icns

- name: Build Executable (Mini) - x86
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: pslo_mini.pyw
onefile: true
standalone: true
disable-console: true
windows-icon-from-ico: ./icon/pslo_icon_mini.ico
macos-create-app-bundle: true
macos-app-icon: ./icon/pslo_icon_mini_mac.icns

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }} Build
path: |
build/*.exe
build/*.bin
build/*.app/**/*
62 changes: 46 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 🌐伪本地化演示程序

新版即将推出,敬请期待~

新版截图👇
![image](https://github.com/suntrise/Pseudo-localization-Demo/assets/89229642/128a04f0-cf92-4408-b74c-17d6ae7d66f8)

![截图](https://user-images.githubusercontent.com/89229642/255376854-128a04f0-cf92-4408-b74c-17d6ae7d66f8.png)

这是一个伪本地化工具, 可用于某些本地化工作用途, 当然也可以作为一个玩具或者工具~

Expand All @@ -21,28 +17,56 @@

网页版:https://suntrise.github.io/pseudo

> ⚠️ 注意, 早期基于PyQt5的1.x版本将在不久的未来移出仓库!
## 👇使用

如果您没有Python环境且比较懒, 可以移步Release下载, tar.gz版本适用于Linux, exe版本适用于Windows, 其他操作系统建议下载源码并执行
如果您没有Python环境且比较懒, 可以移步[Release](https://github.com/suntrise/Pseudo-localization-Demo/releases)下载, tar.gz版本适用于Linux, exe版本适用于Windows, 其他操作系统建议下载源码并执行 (macOS版用户可以到[Actions页](https://github.com/suntrise/Pseudo-localization-Demo/actions)下载)

注意, 要在本地查看并修改源码, 需要安装Python, 版本最少为3.7以保障兼容性

### 🚀依赖安装

运行...[^1]
#### 🧩pip安装 (适用于嵌入式Python及未默认安装pip的Python)

请先确定是否安装了`pip`, 如果已安装, 可以跳过这一步!

- 如果已经提前安装了`easy_install`, 运行...

~~~Bash
easy_inatall pip
~~~

- 使用Linux则可以通过自带的包管理器安装`python3-pip`

- 啥也没有的话则运行...[^1]

~~~Bash
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
~~~

完成后可以运行`pip`进行测试

#### 🗿正式依赖安装

运行...[^2]

~~~Bash
pip install flet
pip install pyperclip
pip install requests
~~~

若要使用或编辑Mini, 还需额外执行...
特定版本若要使用或编辑Mini, 还需额外执行...

~~~Bash
pip install fleter
~~~

以上如果嫌一个一个来麻烦,可以直接执行..
如果代码文件为最新版,则**不用执行该命令**!

以上如果嫌一个一个来麻烦,可以直接执行...

~~~Bash
pip install -r requirements.txt
Expand All @@ -60,6 +84,8 @@ pip install PyQt5

### 🛠️编译

注意, Windows平台请先安装好MSVC编译工具或者MinGW, 其他平台也请准备好GCC!

#### Pyinstaller (简单)

运行......
Expand All @@ -75,7 +101,7 @@ pip install pyinstaller
pyinstaller pslo.pyw -F -w -i ./icon/slo_icon.ico
~~~

Mini版则执行
Mini版则执行......

~~~Bash
pyinstaller pslo_mini.pyw -F -w -i ./icon/pslo_icon.ico
Expand All @@ -93,7 +119,7 @@ pyinstaller pslo_mini.pyw -F -w -i ./icon/pslo_icon.ico
pip install nuitka
~~~

定位到代码根目录, 运行......[^2]
定位到代码根目录, 运行......[^3]

~~~Bash
nuitka pslo.pyw --onefile --windows-disable-console --windows-icon-from-ico=./icon/pslo_icon.ico --standalone --show-progress
Expand Down Expand Up @@ -133,20 +159,24 @@ chmod +x [编译后文件名].bin

[flet-dev/flet](https://github.com/flet-dev/flet)

[pypi/fleter](https://pypi.org/project/fleter) (最新版本已弃用)

[asweigart/pyperclip](https://github.com/asweigart/pyperclip)

### 1.x

[Riverbank Computing PyQt5](https://www.riverbankcomputing.com/software/pyqt/)
[pypi/PyQt5](https://pypi.org/project/PyQt5/)

## 📄许可协议

使用**WTFPL**许可协议开源[^3], 你想干嘛就干嘛
使用**WTFPL**许可协议开源[^4], 你想干嘛就干嘛

![WTFPL](http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-1.png)

[^1]: 部分系统可能要将`pip`改为`pip3`
[^1]: 部分平台没有`curl`指令, 可以用`wget`或者其他方式获取安装脚本

[^2]: 部分系统可能要将`pip`改为`pip3`, 如果有多个Python3, 数字可能需要具体到版本号, 如`pip3.11`

[^2]: 部分系统可能要将`nuitka`改为`nuitka3`
[^3]: 部分系统可能要将`nuitka`改为`nuitka3`, 尚不清楚是否需要和`pip`一样具体到版本号

[^3]: 或许可以解释为**W**indows **T**iny **F**orm **P**seudo-**L**ocalization
[^4]: 或许可以解释为**W**indows **T**iny **F**orm **P**seudo-**L**ocalization
30 changes: 19 additions & 11 deletions lib/basic_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from lib import log # 日志输出库

# 预备输出
print("\033[0;34m[INFO] Basic Information ready...\033[0m")
log.out(0, "Basic Information ready...")

# 基本信息
ver = "v4.5p"
Expand All @@ -9,11 +11,25 @@
updmd = """
# 更新日志 (详见GitHub Releases)
## v4.5p - 2023.8.1
1. UI大改;
2. 优化了部分功能;
3. 检查更新API更换为KGithub;
4. [开发者]控制台日志输出优化;
5. 保存支持自动添加文件后缀;
6. 保存伪本地化内容时允许保留原文;
7. 修复了一些BUG.
## v4.2.1p - 2023.7.17
1. 细节优化.
## v4.2p - 2023.7.15
1. 修复了一些BUG;
2. 界面更新;
3. 仓库置顶;
3. 新增窗口置顶;
3. 细节优化.
## v4.1.1p - 2023.7.14
Expand All @@ -27,14 +43,6 @@
2. 历史记录页面更新;
3. 新增隐藏控制字符;
4. 细节优化.
## v4.0.2p - 2023.7.9
1. 修复了一些BUG.
# v4.0.1p - 2023.7.4
1. 细节优化.
"""

# 定义内容
Expand All @@ -59,4 +67,4 @@
- https://zhuanlan.zhihu.com/p/613293858
"""
about_text = "伪本地化演示程序 " + ver + "\n开发者: " + author +"\n贡献者、使用到的第三方项目详见 GitHub 项目仓库\n(https://github.com/suntrise/Pseudo-localization-Demo)"
about_text = "伪本地化演示程序 " + ver + "\n开发者: " + author +"\n贡献者、使用到的第三方项目详见 GitHub 项目仓库\n(https://github.com/suntrise/Pseudo-localization-Demo)\nMade with ❤ for YOU!\n使用WTFPL许可协议开源 (不涉及使用到的第三方库)"
3 changes: 2 additions & 1 deletion lib/config_li.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from config import *
from lib import log # 日志输出库
import json

# 尚未完成 WIP

# 预备输出
print("\033[0;34m[INFO] Config Read and Write Module ready...\033[0m")
log.out(0, "Config Read and Write Module ready...")

# 读取配置文件
def read_config():
Expand Down
90 changes: 90 additions & 0 deletions lib/controls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import flet
from flet import *
from flet import icons
from lib import log # 日志输出库

# 预备输出
log.out(0, "Advanced Controls Module ready...")

# 窗口顶栏, 基于Fleter库制作, MIT协议
def CLOSE_ID(page: flet.Page):
page.window_close()
page.close_in_app_web_view()

def MAXIMIZE_ID(page: flet.Page):
if page.window_maximized:
page.window_maximized = False
elif not page.window_maximized:
page.window_maximized = True
page.update()

def MINIMIZE_ID(page: flet.Page):
page.window_minimized = True
page.update()

class CloseButton(IconButton):
__name__ = "controls.CloseButton"

def __init__(self,
page: flet.Page,
icon = icons.CLOSE_ROUNDED,
on_click=None,
):
super(CloseButton, self).__init__(icon = icon)

self._page = page

if on_click is None:
self.on_click = lambda _: self.close()

def close(self):
CLOSE_ID(self._page)


class MaximizeButton(IconButton):
__name__ = "controls.MaximizeButton"

def __init__(self,
page: flet.Page,
icon = icons.ZOOM_OUT_MAP_ROUNDED,
icon_max = icons.ZOOM_IN_MAP_ROUNDED,
on_click = None,
):
super(MaximizeButton, self).__init__(icon = icon, icon_size = 20)

self._page = page

self._icon = icon
self._icon_max = icon_max

if on_click is None:
self.on_click = lambda _: self.maximize()

def maximize(self):
if self._page.window_maximized:
self.icon = self._icon
elif not self._page.window_maximized:
self.icon = self._icon_max
MAXIMIZE_ID(self._page)
self._page.update()


class MinimizeButton(IconButton):
__name__ = "controls.MinimizeButton"

def __init__(self,
page: flet.Page,
icon = icons.MINIMIZE_ROUNDED,
on_click = None,
):
super(MinimizeButton, self).__init__(icon = icon)

self._page = page

if on_click is None:
self.on_click = lambda _: self.minimize()

def minimize(self):
self._page.window_minimized = True
MINIMIZE_ID(self._page)
self._page.update()
12 changes: 12 additions & 0 deletions lib/log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import datetime

# 日志
def out(cata, info):
if cata == 0:
print("\033[0;34mINFO\033[0m | " + datetime.datetime.now().strftime('%H:%M:%S') + " | " + info)
elif cata == 1:
print("\033[0;32mDONE\033[0m | " + datetime.datetime.now().strftime('%H:%M:%S') + " | " + info)
elif cata == 2:
print("\033[0;31mERROR\033[0m | " + datetime.datetime.now().strftime('%H:%M:%S') + " | " + info)
elif cata == 3:
print("\033[0;33mWARN\033[0m | " + datetime.datetime.now().strftime('%H:%M:%S') + " | " + info)
Loading

0 comments on commit 7962615

Please sign in to comment.