Example #1
0
 def add_module_list(self):
     """
     adds a module list to the widget.
     :return: <QtWidgets.QListWidget>
     """
     list = QtWidgets.QListWidget(self)
     list.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                        QtWidgets.QSizePolicy.Expanding)
     list.setMinimumHeight(self.parent.HEIGHT - 50)
     list.setMinimumWidth(self.parent.WIDTH - 50)
     return list
Example #2
0
    def __init__(self, parent=None, list_items=()):
        super(ModulesList, self).__init__(parent)
        self.selected_item = None

        self.list_items = list_items

        vertical_layout = QtWidgets.QVBoxLayout()
        self.list_widget = QtWidgets.QListWidget()
        vertical_layout.addWidget(self.list_widget)

        horizontal_layout = QtWidgets.QHBoxLayout()
        self.ok_button = QtWidgets.QPushButton("Ok")
        self.cancel_button = QtWidgets.QPushButton("Cancel")
        horizontal_layout.addWidget(self.ok_button)
        horizontal_layout.addWidget(self.cancel_button)

        vertical_layout.addLayout(horizontal_layout)

        self.list_widget.addItems(self.list_items)

        self.create_connections()

        self.setLayout(vertical_layout)
        self.setWindowTitle("Modules List")