-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
700 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.