Exemplo n.º 1
0
    def show(self):
        try:
            # append folder of 'qt_gui_cpp/lib' to module search path
            qt_gui_cpp_path = os.path.realpath(get_package_path('qt_gui_cpp'))
        except Exception:
            qt_gui_cpp = None
        else:
            sys.path.append(os.path.join(qt_gui_cpp_path, 'lib'))
            sys.path.append(os.path.join(qt_gui_cpp_path, 'src'))
            from qt_gui_cpp.cpp_binding_helper import qt_gui_cpp

        logo = os.path.join(self._qtgui_path, 'share', 'qt_gui', 'resource',
                            'ros_org_vertical.png')
        text = '<img src="%s" width="56" height="200" style="float: left;"/>' % logo

        text += '<h3 style="margin-top: 1px;">%s</h3>' % self.tr('rqt')

        text += '<p>%s %s</p>' % (
            self.tr('rqt is a framework for graphical user interfaces.'),
            self.
            tr('It is extensible with plugins which can be written in either Python or C++.'
               ))
        text += '<p>%s</p>' % (self.tr(
            'Please see the <a href="%s">Wiki</a> for more information on rqt and available '
            'plugins.' % 'http://wiki.ros.org/rqt'))

        text += '<p>%s: ' % self.tr('Utilized libraries:')

        text += 'Python %s, ' % platform.python_version()

        if QT_BINDING == 'pyside':
            text += 'PySide'
        elif QT_BINDING == 'pyqt':
            text += 'PyQt'
        text += ' %s (%s), ' % (QT_BINDING_VERSION, ', '.join(
            sorted(QT_BINDING_MODULES)))

        text += 'Qt %s, ' % qVersion()

        if qt_gui_cpp is not None:
            if QT_BINDING == 'pyside':
                text += '%s' % (self.tr('%s C++ bindings available') %
                                'Shiboken')
            elif QT_BINDING == 'pyqt':
                text += '%s' % (self.tr('%s C++ bindings available') % 'SIP')
            else:
                text += '%s' % self.tr('C++ bindings available')
        else:
            text += '%s' % self.tr(
                'no C++ bindings found - no C++ plugins available')

        text += '.</p>'

        mb = QMessageBox(QMessageBox.NoIcon, self.tr('About rqt'), text,
                         QMessageBox.Ok, self.parent())
        mb.exec_()
Exemplo n.º 2
0
    def __init__(self, parent=None):
        """Create a new, empty DataPlot

        This will raise a RuntimeError if none of the supported plotting
        backends can be found
        """
        super(DataPlot, self).__init__(parent)
        self.x_width = 5.0

        self._plot_index = 0
        self._color_index = 0
        self._markers_on = False
        self._autoscroll = True

        self._autoscale_x = False
        self._autoscale_y = DataPlot.SCALE_ALL

        # the backend widget that we're trying to hide/abstract
        self._data_plot_widget = None
        self._curves = {}
        self._vline = None
        self._redraw.connect(self._do_redraw)

        self._layout = QHBoxLayout()
        self.setLayout(self._layout)

        enabled_plot_types = [pt for pt in self.plot_types if pt['enabled']]
        if not enabled_plot_types:
            if qVersion().startswith('4.'):
                version_info = '1.1.0'
            else:
                # minimum matplotlib version for Qt 5
                version_info = '1.4.0'
            if QT_BINDING == 'pyside':
                version_info += ' and PySide %s' % \
                    ('> 1.1.0' if qVersion().startswith('4.') else '>= 2.0.0')
            raise RuntimeError(
                'No usable plot type found. Install at least one of: PyQtGraph, MatPlotLib '
                '(at least %s) or Python-Qwt5.' % version_info)

        self._switch_data_plot_widget(self._plot_index)

        self.show()
Exemplo n.º 3
0
    def show(self):
        # append folder of 'qt_gui_cpp/lib' to module search path
        qt_gui_cpp_path = os.path.realpath(get_package_path("qt_gui_cpp"))
        sys.path.append(os.path.join(qt_gui_cpp_path, "lib"))
        sys.path.append(os.path.join(qt_gui_cpp_path, "src"))
        from qt_gui_cpp.cpp_binding_helper import qt_gui_cpp

        import rospkg

        _rospkg_version = getattr(rospkg, "__version__", "&lt; 0.2.4")

        logo = os.path.join(self._qtgui_path, "resource", "ros_org_vertical.png")
        text = '<img src="%s" width="56" height="200" style="float: left;"/>' % logo

        text += '<h3 style="margin-top: 1px;">%s</h3>' % self.tr("rqt")

        text += "<p>%s %s</p>" % (
            self.tr("rqt is a framework for graphical user interfaces."),
            self.tr("It is extensible with plugins which can be written in either Python or C++."),
        )
        text += "<p>%s</p>" % (
            self.tr(
                'Please see the <a href="%s">Wiki</a> for more information on rqt and available plugins.'
                % "http://wiki.ros.org/rqt"
            )
        )

        text += "<p>%s: " % self.tr("Utilized libraries:")

        text += "Python %s, " % platform.python_version()

        text += "rospkg %s, " % _rospkg_version

        if QT_BINDING == "pyside":
            text += "PySide"
        elif QT_BINDING == "pyqt":
            text += "PyQt"
        text += " %s (%s), " % (QT_BINDING_VERSION, ", ".join(sorted(QT_BINDING_MODULES)))

        text += "Qt %s, " % qVersion()

        if qt_gui_cpp is not None:
            if QT_BINDING == "pyside":
                text += "%s" % (self.tr("%s C++ bindings available") % "Shiboken")
            elif QT_BINDING == "pyqt":
                text += "%s" % (self.tr("%s C++ bindings available") % "SIP")
            else:
                text += "%s" % self.tr("C++ bindings available")
        else:
            text += "%s" % self.tr("no C++ bindings found - no C++ plugins available")

        text += ".</p>"

        mb = QMessageBox(QMessageBox.NoIcon, self.tr("About rqt"), text, QMessageBox.Ok, self.parent())
        mb.exec_()
    def __init__(self, parent=None):
        """Create a new, empty DataPlot

        This will raise a RuntimeError if none of the supported plotting
        backends can be found
        """
        super(DataPlot, self).__init__(parent)
        self._plot_index = 0
        self._color_index = 0
        self._markers_on = False
        self._autoscroll = True

        self._autoscale_x = True
        self._autoscale_y = DataPlot.SCALE_ALL

        # the backend widget that we're trying to hide/abstract
        self._data_plot_widget = None
        self._curves = {}
        self._vline = None
        self._redraw.connect(self._do_redraw)

        self._layout = QHBoxLayout()
        self.setLayout(self._layout)

        enabled_plot_types = [pt for pt in self.plot_types if pt["enabled"]]
        if not enabled_plot_types:
            if qVersion().startswith("4."):
                version_info = "1.1.0"
            else:
                # minimum matplotlib version for Qt 5
                version_info = "1.4.0"
            if QT_BINDING == "pyside":
                version_info += " and PySide %s" % ("> 1.1.0" if qVersion().startswith("4.") else ">= 2.0.0")
            raise RuntimeError(
                "No usable plot type found. Install at least one of: PyQtGraph, MatPlotLib (at least %s) or Python-Qwt5."
                % version_info
            )

        self._switch_data_plot_widget(self._plot_index)

        self.show()
 def handle_highlight_filters_changed(self):
     """
     Invalidate filters and trigger refiltering.
     """
     if self._show_highlighted_only:
         self.invalidateFilter()
     else:
         self.invalidateFilter()
         if qVersion().startswith('4.'):
             self.dataChanged.emit(self.index(0, 0), self.index(self.rowCount() - 1, self.columnCount() - 1))
         else:
             self.dataChanged.emit(self.index(0, 0), self.index(self.rowCount() - 1, self.columnCount() - 1), [])
Exemplo n.º 6
0
    def show(self):
        # append folder of 'qt_gui_cpp/lib' to module search path
        qt_gui_cpp_path = os.path.realpath(get_package_path('qt_gui_cpp'))
        sys.path.append(os.path.join(qt_gui_cpp_path, 'lib'))
        sys.path.append(os.path.join(qt_gui_cpp_path, 'src'))
        from qt_gui_cpp.cpp_binding_helper import qt_gui_cpp

        _rospkg_version = None
        try:
            import rospkg
            _rospkg_version = getattr(rospkg, '__version__', '&lt; 0.2.4')
        except ImportError:
            pass

        logo = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..', 'icons', 'ros_org_vertical.png'))
        text = '<img src="%s" width="56" height="200" style="float: left;"/>' % logo

        text += '<h3 style="margin-top: 1px;">%s</h3>' % self.tr('ROS GUI')

        text += '<p>%s %s</p>' % (self.tr('ROS GUI is a framework for graphical user interfaces.'), self.tr('It is extensible with plugins which can be written in either Python or C++.'))
        text += '<p>%s</p>' % (self.tr('Please see the <a href="%s">Wiki</a> for more information on ROS GUI and available plugins.' % 'http://www.ros.org/wiki/rqt'))

        text += '<p>%s: ' % self.tr('Utilized libraries:')

        text += 'Python %s, ' % platform.python_version()

        if _rospkg_version is not None:
            text += 'rospkg %s, ' % _rospkg_version
        else:
            text += '%s, ' % self.tr('rospkg not found - using roslib')

        if QT_BINDING == 'pyside':
            text += 'PySide'
        elif QT_BINDING == 'pyqt':
            text += 'PyQt'
        text += ' %s (%s), ' % (QT_BINDING_VERSION, ', '.join(sorted(QT_BINDING_MODULES)))

        text += 'Qt %s, ' % qVersion()

        if qt_gui_cpp is not None:
            if QT_BINDING == 'pyside':
                text += '%s' % (self.tr('%s C++ bindings available') % 'Shiboken')
            elif QT_BINDING == 'pyqt':
                text += '%s' % (self.tr('%s C++ bindings available') % 'SIP')
            else:
                text += '%s' % self.tr('C++ bindings available')
        else:
            text += '%s' % self.tr('no C++ bindings found - no C++ plugins available')

        text += '.</p>'

        QMessageBox.about(self.parent(), self.tr('About ROS GUI'), text)
 def handle_highlight_filters_changed(self):
     """
     Invalidate filters and trigger refiltering.
     """
     if self._show_highlighted_only:
         self.invalidateFilter()
     else:
         self.invalidateFilter()
         if qVersion().startswith('4.'):
             self.dataChanged.emit(
                 self.index(0, 0),
                 self.index(self.rowCount() - 1,
                            self.columnCount() - 1))
         else:
             self.dataChanged.emit(
                 self.index(0, 0),
                 self.index(self.rowCount() - 1,
                            self.columnCount() - 1), [])
Exemplo n.º 8
0
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from python_qt_binding.QtCore import Slot, Qt, qVersion, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtWidgets import QVBoxLayout, QWidget

if qVersion().startswith('5.'):
    try:
        from pkg_resources import parse_version
    except:
        import re

        def parse_version(s):
            return [int(x) for x in re.sub(r'(\.0+)*$', '', s).split('.')]

    try:
        from pyqtgraph import __version__ as pyqtgraph_version
    except RuntimeError:
        # pyqtgraph < 1.0 using Qt4 failing on 16.04 because kinetic uses Qt5.
        # This raises RuntimeError('the PyQt4.QtCore and PyQt5.QtCore modules both wrap the QObject class')
        import pkg_resources
        pyqtgraph_version = pkg_resources.get_distribution("pyqtgraph").version
Exemplo n.º 9
0
    def parse_version(s):
        return [int(x) for x in re.sub(r'(\.0+)*$', '', s).split('.')]

if QT_BINDING == 'pyside':
    qt_binding_version = QT_BINDING_VERSION.replace('~', '-')
    if parse_version(qt_binding_version) <= parse_version('1.1.2'):
        raise ImportError('A PySide version newer than 1.1.0 is required.')

from python_qt_binding.QtCore import Slot, Qt, qVersion, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtWidgets import QWidget, QVBoxLayout, QSizePolicy

import operator
import matplotlib
if qVersion().startswith('5.'):
    if QT_BINDING == 'pyside':
        if parse_version(matplotlib.__version__) < parse_version('2.1.0'):
            raise ImportError('A newer matplotlib is required (at least 2.1.0 for PySide 2)')
    if parse_version(matplotlib.__version__) < parse_version('1.4.0'):
        raise ImportError('A newer matplotlib is required (at least 1.4.0 for Qt 5)')
    try:
        matplotlib.use('Qt5Agg')
        from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
    except ImportError:
        # work around bug in dateutil
        import sys
        import thread
        sys.modules['_thread'] = thread
        from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
    from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
Exemplo n.º 10
0
    def parse_version(s):
        return [int(x) for x in re.sub(r'(\.0+)*$', '', s).split('.')]


if QT_BINDING == 'pyside':
    qt_binding_version = QT_BINDING_VERSION.replace('~', '-')
    if parse_version(qt_binding_version) <= parse_version('1.1.2'):
        raise ImportError('A PySide version newer than 1.1.0 is required.')

from python_qt_binding.QtCore import Slot, Qt, qVersion, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtWidgets import QWidget, QVBoxLayout, QSizePolicy

import operator
import matplotlib
if qVersion().startswith('5.'):
    if QT_BINDING == 'pyside':
        if parse_version(matplotlib.__version__) < parse_version('2.1.0'):
            raise ImportError(
                'A newer matplotlib is required (at least 2.1.0 for PySide 2)')
    if parse_version(matplotlib.__version__) < parse_version('1.4.0'):
        raise ImportError(
            'A newer matplotlib is required (at least 1.4.0 for Qt 5)')
    try:
        matplotlib.use('Qt5Agg')
        from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
    except ImportError:
        # work around bug in dateutil
        import sys
        import thread
        sys.modules['_thread'] = thread
Exemplo n.º 11
0
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from python_qt_binding.QtCore import qVersion
from qt_gui.plugin import Plugin
from qt_gui_py_common.simple_settings_dialog import SimpleSettingsDialog

from shell_widget import ShellWidget

try:
    if qVersion().startswith('5.'):
        raise ImportError('embedding is not support with Qt 5')
    from xterm_widget import XTermWidget, is_xterm_available
    _has_xterm = is_xterm_available()
except ImportError:
    XTermWidget = None
    _has_xterm = False

try:
    if qVersion().startswith('5.'):
        raise ImportError('spyderlib does not support Qt 5 yet')
    from spyder_shell_widget import SpyderShellWidget
    _has_spyderlib = True
except ImportError:
    SpyderShellWidget = None
    _has_spyderlib = False