Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NVDA2025以降のメッセージダイアログ変更に対応 #11

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions addon/globalPlugins/dokutor_for_nvda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .constants import *
from . import updater
from . import converter
from .compat import messageBox


try:
Expand Down Expand Up @@ -116,14 +117,14 @@ def toggleEnableOnStartup(self, evt):
self.setEnableOnStartupSetting(changed)
msg = _("NVDA起動時に、自動で理療科用読み辞書を適用します。") if changed is True else _("NVDA起動時は、通常の読み辞書を利用します。")
self.enableOnStartupToggleItem.SetItemLabel(self.enableOnStartupToggleString())
wx.MessageBox(msg, _("設定変更完了"))
messageBox(msg, _("設定変更完了"))

def toggleUpdateCheck(self, evt):
changed = not self.getUpdateCheckSetting()
self.setUpdateCheckSetting(changed)
msg = _("NVDA起動時に、自動でDFNのアップデートを確認します。") if changed is True else _("NVDA起動時に、DFNのアップデートを確認しません。")
self.updateCheckToggleItem.SetItemLabel(self.updateCheckToggleString())
wx.MessageBox(msg, _("設定変更完了"))
messageBox(msg, _("設定変更完了"))

def performUpdateCheck(self, evt):
updater.AutoUpdateChecker().autoUpdateCheck(mode=updater.MANUAL)
Expand Down
21 changes: 21 additions & 0 deletions addon/globalPlugins/dokutor_for_nvda/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import wx
import gui
import versionInfo

def isCompatibleWith2025():
return versionInfo.version_year >= 2025

def messageBox(message, title):
if isCompatibleWith2025():
gui.message.MessageDialog.alert(message, title)
else:
gui.messageBox(message, title, style=wx.CENTER)


def yesno(message, title):
if isCompatibleWith2025():
dlg = gui.message.MessageDialog(None, message, title, buttons=gui.message.DefaultButtonSet.YES_NO)
return dlg.ShowModal() == gui.message.ReturnCode.YES
else:
return gui.messageBox(message, title, style=wx.CENTER | wx.YES | wx.NO | wx.ICON_INFORMATION) == wx.YES

Loading