Skip to content

Commit

Permalink
#3 #13 in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimotz committed Jun 6, 2019
1 parent e8c7e06 commit 86b2fa8
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions addon/globalPlugins/focusHighlight.py
@@ -1,6 +1,7 @@
# -*- coding: UTF-8 -*-
# focus highlight
# 2019-05-12
# Takuya Nishimoto
#Copyright (C) 2013-2019 Takuya Nishimoto
# Released under GPL 2

import os
import sys
Expand All @@ -12,6 +13,7 @@
from ctypes.wintypes import BOOL, COLORREF
from io import BytesIO

import addonHandler
import api
import config
import controlTypes
Expand All @@ -28,6 +30,20 @@
from logHandler import log
from NVDAObjects import NVDAObject

try:
addonHandler.initTranslation()
except:
_ = lambda x : x
try:
ADDON_SUMMARY = addonHandler.getCodeAddon().manifest["summary"]
ADDON_PANEL_TITLE = str(ADDON_SUMMARY) if sys.version_info.major >= 3 else unicode(ADDON_SUMMARY)
except:
ADDON_PANEL_TITLE = ADDON_SUMMARY = 'focusHighlight'
try:
from gui import SettingsPanel, NVDASettingsDialog, guiHelper
except:
SettingsPanel = NVDASettingsDialog = guiHelper = None

NULL = 0
SW_HIDE = 0
SW_SHOWNA = 8
Expand Down Expand Up @@ -535,6 +551,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):

def __init__(self):
super(globalPluginHandler.GlobalPlugin, self).__init__()
if NVDASettingsDialog:
NVDASettingsDialog.categoryClasses.append(AddonSettingsPanel)
self.gdipToken = c_ulong()
startupInput = GdiplusStartupInput()
startupInput.GdiplusVersion = 1
Expand Down Expand Up @@ -621,8 +639,30 @@ def event_valueChange(self, obj, nextHandler):


def terminate(self):
if NVDASettingsDialog:
NVDASettingsDialog.categoryClasses.remove(AddonSettingsPanel)
global terminating
terminating = True
destroyHighlightWin()
gdiplus.GdiplusShutdown(self.gdipToken)
#log.debug("focusHighlight terminated")


if NVDASettingsDialog:

class AddonSettingsPanel(SettingsPanel):

title = ADDON_PANEL_TITLE

def makeSettings(self, settingsSizer):
sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
# Translators: label of a checkbox.
self.passThroughDefaultModeCheckbox = sHelper.addItem(wx.CheckBox(self, wx.ID_ANY, label=_("passThroughDefaultMode")))
self.passThroughDefaultModeCheckbox.SetValue(bool(config.conf['focusHighlight']['passthrough']['defaultMode']))

def postInit(self):
self.passThroughDefaultModeCheckbox.SetFocus()

def onSave(self):
config.conf['focusHighlight']['passthrough']['defaultMode'] = self.passThroughDefaultModeCheckbox.GetValue()

0 comments on commit 86b2fa8

Please sign in to comment.