Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix SIGNAL
  • Loading branch information
geggo committed Sep 28, 2015
commit 39e5f61fa96575efce42e04545ddbcadb87a6dfa
5 changes: 3 additions & 2 deletions traitsui/qt5/editor_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ def init ( self, parent ):
widget.
"""
self.control = QtWidgets.QLineEdit(self.str_value)
QtCore.QObject.connect(self.control,
QtCore.SIGNAL('editingFinished()'), self.update_object)
#QtCore.QObject.connect(self.control,
# QtCore.SIGNAL('editingFinished()'), self.update_object)
self.control.editingFinished.connect(self.update_object)
self.set_tooltip()

#---------------------------------------------------------------------------
Expand Down
38 changes: 22 additions & 16 deletions traitsui/qt5/enum_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,23 @@ def init ( self, parent ):
self.control = control = self.create_combo_box()
control.addItems(self.names)

QtCore.QObject.connect(control,
QtCore.SIGNAL('currentIndexChanged(QString)'),
self.update_object)
#QtCore.QObject.connect(control,
# QtCore.SIGNAL('currentIndexChanged(QString)'),
# self.update_object)
control.currentIndexChanged.connect(self.update_object)

if self.factory.evaluate is not None:
control.setEditable(True)
if self.factory.auto_set:
QtCore.QObject.connect(control,
QtCore.SIGNAL('editTextChanged(QString)'),
self.update_text_object)
#QtCore.QObject.connect(control,
# QtCore.SIGNAL('editTextChanged(QString)'),
# self.update_text_object)
control.editTextChanged.connect(self.update_text_object)
else:
QtCore.QObject.connect(control.lineEdit(),
QtCore.SIGNAL('editingFinished()'),
self.update_autoset_text_object)
#QtCore.QObject.connect(control.lineEdit(),
# QtCore.SIGNAL('editingFinished()'),
# self.update_autoset_text_object)
control.lineEdit().editingFinished.connect(self.update_autoset_text_object)
control.setInsertPolicy(QtWidgets.QComboBox.NoInsert)

self._no_enum_update = 0
Expand Down Expand Up @@ -362,8 +365,9 @@ def init ( self, parent ):
layout.setContentsMargins(0, 0, 0, 0)

self._mapper = QtCore.QSignalMapper()
QtCore.QObject.connect(self._mapper, QtCore.SIGNAL('mapped(int)'),
self.update_object)
# QtCore.QObject.connect(self._mapper, QtCore.SIGNAL('mapped(int)'),
# self.update_object)
self._mapper.mapped.connect(self.update_object)

self.rebuild_editor()

Expand Down Expand Up @@ -435,8 +439,9 @@ def rebuild_editor ( self ):

rb.setChecked(name == cur_name)

QtCore.QObject.connect(rb, QtCore.SIGNAL('clicked()'),
self._mapper, QtCore.SLOT('map()'))
#QtCore.QObject.connect(rb, QtCore.SIGNAL('clicked()'),
# self._mapper, QtCore.SLOT('map()'))
rb.clicked.connect(self._mapper.map)
self._mapper.setMapping(rb, index)

self.set_tooltip(rb)
Expand Down Expand Up @@ -475,9 +480,10 @@ def init ( self, parent ):
super( ListEditor, self ).init( parent )

self.control = QtWidgets.QListWidget()
QtCore.QObject.connect(self.control,
QtCore.SIGNAL('currentTextChanged(QString)'),
self.update_object)
#QtCore.QObject.connect(self.control,
# QtCore.SIGNAL('currentTextChanged(QString)'),
# self.update_object)
self.control.currentTextChanged.connect(self.update_object)

self.rebuild_editor()
self.set_tooltip()
Expand Down
27 changes: 16 additions & 11 deletions traitsui/qt5/range_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ def init ( self, parent ):
slider.setPageStep(1000)
slider.setSingleStep(100)
slider.setValue(ivalue)
QtCore.QObject.connect(slider, QtCore.SIGNAL('valueChanged(int)'),
self.update_object_on_scroll)
#QtCore.QObject.connect(slider, QtCore.SIGNAL('valueChanged(int)'),
# self.update_object_on_scroll)
slider.valueChanged.connect(self.update_object_on_scroll)
panel.addWidget(slider)

self._label_hi = QtWidgets.QLabel()
Expand All @@ -156,8 +157,9 @@ def init ( self, parent ):
self._label_hi.setMinimumWidth(factory.label_width)

self.control.text = text = QtWidgets.QLineEdit(fvalue_text)
QtCore.QObject.connect(text, QtCore.SIGNAL('editingFinished()'),
self.update_object_on_enter)
#QtCore.QObject.connect(text, QtCore.SIGNAL('editingFinished()'),
# self.update_object_on_enter)
text.editingFinished.connect(self.update_object_on_enter)

# The default size is a bit too big and probably doesn't need to grow.
sh = text.sizeHint()
Expand Down Expand Up @@ -421,8 +423,9 @@ def init ( self, parent ):
slider.setPageStep(1000)
slider.setSingleStep(100)
slider.setValue(ivalue)
QtCore.QObject.connect(slider, QtCore.SIGNAL('valueChanged(int)'),
self.update_object_on_scroll)
#QtCore.QObject.connect(slider, QtCore.SIGNAL('valueChanged(int)'),
# self.update_object_on_scroll)
slider.valueChanged.connect(self.update_object_on_scroll)
panel.addWidget(slider)

# Upper limit button:
Expand All @@ -436,9 +439,10 @@ def init ( self, parent ):

# Text entry:
self.control.text = text = QtWidgets.QLineEdit(fvalue_text)
QtCore.QObject.connect(text, QtCore.SIGNAL('editingFinished()'),
self.update_object_on_enter)

#QtCore.QObject.connect(text, QtCore.SIGNAL('editingFinished()'),
# self.update_object_on_enter)
text.editingFinished.connect(self.update_object_on_enter)

# The default size is a bit too big and probably doesn't need to grow.
sh = text.sizeHint()
sh.setWidth(sh.width() / 2)
Expand Down Expand Up @@ -675,8 +679,9 @@ def init ( self, parent ):
self.control.setMinimum(low)
self.control.setMaximum(high)
self.control.setValue(self.value)
QtCore.QObject.connect(self.control,
QtCore.SIGNAL('valueChanged(int)'), self.update_object)
#QtCore.QObject.connect(self.control,
# QtCore.SIGNAL('valueChanged(int)'), self.update_object)
self.control.valueChanged.connect(self.update_object)
self.set_tooltip()

#---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion traitsui/qt5/ui_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def add_button ( self, action, bbox, role, method=None, enabled=True,
method = editor.perform

if method is not None:
button.connect(button, QtCore.SIGNAL('clicked()'), method)
button.clicked.connect(method)

if action.tooltip != '':
button.setToolTip(action.tooltip)
Expand Down
3 changes: 1 addition & 2 deletions traitsui/qt5/ui_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,7 @@ def __init__ ( self, parent, html, scale_dx, scale_dy ):
# Create the OK button
bbox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok,
QtCore.Qt.Horizontal)
QtCore.QObject.connect(bbox, QtCore.SIGNAL('accepted()'),
self, QtCore.SLOT('accept()'))
bbox.accepted.connect(self.accept)
layout.addWidget(bbox)

# Position and show the dialog
Expand Down