Skip to content

Commit

Permalink
21.06.25
Browse files Browse the repository at this point in the history
Correction of regressions in 21.06.23
  • Loading branch information
ruifontes committed Jun 25, 2021
1 parent 9a24d3b commit 6cabe6e
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 80 deletions.
56 changes: 33 additions & 23 deletions addon/GlobalPlugins/frequentText/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def script_startFrequentText(self, gesture):
self.showFrequentTextCatgsDialog(self)

# For translators: Message to be announced during Keyboard Help
script_startFrequentText.__doc__ = _("Opens a dialog box to registe and paste frequent blocks of text.")
script_startFrequentText.__doc__ = _("Opens a dialog box to registe, manage and paste frequent blocks of text.")
# For translators: Name of the section in "Input gestures" dialog.
script_startFrequentText.category = _("Frequent text")

Expand Down Expand Up @@ -194,8 +194,6 @@ def onRename(self, evt):
config.rename(nameCatg, newKeyCatg)
config.write()
self.listCatgs = config.keys()
#self.listCatgs.append(newKeyCatg)
#self.listCatgs.remove(nameCatg)
listCatgs = config.keys()
# update the list view.
self.updateCatgs(listCatgs, index)
Expand Down Expand Up @@ -317,6 +315,11 @@ def __init__(self, parent, title, dictBlocks):
self.removeButton = wx.Button (self, removeButtonID, _("&Remove"))
buttonsSizer.Add (self.removeButton)

goBackButtonID = wx.Window.NewControlId()
# Translators: Label for button to go back to categories list.
self.goBackButton = wx.Button (self, goBackButtonID, _("&Back to categories"))
buttonsSizer.Add (self.goBackButton)

# Translators: Button Label that closes the add-on.
cancelButton = wx.Button(self, wx.ID_CANCEL, _("&Close"))
buttonsSizer.Add(cancelButton)
Expand All @@ -331,6 +334,7 @@ def __init__(self, parent, title, dictBlocks):
self.Bind(wx.EVT_BUTTON, self.onChangeBlocks, id = changeButtonID)
self.Bind(wx.EVT_BUTTON, self.onMove, id = moveButtonID)
self.Bind(wx.EVT_BUTTON, self.onRemove, id = removeButtonID)
self.Bind(wx.EVT_BUTTON, self.goBack, id = goBackButtonID)
self.listBox.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
mainSizer.Fit(self)
self.SetSizer(mainSizer)
Expand Down Expand Up @@ -385,8 +389,6 @@ def _addBlock(self, name):
self.listBox.Focus (newIndex)
self.listBox.Select(newIndex)
self.listBox.SetFocus()
#name = ""
#newBlock = []
return

def onPaste (self, evt):
Expand Down Expand Up @@ -462,29 +464,29 @@ def onChangeBlocks(self, evt):
config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")
blocks = config[Catg]
paste = blocks[name]
oldBlock = ""
for x in range(len(paste)):
oldBlock += ("%s \n")%paste[x]
x = x+1
self.dialogActive = True

changeBlock = []
for x in range(len(paste)):
# Translators: Message dialog box to change a block of text.
dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the new block of text or press Enter to confirm"), self.title)
dlg.SetValue(paste[x])
if dlg.ShowModal() == wx.ID_OK:
nBlock = dlg.GetValue()
else:
dlg.Destroy()
return
# Translators: Message dialog box to change a block of text.
dlg = wx.TextEntryDialog(gui.mainFrame, _("Change the block of text as you want and press Tab to Ok button and Enter to confirm"), self.title, style = wx.OK | wx.CANCEL | wx.TE_MULTILINE)
dlg.SetValue(oldBlock)
if dlg.ShowModal() == wx.ID_OK:
nBlock = dlg.GetValue()
else:
dlg.Destroy()
return

if nBlock != "":
changeBlock.append(nBlock)
elif nBlock == paste[x]:
changeBlock.append(nBlock)
else:
dlg.Destroy()
return
if nBlock != "":
changeBlock = nBlock.split("\n")
else:
dlg.Destroy()
return

# update the dictionary.
blocks.__delitem__(name) #, paste)
blocks.__delitem__(name)
blocks.__setitem__(name, changeBlock)
config.write()

Expand Down Expand Up @@ -546,6 +548,14 @@ def removeItem (self):
self.dialogActive = False
self.listBox.SetFocus()

def goBack(self, evt):
# Returns to categories list dialog
evt.Skip()
config = ConfigObj(_ffIniFile, list_values = True, encoding = "utf-8")
listCatgs = config.keys()
self.Close()
GlobalPlugin.showFrequentTextCatgsDialog(self, listCatgs)

def onKeyPress(self, evt):
# Sets enter key to paste the text and delete to remove it.
evt.Skip()
Expand Down
61 changes: 33 additions & 28 deletions addon/locale/pt_BR/LC_MESSAGES/nvda.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: FrequentText\n"
"Report-Msgid-Bugs-To: '[email protected]'\n"
"POT-Creation-Date: 2021-06-23 01:19+0100\n"
"PO-Revision-Date: 2021-06-23 01:24+0100\n"
"POT-Creation-Date: 2021-06-25 00:47+0100\n"
"PO-Revision-Date: 2021-06-25 01:00+0100\n"
"Last-Translator: Rui Fontes <[email protected]>\n"
"Language-Team: Equipa portuguesa do NVDA\n"
"Language: pt\n"
Expand All @@ -18,7 +18,8 @@ msgstr ""

#. For translators: Message to be announced during Keyboard Help
#: addon\globalPlugins\frequentText\__init__.py:48
msgid "Opens a dialog box to registe and paste frequent blocks of text."
msgid ""
"Opens a dialog box to registe, manage and paste frequent blocks of text."
msgstr ""
"Abre uma janela para registar, gerir e selecionar os blocos a colar no texto."

Expand Down Expand Up @@ -49,25 +50,25 @@ msgstr "&Mostrar Entradas"
#. Translators: Button Label to add a new category
#. Translators: Button Label to add a new block.
#: addon\globalPlugins\frequentText\__init__.py:120
#: addon\globalPlugins\frequentText\__init__.py:292
#: addon\globalPlugins\frequentText\__init__.py:290
msgid "&Add"
msgstr "&Adicionar"

#. Translators: Button Label that renames the name of the selected block.
#: addon\globalPlugins\frequentText\__init__.py:125
#: addon\globalPlugins\frequentText\__init__.py:302
#: addon\globalPlugins\frequentText\__init__.py:300
msgid "Re&name"
msgstr "&Renomear"

#. Translators: Button Label that removes the selected block.
#: addon\globalPlugins\frequentText\__init__.py:130
#: addon\globalPlugins\frequentText\__init__.py:317
#: addon\globalPlugins\frequentText\__init__.py:315
msgid "&Remove"
msgstr "&Eliminar"

#. Translators: Button Label that closes the add-on.
#: addon\globalPlugins\frequentText\__init__.py:134
#: addon\globalPlugins\frequentText\__init__.py:321
#: addon\globalPlugins\frequentText\__init__.py:324
msgid "&Close"
msgstr "&Fechar"

Expand All @@ -78,80 +79,87 @@ msgstr "Introduza um nome para a categoria."

#. Translators: Announcement that the category name already exists in the list.
#: addon\globalPlugins\frequentText\__init__.py:162
#: addon\globalPlugins\frequentText\__init__.py:209
#: addon\globalPlugins\frequentText\__init__.py:207
msgid "There is already a category with this name!"
msgstr "Já existe uma categoria com este nome!"

#. Translators: Message dialog to rename the category
#. Translators: Message dialog to rename the block of text.
#: addon\globalPlugins\frequentText\__init__.py:189
#: addon\globalPlugins\frequentText\__init__.py:437
#: addon\globalPlugins\frequentText\__init__.py:439
#, python-format
msgid "Enter a new name for %s"
msgstr "Introduza um novo nome para %s"

#. Translators: Message dialog box to remove the selected category
#. Translators: Message dialog box to remove the selected block.
#: addon\globalPlugins\frequentText\__init__.py:219
#: addon\globalPlugins\frequentText\__init__.py:538
#: addon\globalPlugins\frequentText\__init__.py:217
#: addon\globalPlugins\frequentText\__init__.py:540
#, python-format
msgid "Are you sure you want to remove %s?"
msgstr "Tem a certeza que quer eliminar %s da lista de blocos?"

#. Translators: Title of the column of the list view.
#: addon\globalPlugins\frequentText\__init__.py:252
#: addon\globalPlugins\frequentText\__init__.py:561
#: addon\globalPlugins\frequentText\__init__.py:250
#: addon\globalPlugins\frequentText\__init__.py:571
msgid "Name"
msgstr "Nome"

#. Create a label and a list view for Frequent Text list.
#. Label is above the list view.
#. Translators: Label the list view that contains the Blocks.
#: addon\globalPlugins\frequentText\__init__.py:279
#: addon\globalPlugins\frequentText\__init__.py:277
#, python-format
msgid "List of text blocks of %s category"
msgstr "Lista de blocos de texto da categoria %s"

#. Translators: Button Label that paste the block to the edit box.
#: addon\globalPlugins\frequentText\__init__.py:297
#: addon\globalPlugins\frequentText\__init__.py:295
msgid "&Paste"
msgstr "&Colar"

#. Translators: Button Label that change the blocks of text.
#: addon\globalPlugins\frequentText\__init__.py:307
#: addon\globalPlugins\frequentText\__init__.py:305
msgid "&Change blocks"
msgstr "Modificar &blocos"

#. Translators: Label for btton to move the selected block to other category.
#: addon\globalPlugins\frequentText\__init__.py:312
#: addon\globalPlugins\frequentText\__init__.py:310
msgid "&Move"
msgstr "&Mover"

#. Translators: Label for button to go back to categories list.
#: addon\globalPlugins\frequentText\__init__.py:320
msgid "&Back to categories"
msgstr "&Voltar a categorias"

#. Translators: Message dialog box to add a name to a new block.
#: addon\globalPlugins\frequentText\__init__.py:342
#: addon\globalPlugins\frequentText\__init__.py:346
msgid "Enter a name for the block"
msgstr "Introduza um nome para o bloco."

#. Translators: Announcement that the block name already exists in the list.
#: addon\globalPlugins\frequentText\__init__.py:351
#: addon\globalPlugins\frequentText\__init__.py:455
#: addon\globalPlugins\frequentText\__init__.py:355
#: addon\globalPlugins\frequentText\__init__.py:457
msgid "There is already a block with this name!"
msgstr "Já existe um bloco com este nome!"

#. Translators: Message dialog box to add a new block of text.
#: addon\globalPlugins\frequentText\__init__.py:361
#: addon\globalPlugins\frequentText\__init__.py:365
msgid "Enter the block of text"
msgstr "Introduza o bloco de texto"

#. Translators: Message dialog box to change a block of text.
#: addon\globalPlugins\frequentText\__init__.py:470
msgid "Enter the new block of text or press Enter to confirm"
#: addon\globalPlugins\frequentText\__init__.py:474
msgid ""
"Change the block of text as you want and press Tab to Ok button and Enter to "
"confirm"
msgstr ""
"Altere o bloco de texto como quiser, pressione Tab para o botão Ok e Enter "
"para confirmar"

#. Translators: Message dialog box to move the selected block to other category.
#: addon\globalPlugins\frequentText\__init__.py:508
#: addon\globalPlugins\frequentText\__init__.py:510
#, python-format
msgid ""
"If you really want to move %s from %s category, enter the name of the new, "
Expand All @@ -161,7 +169,7 @@ msgstr ""
"já existente"

#. Translators: Announcement that the category does not exists.
#: addon\globalPlugins\frequentText\__init__.py:524
#: addon\globalPlugins\frequentText\__init__.py:526
msgid "There is no such category!"
msgstr "Não existe essa categoria!"

Expand All @@ -182,9 +190,6 @@ msgstr ""
"Armazena e torna possível a introdução de blocos de texto frequentemente "
"usados. Comando: Windows+f12."

#~ msgid "&Back to categories"
#~ msgstr "&Voltar a categorias"

#~ msgid "Frequent Text"
#~ msgstr "Texto frequente"

Expand Down
Loading

0 comments on commit 6cabe6e

Please sign in to comment.