Skip to content

Improve wheel edit handling of formats and digits

Carlos Pascual requested to merge github/fork/cpascual/wheeledit_format into develop

This PR tackles 3 different issues related to the wheel edit widget:

  • usage of tango-centric API
  • poor synchronization between the wheel edit and its internal editor
  • user cannot control (via GUI) the number of digits shown by the widget

usage of tango-centric API

For example the following code: will raise an exception and deprecation warnings:

from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.panel import TaurusForm
from taurus.qt.qtgui.input import TaurusWheelEdit

if __name__ == '__main__':
    import sys
    app = TaurusApplication(cmd_line_parser=None)
    w = TaurusForm()
    w.setModel( ['sys/tg_test/1/ampli'])
    w[0].setWriteWidgetClass(TaurusWheelEdit)
    w.show()
    sys.exit(app.exec_())

Raises an exception: ValueError: '%6.2e' format unsupported And also a deprecation warning: DeprecationWarning: format is deprecated since 4.0.4. Use format_spec or precision instead

This PR fixes it, but in doing so, it removes the feature that the format is used to initialize the number of digits (this is mitigated by the implementation of user-access to setting the number of digits, see below)

poor synchronization between the wheel edit and its internal editor

The internal editor widget allows to type in values that cannot be represented by the wheel widget. When this occurs and return is pressed, the value is silently discarded, which can be confusing.

This is fixed by making the internal editor enforce the same limitations as the wheel when editing.

user cannot control (via GUI) the number of digits shown by the widget

This PR adds an action (accessible via context menu of the wheel edit widget) that allows the user to set the digit count.

Merge request reports