Issue 2930

Title
Float and integer fields should support some operators
Priority
feature
Status
chatting
Nosy list
albertca, ced, pokoli
Assigned to
albertca
Keywords

Created on 2012-12-16.12:55:03 by albertca, last changed 1 month ago by ced.

Files

File name Uploaded Type Details
unnamed albertca, 2012-12-16.14:30:19 text/plain view

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-01-20.10:13:34

With this thread I started to think about a good design. I think this could work. On pressing a key (for example =) on a numeric input, we popup an popover (in GTK and equivalent in HTML) with a text input focuses. This input can be edited with a formula. The numeric input is updated on the fly with the result of the formula as it is edited (empty when it is not valid). The popup should take care that the numeric input is still visible. The user can accept the result by pressing Return or refuse with Esc (and the initial value of the numeric input is restored).
Optionally the input could remember the last formula so it can be re-edited.

The only drawback I see is that in HTML, the formula input could not display a virtual numeric keyboard because it needs to be a "text" input.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2016-09-24.09:25:32
I do not think it should be invalidate.
There are probably a design that could remove the drawbacks.
For example, there could be a button which pops up a kind of calculator.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2016-09-23.19:23:10
I'm marking the issue as invalid as there are a lot of drawbacks as explained on msg12201

Also this can be implemented as tryton plugin.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2012-12-16.14:59:43
On 16/12/12 14:30 +0100, Albert Cervera i Areny wrote:
> > > This
> > > would allow the user to write "3.4*2" in the widget and when Tab or Enter
> > > were pressed, he would get the result in the same widget "6.80".
> > 
> > I doubt about such functionnality because it makes the widget more
> > complicated, it doesn't get the right feedback to the user in case of
> > wrong result (ex: too much decimal, NaN etc.).
> > Maybe a calculator popup? But almost all OS has one.
> 
> The idea is to make it much quicker than using OS or a calculator popup. 
> Decimals are rounded automatically so I think the user notices this once he 
> gets out of the widget, the same for NaN because he'd get an empty field.
> 
> That said, maybe a popup could be shown (a blocking or non-blocking one) with 
> those errors. What do you think?

I think what you try to achieve has a lot of design/usability issues.

- if the result of computation can not be set on the field, the user
  must have feedback.

- the current behavior that doesn't allow to type not valid value should
  be keept but once you start to use an expression it is almost
  impossible to keep that.

- if the result is wrong, it should be possible to correct the
  expression used to compute it.

- it should have a clear/visual difference between the mode where you
  type an expression and when it is a number.

- the computation should not be done on focus-out because user would
  want to make some copy/paste.
Author: [hidden] (albertca) Tryton committer
Date: 2012-12-16.14:30:19
A Diumenge, 16 de desembre de 2012 13:50:36, Cédric Krier va escriure:
> Cédric Krier <cedric.krier@b2ck.com> added the comment:
> 
> On 16/12/12 12:55 +0100, Albert Cervera i Areny wrote:
> > Both integer and float widgets could support simple operations such as +,
> > -, *, /, **. Similar functionality is already supported by float_time
> > widget.
> 
> There is no such functionnality in float_time widget.

My mistake, then. But I tried "4h+2h" and it resulted in "6h" so I thought 
there was a calculator there :)

> > This
> > would allow the user to write "3.4*2" in the widget and when Tab or Enter
> > were pressed, he would get the result in the same widget "6.80".
> 
> I doubt about such functionnality because it makes the widget more
> complicated, it doesn't get the right feedback to the user in case of
> wrong result (ex: too much decimal, NaN etc.).
> Maybe a calculator popup? But almost all OS has one.

The idea is to make it much quicker than using OS or a calculator popup. 
Decimals are rounded automatically so I think the user notices this once he 
gets out of the widget, the same for NaN because he'd get an empty field.

That said, maybe a popup could be shown (a blocking or non-blocking one) with 
those errors. What do you think?

> ----------
> nosy: +ced
> 
> _______________________________________________
> Tryton issue tracker <issue_tracker@tryton.org>
> <https://bugs.tryton.org/issue2930>
> _______________________________________________
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2012-12-16.13:50:35
On 16/12/12 12:55 +0100, Albert Cervera i Areny wrote:
> Both integer and float widgets could support simple operations such as +, -, *, 
> /, **. Similar functionality is already supported by float_time widget.

There is no such functionnality in float_time widget.

> This 
> would allow the user to write "3.4*2" in the widget and when Tab or Enter were 
> pressed, he would get the result in the same widget "6.80".

I doubt about such functionnality because it makes the widget more
complicated, it doesn't get the right feedback to the user in case of
wrong result (ex: too much decimal, NaN etc.).
Maybe a calculator popup? But almost all OS has one.
Author: [hidden] (albertca) Tryton committer
Date: 2012-12-16.13:19:31
Author: [hidden] (albertca) Tryton committer
Date: 2012-12-16.12:55:02
Both integer and float widgets could support simple operations such as +, -, *, 
/, **. Similar functionality is already supported by float_time widget. This 
would allow the user to write "3.4*2" in the widget and when Tab or Enter were 
pressed, he would get the result in the same widget "6.80".
History
Date User Action Args
2021-01-20 10:13:34cedsetcomponent: + tryton, sao
messages: + msg63999
priority: wish -> feature
2016-09-24 09:25:33cedsetstatus: invalid -> chatting
messages: + msg28990
2016-09-23 19:23:10pokolisetstatus: in-progress -> invalid
nosy: + pokoli
messages: + msg28984
2012-12-16 14:59:43cedsetmessages: + msg12201
2012-12-16 14:30:20albertcasetfiles: + unnamed
messages: + msg12200
2012-12-16 13:50:36cedsetnosy: + ced
messages: + msg12199
2012-12-16 13:19:31albertcasetmessages: + msg12198
2012-12-16 12:55:03albertcacreate

Showing 10 items. Show all history (warning: this could be VERY long)