-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added copyright header to an appModule
Remove globalPlugin and migrate settings panel to an appModule Corrected event_UIANotification method signature Changed minimum tested version to 2019.3
- Loading branch information
1 parent
890cd63
commit 4d9b160
Showing
3 changed files
with
48 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,61 @@ | ||
# MSEdgeDiscardAnnouncements: An appModule to discard some of notifications generated by Microsoft Edge | ||
# Copyright (C) 2022 Beqa Gozalishvili | ||
# Released under GPL 2 | ||
|
||
import appModuleHandler | ||
from collections import namedtuple | ||
import config | ||
import gui | ||
import wx | ||
|
||
Settings = namedtuple("Settings", "configKey, label, defaultValue") | ||
settingItems = [ | ||
Settings("PageLoading", _("Announce loading of pages"), "boolean(default=false)"), | ||
Settings("RefreshingPage", _("Announce page refresh"), "boolean(default=false)"), | ||
Settings("ClosingTab", _("Announce closing of tab"), "boolean(default=false)"), | ||
Settings("OpeningNewTab", _("Announce Opening of new tab"), "boolean(default=false)"), | ||
Settings("OpeningWindow", _("Announce window opening"), "boolean(default=false)") | ||
] | ||
|
||
config.conf.spec["MSEdgeDiscardAnnouncements"] = {setting.configKey: setting.defaultValue for setting in settingItems} | ||
|
||
class AppModule(appModuleHandler.AppModule): | ||
activityIDs = [] | ||
|
||
def __init__(self, processID, appName): | ||
super(AppModule, self).__init__(processID, appName) | ||
categoryClasses = gui.settingsDialogs.NVDASettingsDialog.categoryClasses | ||
if not (MSEdgeDiscardAnnouncementsPanel in categoryClasses): | ||
categoryClasses.append(MSEdgeDiscardAnnouncementsPanel) | ||
|
||
|
||
def terminate(self): | ||
super(AppModule, self).terminate() | ||
gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove(MSEdgeDiscardAnnouncementsPanel) | ||
|
||
def getActivityIDsFromConfig(self): | ||
edgeConf = config.conf["MSEdgeDiscardAnnouncements"] | ||
self.activityIDs = [k for k, v in edgeConf.items() if type(v) == bool and v == False] | ||
|
||
def event_appModule_gainFocus(self): | ||
self.getActivityIDsFromConfig() | ||
|
||
def event_UIA_notification(self, obj, nextHandler, activityId, **kwargs): | ||
def event_UIA_notification(self, obj, nextHandler, activityId=None, **kwargs): | ||
if activityId in self.activityIDs: return | ||
nextHandler() | ||
|
||
class MSEdgeDiscardAnnouncementsPanel(gui.settingsDialogs.SettingsPanel): | ||
title = "Microsoft Edge discard announcements" | ||
|
||
def makeSettings(self, sizer): | ||
self.config = config.conf["MSEdgeDiscardAnnouncements"] | ||
self.helper = gui.guiHelper.BoxSizerHelper(self, sizer=sizer) | ||
for setting in settingItems: | ||
widget = self.helper.addItem(wx.CheckBox(self, label=setting.label, name=setting.configKey)) | ||
widget.SetValue(self.config[setting.configKey]) | ||
|
||
def onSave(self): | ||
for child in self.helper.sizer.GetChildren(): | ||
widget = child.GetWindow() | ||
if isinstance(widget, wx.CheckBox): | ||
self.config[widget.Name] = widget.IsChecked() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name = MSEdgeDiscardAnnouncements | ||
summary = Microsoft Edge discard announcements | ||
version = 0.2 | ||
version = 0.3 | ||
author = """Beqa Gozalishvili <[email protected]>""" | ||
description = """Discards UIA announcements in Microsoft Edge such as page loading and refreshing, opening and closing tabs and windows.""" | ||
url = https://gozaltech.org | ||
docFileName = None | ||
minimumNVDAVersion = 2012.3.0 | ||
minimumNVDAVersion = 2019.3.0 | ||
lastTestedNVDAVersion = 2021.3.0 | ||
updateChannel = None |