Skip to content

Commit

Permalink
having online bulletin for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
shrivaths16 committed Jan 12, 2024
1 parent 5391131 commit 6ddb158
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
28 changes: 20 additions & 8 deletions sleap/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from pathlib import Path
from typing import Callable, List, Optional, Tuple
from datetime import date
import webbrowser

from qtpy import QtCore, QtGui
from qtpy.QtCore import QEvent, Qt
Expand All @@ -66,7 +67,14 @@
from sleap.gui.dialogs.formbuilder import FormBuilderModalDialog
from sleap.gui.dialogs.metrics import MetricsTableDialog
from sleap.gui.dialogs.shortcuts import ShortcutDialog
from sleap.gui.dialogs.bulletin import BulletinWorker

# Open bulletin online if there is an ImportError (for MacOS)
online_bulletin = False
try:
from sleap.gui.dialogs.bulletin import BulletinWorker
except ImportError:
online_bulletin = True

from sleap.gui.overlays.instance import InstanceOverlay
from sleap.gui.overlays.tracks import TrackListOverlay, TrackTrailOverlay
from sleap.gui.shortcuts import Shortcuts
Expand Down Expand Up @@ -206,14 +214,18 @@ def __init__(

def bulletin_dialog(self):
"""Displays bulletin dialog is new announcement is available."""
# Initialize the bulletin popup worker
popup_worker = BulletinWorker(
"".join(["# What's New? \n", self.state["announcement"]]), self
)
popup_worker.show_bulletin()
# TODO: Change the URL to the actual SLEAP website before merging to main
if online_bulletin:
webbrowser.open('https://sleap.ai/develop/bulletin.html')
else:
# Initialize the bulletin popup worker
popup_worker = BulletinWorker(
"".join(["# What's New? \n", self.state["announcement"]]), self
)
popup_worker.show_bulletin()

# Save the bulletin worker so we can close them later
self._child_windows["bulletin_worker"] = popup_worker # Needed!
# Save the bulletin worker so we can close them later
self._child_windows["bulletin_worker"] = popup_worker # Needed!

def setWindowTitle(self, value):
"""Sets window title (if value is not None)."""
Expand Down
7 changes: 0 additions & 7 deletions tests/gui/learning/test_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@

import cattr
import pytest
import sys
from qtpy import QtWidgets

# Skip the test for MacOS due to QWebEngineView ImportError
# TODO: Need to resolve the ImportError
if sys.platform == "darwin":
pytestmark = pytest.mark.skip(reason="ImportError for MacOS")
pytest.skip(reason="Skipping tests and import on macOS", allow_module_level=True)

from sleap.gui.learning.dialog import LearningDialog, TrainingEditorWidget
from sleap.gui.learning.configs import (
TrainingConfigFilesWidget,
Expand Down

0 comments on commit 6ddb158

Please sign in to comment.