Add changelog/announcements to the GUI #1563
Labels
2023-hackathon
PRs created for the 2023 intra-lab SLEAP hackathon (very detailed)
enhancement
New feature or request
Discussed in #1492
Originally posted by roomrys January 5, 2023
Problem background
Feature proposal
Implementation details
For this feature, we will just be retrieving the changelog and displaying this message in SLEAP. Checkout this example repository which shows Proof of Concept.
PR 1 (Skip for Hackathon MVP): Add a changelog/announcements page to sleap.ai
SLEAP uses sphinx to generate documentation (the sleap.ai page) for the codebase. We are currently in the process of converting all our documentation from reStructuredTest to Markdown. SLEAP uses MyST, "a rich and extensible flavour of Markdown", which has some cool features that regular markdown doesn't have.
1. Create a
bulletin.md
file in thedocs
folderThis file will be used to display any news (and new release info) the developers wish to convey to the user.
# Bulletin
(this is used as the link name in the next step)2. Add a new link to the main sleap.ai page called "Bulletin"
bulletin.md
inside index.rst.PR 2: Check for and grab new announcements in SLEAP
1. Add a variable to be stored past the program runtime which remembers when the user has last seen an announcement
Ever wonder how SLEAP remembers user preferences, such as which color scheme to use, even after the user closes (and reopens) the program? SLEAP stores these preferences in a hidden folder called
.sleap
at the User's root directory. Whenever a new version of SLEAP is installed on a user's computer, a new folder is created within the.sleap
directory which stores the user's preferences for that version of SLEAP. If the files preferences file does not exist yet (a fresh install of the latest SLEAP version), then SLEAP will create the preferences based on the defaults set in the singleton classPreferences
:sleap/sleap/prefs.py
Lines 10 to 74 in c4861e3
_defaults
dictionary which will store the date of last seen announcement in the format YYYYMMDD.sleap/sleap/gui/app.py
Lines 148 to 161 in c4861e3
MainWindow
sleap/sleap/gui/app.py
Lines 211 to 220 in c4861e3
2. Create a
AnnouncementChecker
class to check for and fetch new announcementsThe sleap/gui/web.py module contains all web related interactions handled by SLEAP. We will modify this module to check for new announcements.
The
AnnouncementChecker
class should:PR 3: Display changelog/announcement page in SLEAP GUI
After we've fetched the announcement, we now need to display it in the GUI.
1. Create a simple dialog that displays the announcement.
All dialogs/pop-ups are created in the sleap/gui/dialogs folder as their own modules. For example, checkout the
ShortcutDialog
class:sleap/sleap/gui/dialogs/shortcuts.py
Lines 12 to 110 in c4861e3
bulletin.py
and classBulletinDialog
to display the announcement.BulletinDialog
class while initializing theMainWindow
IF there is an UNSEEN announcement.PR 4: Add a Help Menu item which allows users to pop-up the announcement on demand.
Whenever a user calls upon any GUI commands, SLEAP's
CommandContext
in conjunction with theAppCommand
class handles the call using a Command design pattern.sleap/sleap/gui/commands.py
Lines 176 to 574 in c4861e3
sleap/sleap/gui/commands.py
Lines 85 to 165 in c4861e3
1. Create a new class
ShowBulletin(AppCommand)
which displays the bulletin whenShowBulletin.execute()
is run.do_action
method which creates an instance ofBulletinDialog
CommandContext.bulletinDialog()
method which executesBulletinDialog
2. Add a "Show Bulletin" button to the help menu
The help menu is created here:
sleap/sleap/gui/app.py
Lines 889 to 927 in c4861e3
helpMenu
with title"Show Bulletin"
and actionself.commands.showBulletin
The text was updated successfully, but these errors were encountered: