Python PySide2.QtWidgets.QListWidget() Examples

The following are 5 code examples of PySide2.QtWidgets.QListWidget(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PySide2.QtWidgets , or try the search function .
Example #1
Source File: ToolBox.py    From PyAero with MIT License 6 votes vote down vote up
def keyPressEvent(self, event):
        key = event.key()

        if key == QtCore.Qt.Key_Delete:
            item = self.selectedItems()[0]
            row = self.row(item)
            self.takeItem(row)

            for airfoil in self.parent.airfoils:
                if item.text() == airfoil.name:
                    name = airfoil.name
                    self.parent.slots.removeAirfoil(name=name)
                    break

        # call original implementation of QListWidget keyPressEvent handler
        super().keyPressEvent(event) 
Example #2
Source File: excel_sheet_selection.py    From GridCal with GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, ExcelSelectionDialog):
        ExcelSelectionDialog.setObjectName("ExcelSelectionDialog")
        ExcelSelectionDialog.resize(272, 229)
        ExcelSelectionDialog.setMaximumSize(QtCore.QSize(272, 229))
        ExcelSelectionDialog.setModal(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(ExcelSelectionDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.sheets_list = QtWidgets.QListWidget(ExcelSelectionDialog)
        self.sheets_list.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.sheets_list.setObjectName("sheets_list")
        self.verticalLayout.addWidget(self.sheets_list)
        self.buttonBox = QtWidgets.QDialogButtonBox(ExcelSelectionDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(ExcelSelectionDialog)
        self.buttonBox.accepted.connect(ExcelSelectionDialog.accept)
        self.buttonBox.rejected.connect(ExcelSelectionDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(ExcelSelectionDialog) 
Example #3
Source File: FileSystemWidget.py    From pyrdp with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, root: Directory, parent: QObject = None):
        """
        :param root: root of all directories. Directories in root will be displayed with drive icons.
        :param parent: parent object.
        """

        super().__init__(parent)
        self.root = root
        self.breadcrumbLabel = QLabel()

        self.titleLabel = QLabel()
        self.titleLabel.setStyleSheet("font-weight: bold")

        self.titleSeparator: QFrame = QFrame()
        self.titleSeparator.setFrameShape(QFrame.HLine)

        self.listWidget = QListWidget()
        self.listWidget.setSortingEnabled(True)
        self.listWidget.setContextMenuPolicy(Qt.CustomContextMenu)
        self.listWidget.customContextMenuRequested.connect(self.onCustomContextMenu)

        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.addWidget(self.breadcrumbLabel)
        self.verticalLayout.addWidget(self.listWidget)

        self.setLayout(self.verticalLayout)
        self.listWidget.itemDoubleClicked.connect(self.onItemDoubleClicked)

        self.currentPath: Path = Path("/")
        self.currentDirectory: Directory = root
        self.listCurrentDirectory()

        self.currentDirectory.addObserver(self) 
Example #4
Source File: copy_bounding_box_dialog.py    From metashape-scripts with MIT License 5 votes vote down vote up
def __init__(self, parent):

        QtWidgets.QDialog.__init__(self, parent)
        self.setWindowTitle("Copy bounding box")

        self.labelFrom = QtWidgets.QLabel("From")
        self.labelTo = QtWidgets.QLabel("To")

        self.fromChunk = QtWidgets.QComboBox()
        for chunk in Metashape.app.document.chunks:
            self.fromChunk.addItem(chunk.label)

        self.toChunks = QtWidgets.QListWidget()
        self.toChunks.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
        for chunk in Metashape.app.document.chunks:
            self.toChunks.addItem(chunk.label)

        self.btnOk = QtWidgets.QPushButton("Ok")
        self.btnOk.setFixedSize(90, 50)
        self.btnOk.setToolTip("Copy bounding box to all selected chunks")

        self.btnQuit = QtWidgets.QPushButton("Close")
        self.btnQuit.setFixedSize(90, 50)

        layout = QtWidgets.QGridLayout()  # creating layout
        layout.addWidget(self.labelFrom, 0, 0)
        layout.addWidget(self.fromChunk, 0, 1)

        layout.addWidget(self.labelTo, 0, 2)
        layout.addWidget(self.toChunks, 0, 3)

        layout.addWidget(self.btnOk, 1, 1)
        layout.addWidget(self.btnQuit, 1, 3)

        self.setLayout(layout)

        QtCore.QObject.connect(self.btnOk, QtCore.SIGNAL("clicked()"), self.copyBoundingBox)
        QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))

        self.exec() 
Example #5
Source File: MainWindow.py    From HS_Downloader with MIT License 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(476, 263)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.searchButton = QtWidgets.QPushButton(self.centralwidget)
        self.searchButton.setGeometry(QtCore.QRect(340, 10, 131, 31))
        self.searchButton.setObjectName("searchButton")
        self.selectAll = QtWidgets.QPushButton(self.centralwidget)
        self.selectAll.setGeometry(QtCore.QRect(340, 55, 131, 31))
        self.selectAll.setObjectName("selectAll")
        self.deselectAll = QtWidgets.QPushButton(self.centralwidget)
        self.deselectAll.setGeometry(QtCore.QRect(340, 90, 131, 31))
        self.deselectAll.setObjectName("deselectAll")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(340, 35, 131, 31))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.downloadButton = QtWidgets.QPushButton(self.centralwidget)
        self.downloadButton.setGeometry(QtCore.QRect(340, 220, 131, 31))
        self.downloadButton.setObjectName("downloadButton")
        self.animeView = QtWidgets.QListWidget(self.centralwidget)
        self.animeView.setGeometry(QtCore.QRect(10, 50, 321, 201))
        self.animeView.setObjectName("animeView")
        self.searchField = QtWidgets.QLineEdit(self.centralwidget)
        self.searchField.setGeometry(QtCore.QRect(10, 10, 321, 31))
        self.searchField.setObjectName("searchField")
        self.loadingStatus = QtWidgets.QLabel(self.centralwidget)
        self.loadingStatus.setEnabled(True)
        self.loadingStatus.setGeometry(QtCore.QRect(340, 160, 131, 20))
        font = QtGui.QFont()
        font.setFamily("Segoe UI")
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.loadingStatus.setFont(font)
        self.loadingStatus.setAlignment(QtCore.Qt.AlignCenter)
        self.loadingStatus.setObjectName("loadingStatus")
        self.selectQuality = QtWidgets.QComboBox(self.centralwidget)
        self.selectQuality.setGeometry(QtCore.QRect(340, 190, 131, 22))
        self.selectQuality.setObjectName("selectQuality")
        self.intellTurn = QtWidgets.QCheckBox(self.centralwidget)
        self.intellTurn.setGeometry(QtCore.QRect(340, 130, 131, 17))
        self.intellTurn.setObjectName("intellTurn")
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)