Skip to content

Commit

Permalink
Added copyright header to an appModule
Browse files Browse the repository at this point in the history
Remove globalPlugin and migrate settings panel to an appModule
Corrected event_UIANotification method signature
Changed minimum tested version to 2019.3
  • Loading branch information
beqabeqa473 committed Jan 3, 2022
1 parent 890cd63 commit 4d9b160
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 47 deletions.
47 changes: 46 additions & 1 deletion appModules/msedge/__init__.py
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()
44 changes: 0 additions & 44 deletions globalPlugins/msedge/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions manifest.ini
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

0 comments on commit 4d9b160

Please sign in to comment.