Ejemplo n.º 1
0
    def __init__(self, parent=None):

        super(DebugFlagsWidget, self).__init__(parent)

        self.setObjectName("Debug Flags")
        self.setMinimumSize(640, 300)
        self._listView = QtWidgets.QListView()
        self._tableWidget = QtWidgets.QTableWidget(0, 2)

        # Configure and populate the left list view
        self._listView.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)

        self._populateDebugFlagsListView(self._listView)

        # For some reason, the last two lines work, while combining them into one command throws an error.
        self._listModel = self._listView.selectionModel()
        self._listModel.selectionChanged.connect(self._onFlagSelectionChanged)

        # Configure the table widget
        self._tableWidget.horizontalHeader().setStretchLastSection(True)
        self._tableWidget.horizontalHeader().setDefaultSectionSize(200)
        self._tableWidget.setHorizontalHeaderLabels(
            ['Debug Symbol', 'Description'])
        self._tableWidget.verticalHeader().hide()

        self._tableWidget.itemClicked.connect(self._onDebugFlagChecked)

        # Set the layout
        lay = QtWidgets.QHBoxLayout()
        lay.addWidget(self._listView, 0)
        lay.addWidget(self._tableWidget, 1)
        self.setLayout(lay)
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        super(ArrayAttributeView, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        sliceLayout = QtWidgets.QHBoxLayout()
        layout.addLayout(sliceLayout)

        sliceLayout.addWidget(QtWidgets.QLabel("Slice:"))
        self._lineEdit = _SliceLineEdit()
        self._lineEdit.setPlaceholderText('e.g.: "0:5000", "::-1"')
        sliceLayout.addWidget(self._lineEdit)

        self._arrayAttrModel = _ArrayAttributeModel()
        self._listView = QtWidgets.QListView()
        self._listView.setUniformItemSizes(True)
        self._listView.setViewMode(QtWidgets.QListView.ListMode)
        self._listView.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        self._listView.setModel(self._arrayAttrModel)
        layout.addWidget(self._listView)

        self._lineEdit.SliceChanged.connect(self._arrayAttrModel.SetSlice)

        self._SetupContextMenu()
Ejemplo n.º 3
0
    def _setupLayouts(self):
        self.mainLayout = QtWidgets.QVBoxLayout(self)
        self.mainLayout.setContentsMargins(2, 2, 2, 2)
        self.mainLayout.setSpacing(1)
        self.listview = QtWidgets.QListView(parent=self)
        self.listview.setSelectionMode(self.listview.ExtendedSelection)
        self.listview.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listview.customContextMenuRequested.connect(self.contextMenu)
        self._setupFilter()

        self.mainLayout.addWidget(self.listview)

        self.proxySearch = QtCore.QSortFilterProxyModel(parent=self)
        self.proxySearch.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.listview.setModel(self.proxySearch)
        # self.listview.setSortingEnabled(True)
        self.selectionModel = self.listview.selectionModel()