From a7bcaca8f57d557cee257b9cd4b2d667657a8c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Mon, 10 May 2021 15:54:07 +0100 Subject: [PATCH] add version number to about page --- TODO.md | 26 +++++++++++++++++++++++--- poetry.lock | 14 +++++++++++++- py/WM_utils.py | 8 ++++++++ py/webcam_manager.py | 8 +++++--- pyproject.toml | 3 ++- 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 1836850..3529eda 100644 --- a/TODO.md +++ b/TODO.md @@ -1,14 +1,31 @@ # TODO +- app + - about window + - remove borders around windows + +- Readme +- Docs/zine: + - intro + - usage + - screenshots +- export static website + - sidebar with download button and link to repo + + + +- [x] app/installer icon + - [ ] V4L2 warnings on Linux - 9 warnings so I guess one for each camera that is not found (we test for 10 devices in `camera_indexes()`) -- [ ] Stealth button names/colors - - icons only? see [this](https://pysimplegui.readthedocs.io/en/latest/cookbook/#use-with-buttons) +- [ ] Crash when bad value (e.g. nothing) is entered manually in the device dropdown. + -- [ ] Start modprobe service automatically from Python? +- [x] Start modprobe service automatically from Python? - probably can call a `subprocess` or something. Probably check first if the `v4l2loopback` package exist, and if not display the command to execute? + - asks for sudo password. - [ ] Package Font? - Title using [Steps Mono](https://www.velvetyne.fr/fonts/steps-mono/download/) libre font from Velvetyne. @@ -25,6 +42,9 @@ https://stackoverflow.com/a/60822647 ## DONE +- [x] Stealth button names/colors + - icons only? see [this](https://pysimplegui.readthedocs.io/en/latest/cookbook/#use-with-buttons) + - [x] Keyboard shortcuts - ~~to easily start/stop recording: space bar~~ - ~~start/stop loop: enter?~~ diff --git a/poetry.lock b/poetry.lock index f7289ac..0fffe4b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -60,10 +60,18 @@ category = "main" optional = false python-versions = "*" +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "main" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" + [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "38ef9a8930d7d771da26851583eb09abffe03f041d230fc9903ac0d32ec16fc7" +content-hash = "c7673e83214b30272d4613cdbbba0bfe79b51e0d632e47eb96dc4f7459252371" [metadata.files] imutils = [ @@ -179,3 +187,7 @@ tk = [ {file = "tk-0.1.0-py3-none-any.whl", hash = "sha256:703a69ff0d5ba2bd2f7440582ad10160e4a6561595d33457dc6caa79b9bf4930"}, {file = "tk-0.1.0.tar.gz", hash = "sha256:60bc8923d5d35f67f5c6bd93d4f0c49d2048114ec077768f959aef36d4ed97f8"}, ] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] diff --git a/py/WM_utils.py b/py/WM_utils.py index e623d4a..74b6982 100644 --- a/py/WM_utils.py +++ b/py/WM_utils.py @@ -4,6 +4,14 @@ import cv2 import shutil import os import glob +import toml + +def WM_version(): + f = open("../pyproject.toml", "r") + text = f.read() + poetry = toml.loads(text) + version = poetry['tool']['poetry']['version'] + return version def camera_indexes(): ''' diff --git a/py/webcam_manager.py b/py/webcam_manager.py index 20a1dae..8d0ac10 100644 --- a/py/webcam_manager.py +++ b/py/webcam_manager.py @@ -5,7 +5,6 @@ from imutils.video import count_frames import os import pathlib - from WM_utils import * @@ -51,8 +50,9 @@ def about_window(): https://pysimplegui.readthedocs.io/en/latest/call%20reference/#text-element - add IDS Logo ''' + version = WM_version() layout = [ - [sg.Text("New Window", key="new")] + [sg.Text("Version: " + version, key="new")] ] window = sg.Window("Second Window", layout, modal=False, size=(300,150)) choice = None @@ -64,6 +64,9 @@ def about_window(): window.close() def main(): + ''' + Main Window + ''' flushvideofiles() global cv recVidNum= 0 @@ -87,7 +90,6 @@ def main(): size=(15,1), font=("Steps-Mono", 20), justification="left"), - sg.Text("V α 0.1", size=(19,1), justification="left"), sg.Button( image_data=convert_to_bytes('assets/button_ABOUT.png', (40, 40)), button_color=(sg.theme_background_color(), sg.theme_background_color()), diff --git a/pyproject.toml b/pyproject.toml index de81b2b..08849ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "webcam_manager" -version = "0.1.0" +version = "Alpha 0.1" description = "" authors = ["Your Name "] @@ -12,6 +12,7 @@ PySimpleGUI = "^4.37.0" pyvirtualcam = "^0.5.0" Pillow = "^8.1.2" tk = "^0.1.0" +toml = "^0.10.2" [tool.poetry.dev-dependencies]