Free Motion Capture for Everyone πβ¨
TypeScript
add `feedback` and `donation` link, check for new version (#472)
jonmatthise22a21501c7d
diff --git a/.flake8 b/.flake8index 3b88fb89..2e94f201 100644--- a/.flake8+++ b/.flake8@@ -1,10 +1,12 @@[flake8]-+root = ./freemocapexclude =./freemocap/data_layer/export_data/blender_stuff/blender_bpy_export_scripts/*./freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/anipose_camera_calibrator.py./freemocap/core_processes/capture_volume_calibration/anipose_camera_calibration/freemocap_anipose.py./.nox+ ./.venv+ ./venvper-file-ignores =./freemocap/core_processes/process_motion_capture_videos/process_recording_folder.py:C901diff --git a/experimental/batch_process/batch_process.py b/experimental/batch_process/batch_process.pyindex 1252e625..ee866127 100644--- a/experimental/batch_process/batch_process.py+++ b/experimental/batch_process/batch_process.py@@ -22,9 +22,15 @@ def process_folder_of_session_folders(for session_folder_path in list_of_session_folders:logging.info(f"Looking in {session_folder_path} for recording folders")- list_of_recording_folders = [f for f in session_folder_path.iterdir() if f.is_dir() and (f/'synchronized_videos').exists() and any((f/'synchronized_videos').iterdir())]+ list_of_recording_folders = [+ f+ for f in session_folder_path.iterdir()+ if f.is_dir() and (f / "synchronized_videos").exists() and any((f / "synchronized_videos").iterdir())+ ]- calibration_files = [toml_file for sesh in list_of_recording_folders for toml_file in list(sesh.glob("*calibration.toml"))]+ calibration_files = [+ toml_file for sesh in list_of_recording_folders for toml_file in list(sesh.glob("*calibration.toml"))+ ]for recording_folder_path in list_of_recording_folders:logging.info("Looking for calibration toml")@@ -60,7 +66,7 @@ def process_recording_without_gui(else:logging.warning("No camera calibration toml file provided. May cause an error with multicamera recordings.")- recording_info_dict = rec.dict(exclude={'recording_info_model'})+ recording_info_dict = rec.dict(exclude={"recording_info_model"})Path(rec.recording_info_model.output_data_folder_path).mkdir(parents=True, exist_ok=True)diff --git a/experimental/batch_process/headless_calibration.py b/experimental/batch_process/headless_calibration.pyindex 7a1f15b5..1f821e3c 100644--- a/experimental/batch_process/headless_calibration.py+++ b/experimental/batch_process/headless_calibration.py@@ -26,9 +26,7 @@ def headless_calibration(if __name__ == "__main__":- path_to_folder_of_calibration_videos = Path(- "/PATH/TO/CALIBRATION/VIDEOS"- )+ path_to_folder_of_calibration_videos = Path("/PATH/TO/CALIBRATION/VIDEOS")charuco_square_size = 110 # size of a black square on your charuco board in mmheadless_calibration(diff --git a/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py b/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.pyindex 65408a4d..44e610bf 100644--- a/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py+++ b/freemocap/core_processes/process_motion_capture_videos/process_recording_headless.py@@ -62,8 +62,7 @@ def process_recording_headless()logger.info("Starting core processing pipeline...")- process_recording_folder(recording_processing_parameter_model=rec,- use_tqdm=use_tqdm)+ process_recording_folder(recording_processing_parameter_model=rec, use_tqdm=use_tqdm)logger.info("Generating jupyter notebook...")generate_jupyter_notebook(path_to_recording=recording_path)diff --git a/freemocap/gui/qt/main_window/freemocap_main_window.py b/freemocap/gui/qt/main_window/freemocap_main_window.pyindex 177d4d39..21bfc2da 100644--- a/freemocap/gui/qt/main_window/freemocap_main_window.py+++ b/freemocap/gui/qt/main_window/freemocap_main_window.py@@ -502,9 +502,7 @@ class MainWindow(QMainWindow):logger.info("Opening `Welcome to Freemocap` dialog... ")self._welcome_screen_dialog = WelcomeScreenDialog(- gui_state=self._gui_state,- kill_thread_event=self._kill_thread_event,- parent=self+ gui_state=self._gui_state, kill_thread_event=self._kill_thread_event, parent=self)self._welcome_screen_dialog.exec()diff --git a/freemocap/gui/qt/widgets/home_widget.py b/freemocap/gui/qt/widgets/home_widget.pyindex 314cd475..f0d9a4b7 100644--- a/freemocap/gui/qt/widgets/home_widget.py+++ b/freemocap/gui/qt/widgets/home_widget.py@@ -1,5 +1,7 @@import logging+from typing import Union+import requestsfrom PyQt6.QtCore import Qtfrom PyQt6.QtGui import QPixmapfrom PyQt6.QtWidgets import (@@ -10,6 +12,7 @@ from PyQt6.QtWidgets import (QWidget,QHBoxLayout,)+from packaging import versionimport freemocapfrom freemocap.gui.qt.actions_and_menus.actions import (@@ -20,7 +23,6 @@ from freemocap.gui.qt.actions_and_menus.actions import (Actions,)from freemocap.gui.qt.utilities.save_and_load_gui_state import GuiState, save_gui_state-from freemocap.system.paths_and_filenames.file_and_folder_names import PATH_TO_FREEMOCAP_LOGO_SVGfrom freemocap.system.paths_and_filenames.path_getters import get_gui_state_json_path@@ -74,7 +76,7 @@ class HomeWidget(QWidget):self._create_user_info_consent_checkbox()- self._add_code_and_docs_links()+ self._add_text_links()self._make_version_label()self.style().polish(self)@@ -83,15 +85,50 @@ class HomeWidget(QWidget):hbox = QHBoxLayout()self._layout.addLayout(hbox)version_label_string = f'source:<a href="https://github.com/freemocap/freemocap" style="color: #777777;"> {freemocap.__version__}</a>'-+ latest_version = self.check_for_latest_version().split("rc")[0]+ current_version = freemocap.__version__.strip("v").split("-")[0]++ if latest_version is None:+ version_label_string += " (X)"+ tooltip_string = " (`new version check` failed!)"+ elif latest_version != current_version or True:+ version_label_string += " (update available!)"+ tooltip_string = (+ f"New version {latest_version} available!\n"+ f" upgrade to latest version by entering the command \n\n"+ f" ```\npip install freemocap --upgrade --pre\n``` "+ f"\n\ninto the terminal you used to launch this program (with your `(freemocap-env)` environment activated)"+ )+ else:+ tooltip_string = f"Your version of freemocap ({freemocap.__version__}) is up to date! (latest: {self.check_for_latest_version()})"version_label = QLabel(version_label_string)version_label.setAlignment(Qt.AlignmentFlag.AlignRight)version_label.setStyleSheet("font-size: 12px;color: #777777")version_label.setOpenExternalLinks(True)+ version_label.setToolTip(tooltip_string)hbox.addWidget(version_label)- def _add_code_and_docs_links(self):+ def check_for_latest_version(self) -> Union[str, None]:+ response = requests.get(f"https://pypi.org/pypi/{freemocap.__package_name__}/json")+ if response.status_code != 200:+ logger.error(f"Failed to check for latest version of {freemocap.__package_name__}")+ return None++ versions = response.json()["releases"].keys()++ pre_releases = [v for v in versions if "a" in v or "b" in v or "rc" in v]+ if pre_releases:+ pre_releases.sort(key=version.parse)++ versions = list(versions)+ versions.sort(key=version.parse)+ all_versions = pre_releases + versions+ all_versions.sort(key=version.parse)++ return all_versions[-1] if all_versions else None++ def _add_text_links(self):hbox = QHBoxLayout()self._layout.addLayout(hbox)hbox.addStretch(1)@@ -103,6 +140,15 @@ class HomeWidget(QWidget):docs_string = QLabel(docs_string)docs_string.setOpenExternalLinks(True)hbox.addWidget(docs_string, alignment=Qt.AlignmentFlag.AlignCenter)+ feedback_string = '<a href="https://forms.gle/AguGxQAJGXxaJbXdA" style="color: #333333;">feedback</a>'+ feedback_string = QLabel(feedback_string)+ feedback_string.setOpenExternalLinks(True)+ hbox.addWidget(feedback_string, alignment=Qt.AlignmentFlag.AlignRight)+ donate_string = '<a href="https://freemocap.org/about-us.html#donate" style="color: #333333;">donate <3</a>'+ donate_string = QLabel(donate_string)+ donate_string.setOpenExternalLinks(True)+ hbox.addWidget(donate_string, alignment=Qt.AlignmentFlag.AlignRight)+hbox.addStretch(1)def _create_user_info_consent_checkbox(self):diff --git a/freemocap/gui/qt/widgets/welcome_screen_dialog.py b/freemocap/gui/qt/widgets/welcome_screen_dialog.pyindex 3682e0d0..6edcfd91 100644--- a/freemocap/gui/qt/widgets/welcome_screen_dialog.py+++ b/freemocap/gui/qt/widgets/welcome_screen_dialog.py@@ -1,14 +1,6 @@import threadingfrom PyQt6.QtCore import Qt-from PyQt6.QtWidgets import (- QVBoxLayout,- QDialog,- QCheckBox,- QPushButton,- QLabel,- QHBoxLayout,- QFrame-)+from PyQt6.QtWidgets import QVBoxLayout, QDialog, QCheckBox, QPushButton, QLabel, QHBoxLayout, QFramefrom freemocap.gui.qt.utilities.save_and_load_gui_state import GuiState, save_gui_statefrom freemocap.system.paths_and_filenames.path_getters import get_gui_state_json_pathdiff --git a/freemocap/system/user_data/pipedream_pings.py b/freemocap/system/user_data/pipedream_pings.pyindex 3b609ef4..f5d26d07 100644--- a/freemocap/system/user_data/pipedream_pings.py+++ b/freemocap/system/user_data/pipedream_pings.py@@ -24,8 +24,4 @@ class PipedreamPings:f"{self._pings_dict} ")- requests.post(- self._pipedream_url,- json=self._pings_dict,- timeout=(5, 60)- )+ requests.post(self._pipedream_url, json=self._pings_dict, timeout=(5, 60))diff --git a/freemocap/tests/__init__.py b/freemocap/tests/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/pyproject.toml b/pyproject.tomlindex a0030ab2..01b81f2a 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -79,7 +79,8 @@ dependencies = ["libsass==0.21.0","ipykernel==6.23.1","plotly==5.14.1",- "pydantic==1.*"+ "pydantic==1.*",+ "packaging"]requires-python = ">=3.8"diff --git a/src/gui/main/main.py b/src/gui/main/main.pyindex d428ccdb..5aa409f5 100644--- a/src/gui/main/main.py+++ b/src/gui/main/main.py@@ -4,19 +4,22 @@ logger = logging.getLogger(__name__)if __name__ == "__main__":logger.info(- "User tried using `pre-alpha` entry point (`import freemocap: freemocap.RunMe() - displaying friendly message then re-directing to `freemocap.__main__:main()` entry point")+ "User tried using `pre-alpha` entry point (`import freemocap: freemocap.RunMe() - displaying friendly message then re-directing to `freemocap.__main__:main()` entry point"+ )- print("--------------------------------\n"- "--------------------------------\n"- "--------------------------------\n"- "Hello! Looks like you're trying to use the `alpha GUI` entry point for FreeMoCap.\n"- "This entry point is deprecated, so we're launching the GUI via `freemocap.__main__:main()` entry point.\n"- "If you want use the `alpha GUI` code, use check out the `v0.1.0` tag in the github repo.\n"- "Thank you for using FreeMoCap!\n"- "--------------------------------\n"- "(NOTE - this entry point will be removed eventually\n"- "--------------------------------\n"- "--------------------------------\n")+ print(+ "--------------------------------\n"+ "--------------------------------\n"+ "--------------------------------\n"+ "Hello! Looks like you're trying to use the `alpha GUI` entry point for FreeMoCap.\n"+ "This entry point is deprecated, so we're launching the GUI via `freemocap.__main__:main()` entry point.\n"+ "If you want use the `alpha GUI` code, use check out the `v0.1.0` tag in the github repo.\n"+ "Thank you for using FreeMoCap!\n"+ "--------------------------------\n"+ "(NOTE - this entry point will be removed eventually\n"+ "--------------------------------\n"+ "--------------------------------\n"+ )from freemocap.__main__ import main