Title: Compact Read+Write widgets in Taurus SEP: 9 State: ACCEPTED Date: 2014-07-02 Drivers: Carlos Pascual-Izarra <cpascual@cells.es> URL: https://sourceforge.net/p/sardana/wiki/SEP9 License: http://www.jclark.com/xml/copying.txt Abstract: Providing a common pattern for compact widgets which both display the read value of an attribute and allow the user to change the write value
Taurus currently provides a set of widgets for displaying values of attributes (implemented mostly in the taurus.qt.qtgui.display module) and a separate set of widgets allowing to modify such values (implemented mostly in the taurus.qt.qtgui.input module and which inherit from TaurusBaseWritableWidget abstract class).
In practice, these two sets are often used together to provide control of an attribute, and very often this is done via a TaurusForm which puts a display widget next to an input widget for the same attribute (and also typically uses another widget for a label and another for displaying units).
A recurrent feature request from users is to provide a more compact way of viewing and writing to an attribute. This SEP intends to provide a "canonical" way of doing it.
The following goals and constraints are taken into consideration for this proposal:
A sep9 branch in the official repository has being created to host an implementation proposal:
https://sf.net/p/sardana/sardana.git/ci/sep9/tree/
The compact widget is implemented by adding a "read" widget and a "write" widget to a QStackLayout, and allowing the user to switch between the two.
A very basic prototype which already fulfilled goals 1, 2, 3 and 6 was submitted to the sardana-devel mailing list:
https://sf.net/p/sardana/mailman/message/31624240/
This prototype was further developed in the sep9 branch which, at its commit f90ed28 already fulfilled all stated goals of this SEP.
Should we go further and include the units in the "display widget"? (e.g., for a Taurus Label, use a suffix).
Widgets inheritting from TaurusValue: Sardana currently provides some widgets which inherit from TaurusValue (PoolMotorTV, PoolIORegisterTV,...) and users may have created their own versions as well. Some of these widgets may not be currently compatible with the compact mode (note that at least the compact mode is not used by default). Since the user may switch to compact mode, we propose that, until the widgets support it, they should just reimplement setCompact() to ignore the compact mode request:
def setCompact(*a): pass
The main discussions for this SEP take place in the sardana-devel mailing list. See:
- The initial SEP9 thread.
This document is under the Expat License. The following copyright statement and license apply to this document.
Copyright (c) 2013 Carlos Pascual-Izarra
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Why don't just create a lineedit/spinbox with the read value? When it gets focus it changes to the write value and the user changes it.
If editing is successfully finished (return is pressed) the value is written.
If the widget loses focus before applying the widget displayed value changes to the read value.
Hi, thanks for the suggestion. I posted a lengthy reply in the SEP9 thread of the sardana-devel list