Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ros kinetic qt5 compatibility fix #106

Merged
merged 3 commits into from
Jun 2, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import rospy
from diagnostic_msgs.msg import DiagnosticStatus
from python_qt_binding.QtCore import QMutex, QMutexLocker, QSize, QTimer
from python_qt_binding.QtCore import QMutex, QMutexLocker, QSize, QTimer, pyqtSignal
from rqt_robot_monitor.robot_monitor import RobotMonitorWidget
from .icon_tool_button import IconToolButton

Expand All @@ -48,6 +48,8 @@ class MonitorDashWidget(IconToolButton):
:param context: The plugin context to create the monitor in.
:type context: qt_gui.plugin_context.PluginContext
"""
msg_trigger = pyqtSignal()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the generic Signal instead of PyQt specific pyqtSignal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the signal shouldn't be used externally it should also be prefixed with an underscore to make it "private".


def __init__(self, context, icon_paths=[]):
self._graveyard = []
ok_icon = ['bg-green.svg', 'ic-diagnostics.svg']
Expand Down Expand Up @@ -85,10 +87,11 @@ def __init__(self, context, icon_paths=[]):
self._stalled()
self._plugin_settings = None
self._instance_settings = None
self.msg_trigger.connect(self.handle_msg_trigger)

def toplevel_state_callback(self, msg):
self._is_stale = False
self._stall_timer.start(5000)
self.msg_trigger.emit()

if self._top_level_state != msg.level:
if (msg.level >= 2):
Expand All @@ -102,6 +105,9 @@ def toplevel_state_callback(self, msg):
self.setToolTip("Diagnostics: OK")
self._top_level_state = msg.level

def handle_msg_trigger(self):
self._stall_timer.start(5000)

def _stalled(self):
self._stall_timer.stop()
self._is_stale = True
Expand Down
2 changes: 1 addition & 1 deletion rqt_robot_dashboard/src/rqt_robot_dashboard/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
To use them you must provide instances of them to your dashboard in its :func:`get_widgets` method. For example::

from rqt_robot_dashboard.dashboard import Dashboard
from rqt_robot_dashboard.widgets import MonitorDashWidget, ConsoleDashWidget
from rqt_robot_dashboard.widgets import MonitorDashWidget, ConsoleDashWidget, BatteryDashWidget

class MyDashboard(Dashboard):
def get_widgets(self):
Expand Down