You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many users download SLEAP once and never look back.
Very rarely will users keep tabs on the new releases of SLEAP and rush to get the latest version.
Feature proposal
We should keep track of the latest SLEAP changelog (and other announcements) on the sleap.ai page.
Then, we can reference the url to this webpage from within the SLEAP codebase to update messages to the user.
New messages can then be displayed without needing to update the version of SLEAP.
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.
This file will be used to display any news (and new release info) the developers wish to convey to the user.
Use extended MyST syntax where needed/useful
Copy over the SLEAP changelog for the latest version from the Github releases page.
The first line should be the heading: # 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"
List the relative path to 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 class Preferences:
2. Create a AnnouncementChecker class to check for and fetch new announcements
The 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:
Check if there has been a new announcement since the last SEEN announcement
Fetch the announcement if there is a new UNSEEN announcement
Update the app's state of when an announcement was last seen.
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:
Create a new file bulletin.py and class BulletinDialog to display the announcement.
Create an instance of this BulletinDialog class while initializing the MainWindow 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 the AppCommand class handles the call using a Command design pattern.
enhancementNew feature or request2023-hackathonPRs created for the 2023 intra-lab SLEAP hackathon (very detailed)
1 participant
Converted from issue
This discussion was converted from issue #1108 on September 11, 2023 23:01.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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
Beta Was this translation helpful? Give feedback.
All reactions