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


Python QListView.setMinimumHeight方法代码示例

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


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

示例1: PatchPanel

# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import setMinimumHeight [as 别名]
class PatchPanel(QGroupBox):
    """Group of widget to patch an universe"""
    def __init__(self, parent):
        super(PatchPanel, self).__init__()

        self.ola = parent.ola

        self.parent = parent

        self.device_selected = None

        self.universe = None

        grid = QGridLayout()
        self.inputs_model = PortList(self, 'input_mode')
        self.outputs_model = PortList(self, 'output_mode')
        self.devices = QListView()
        self.devices_model = DeviceList(self)
        self.devices.setModel(self.devices_model)
        self.inputs = QListView()
        self.inputs.setModel(self.inputs_model)
        self.inputs.setMinimumHeight(400)
        self.inputs.setMinimumHeight(120)
        self.outputs = QListView()
        self.outputs.setModel(self.outputs_model)
        self.outputs.setMinimumHeight(400)
        self.outputs.setMinimumHeight(120)

        # Universe Selected Change
        self.devices.selectionModel().selectionChanged.connect(self.device_selection_changed)

        devices_label = QLabel('Devices')
        grid.addWidget(devices_label, 0, 0, 1, 1)
        grid.addWidget(self.devices, 1, 0, 21, 1)
        inputs_label = QLabel('Inputs')
        grid.addWidget(inputs_label, 0, 1, 1, 1)
        grid.addWidget(self.inputs, 1, 1, 10, 1)
        outputs_label = QLabel('Outputs')
        grid.addWidget(outputs_label, 11, 1, 1, 1)
        grid.addWidget(self.outputs, 12, 1, 10, 1)
        grid.setSpacing(5)
        self.setLayout(grid)

    def display_ports(self, universe=None):
        """
        Request a list of Devices
        if universe == None, a list of None-Already-Patched ports is send

        """
        if universe is None:
            result = self.ola.client.GetCandidatePorts(self.GetCandidatePortsCallback, None)
            return result
        result = self.ola.client.FetchDevices(self.GetDevicesCallback, 0)
        return result

    def GetCandidatePortsCallback(self, status, devices):
        """
        Called for a new universe
        """
        if status.Succeeded():
            # clear the list of devices
            self.devices_model.devices = []
            if debug:
                print('found', len(devices), 'candidate devices')
            for device in devices:
                self.devices_model.devices.append(device)
        self.parent.ola.devicesList.emit()
        self.refresh_ports()

    def GetDevicesCallback(self, status, devices):
        """
        Fill-in universe menus with candidate devices/ports
        We need to make menus checkable to be able to patch ports
        """
        if status.Succeeded():
            # clear the list of devices
            self.devices_model.devices = []
            for device in devices:
                if device.input_ports == []:
                    # there is no input ports
                    if device.output_ports == []:
                        # no in + no out = no device
                        pass
                    else:
                        self.devices_model.devices.append(device)
                else:
                    self.devices_model.devices.append(device)
            if debug:
                print('found', len(self.devices_model.devices), 'devices')
        self.parent.ola.devicesList.emit()
        self.refresh_ports()
        # if there was a selection before, restore it
        #if self.device_selected:
            #self.devices.setSelection(self.device_selected)

    def refresh_ports(self):
        device = self.device_selected
        if device:
            # reset the models of inputs and outputs
            self.inputs_model.ports = []
#.........这里部分代码省略.........
开发者ID:PixelStereo,项目名称:ola-pyqt-gui,代码行数:103,代码来源:patch.py


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