Skip to content

Commit c51f019

Browse files
committed
version 24.1.1
Updated releaze github workflow. Now the changes are taken from the body of first heading 1. * added a donation dialog to support the author. * added spanish locale strings. * updated the locale strings template. * added the changelog, still need the info of the previous versions.
1 parent c158e19 commit c51f019

File tree

11 files changed

+513
-94
lines changed

11 files changed

+513
-94
lines changed

.github/workflows/release-on-tag.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
permissions:
2+
contents: write
3+
name: Upload on new tags
4+
on:
5+
push:
6+
tags:
7+
['*']
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
- run: echo -e "scons\nmarkdown">requirements.txt
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
cache: 'pip'
22+
- name: Install dependencies
23+
run: |
24+
pip install scons markdown
25+
sudo apt update
26+
sudo apt install gettext
27+
28+
- name: Set add-on version from tag
29+
run: |
30+
import re
31+
with open("buildVars.py", 'r+', encoding='utf-8') as f:
32+
text = f.read()
33+
version = "${{ github.ref }}".split("/")[-1]
34+
text = re.sub('"addon_version" *:.*,', '"addon_version" : "%s",' % version, text)
35+
f.seek(0)
36+
f.write(text)
37+
f.truncate()
38+
shell: python
39+
40+
- name: Build add-on
41+
run: scons
42+
- name: load latest changes from changelog
43+
run: awk '/^# / && !flag {flag=1; next} /^# / && flag {exit} flag && NF' changelog.md > newChanges.md
44+
- name: Calculate sha256
45+
run: sha256sum *.nvda-addon >> newChanges.md
46+
- uses: actions/upload-artifact@v3
47+
with:
48+
name: packaged_addon
49+
path: |
50+
./*.nvda-addon
51+
./newChanges.md
52+
53+
upload_release:
54+
runs-on: ubuntu-latest
55+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
56+
needs: ["build"]
57+
steps:
58+
- name: download releases files
59+
uses: actions/download-artifact@v3
60+
- name: Display structure of downloaded files
61+
run: ls -R
62+
63+
- name: Release
64+
uses: softprops/action-gh-release@v1
65+
with:
66+
body_path: packaged_addon/newChanges.md
67+
files: packaged_addon/*.nvda-addon
68+
fail_on_unmatched_files: true
69+
prerelease: ${{ contains(github.ref, '-') }}

.github/workflows/upload-on-tag.yaml

Lines changed: 0 additions & 71 deletions
This file was deleted.

addon/globalPlugins/beepKeyboard/__init__.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
#globalPlugins/beepKeyboard.py
77

88
import api, codecs, config, globalPluginHandler, gui, keyboardHandler, tones, ui, winreg, winUser, wx, addonHandler
9-
9+
from .beepKeyboardUtils import configSpec, registerConfig, showDonationsDialog
1010
addonHandler.initTranslation()
1111

1212

13-
from ._configHelper import configSpec, registerConfig
1413
@configSpec('beepKeyboard')
1514
class AppConfig:
1615
beepUpperWithCapsLock = 'boolean(default=True)'
@@ -54,7 +53,24 @@ def _reportToggleKey(self):
5453
if ignoreToggleKeys or AF.announceToggleStatus or (AF.disableBeepingOnPasswordFields and api.getFocusObject().isProtected):
5554
origReportToggleKey(self)
5655

57-
class BeepKeyboardSettingsPanel(gui.SettingsPanel):
56+
57+
DONATE_METHODS = (
58+
{
59+
'label': _('Using Paypal'),
60+
'url': 'https://paypal.me/davicm'
61+
},
62+
{
63+
'label': _('using Co-fi'),
64+
'url': 'https://ko-fi.com/davidacm'
65+
},
66+
{
67+
'label': _('See more methods on my github Page'),
68+
'url': 'https://davidacm.github.io/donations/'
69+
}
70+
)
71+
72+
73+
class BeepKeyboardSettingsPanel(gui.settingsDialogs.SettingsPanel):
5874
# Translators: This is the label for the beepKeyboard settings category in NVDA Settings screen.
5975
title = _("Beep keyboard")
6076

@@ -79,6 +95,8 @@ def makeSettings(self, settingsSizer):
7995
# Translators: label for a button to open advanced settings dialog in the settings panel.
8096
advancedButton = sHelper.addItem (wx.Button (self, label = _("&Open advanced options")))
8197
advancedButton.Bind(wx.EVT_BUTTON, self.onAdvanced)
98+
donateButton = sHelper.addItem(wx.Button(self, label=_("&Support beep keyboard add-on")))
99+
donateButton.Bind(wx.EVT_BUTTON, lambda e: showDonationsDialog(self, "Beep Keyboard", DONATE_METHODS))
82100

83101
def onAdvanced(self, evt):
84102
advanced = AdvancedBeepKeyboardSettingsDialog(self, multiInstanceAllowed=True)

addon/globalPlugins/beepKeyboard/_configHelper.py renamed to addon/globalPlugins/beepKeyboard/beepKeyboardUtils.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
# NVDA configHelper.
2-
# Copyright (C) 2022 David CM
1+
# -*- coding: UTF-8 -*-
2+
#globalPlugins/beepKeyboard/_beepKeyboardUtils.py
3+
# Copyright (C) 2022 - 2024 David CM
4+
5+
import os, gui, wx, config, addonHandler
6+
7+
addonHandler.initTranslation()
38

4-
import config
59

610
def getConfigValue(path, optName):
711
""" this function helps to accessing config values.
@@ -118,4 +122,32 @@ class ConfigSpec(BaseConfig):
118122
if isinstance(pathOrCls, str):
119123
return configDecorator
120124
else:
121-
return configDecorator(pathOrCls)
125+
return configDecorator(pathOrCls)
126+
127+
128+
class DonationDialog(gui.nvdaControls.MessageDialog):
129+
def __init__(self, parent, title, message, donateOptions):
130+
self.donateOptions = donateOptions
131+
super().__init__(parent, title, message, dialogType=gui.nvdaControls.MessageDialog.DIALOG_TYPE_WARNING)
132+
133+
def _addButtons(self, buttonHelper):
134+
for k in self.donateOptions:
135+
btn = buttonHelper.addButton(self, label=k['label'], name=k['url'])
136+
btn.Bind(wx.EVT_BUTTON, self.onDonate)
137+
cancelBtn = buttonHelper.addButton(self, id=wx.ID_CANCEL, label=_("&Not now"))
138+
cancelBtn.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.CANCEL))
139+
140+
def onDonate(self, evt):
141+
donateBtn = evt.GetEventObject()
142+
donateUrl = donateBtn.Name
143+
os.startfile(donateUrl)
144+
self.EndModal(wx.OK)
145+
146+
147+
def showDonationsDialog(parentWindow, addonName, donateOptions):
148+
title = _("Request for contributions to %s") % addonName
149+
message = _("""Creating add-ons demands substantial time and effort. With limited job prospects in my country, your donations could significantly aid in dedicating more time to developing free plugins for the community.
150+
Your contribution would support the development of this and other free projects.
151+
Would you like to contribute to this cause? Select from our available payment methods below. You will be redirected to the corresponding website to complete your donation.
152+
Thank you for your support and generosity.""")
153+
return DonationDialog(parentWindow, title, message, donateOptions).ShowModal()

addon/installTasks.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding: UTF-8 -*-
2+
# Copyright (C) 2024 David CM, released under the GPL.
3+
# Author: David CM <[email protected]>.
4+
5+
import sys, os, wx, gui, addonHandler
6+
7+
addonDir = os.path.abspath(os.path.join(os.path.dirname(__file__), "globalPlugins", "beepKeyboard"))
8+
sys.path.append(addonDir)
9+
from beepKeyboardUtils import showDonationsDialog
10+
sys.path.remove(sys.path[-1])
11+
12+
addonHandler.initTranslation()
13+
14+
15+
DONATE_METHODS = (
16+
{
17+
'label': _('Using Paypal'),
18+
'url': 'https://paypal.me/davicm'
19+
},
20+
{
21+
'label': _('using Co-fi'),
22+
'url': 'https://ko-fi.com/davidacm'
23+
},
24+
{
25+
'label': _('See more methods on my github Page'),
26+
'url': 'https://davidacm.github.io/donations/'
27+
}
28+
)
29+
30+
31+
def onInstall():
32+
gui.mainFrame.prePopup()
33+
wx.CallAfter(showDonationsDialog, gui.mainFrame, "Beep Keyboard", DONATE_METHODS)
34+
gui.mainFrame.postPopup()

0 commit comments

Comments
 (0)