Instant recording (with custom duration) f...
Dimitrij 19 Aug 2023
>>> a = ' 5 5 ' >>> a.strip() '5 5' >>> int(a.strip()) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: '5 5'
>>> a = ' 5 5 ' >>> int(a.replace(" ", "")) 55 >>>
Edited by Dimitrij, 19 August 2023 - 16:36.
WanWizard 19 Aug 2023
Yes, I understand the difference.
My question is how on earth is this valid input? And who inputs this, you have to bend over backwards go get a space in there, let alone three...
ims 19 Aug 2023
As I saw, for Input box has definition of default text and length in one. In this case used text="5 " means 5 minuts as default number and length 3 chars. And user, unfortunately, can in this input box with < and > move cursor and then set f.eg. "5 1"... due it using useableChars is for nothing.
And then .replace(" ", "") is simplest way of fixing it (may be used "".join(text.split() too, but why ...)
littlesat 19 Aug 2023
Instill do not understand why we get space 5 space 5 and then we need to make it 55? What is this about? Can’t it be resolved at the input by not allowing unusable characters instead of work-a-round it afterwards… somehow they are already replaced by spaces?
Edited by littlesat, 19 August 2023 - 18:19.
ims 19 Aug 2023
read once again my first line ...
text="5 " => input length is 3, default text is "5 ". User then can use ">" (keys for edit, it cannot be disabled) and type 1 => "5 1"
Edited by ims, 19 August 2023 - 18:23.
littlesat 19 Aug 2023
I did indeed… with strip you remove already the extra spaces. But when the field should be a number than arrange that is could only be a number… and arrange that at the input you cannot get spaces at all… solve the cause instead of hiding the symptom.
Edited by littlesat, 19 August 2023 - 18:24.
ims 19 Aug 2023
then must be rebuilded whole input box in E2 ... user cannot add spaces, he can type numbers only, but spaces are there as definition field length and user can move cursor to end and type number.
btw - strip(char) removing char on start or on end ...
Edited by ims, 19 August 2023 - 18:29.
littlesat 19 Aug 2023
Edited by littlesat, 19 August 2023 - 19:42.
ims 19 Aug 2023
The InputBox is an old text field. You can specify which characters are accepted during input, but once you delete something, spaces are inserted there anyway. Even entering something like text="005" doesn't help. Try it.
ims 19 Aug 2023
it could be fixed in InputBox:
def go(self): + if self.useableChars and " " not in self.useableChars: + self.close(self["input"].getText().replace(" ","")) + else: self.close(self["input"].getText())
and in InstantRecording in call InputBox add
useableChars='0123456789'
littlesat 20 Aug 2023
Again work a round… unless it might work. The issue is that you reserved 3 characters for the input… so it starts with “ “. Why? You want to enter a number…. It should not have length of string… maybe only when we want a max number…
as far I know in config stuff we have number options… use that instead?
Edited by littlesat, 20 August 2023 - 07:57.
ims 20 Aug 2023
Once you set a fixed length (maxSize=True), the field length is determined by the length of the string 'text,' and it cannot be changed.
So, without spaces (text="5"), only a single-digit number will be accepted. Because that's how the InputBox works.
We can call InputBox with: text="5", maxSize=False. Then it will be without spaces, but then is not limited length of typed number. Does the size of the number need to be limited?
PR is created on github.
Edited by ims, 20 August 2023 - 09:04.
Stan 20 Aug 2023
Werbezapper uses this inputbox too. It has maxSize=False and crashes with long inputs.
Is there really no suited input mask that can be used instead?
littlesat 20 Aug 2023
Edited by littlesat, 20 August 2023 - 13:02.
ims 20 Aug 2023
If you want rebuild string inputBox, you have the option... InputBox.py, respective Input.py
Btw - I dont know, who merged my PR, but it seems, it is merged...
littlesat 23 Aug 2023
I just tried to verify the issue with the 5 space 5... but I tried with instant recording but I was not able to get it. How did you arrange to get 5 space 5... I can't.