# Path: Qt.py



from Qt import QtWidgets, Qt
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the
#   Free Software Foundation, Inc.,
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#



class ServicesDelegate(QtWidgets.QStyledItemDelegate):
    """ServicesDelegate is a delegate that provides a combo box for
    selecting a Service.
    """

    def createEditor(self, parent, option, index):
        """Creates the editor, i.e. a combo box for selecting a service."""
        simulation = index.model().sourceModel().simulation
        comboBox = QtWidgets.QComboBox(parent)
        comboBox.setModel(simulation.servicesModel)
        comboBox.setModelColumn(0)
        return comboBox

    def setEditorData(self, editor, index):
        """Sets the values from the model in the combo box"""
        simulation = index.model().sourceModel().simulation

# Path: Qt.py



# Path: ts2/editor/delegates.py
from Qt import QtWidgets, Qt

#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the
#   Free Software Foundation, Inc.,
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#



class ServicesDelegate(QtWidgets.QStyledItemDelegate):
    """ServicesDelegate is a delegate that provides a combo box for
    selecting a Service.
    """

    def createEditor(self, parent, option, index):
        """Creates the editor, i.e. a combo box for selecting a service."""
        simulation = index.model().sourceModel().simulation
        comboBox = QtWidgets.QComboBox(parent)
        comboBox.setModel(simulation.servicesModel)
        comboBox.setModelColumn(0)
        return comboBox

    def setEditorData(self, editor, index):
        """Sets the values from the model in the combo box"""
        simulation = index.model().sourceModel().simulation

        serviceCode = index.model().data(index, Qt.EditRole)