Skip to content

Commit

Permalink
Merge pull request #430 from hhslepicka/btn_group
Browse files Browse the repository at this point in the history
ENH: Add new widget Enum Buttons.
  • Loading branch information
mattgibbs authored Nov 18, 2018
2 parents 24ac01a + 3f5069f commit 44b4a93
Show file tree
Hide file tree
Showing 9 changed files with 696 additions and 6 deletions.
6 changes: 6 additions & 0 deletions docs/source/widgets/enum_button.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#######################
PyDMEnumButton
#######################

.. autoclass:: pydm.widgets.enum_button.PyDMEnumButton
:members:
1 change: 1 addition & 0 deletions docs/source/widgets/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Input Widgets
:maxdepth: 1

checkbox.rst
enum_button.rst
enum_combo_box.rst
line_edit.rst
pushbutton.rst
Expand Down
4 changes: 2 additions & 2 deletions examples/buttons/buttons.ui
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
The file to be opened
</string>
</property>
<property name="text" stdset="0">
<property name="text">
<string>Open Display</string>
</property>
</widget>
Expand Down Expand Up @@ -145,7 +145,7 @@
</customwidget>
<customwidget>
<class>PyDMRelatedDisplayButton</class>
<extends>QFrame</extends>
<extends>QPushButton</extends>
<header>pydm.widgets.related_display_button</header>
</customwidget>
<customwidget>
Expand Down
239 changes: 239 additions & 0 deletions examples/enum_buttons/buttons.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>583</width>
<height>438</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="PyDMEnumButton" name="PyDMEnumButton">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string>
A QWidget that renders buttons for every option of Enum Items.
For now three types of buttons can be rendered:
- Push Button
- Radio Button
- Check Box

Parameters
----------
parent : QWidget
The parent widget for the Label
init_channel : str, optional
The channel to be used by the widget.

Signals
-------
send_value_signal : int, float, str, bool or np.ndarray
Emitted when the user changes the value.
</string>
</property>
<property name="channel" stdset="0">
<string>ca://MTEST:Run</string>
</property>
</widget>
</item>
<item>
<widget class="PyDMEnumButton" name="PyDMEnumButton_2">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string>
A QWidget that renders buttons for every option of Enum Items.
For now three types of buttons can be rendered:
- Push Button
- Radio Button
- Check Box

Parameters
----------
parent : QWidget
The parent widget for the Label
init_channel : str, optional
The channel to be used by the widget.

Signals
-------
send_value_signal : int, float, str, bool or np.ndarray
Emitted when the user changes the value.
</string>
</property>
<property name="channel" stdset="0">
<string>ca://MTEST:Run</string>
</property>
<property name="widgetType" stdset="0">
<enum>PyDMEnumButton::RadioButton</enum>
</property>
</widget>
</item>
<item>
<widget class="PyDMEnumButton" name="PyDMEnumButton_3">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string>
A QWidget that renders buttons for every option of Enum Items.
For now three types of buttons can be rendered:
- Push Button
- Radio Button
- Check Box

Parameters
----------
parent : QWidget
The parent widget for the Label
init_channel : str, optional
The channel to be used by the widget.

Signals
-------
send_value_signal : int, float, str, bool or np.ndarray
Emitted when the user changes the value.
</string>
</property>
<property name="channel" stdset="0">
<string>ca://MTEST:Run</string>
</property>
<property name="widgetType" stdset="0">
<enum>PyDMEnumButton::CheckBox</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="PyDMEnumButton" name="PyDMEnumButton_5">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string>
A QWidget that renders buttons for every option of Enum Items.
For now three types of buttons can be rendered:
- Push Button
- Radio Button
- Check Box

Parameters
----------
parent : QWidget
The parent widget for the Label
init_channel : str, optional
The channel to be used by the widget.

Signals
-------
send_value_signal : int, float, str, bool or np.ndarray
Emitted when the user changes the value.
</string>
</property>
<property name="channel" stdset="0">
<string>ca://MTEST:Run</string>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="PyDMEnumButton" name="PyDMEnumButton_6">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string>
A QWidget that renders buttons for every option of Enum Items.
For now three types of buttons can be rendered:
- Push Button
- Radio Button
- Check Box

Parameters
----------
parent : QWidget
The parent widget for the Label
init_channel : str, optional
The channel to be used by the widget.

Signals
-------
send_value_signal : int, float, str, bool or np.ndarray
Emitted when the user changes the value.
</string>
</property>
<property name="channel" stdset="0">
<string>ca://MTEST:Run</string>
</property>
<property name="widgetType" stdset="0">
<enum>PyDMEnumButton::RadioButton</enum>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="PyDMEnumButton" name="PyDMEnumButton_4">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string>
A QWidget that renders buttons for every option of Enum Items.
For now three types of buttons can be rendered:
- Push Button
- Radio Button
- Check Box

Parameters
----------
parent : QWidget
The parent widget for the Label
init_channel : str, optional
The channel to be used by the widget.

Signals
-------
send_value_signal : int, float, str, bool or np.ndarray
Emitted when the user changes the value.
</string>
</property>
<property name="channel" stdset="0">
<string>ca://MTEST:Run</string>
</property>
<property name="widgetType" stdset="0">
<enum>PyDMEnumButton::CheckBox</enum>
</property>
<property name="orientation" stdset="0">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PyDMEnumButton</class>
<extends>QWidget</extends>
<header>pydm.widgets.enum_button</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
4 changes: 0 additions & 4 deletions pydm/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# coding: utf-8
# Fixtures for PyDM Unit Tests

pytest_plugins = 'pytester'

import pytest
from pytestqt.qt_compat import qt_api

Expand All @@ -15,8 +13,6 @@
from ..widgets.base import PyDMWidget
from pydm.data_plugins import PyDMPlugin, add_plugin

pytest_plugins = 'pytester'

logger = logging.getLogger(__name__)
_, file_path = tempfile.mkstemp(suffix=".log")
handler = logging.FileHandler(file_path)
Expand Down
5 changes: 5 additions & 0 deletions pydm/tests/test_plugins_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def test_import_frame_plugin():
from ..widgets.frame import PyDMFrame
PyDMFramePlugin = qtplugin_factory(PyDMFrame, is_container=True)

def test_import_enum_button_plugin():
# Enum Button plugin
from ..widgets.enum_button import PyDMEnumButton
PyDMEnumButtonPlugin = qtplugin_factory(PyDMEnumButton)

def test_import_combobox_plugin():
# Enum Combobox plugin
from ..widgets.enum_combo_box import PyDMEnumComboBox
Expand Down
Loading

0 comments on commit 44b4a93

Please sign in to comment.