Free Motion Capture for Everyone πβ¨
TypeScript
Welcome screen (#460)
philipqueenee7866be0079
diff --git a/freemocap/gui/qt/freemocap_main.py b/freemocap/gui/qt/freemocap_main.pyindex 61008c28..9fdb7d37 100644--- a/freemocap/gui/qt/freemocap_main.py+++ b/freemocap/gui/qt/freemocap_main.py@@ -41,6 +41,8 @@ def qt_gui_main():logger.info("Showing main window - Ready to start!")logger.info("Welcome to FreeMoCap πβ¨")freemocap_main_window.show()+ if freemocap_main_window._gui_state.show_welcome_screen:+ freemocap_main_window.open_welcome_screen_dialog()timer.timeout.connect(freemocap_main_window.update)error_code = app.exec()logger.info(f"`main` exited with error code: {error_code}")diff --git a/freemocap/gui/qt/main_window/freemocap_main_window.py b/freemocap/gui/qt/main_window/freemocap_main_window.pyindex ef839b6b..177d4d39 100644--- a/freemocap/gui/qt/main_window/freemocap_main_window.py+++ b/freemocap/gui/qt/main_window/freemocap_main_window.py@@ -23,7 +23,7 @@ from tqdm import tqdmfrom freemocap.data_layer.export_data.blender_stuff.export_to_blender import export_to_blenderfrom freemocap.data_layer.export_data.blender_stuff.get_best_guess_of_blender_path import get_best_guess_of_blender_path-from freemocap.data_layer.export_data.generate_jupyter_notebook.generate_jupyter_notebook import (+from freemocap.data_layer.generate_jupyter_notebook.generate_jupyter_notebook import (generate_jupyter_notebook,)from freemocap.data_layer.recording_models.post_processing_parameter_models import (@@ -62,6 +62,7 @@ from freemocap.gui.qt.utilities.save_and_load_gui_state import (GuiState,load_gui_state,)+from freemocap.gui.qt.widgets.welcome_screen_dialog import WelcomeScreenDialog# reboot GUI method based on this - https://stackoverflow.com/a/56563926/14662833from freemocap.system.open_file import open_file@@ -497,6 +498,17 @@ class MainWindow(QMainWindow):self._import_videos_window.folder_to_save_videos_to_selected.connect(self._handle_import_videos)self._import_videos_window.exec()+ def open_welcome_screen_dialog(self):+ 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+ )++ self._welcome_screen_dialog.exec()+def download_sample_data(self):logger.info("Downloading sample data")self.download_sample_data_thread_worker = DownloadSampleDataThreadWorker(diff --git a/freemocap/gui/qt/style_sheet/qt_style_sheet.css b/freemocap/gui/qt/style_sheet/qt_style_sheet.cssindex 115be0ba..1eb8aad8 100644--- a/freemocap/gui/qt/style_sheet/qt_style_sheet.css+++ b/freemocap/gui/qt/style_sheet/qt_style_sheet.css@@ -173,7 +173,7 @@ LogViewWidget {padding: 8px; }QDialog {- background-color: #eeeeee; }+ background-color: #f5f5f5; }QListWidget {background-color: #f5f5f5; }diff --git a/freemocap/gui/qt/style_sheet/qt_style_sheet.scss b/freemocap/gui/qt/style_sheet/qt_style_sheet.scssindex d72b4c6a..1357ebde 100644--- a/freemocap/gui/qt/style_sheet/qt_style_sheet.scss+++ b/freemocap/gui/qt/style_sheet/qt_style_sheet.scss@@ -43,7 +43,6 @@ QGroupBox {}-QStatusBar {color: $plain-black;}@@ -74,7 +73,6 @@ QTabBar::tab {font-size: 16px;}-QTabBar::tab:selected,QTabBar::tab:hover {background: $active-element;@@ -178,6 +176,7 @@ WelcomeScreenButton[recommended_next = true]:hover {QLabel {font-size: 14px;color: $dark-charcoal;+QTreeView & {color: $plain-black;@@ -229,7 +228,7 @@ LogViewWidget {}QDialog {- background-color: $background;+ background-color: $accent-background;}QListWidget {diff --git a/freemocap/gui/qt/utilities/save_and_load_gui_state.py b/freemocap/gui/qt/utilities/save_and_load_gui_state.pyindex 7a6723ed..dd938d81 100644--- a/freemocap/gui/qt/utilities/save_and_load_gui_state.py+++ b/freemocap/gui/qt/utilities/save_and_load_gui_state.py@@ -4,6 +4,7 @@ from pydantic import BaseModelclass GuiState(BaseModel):send_user_pings: bool = True+ show_welcome_screen: bool = Trueauto_process_videos_on_save: bool = Truegenerate_jupyter_notebook: bool = Trueauto_open_in_blender: bool = Truediff --git a/freemocap/gui/qt/widgets/welcome_screen_dialog.py b/freemocap/gui/qt/widgets/welcome_screen_dialog.pynew file mode 100644index 00000000..3682e0d0--- /dev/null+++ b/freemocap/gui/qt/widgets/welcome_screen_dialog.py@@ -0,0 +1,83 @@+import threading+from PyQt6.QtCore import Qt+from PyQt6.QtWidgets import (+ QVBoxLayout,+ QDialog,+ QCheckBox,+ QPushButton,+ QLabel,+ QHBoxLayout,+ QFrame+)++from freemocap.gui.qt.utilities.save_and_load_gui_state import GuiState, save_gui_state+from freemocap.system.paths_and_filenames.path_getters import get_gui_state_json_path+from freemocap.system.paths_and_filenames.file_and_folder_names import SPARKLES_EMOJI_STRING+++class WelcomeScreenDialog(QDialog):+ def __init__(self, gui_state: GuiState, kill_thread_event: threading.Event, parent=None) -> None:+ super().__init__(parent=parent)+ self.gui_state = gui_state+ self.kill_thread_event = kill_thread_event++ self.setMinimumSize(600, 300)++ self.setWindowTitle("Welcome to Freemocap!")++ self._layout = QVBoxLayout()+ self.setLayout(self._layout)++ welcome_message = SPARKLES_EMOJI_STRING + "Welcome to Freemocap!" + SPARKLES_EMOJI_STRING++ welcome_text_label = QLabel(welcome_message)+ welcome_text_label.setWordWrap(True)+ welcome_text_label.setAlignment(Qt.AlignmentFlag.AlignCenter)+ self._layout.addWidget(welcome_text_label, 1)++ self.frame = QFrame()+ self.frame.setFrameShape(QFrame.Shape.HLine)+ self.frame.setFrameShadow(QFrame.Shadow.Sunken)+ self._layout.addWidget(self.frame)++ single_camera_doc_text = "Starting with a single camera recording is a great way to learn to use FreeMoCap.\nClick the link below for a tutorial on getting 2d data from a single camera, without any calibrating."+ single_camera_docs_label = QLabel(single_camera_doc_text)+ single_camera_docs_label.setWordWrap(True)+ self._layout.addWidget(single_camera_docs_label, 1)++ single_camera_recording_doc_link_string = '➔ <a href="https://freemocap.readthedocs.io/en/latest/getting_started/single_camera_recording/" style="color: #333333;"> Single camera recording tutorial</a>'+ single_camera_doc_link = QLabel(single_camera_recording_doc_link_string)+ single_camera_doc_link.setOpenExternalLinks(True)+ self._layout.addWidget(single_camera_doc_link)++ multi_camera_doc_text = "To get 3d data from FreeMoCap, you need to record with multiple cameras and calibrate them with a charuco board.\nClick the link below for a tutorial on calibrating multiple cameras."+ multi_camera_docs_label = QLabel(multi_camera_doc_text)+ multi_camera_docs_label.setWordWrap(True)+ self._layout.addWidget(multi_camera_docs_label, 1)++ multi_camera_recording_doc_link_string = '➔ <a href="https://freemocap.readthedocs.io/en/latest/getting_started/multi_camera_calibration/" style="color: #333333;"> Multi camera recording tutorial</a>'+ multi_camera_doc_link = QLabel(multi_camera_recording_doc_link_string)+ multi_camera_doc_link.setOpenExternalLinks(True)+ self._layout.addWidget(multi_camera_doc_link)++ sample_data_text = "You can also download sample data from the File Menu to try processing a session and see what the output looks like."+ sample_data_label = QLabel(sample_data_text)+ sample_data_label.setWordWrap(True)+ self._layout.addWidget(sample_data_label, 1)++ button_box = QHBoxLayout()++ self._dont_show_again_checkbox = QCheckBox("Don't show this again")+ self._dont_show_again_checkbox.setChecked(False)+ self._dont_show_again_checkbox.stateChanged.connect(self._dont_show_again_checkbox_changed)+ button_box.addWidget(self._dont_show_again_checkbox)++ done_button = QPushButton("Done")+ done_button.clicked.connect(self.accept)+ button_box.addWidget(done_button)++ self._layout.addLayout(button_box)++ def _dont_show_again_checkbox_changed(self) -> None:+ self.gui_state.show_welcome_screen = not self._dont_show_again_checkbox.isChecked()+ save_gui_state(gui_state=self.gui_state, file_pathstring=get_gui_state_json_path())