Topics

Entry multiline text

Rui Fontes
 

Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


    def _addBlock(self):
        # Translators: Message dialog box to add a new block of text.
        dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
        dlg.SetValue("")
        if dlg.ShowModal() == wx.ID_OK:
            nBlock = dlg.GetValue()
        else:
            dlg.Destroy()
            return
        if nBlock != "":
            global name
            global newBlock
            newBlock.append(nBlock)
            if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                self._addBlock()
                return
        else:
            dlg.Destroy()
            return

Best regards,

Rui Fontes

NVDA portuguese team

James Scholes
 

The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text string
from the user.

So there is no way to prompt users for multiple lines using this helper. But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!
I have the following function to collect a multiline block of text.
It is possible to replace it by a function that collects the all block at once?
    def _addBlock(self):
        # Translators: Message dialog box to add a new block of text.
        dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
        dlg.SetValue("")
        if dlg.ShowModal() == wx.ID_OK:
            nBlock = dlg.GetValue()
        else:
            dlg.Destroy()
            return
        if nBlock != "":
            global name
            global newBlock
            newBlock.append(nBlock)
            if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                self._addBlock()
                return
        else:
            dlg.Destroy()
            return
Best regards,
Rui Fontes
NVDA portuguese team

Rui Fontes
 

Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:

The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text string
from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team




James Scholes
 

Good find. The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,
I read that, and I was asking which alternative I should use...
And, by the way, it seems that is possible to use multiline with it...
Read on:
https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm
specially this part:
wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.
But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...
Best regards,
Rui Fontes
NVDA portuguese team
Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text string
from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team





Rui Fontes
 

Thanks! It worked, but creates an error...

Traceback (most recent call last):
    config.write()
  File "configobj\__init__.pyc", line 2037, in write
  File "configobj\__init__.pyc", line 2043, in write
  File "configobj\__init__.pyc", line 1948, in _write_line
  File "configobj\__init__.pyc", line 1758, in _quote
  File "configobj\__init__.pyc", line 1784, in _quote
  File "<string>", line None
configobj.ConfigObjError: Value cannot be safely quoted: 'Isto é apenas um teste\n\nVamos ver como resulta.\n'

The error can be caused by the parameter list_values=True, on thefollowing line?

        config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")



Best regards,

Rui Fontes

NVDA portuguese team


Às 16:11 de 26/03/2020, James Scholes escreveu:

Good find.  The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text
string from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team






Rui Fontes
 

Nop, I removed the list_values=True,  and received the same error...


Rui Fontes


Às 16:47 de 26/03/2020, Rui Fontes via Groups.Io escreveu:

Thanks! It worked, but creates an error...

Traceback (most recent call last):
    config.write()
  File "configobj\__init__.pyc", line 2037, in write
  File "configobj\__init__.pyc", line 2043, in write
  File "configobj\__init__.pyc", line 1948, in _write_line
  File "configobj\__init__.pyc", line 1758, in _quote
  File "configobj\__init__.pyc", line 1784, in _quote
  File "<string>", line None
configobj.ConfigObjError: Value cannot be safely quoted: 'Isto é apenas um teste\n\nVamos ver como resulta.\n'

The error can be caused by the parameter list_values=True, on thefollowing line?

        config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")



Best regards,

Rui Fontes

NVDA portuguese team


Às 16:11 de 26/03/2020, James Scholes escreveu:
Good find.  The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text
string from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team







James Scholes
 

I have no idea. Suggest looking at the configobj docs, and trying test cases in the Python console because it's probably not linked with the dialog.

Regards,

James Scholes

On 26/03/2020 at 10:50 am, Rui Fontes wrote:
Nop, I removed the list_values=True,  and received the same error...
Rui Fontes
Às 16:47 de 26/03/2020, Rui Fontes via Groups.Io escreveu:
Thanks! It worked, but creates an error...

Traceback (most recent call last):
    config.write()
  File "configobj\__init__.pyc", line 2037, in write
  File "configobj\__init__.pyc", line 2043, in write
  File "configobj\__init__.pyc", line 1948, in _write_line
  File "configobj\__init__.pyc", line 1758, in _quote
  File "configobj\__init__.pyc", line 1784, in _quote
  File "<string>", line None
configobj.ConfigObjError: Value cannot be safely quoted: 'Isto é apenas um teste\n\nVamos ver como resulta.\n'

The error can be caused by the parameter list_values=True, on thefollowing line?

        config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")



Best regards,

Rui Fontes

NVDA portuguese team


Às 16:11 de 26/03/2020, James Scholes escreveu:
Good find.  The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text
string from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team








Rui Fontes
 

Hi James!


Solved!


As I want to collect a list, only needed to split the string using "\n" as argument...


It is already working as expected...


Best regards,

Rui Fontes

NVDA portuguese team



Às 16:57 de 26/03/2020, James Scholes escreveu:

I have no idea.  Suggest looking at the configobj docs, and trying test cases in the Python console because it's probably not linked with the dialog.

Regards,

James Scholes

On 26/03/2020 at 10:50 am, Rui Fontes wrote:
Nop, I removed the list_values=True,  and received the same error...


Rui Fontes


Às 16:47 de 26/03/2020, Rui Fontes via Groups.Io escreveu:
Thanks! It worked, but creates an error...

Traceback (most recent call last):
    config.write()
  File "configobj\__init__.pyc", line 2037, in write
  File "configobj\__init__.pyc", line 2043, in write
  File "configobj\__init__.pyc", line 1948, in _write_line
  File "configobj\__init__.pyc", line 1758, in _quote
  File "configobj\__init__.pyc", line 1784, in _quote
  File "<string>", line None
configobj.ConfigObjError: Value cannot be safely quoted: 'Isto é apenas um teste\n\nVamos ver como resulta.\n'

The error can be caused by the parameter list_values=True, on thefollowing line?

        config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")



Best regards,

Rui Fontes

NVDA portuguese team


Às 16:11 de 26/03/2020, James Scholes escreveu:
Good find.  The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text
string from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team









James Scholes
 

Not sure how wx handles this, but you may want to strip/trim each line. If someone pastes text into your dialog from Notepad or wherever, it may have \r\n line breaks, meaning a trailing \r when you split by \n.

Regards,

James Scholes

On 26/03/2020 at 5:06 pm, Rui Fontes wrote:
Hi James!
Solved!
As I want to collect a list, only needed to split the string using "\n" as argument...
It is already working as expected...
Best regards,
Rui Fontes
NVDA portuguese team
Às 16:57 de 26/03/2020, James Scholes escreveu:
I have no idea.  Suggest looking at the configobj docs, and trying test cases in the Python console because it's probably not linked with the dialog.

Regards,

James Scholes

On 26/03/2020 at 10:50 am, Rui Fontes wrote:
Nop, I removed the list_values=True,  and received the same error...


Rui Fontes


Às 16:47 de 26/03/2020, Rui Fontes via Groups.Io escreveu:
Thanks! It worked, but creates an error...

Traceback (most recent call last):
    config.write()
  File "configobj\__init__.pyc", line 2037, in write
  File "configobj\__init__.pyc", line 2043, in write
  File "configobj\__init__.pyc", line 1948, in _write_line
  File "configobj\__init__.pyc", line 1758, in _quote
  File "configobj\__init__.pyc", line 1784, in _quote
  File "<string>", line None
configobj.ConfigObjError: Value cannot be safely quoted: 'Isto é apenas um teste\n\nVamos ver como resulta.\n'

The error can be caused by the parameter list_values=True, on thefollowing line?

        config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")



Best regards,

Rui Fontes

NVDA portuguese team


Às 16:11 de 26/03/2020, James Scholes escreveu:
Good find.  The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text
string from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team










Rui Fontes
 

Nop, not necessary...

I have tried copying text from NotePad, Edge, Word and Adobe Digital Editions and all went well!


Thanks by the help and best regards,


Rui Fontes

NVDA portuguese team


Às 00:57 de 27/03/2020, James Scholes escreveu:

Not sure how wx handles this, but you may want to strip/trim each line. If someone pastes text into your dialog from Notepad or wherever, it may have \r\n line breaks, meaning a trailing \r when you split by \n.

Regards,

James Scholes

On 26/03/2020 at 5:06 pm, Rui Fontes wrote:
Hi James!


Solved!


As I want to collect a list, only needed to split the string using "\n" as argument...


It is already working as expected...


Best regards,

Rui Fontes

NVDA portuguese team



Às 16:57 de 26/03/2020, James Scholes escreveu:
I have no idea.  Suggest looking at the configobj docs, and trying test cases in the Python console because it's probably not linked with the dialog.

Regards,

James Scholes

On 26/03/2020 at 10:50 am, Rui Fontes wrote:
Nop, I removed the list_values=True, and received the same error...


Rui Fontes


Às 16:47 de 26/03/2020, Rui Fontes via Groups.Io escreveu:
Thanks! It worked, but creates an error...

Traceback (most recent call last):
    config.write()
  File "configobj\__init__.pyc", line 2037, in write
  File "configobj\__init__.pyc", line 2043, in write
  File "configobj\__init__.pyc", line 1948, in _write_line
  File "configobj\__init__.pyc", line 1758, in _quote
  File "configobj\__init__.pyc", line 1784, in _quote
  File "<string>", line None
configobj.ConfigObjError: Value cannot be safely quoted: 'Isto é apenas um teste\n\nVamos ver como resulta.\n'

The error can be caused by the parameter list_values=True, on thefollowing line?

        config = ConfigObj(_ffIniFile, list_values=True, encoding = "utf-8")



Best regards,

Rui Fontes

NVDA portuguese team


Às 16:11 de 26/03/2020, James Scholes escreveu:
Good find.  The buttons disappear, because by using style=wx.TE_MULTILINE you are removing the default styling. You'll need to use style=wx.wx.OK|wx.CANCEL|wx.TE_MULTILINE.

Regards,

James Scholes

On 26/03/2020 at 10:04 am, Rui Fontes wrote:
Hello James,


I read that, and I was asking which alternative I should use...

And, by the way, it seems that is possible to use multiline with it...

Read on:

https://www.tutorialspoint.com/wxpython/wx_dialog_class.htm

specially this part:

wx.TextEntryDialog
Object of this class displays a dialog with one text field, a customizable label prompting the user to input and two buttons with predefined styles.
Although this dialog requests a one line input, the text box can be customized by using TextCtrl styles like password and multiline.
Contents of the text field are collected as return value when the user clicks OK button.


But if I include the parameter style=wx.TE_MULTILINE, the text field becomes multiline but the buttons disappear...


Best regards,

Rui Fontes

NVDA portuguese team


Às 15:09 de 26/03/2020, James Scholes escreveu:
The first line of the documentation for wx.TextEntryDialog states:

This class represents a dialog that requests a one-line text
string from the user.

So there is no way to prompt users for multiple lines using this helper.  But just replace it with a modal that has a label, a multi-line wx.TextCtrl and OK/Cancel buttons.

Regards,

James Scholes

On 26/03/2020 at 8:45 am, Rui Fontes wrote:
Hello!


I have the following function to collect a multiline block of text.

It is possible to replace it by a function that collects the all block at once?


     def _addBlock(self):
         # Translators: Message dialog box to add a new block of text.
         dlg = wx.TextEntryDialog(gui.mainFrame, _("Enter the block of text"), self.title)
         dlg.SetValue("")
         if dlg.ShowModal() == wx.ID_OK:
             nBlock = dlg.GetValue()
         else:
             dlg.Destroy()
             return
         if nBlock != "":
             global name
             global newBlock
             newBlock.append(nBlock)
             if gui.messageBox(_("Do you want to add a new line?"), self.title, style=wx.ICON_QUESTION|wx.YES_NO) == wx.YES:
                 self._addBlock()
                 return
         else:
             dlg.Destroy()
             return

Best regards,

Rui Fontes

NVDA portuguese team