当前位置: 首页>>代码示例>>Python>>正文


Python QWidget.setFixedHeight方法代码示例

本文整理汇总了Python中python_qt_binding.QtGui.QWidget.setFixedHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.setFixedHeight方法的具体用法?Python QWidget.setFixedHeight怎么用?Python QWidget.setFixedHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在python_qt_binding.QtGui.QWidget的用法示例。


在下文中一共展示了QWidget.setFixedHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MyPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import setFixedHeight [as 别名]
class MyPlugin(Plugin):

    """
    Class to show a GUI. Could be a form.
    """

    def __init__(self, context):
        """
        Constructor of the class.
        """

        super(MyPlugin, self).__init__(context)

        # give QObjects reasonable names
        self.setObjectName('TelepresencePlugin')

        # create QWidget
        self._widget = QWidget()

        # get path to UI file which should be in the "resource" folder of this
        # package
        ui_file = os.path.join(
            rospkg.RosPack().get_path('rqt_servo'), 'resource', 'view.ui')

        # extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)

        # give QObjects reasonable names
        self._widget.setObjectName('TelepresencePlugin')
        
        # set fixed height
        self._widget.setFixedHeight(164)

        # add widget to the user interface
        context.add_widget(self._widget)
        
        # create a timer
        self.timer = QtCore.QTimer()
        self.timer.start(40)
        
        # class variables
        self.i = 0
        
        # publishers and subscribers
        self.pub_pitch_oculus = rospy.Publisher('pitch_controller/command',
                                                Float32, queue_size=100)
        self.pub_yaw_oculus = rospy.Publisher('yaw_controller/command',
                                              Float32, queue_size=100)

        # events
        QtCore.QObject.connect(self._widget.CheckManual,
                               QtCore.SIGNAL('toggled(bool)'),
                               self.on_CheckManual_toggled)

        QtCore.QObject.connect(self._widget.PitchSlider,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_PitchSlider_valueChanged)
        QtCore.QObject.connect(self._widget.PitchSpin,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_PitchSpin_valueChanged)

        QtCore.QObject.connect(self._widget.YawSlider,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_YawSlider_valueChanged)
        QtCore.QObject.connect(self._widget.YawSpin,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_YawSpin_valueChanged)
        
        QtCore.QObject.connect(self.timer,
                               QtCore.SIGNAL('timeout()'),
                               self.auto_update)

        # set manual box unnactive
        self._widget.CheckManual.setChecked(False)

    def shutdown_plugin(self):
        # unregister all
        self.pub_pitch_oculus.unregister()
        self.pub_yaw_oculus.unregister()

    def save_settings(self, plugin_settings, instance_settings):
        # TODO save intrinsic configuration, usually using:
        # instance_settings.set_value(k, v)
        pass

    def restore_settings(self, plugin_settings, instance_settings):
        # TODO restore intrinsic configuration, usually using:
        # v = instance_settings.value(k)
        pass

    # def trigger_configuration(self):
        # Comment in to signal that the plugin has a way to configure
        # This will enable a setting button (gear icon) in each dock widget title bar
        # Usually used to open a modal configuration dialog

    def auto_update(self):
        """
        Se llama cuando el timer llega a su valor de cuenta, y sirve para obtener los valores
        actuales de los sensores de las Oculus, además de para publicarlos gracias a los publishers
        específicos, así como mostrarlos en la interfaz. Además, cada vez que se ejecuta se comprueba
#.........这里部分代码省略.........
开发者ID:raulperula,项目名称:oculus_rift,代码行数:103,代码来源:controller.py


注:本文中的python_qt_binding.QtGui.QWidget.setFixedHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。