mirror of
https://github.com/netinvent/npbackup.git
synced 2024-09-20 06:46:13 +08:00
GUI: Shift from PySimpleGUI 4.60 to FreeSimpleGUI 5.1.1
This commit is contained in:
parent
b48df41e66
commit
4a6d404966
8
.github/workflows/pylint-linux.yaml
vendored
8
.github/workflows/pylint-linux.yaml
vendored
|
@ -30,22 +30,22 @@ jobs:
|
|||
python -m pip install pylint
|
||||
# Do not run pylint on python 3.3 because isort is not available for python 3.3, don't run on python 3.4 because pylint: disable=xxxx does not exist
|
||||
# Disable E0401 import error since we lint on linux and pywin32 is obviously missing
|
||||
python -m pylint --disable=C,W,R --max-line-length=127 --ignore PySimpleGUI.py npbackup
|
||||
python -m pylint --disable=C,W,R --max-line-length=127 npbackup
|
||||
python -m pylint --disable=C,W,R --max-line-length=127 upgrade_server/upgrade_server
|
||||
- name: Lint with flake8
|
||||
#if: ${{ matrix.python-version == '3.11' }}
|
||||
run: |
|
||||
python -m pip install flake8
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics --exclude PySimpleGUI.py npbackup
|
||||
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics npbackup
|
||||
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics upgrade_server/upgrade_server
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
python -m flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude PySimpleGUI.py npbackup
|
||||
python -m flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics npbackup
|
||||
python -m flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics upgrade_server
|
||||
- name: Lint with Black
|
||||
# Don't run on python < 3.6 since black does not exist there, run only once
|
||||
#if: ${{ matrix.python-version == '3.11' }}
|
||||
run: |
|
||||
pip install black
|
||||
python -m black --check --exclude PySimpleGUI.py npbackup
|
||||
python -m black --check npbackup
|
||||
python -m black --check upgrade_server/upgrade_server
|
8
.github/workflows/pylint-windows.yaml
vendored
8
.github/workflows/pylint-windows.yaml
vendored
|
@ -30,22 +30,22 @@ jobs:
|
|||
run: |
|
||||
python -m pip install pylint
|
||||
# Do not run pylint on python 3.3 because isort is not available for python 3.3, don't run on python 3.4 because pylint: disable=xxxx does not exist
|
||||
python -m pylint --disable=C,W,R --max-line-length=127 --ignore PySimpleGUI.py npbackup
|
||||
python -m pylint --disable=C,W,R --max-line-length=127 npbackup
|
||||
python -m pylint --disable=C,W,R --max-line-length=127 upgrade_server/upgrade_server
|
||||
- name: Lint with flake8
|
||||
#if: ${{ matrix.python-version == '3.12' }}
|
||||
run: |
|
||||
python -m pip install flake8
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics --exclude PySimpleGUI.py npbackup
|
||||
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics npbackup
|
||||
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics upgrade_server/upgrade_server
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
python -m flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude PySimpleGUI.py npbackup
|
||||
python -m flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics npbackup
|
||||
python -m flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics upgrade_server/upgrade_server
|
||||
- name: Lint with Black
|
||||
# Don't run on python < 3.6 since black does not exist there, run only once
|
||||
#if: ${{ matrix.python-version == '3.12' }}
|
||||
run: |
|
||||
pip install black
|
||||
python -m black --check --exclude PySimpleGUI.py npbackup
|
||||
python -m black --check npbackup
|
||||
python -m black --check upgrade_server/upgrade_server
|
|
@ -266,7 +266,7 @@ def compile(arch: str, audience: str, build_type: str, onefile: bool):
|
|||
if build_type in ("gui", "viewer"):
|
||||
NUITKA_OPTIONS += " --plugin-enable=tk-inter --disable-console"
|
||||
else:
|
||||
NUITKA_OPTIONS += " --plugin-disable=tk-inter --nofollow-import-to=PySimpleGUI --nofollow-import-to=_tkinter --nofollow-import-to=npbackup.gui"
|
||||
NUITKA_OPTIONS += " --plugin-disable=tk-inter --nofollow-import-to=FreeSimpleGUI --nofollow-import-to=_tkinter --nofollow-import-to=npbackup.gui"
|
||||
if onefile:
|
||||
NUITKA_OPTIONS += " --onefile"
|
||||
# Stupid fix for synology RS816 where /tmp is mounted with `noexec`.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27,7 +27,7 @@ from ofunctions.process import kill_childs
|
|||
from ofunctions.threading import threaded
|
||||
from threading import Thread
|
||||
from ofunctions.misc import BytesConverter
|
||||
import npbackup.gui.PySimpleGUI as sg
|
||||
import FreeSimpleGUI as sg
|
||||
import _tkinter
|
||||
import npbackup.configuration
|
||||
import npbackup.common
|
||||
|
@ -43,7 +43,7 @@ from resources.customization import (
|
|||
FOLDER_ICON,
|
||||
FILE_ICON,
|
||||
LICENSE_TEXT,
|
||||
PYSIMPLEGUI_THEME,
|
||||
SIMPLEGUI_THEME,
|
||||
OEM_ICON,
|
||||
SHORT_PRODUCT_NAME,
|
||||
)
|
||||
|
@ -63,7 +63,7 @@ backend_binary = None
|
|||
FIRST_GUI_RUN = True
|
||||
|
||||
|
||||
sg.theme(PYSIMPLEGUI_THEME)
|
||||
sg.theme(SIMPLEGUI_THEME)
|
||||
sg.SetOptions(icon=OEM_ICON)
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import os
|
|||
import re
|
||||
import pathlib
|
||||
from logging import getLogger
|
||||
import npbackup.gui.PySimpleGUI as sg
|
||||
import FreeSimpleGUI as sg
|
||||
import textwrap
|
||||
from ruamel.yaml.comments import CommentedMap
|
||||
import npbackup.configuration as configuration
|
||||
|
@ -39,8 +39,8 @@ from npbackup.task import create_scheduled_task
|
|||
logger = getLogger()
|
||||
|
||||
|
||||
# Monkeypatching PySimpleGUI
|
||||
# @PySimpleGUI: Why is there no delete method for TreeData ?
|
||||
# Monkeypatching SimpleGUI
|
||||
# @SimpleGUI: Why is there no delete method for TreeData ?
|
||||
def delete(self, key):
|
||||
if key == "":
|
||||
return False
|
||||
|
@ -82,7 +82,7 @@ def ask_manager_password(manager_password: str) -> bool:
|
|||
def config_gui(full_config: dict, config_file: str):
|
||||
logger.info("Launching configuration GUI")
|
||||
|
||||
# Don't let PySimpleGUI handle key errros since we might have new keys in config file
|
||||
# Don't let SimpleGUI handle key errros since we might have new keys in config file
|
||||
sg.set_options(
|
||||
suppress_raise_key_errors=True,
|
||||
suppress_error_popups=True,
|
||||
|
@ -581,7 +581,7 @@ def config_gui(full_config: dict, config_file: str):
|
|||
|
||||
# We need to patch values since sg.Tree() only returns selected data from TreeData()
|
||||
# Hence we'll fill values with a list or a dict depending on our TreeData data structure
|
||||
# @PysimpleGUI: there should be a get_all_values() method or something
|
||||
# @simpleGUI: there should be a get_all_values() method or something
|
||||
list_tree_data_keys = [
|
||||
"backup_opts.paths",
|
||||
"backup_opts.tags",
|
||||
|
|
|
@ -15,7 +15,7 @@ from logging import getLogger
|
|||
from time import sleep
|
||||
import re
|
||||
import queue
|
||||
import npbackup.gui.PySimpleGUI as sg
|
||||
import FreeSimpleGUI as sg
|
||||
from npbackup.core.i18n_helper import _t
|
||||
from resources.customization import (
|
||||
LOADER_ANIMATION,
|
||||
|
@ -25,12 +25,12 @@ from resources.customization import (
|
|||
from npbackup.core.runner import NPBackupRunner
|
||||
from npbackup.__debug__ import _DEBUG
|
||||
from npbackup.__env__ import GUI_CHECK_INTERVAL
|
||||
from resources.customization import PYSIMPLEGUI_THEME, OEM_ICON
|
||||
from resources.customization import SIMPLEGUI_THEME, OEM_ICON
|
||||
|
||||
logger = getLogger()
|
||||
|
||||
|
||||
sg.theme(PYSIMPLEGUI_THEME)
|
||||
sg.theme(SIMPLEGUI_THEME)
|
||||
sg.SetOptions(icon=OEM_ICON)
|
||||
|
||||
|
||||
|
@ -240,7 +240,7 @@ def gui_thread_runner(
|
|||
kwargs = {**kwargs, **{"__no_threads": True}}
|
||||
result = runner.__getattribute__(fn.__name__)(*args, **kwargs)
|
||||
while True:
|
||||
# No idea why pylint thinks that UpdateAnimation does not exist in PySimpleGUI
|
||||
# No idea why pylint thinks that UpdateAnimation does not exist in SimpleGUI
|
||||
# pylint: disable=E1101 (no-member)
|
||||
progress_window["-LOADER-ANIMATION-"].UpdateAnimation(
|
||||
LOADER_ANIMATION, time_between_frames=100
|
||||
|
|
|
@ -12,7 +12,7 @@ __build__ = "2024061601"
|
|||
|
||||
import os
|
||||
from logging import getLogger
|
||||
import npbackup.gui.PySimpleGUI as sg
|
||||
import FreeSimpleGUI as sg
|
||||
from npbackup.configuration import (
|
||||
get_repo_config,
|
||||
get_group_list,
|
||||
|
|
|
@ -8,8 +8,9 @@ ofunctions.threading>=2.2.0
|
|||
ofunctions.platform>=1.5.1
|
||||
ofunctions.random
|
||||
python-pidfile>=3.0.0
|
||||
# pysimplegui 5 has gone commercial, let's keep an inline version for noww
|
||||
#pysimplegui==4.60.5
|
||||
# pysimplegui 5 has gone commercial, let's switch to freesimplegui
|
||||
# also, we need to stick to freesimplegui 5.1.1 to keep Python 3.6 compat in order compile for elder linuxes
|
||||
freesimplegui==5.1.1
|
||||
requests
|
||||
ruamel.yaml
|
||||
psutil
|
||||
|
|
|
@ -31,9 +31,9 @@ SHORT_PRODUCT_NAME = "NPBackup"
|
|||
TASK_AUTHOR = "NetPerfect Opensource Initiative"
|
||||
TASK_URI = f"\\{PROGRAM_NAME}"
|
||||
|
||||
# PySimpleGUI theme
|
||||
# SimpleGUI theme
|
||||
# Valid list: ['Black', 'BlueMono', 'BluePurple', 'BrightColors', 'BrownBlue', 'Dark', 'Dark2', 'DarkAmber', 'DarkBlack', 'DarkBlack1', 'DarkBlue', 'DarkBlue1', 'DarkBlue10', 'DarkBlue11', 'DarkBlue12', 'DarkBlue13', 'DarkBlue14', 'DarkBlue15', 'DarkBlue16', 'DarkBlue17', 'DarkBlue2', 'DarkBlue3', 'DarkBlue4', 'DarkBlue5', 'DarkBlue6', 'DarkBlue7', 'DarkBlue8', 'DarkBlue9', 'DarkBrown', 'DarkBrown1', 'DarkBrown2', 'DarkBrown3', 'DarkBrown4', 'DarkBrown5', 'DarkBrown6', 'DarkBrown7', 'DarkGreen', 'DarkGreen1', 'DarkGreen2', 'DarkGreen3', 'DarkGreen4', 'DarkGreen5', 'DarkGreen6', 'DarkGreen7', 'DarkGrey', 'DarkGrey1', 'DarkGrey10', 'DarkGrey11', 'DarkGrey12', 'DarkGrey13', 'DarkGrey14', 'DarkGrey15', 'DarkGrey2', 'DarkGrey3', 'DarkGrey4', 'DarkGrey5', 'DarkGrey6', 'DarkGrey7', 'DarkGrey8', 'DarkGrey9', 'DarkPurple', 'DarkPurple1', 'DarkPurple2', 'DarkPurple3', 'DarkPurple4', 'DarkPurple5', 'DarkPurple6', 'DarkPurple7', 'DarkRed', 'DarkRed1', 'DarkRed2', 'DarkTanBlue', 'DarkTeal', 'DarkTeal1', 'DarkTeal10', 'DarkTeal11', 'DarkTeal12', 'DarkTeal2', 'DarkTeal3', 'DarkTeal4', 'DarkTeal5', 'DarkTeal6', 'DarkTeal7', 'DarkTeal8', 'DarkTeal9', 'Default', 'Default1', 'DefaultNoMoreNagging', 'GrayGrayGray', 'Green', 'GreenMono', 'GreenTan', 'HotDogStand', 'Kayak', 'LightBlue', 'LightBlue1', 'LightBlue2', 'LightBlue3', 'LightBlue4', 'LightBlue5', 'LightBlue6', 'LightBlue7', 'LightBrown', 'LightBrown1', 'LightBrown10', 'LightBrown11', 'LightBrown12', 'LightBrown13', 'LightBrown2', 'LightBrown3', 'LightBrown4', 'LightBrown5', 'LightBrown6', 'LightBrown7', 'LightBrown8', 'LightBrown9', 'LightGray1', 'LightGreen', 'LightGreen1', 'LightGreen10', 'LightGreen2', 'LightGreen3', 'LightGreen4', 'LightGreen5', 'LightGreen6', 'LightGreen7', 'LightGreen8', 'LightGreen9', 'LightGrey', 'LightGrey1', 'LightGrey2', 'LightGrey3', 'LightGrey4', 'LightGrey5', 'LightGrey6', 'LightPurple', 'LightTeal', 'LightYellow', 'Material1', 'Material2', 'NeutralBlue', 'Purple', 'Python', 'PythonPlus', 'Reddit', 'Reds', 'SandyBeach', 'SystemDefault', 'SystemDefault1', 'SystemDefaultForReal', 'Tan', 'TanBlue', 'TealMono', 'Topanga']
|
||||
PYSIMPLEGUI_THEME = "Reddit"
|
||||
SIMPLEGUI_THEME = "Reddit"
|
||||
BG_COLOR_LDR = "#0079d3"
|
||||
TXT_COLOR_LDR = "#FFFFFF"
|
||||
GUI_STATE_OK_BUTTON = ("#FFFFFF", "#0079d3")
|
||||
|
|
Loading…
Reference in a new issue