-
Notifications
You must be signed in to change notification settings - Fork 6
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
Removing convert button #22
Conversation
Thanks. Tested. Comments;
Waiting on @chimosky as a recent contributor to Convert. |
Thanks for reviewing. Updated the POT file 😄 . |
@quozl thanks, tested. |
Should the conversion be on each change to the value (as described in the first comment of the issue), or when enter key is pressed (as done in this pull request)? |
@chimosky please suggest. |
Yes, please be the tie breaker, @chimosky. My opinion is in #16, and @Aniket21mathur's opinion is in the commits. 😁 |
I agree with @quozl as described in #16, It'll be great for the conversion to be automatic each time rather than wait for the enter key to be pressed. It'll be great to also have a |
@chimosky I automated the conversions on every change of values and also placed a placeholder instead of the value "1". Sorry for the delay.Thanks! |
Tested works fine, I'd like to know why you added the statement on line 201 as it has no effect on the code. |
Thanks for reviewing. I added the line to check whether the input is a float number or not, but It is checked in the update_label function also, so there is no need of that line.Thanks, updated the file. 😄 |
Previously the convert button has to be clicked to calculate results. Now on every change of value the "_call" function will be called and results will be calculated. The Convert.pot file is also updated. A placeholder is also placed instead of value "1" and check is introduced for call of the _update_label() function to proceed only for integer values to avoid float convert errors. Fixes #16
Thanks. Tested on Ubuntu 18.04. A traceback happens if I choose two units and press the swap button;
I'm puzzled by the exception handler in |
When the activity is started the value of the text box is a string placeholder and there will also be chances when the text box is empty . Since update_label function is called on every change of value of text box, for above cases this line
will throw an error due to float(), num_value being a string.
The reason for the trace back is that initially "self.label.get_text()" is an empty value, so adding an exception handler in the flip function will fix it. |
The risk of an unspecified or wildcard exception handler is that it hides any other problems. Also they make code harder to read. Could you put the exception handler around the code that may fail, and use the name of the exception? Could you check for the condition that would throw the exception? |
There are 2 types of exceptions faced till now:-
Condition:- Start the activity, click on the flip button without entering any number in the text box. 2)ValueError: could not convert string to float.
This exception is caused in these lines.The first line in the update_label function and the second in the convert function (which is called through the update_label function). |
I agree with @quozl.
The exceptions raised were handled in the various callbacks you cited above. Also change the exception handler in |
@Aniket21mathur ping |
@quozl kindly test. |
Thank you very much @chimosky . I tested it. Looks great. |
Thanks. I tested.
I saw some other problems that were also affecting master, so I put them into a new issue. |
Previously the convert button has to be clicked to calculate results.
Now on pressing enter the activate signal will call the "_call" function
and results will be calculated.
Fixes #16