Commit f30aef12 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Make UserWidgets in Pyside2/Python3

parent d9269335
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
''' Edit this module at will to create custom widgets that can send TC or
......@@ -14,8 +14,9 @@ import sys
import os
import importlib
import DV
from PySide.QtCore import (QObject, Signal, Slot, Qt, QTimer)
import PySide.QtGui as QtGui
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from asn1_value_editor import UserWidgetsCommon
......@@ -39,7 +40,7 @@ class PedestrianButton(UserWidgetsCommon.TC):
self._asn1_typename = asn1_typename
self.widget = QtGui.QPushButton("Request passage")
self.widget = QPushButton("Request passage")
self.widget.clicked.connect(self.clicked)
self.setWidget(self.widget)
......@@ -72,10 +73,10 @@ class TrafficLight(UserWidgetsCommon.TM):
def __init__(self, parent=None):
''' Initialise the widget '''
super(TrafficLight, self).__init__(parent)
self.widget = QtGui.QLabel()
self.colorMap = { DV.red: QtGui.QPixmap ("red.png"),
DV.orange: QtGui.QPixmap ("orange.png"),
DV.green: QtGui.QPixmap ("green.png") }
self.widget = QLabel()
self.colorMap = { DV.red: QPixmap ("red.png"),
DV.orange: QPixmap ("orange.png"),
DV.green: QPixmap ("green.png") }
self.widget.setPixmap (self.colorMap[DV.red])
self.setWidget(self.widget)
self.setWindowTitle(parent.treeItem.text())
......@@ -111,9 +112,9 @@ class Pedestrian(UserWidgetsCommon.TM):
def __init__(self, parent=None):
''' Initialise the widget '''
super(Pedestrian, self).__init__(parent)
self.widget = QtGui.QLabel()
self.colorMap = { DV.wait: QtGui.QPixmap ("wait.png"),
DV.go: QtGui.QPixmap ("go.png")}
self.widget = QLabel()
self.colorMap = { DV.wait: QPixmap ("wait.png"),
DV.go: QPixmap ("go.png")}
self.widget.setPixmap (self.colorMap[DV.wait])
self.setWidget(self.widget)
self.setWindowTitle(parent.treeItem.text())
......@@ -143,5 +144,5 @@ class Pedestrian(UserWidgetsCommon.TM):
return editor.messageName == "Info_User"
if __name__ == '__main__':
print 'This module can only be imported from the main TASTE guis'
print('This module can only be imported from the main TASTE guis')
sys.exit(-1)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment