Python PyQt5.QtWidgets.QListWidget() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QListWidget(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: Traffic-Rules-Violation-Detection   Author: rahatzamancse   File: Archive.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(ArchiveWindow, self).__init__(parent)
        loadUi('UI/Archive.ui', self)

        self.cancel.clicked.connect(self.close)

        self.log_tabwidget.clear()
        self.violation_list = QListWidget(self)
        self.log_tabwidget.addTab(self.violation_list, "Violations")
        self.violation_list.clear()
        rows = Database.get_instance().get_violations_from_cam(None, cleared=True)
        for row in rows:
            listWidget = ViolationItem()
            listWidget.setData(row)
            listWidgetItem = QtWidgets.QListWidgetItem(self.violation_list)
            listWidgetItem.setSizeHint(listWidget.sizeHint())
            self.violation_list.addItem(listWidgetItem)
            self.violation_list.setItemWidget(listWidgetItem, listWidget) 
Example 2
Project: qhangups   Author: xmikos   File: ui_qhangupsconversationslist.py    License: GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, QHangupsConversationsList):
        QHangupsConversationsList.setObjectName("QHangupsConversationsList")
        QHangupsConversationsList.resize(250, 500)
        self.centralwidget = QtWidgets.QWidget(QHangupsConversationsList)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.conversationsListWidget = QtWidgets.QListWidget(self.centralwidget)
        self.conversationsListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.conversationsListWidget.setObjectName("conversationsListWidget")
        self.verticalLayout.addWidget(self.conversationsListWidget)
        QHangupsConversationsList.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(QHangupsConversationsList)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 250, 27))
        self.menubar.setObjectName("menubar")
        QHangupsConversationsList.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(QHangupsConversationsList)
        self.statusbar.setObjectName("statusbar")
        QHangupsConversationsList.setStatusBar(self.statusbar)

        self.retranslateUi(QHangupsConversationsList)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversationsList) 
Example 3
Project: visma   Author: aerospaceresearch   File: window.py    License: GNU General Public License v3.0 6 votes vote down vote up
def equationsLayout(self):
        self.myQListWidget = QtWidgets.QListWidget(self)
        for index, name in self.equations:
            myQCustomQWidget = QCustomQWidget()
            myQCustomQWidget.setTextUp(index)
            myQCustomQWidget.setTextDown(name)
            myQListWidgetItem = QtWidgets.QListWidgetItem(self.myQListWidget)
            myQListWidgetItem.setSizeHint(myQCustomQWidget.sizeHint())
            self.myQListWidget.addItem(myQListWidgetItem)
            self.myQListWidget.setItemWidget(
                myQListWidgetItem, myQCustomQWidget)
        self.myQListWidget.resize(400, 300)
        self.equationListVbox.addWidget(self.myQListWidget)
        self.myQListWidget.itemClicked.connect(self.Clicked)
        self.clearButton = QtWidgets.QPushButton('Clear equations')
        self.clearButton.clicked.connect(self.clearHistory)
        self.clearButton.setStatusTip("Clear history")
        self.equationListVbox.addWidget(self.clearButton)
        return self.equationListVbox 
Example 4
Project: kawaii-player   Author: kanishka-linux   File: settings_widget.py    License: GNU General Public License v3.0 6 votes vote down vote up
def library(self):
        self.list_library = QtWidgets.QListWidget()
        self.list_library.setObjectName("list_library")
        self.add_library_btn = QPushButtonExtra()
        self.add_library_btn.setObjectName('add_library_btn')
        self.add_library_btn.setText(" Add Folder ")
        self.remove_library_btn = QPushButtonExtra()
        self.remove_library_btn.setObjectName('remove_library_btn')
        self.remove_library_btn.setText(' Remove Folder ')
        self.add_library_btn.setMinimumHeight(32)
        self.remove_library_btn.setMinimumHeight(32)
        self.gl5.addWidget(self.list_library, 0, 0, 1, 2)
        self.gl5.addWidget(self.add_library_btn, 1, 0, 1, 1)
        self.gl5.addWidget(self.remove_library_btn, 1, 1, 1, 1)
        if os.path.exists(self.library_file_name):
            lines = open_files(self.library_file_name, True)
            self.list_library.clear()
            for i in lines:
                i = i.strip()
                self.list_library.addItem(i)
        self.add_library_btn.clicked_connect(self.add_folder_to_library)
        self.remove_library_btn.clicked_connect(self.remove_folder_from_library) 
Example 5
Project: imperialism-remake   Author: Trilarion   File: lobby.py    License: GNU General Public License v3.0 6 votes vote down vote up
def received_titles(self, client, channel, action, content):
        """
            Received all available scenario titles as a list together with the file names
            which act as unique identifiers. The list is sorted by title.
        """

        # immediately close the channel, we do not want to get this content twice
        client.remove_channel(channel)

        # unpack content
        scenario_titles, self.scenario_files = zip(*content)

        # create list widget
        self.list = QtWidgets.QListWidget()
        self.list.itemSelectionChanged.connect(self.selection_changed)
        self.list.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        self.list.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.list.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.list.addItems(scenario_titles)
        # set height size fixed to content
        self.list.setFixedHeight(self.list.sizeHintForRow(0) * self.list.count() + 2 * self.list.frameWidth())

        self.layout.addWidget(self.list) 
Example 6
Project: pychemqt   Author: jjgomera   File: UI_unitConverter.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(UI_unitConverter, self).__init__(parent)
        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt", "Units converter"))

        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        self.lista = QtWidgets.QListWidget()
        self.lista.itemDoubleClicked.connect(self.showChildWindow)
        self.verticalLayout.addWidget(self.lista)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.rejected.connect(self.reject)
        self.verticalLayout.addWidget(self.buttonBox)
        for unidad in _all:
            self.lista.addItem(unidad.__title__)

        self.lista.setCurrentRow(-1)
        logging.info(QtWidgets.QApplication.translate(
            "pychemqt", "Starting unit converte tool")) 
Example 7
Project: peakonly   Author: Arseha   File: auxilary_utils.py    License: MIT License 6 votes vote down vote up
def __init__(self, label, parent=None):
        super().__init__(parent)

        button = QtWidgets.QToolButton()
        button.setText('...')
        button.clicked.connect(self.add_folder)

        self.lineEdit = QtWidgets.QToolButton()
        self.lineEdit.setText(label)

        folder_getter_layout = QtWidgets.QHBoxLayout()
        folder_getter_layout.addWidget(self.lineEdit, 85)
        folder_getter_layout.addWidget(button, 15)

        self.list_widget = QtWidgets.QListWidget()
        self.list_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.addLayout(folder_getter_layout)
        main_layout.addWidget(self.list_widget)

        self.setLayout(main_layout) 
Example 8
Project: autokey   Author: autokey   File: centralwidget.py    License: GNU General Public License v3.0 6 votes vote down vote up
def on_save_log(self):
        file_name, _ = QFileDialog.getSaveFileName(  # second return value contains the used file type filter.
            self.window(),
            "Save log file",
            "",
            ""  # TODO: File type filter. Maybe "*.log"?
        )
        del _  # We are only interested in the selected file name
        if file_name:
            list_widget = self.listWidget  # type: QListWidget
            item_texts = (list_widget.item(row).text() for row in range(list_widget.count()))
            log_text = "\n".join(item_texts) + "\n"
            try:
                with open(file_name, "w") as log_file:
                    log_file.write(log_text)
            except IOError:
                logger.exception("Error saving log file")
            else:
                self.on_clear_log()  # Error log saved, so clear the previously saved entries 
Example 9
def __init__(self, parent=None):
        super(ArchiveWindow, self).__init__(parent)
        loadUi('UI/Archive.ui', self)

        self.cancel.clicked.connect(self.close)

        self.log_tabwidget.clear()
        self.violation_list = QListWidget(self)
        self.log_tabwidget.addTab(self.violation_list, "Violations")
        self.violation_list.clear()
        rows = Database.getInstance().getViolationsFromCam(None, cleared=True)
        for row in rows:
            listWidget = ViolationItem()
            listWidget.setData(row)
            listWidgetItem = QtWidgets.QListWidgetItem(self.violation_list)
            listWidgetItem.setSizeHint(listWidget.sizeHint())
            self.violation_list.addItem(listWidgetItem)
            self.violation_list.setItemWidget(listWidgetItem, listWidget) 
Example 10
Project: PyRAT   Author: birgander2   File: Dialogs.py    License: Mozilla Public License 2.0 6 votes vote down vote up
def __init__(self, tables, current=0, parent=None):
        super(PaletteSelector, self).__init__(parent)
        self.pnames, self.pcolors = tables
        self.palette = current
        self.setWindowTitle("Colour palette chooser")
        layout = QtWidgets.QVBoxLayout(self)
        self.showpalette = QtWidgets.QLabel()
        self.update(self.palette)
        wid = QtWidgets.QLabel("Select colour palette:")
        layout.addWidget(self.showpalette)
        layout.addWidget(wid)
        self.list = QtWidgets.QListWidget()
        self.list.addItems(self.pnames)
        layout.addWidget(self.list)
        self.buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
        self.list.itemClicked.connect(self.item_click) 
Example 11
Project: tinydecred   Author: decred   File: screens.py    License: ISC License 6 votes vote down vote up
def __init__(self):
        super().__init__()
        self.isPoppable = True
        self.canGoHome = True

        self.wgt.setMinimumWidth(400)
        self.wgt.setMinimumHeight(225)

        self.liveTickets = {}

        # Network statistics
        lbl = Q.makeLabel("Live Tickets", 18)
        self.layout.addWidget(lbl, 0, Q.ALIGN_LEFT)

        # List of live tickets. Click to open dcrdata in browser.
        wgt = self.ticketsWgt = QtWidgets.QListWidget()
        wgt.itemClicked.connect(self.onTicketItemClicked)
        self.layout.addWidget(wgt, 0, Q.ALIGN_LEFT) 
Example 12
Project: tf-pose   Author: SrikanthVelpuri   File: exportDialogTemplate_pyqt5.py    License: Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(241, 367)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
        self.itemTree = QtWidgets.QTreeWidget(Form)
        self.itemTree.setObjectName("itemTree")
        self.itemTree.headerItem().setText(0, "1")
        self.itemTree.header().setVisible(False)
        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
        self.label_2 = QtWidgets.QLabel(Form)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
        self.formatList = QtWidgets.QListWidget(Form)
        self.formatList.setObjectName("formatList")
        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
        self.exportBtn = QtWidgets.QPushButton(Form)
        self.exportBtn.setObjectName("exportBtn")
        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
        self.closeBtn = QtWidgets.QPushButton(Form)
        self.closeBtn.setObjectName("closeBtn")
        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
        self.paramTree = ParameterTree(Form)
        self.paramTree.setObjectName("paramTree")
        self.paramTree.headerItem().setText(0, "1")
        self.paramTree.header().setVisible(False)
        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
        self.label_3 = QtWidgets.QLabel(Form)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
        self.copyBtn = QtWidgets.QPushButton(Form)
        self.copyBtn.setObjectName("copyBtn")
        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 13
Project: visma   Author: aerospaceresearch   File: window.py    License: GNU General Public License v3.0 5 votes vote down vote up
def clearHistory(self):

        for i in reversed(range(self.equationListVbox.count())):
            self.equationListVbox.itemAt(i).widget().setParent(None)

        self.equations = [('No equations stored', '')]

        file = open('local/eqn-list.vis', 'r+')
        file.truncate()
        self.myQListWidget = QtWidgets.QListWidget(self)
        i = 0
        for index, name in self.equations:
            if i != 0:
                file.write("\n")
            file.write(name)
            myQCustomQWidget = QCustomQWidget()
            myQCustomQWidget.setTextUp(index)
            myQCustomQWidget.setTextDown(name)
            myQListWidgetItem = QtWidgets.QListWidgetItem(self.myQListWidget)
            myQListWidgetItem.setSizeHint(myQCustomQWidget.sizeHint())
            self.myQListWidget.addItem(myQListWidgetItem)
            self.myQListWidget.setItemWidget(
                myQListWidgetItem, myQCustomQWidget)
            i += 1
        file.close()
        self.myQListWidget.resize(400, 300)
        self.myQListWidget.itemClicked.connect(self.Clicked)
        self.equationListVbox.addWidget(self.myQListWidget)
        self.clearButton = QtWidgets.QPushButton('Clear equations')
        self.clearButton.clicked.connect(self.clearHistory)
        self.equationListVbox.addWidget(self.clearButton)
        return self.equationListVbox 
Example 14
Project: imperialism-remake   Author: Trilarion   File: lobby.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        layout = QtWidgets.QHBoxLayout(self)

        self.client_list_widget = QtWidgets.QListWidget()
#       list.itemSelectionChanged.connect(self.selection_changed)
#       list.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.client_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.client_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.client_list_widget.setFixedWidth(200)
        layout.addWidget(qt.wrap_in_groupbox(self.client_list_widget, 'Players'))

        self.chat_log_text_edit = QtWidgets.QTextEdit()
        self.chat_log_text_edit.setEnabled(False)
        chat_log_group = qt.wrap_in_groupbox(self.chat_log_text_edit, 'Chat log')

        self.chat_input_edit = QtWidgets.QLineEdit()
        self.chat_input_edit.returnPressed.connect(self.send_chat_message)
        chat_input_group = qt.wrap_in_groupbox(self.chat_input_edit, 'Chat input')
        layout.addLayout(qt.wrap_in_boxlayout((chat_log_group, chat_input_group), horizontal=False, add_stretch=False),
                         stretch=1)

        # connection to server

        # chat messages
        local_network_client.connect_to_channel(constants.C.CHAT, self.receive_chat_messages)
        local_network_client.send(constants.C.CHAT, constants.M.CHAT_SUBSCRIBE)

        # LOBBY
        local_network_client.connect_to_channel(constants.C.LOBBY, self.receive_lobby_messages)
        self.request_updated_client_list()

        # set timer for connected client updates
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.request_updated_client_list)
        self.timer.setInterval(5000)
        self.timer.start() 
Example 15
Project: imperialism-remake   Author: Trilarion   File: lobby.py    License: GNU General Public License v3.0 5 votes vote down vote up
def selection_changed(self):
        """
            A scenario title has been selected in the list.
        """
        # get selected file
        row = self.list.currentRow()  # only useful if QListWidget does not sort by itself
        scenario_file = self.scenario_files[row]
        # emit title selected signal
        self.title_selected.emit(scenario_file) 
Example 16
Project: rainbow   Author: Ledger-Donjon   File: interface.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def add_widgets(self):
        self.plot_ = plot(self.etraces, highlight=self.highlight, parent=self)
        self.instr_list = qt.QListWidget(self)
        self.instr_list.itemClicked.connect(self.instr_change_focus)
        self.instr_list.currentRowChanged.connect(self.rowchange)
        self.instr_list.addItems(self.instr) 
Example 17
Project: pip-gui   Author: GDGVIT   File: updateScreen.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(427, 456)
        self.listWidget = QtWidgets.QListWidget(Form)
        self.listWidget.setGeometry(QtCore.QRect(10, 60, 261, 381))
        self.listWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.MultiSelection)
        self.listWidget.setObjectName(_fromUtf8("listWidget"))
        self.verticalLayoutWidget = QtWidgets.QWidget(Form)
        self.verticalLayoutWidget.setGeometry(
            QtCore.QRect(290, 60, 121, 98))
        self.verticalLayoutWidget.setObjectName(
            _fromUtf8("verticalLayoutWidget"))
        self.verticalLayout = QtWidgets.QVBoxLayout(
            self.verticalLayoutWidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.btnUpdate = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.btnUpdate.setObjectName(_fromUtf8("btnUpdate"))
        self.verticalLayout.addWidget(self.btnUpdate)
        self.btnUpdateAll = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.btnUpdateAll.setObjectName(_fromUtf8("btnUpdateAll"))
        self.verticalLayout.addWidget(self.btnUpdateAll)
        self.btnBack = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.btnBack.setObjectName(_fromUtf8("btnBack"))
        self.verticalLayout.addWidget(self.btnBack)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(10, 20, 401, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 18
Project: pip-gui   Author: GDGVIT   File: uninstallScreen.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(428, 457)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(10, 20, 401, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))
        self.listWidget = QtWidgets.QListWidget(Form)
        self.listWidget.setGeometry(QtCore.QRect(10, 60, 261, 381))
        self.listWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.MultiSelection)
        self.listWidget.setObjectName(_fromUtf8("listWidget"))
        self.verticalLayoutWidget = QtWidgets.QWidget(Form)
        self.verticalLayoutWidget.setGeometry(
            QtCore.QRect(290, 60, 121, 98))
        self.verticalLayoutWidget.setObjectName(
            _fromUtf8("verticalLayoutWidget"))
        self.verticalLayout = QtWidgets.QVBoxLayout(
            self.verticalLayoutWidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.btnUninstall = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.btnUninstall.setObjectName(_fromUtf8("btnUninstall"))
        self.verticalLayout.addWidget(self.btnUninstall)
        self.btnUninstallAll = QtWidgets.QPushButton(
            self.verticalLayoutWidget)
        self.btnUninstallAll.setObjectName(_fromUtf8("btnUninstallAll"))
        self.verticalLayout.addWidget(self.btnUninstallAll)
        self.btnBack = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.btnBack.setObjectName(_fromUtf8("btnBack"))
        self.verticalLayout.addWidget(self.btnBack)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 19
Project: pychemqt   Author: jjgomera   File: UI_Preferences.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config, parent=None):
        """Constructor, opcional config parameter to input project config"""
        super(Preferences, self).__init__(parent)
        self.config = config
        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt", "Preferences"))

        layout = QtWidgets.QGridLayout(self)
        self.lista = QtWidgets.QListWidget()
        self.lista.setIconSize(QtCore.QSize(20, 20))
        self.lista.setSizePolicy(
            QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
        layout.addWidget(self.lista, 1, 1)
        self.stacked = QtWidgets.QStackedWidget()
        layout.addWidget(self.stacked, 1, 2)
        for icon, dialog, title in self.classes:
            self.stacked.addWidget(dialog(config))
            icon = QtGui.QIcon(QtGui.QPixmap(
                os.environ["pychemqt"]+"/images/%s" % icon))
            self.lista.addItem(QtWidgets.QListWidgetItem(icon, title))

        self.lista.currentRowChanged.connect(self.stacked.setCurrentIndex)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 2, 2) 
Example 20
Project: peakonly   Author: Arseha   File: auxilary_utils.py    License: MIT License 5 votes vote down vote up
def mousePressEvent(self, QMouseEvent):
        super(QtWidgets.QListWidget, self).mousePressEvent(QMouseEvent)
        if QMouseEvent.button() == QtCore.Qt.RightButton and self.right_click is not None:
            self.right_click() 
Example 21
Project: Qt5-Python-GUI-Programming-Cookbook   Author: PacktPublishing   File: demoListWidget1.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(686, 287)
        self.listWidgetDiagnosis = QtWidgets.QListWidget(Dialog)
        self.listWidgetDiagnosis.setGeometry(QtCore.QRect(280, 20, 351, 171))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidgetDiagnosis.setFont(font)
        self.listWidgetDiagnosis.setObjectName("listWidgetDiagnosis")
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        self.labelTest = QtWidgets.QLabel(Dialog)
        self.labelTest.setGeometry(QtCore.QRect(40, 230, 621, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.labelTest.setFont(font)
        self.labelTest.setText("")
        self.labelTest.setObjectName("labelTest")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(30, 10, 241, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName("label")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 22
Project: Qt5-Python-GUI-Programming-Cookbook   Author: PacktPublishing   File: demoListWidget2.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(729, 412)
        self.listWidgetDiagnosis = QtWidgets.QListWidget(Dialog)
        self.listWidgetDiagnosis.setGeometry(QtCore.QRect(200, 20, 351, 171))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidgetDiagnosis.setFont(font)
        self.listWidgetDiagnosis.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
        self.listWidgetDiagnosis.setObjectName("listWidgetDiagnosis")
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        self.labelTest = QtWidgets.QLabel(Dialog)
        self.labelTest.setGeometry(QtCore.QRect(20, 230, 171, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.labelTest.setFont(font)
        self.labelTest.setObjectName("labelTest")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(30, 10, 151, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.listWidgetSelectedTests = QtWidgets.QListWidget(Dialog)
        self.listWidgetSelectedTests.setGeometry(QtCore.QRect(200, 220, 351, 192))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidgetSelectedTests.setFont(font)
        self.listWidgetSelectedTests.setObjectName("listWidgetSelectedTests")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 23
Project: Qt5-Python-GUI-Programming-Cookbook   Author: PacktPublishing   File: demoListWidget3.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(734, 270)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 191, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEditFoodItem = QtWidgets.QLineEdit(Dialog)
        self.lineEditFoodItem.setGeometry(QtCore.QRect(210, 20, 201, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.lineEditFoodItem.setFont(font)
        self.lineEditFoodItem.setObjectName("lineEditFoodItem")
        self.pushButtonAdd = QtWidgets.QPushButton(Dialog)
        self.pushButtonAdd.setGeometry(QtCore.QRect(110, 72, 111, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.pushButtonAdd.setFont(font)
        self.pushButtonAdd.setObjectName("pushButtonAdd")
        self.listWidgetSelectedItems = QtWidgets.QListWidget(Dialog)
        self.listWidgetSelectedItems.setGeometry(QtCore.QRect(430, 20, 256, 221))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.listWidgetSelectedItems.setFont(font)
        self.listWidgetSelectedItems.setObjectName("listWidgetSelectedItems")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 24
Project: CNNArt   Author: thomaskuestner   File: LabelChoose.py    License: Apache License 2.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(210, 311)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/Icons/list.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(10, 10, 121, 31))
        self.lineEdit.setObjectName("lineEdit")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(150, 10, 41, 31))
        self.pushButton.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/Icons/palette.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon1)
        self.pushButton.setObjectName("pushButton")
        self.listWidget = QtWidgets.QListWidget(Dialog)
        self.listWidget.setGeometry(QtCore.QRect(10, 50, 181, 221))
        self.listWidget.setObjectName("listWidget")
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(20, 280, 161, 21))
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).clicked.connect(self.validate)
        self.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel).clicked.connect(self.close)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 25
Project: superboucle   Author: Vampouille   File: device_manager_ui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(320, 229)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.list = QtWidgets.QListWidget(Dialog)
        self.list.setObjectName("list")
        self.gridLayout.addWidget(self.list, 0, 0, 1, 1)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.editButton = QtWidgets.QPushButton(Dialog)
        self.editButton.setObjectName("editButton")
        self.verticalLayout.addWidget(self.editButton)
        self.deleteButton = QtWidgets.QPushButton(Dialog)
        self.deleteButton.setObjectName("deleteButton")
        self.verticalLayout.addWidget(self.deleteButton)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.importButton = QtWidgets.QPushButton(Dialog)
        self.importButton.setObjectName("importButton")
        self.verticalLayout.addWidget(self.importButton)
        self.exportButton = QtWidgets.QPushButton(Dialog)
        self.exportButton.setObjectName("exportButton")
        self.verticalLayout.addWidget(self.exportButton)
        self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 26
Project: superboucle   Author: Vampouille   File: scene_manager_ui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(320, 333)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.scenelistList = QtWidgets.QListWidget(Dialog)
        self.scenelistList.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.scenelistList.setSizeIncrement(QtCore.QSize(100, 100))
        self.scenelistList.setMovement(QtWidgets.QListView.Static)
        self.scenelistList.setResizeMode(QtWidgets.QListView.Adjust)
        self.scenelistList.setObjectName("scenelistList")
        self.horizontalLayout.addWidget(self.scenelistList)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.loadScenesBtn = QtWidgets.QPushButton(Dialog)
        self.loadScenesBtn.setObjectName("loadScenesBtn")
        self.verticalLayout_3.addWidget(self.loadScenesBtn)
        self.addScenesBtn = QtWidgets.QPushButton(Dialog)
        self.addScenesBtn.setObjectName("addScenesBtn")
        self.verticalLayout_3.addWidget(self.addScenesBtn)
        self.removeScenesBtn = QtWidgets.QPushButton(Dialog)
        self.removeScenesBtn.setObjectName("removeScenesBtn")
        self.verticalLayout_3.addWidget(self.removeScenesBtn)
        self.preview = QtWidgets.QGridLayout()
        self.preview.setSpacing(2)
        self.preview.setObjectName("preview")
        self.verticalLayout_3.addLayout(self.preview)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_3.addItem(spacerItem)
        self.setInitialSceneBtn = QtWidgets.QPushButton(Dialog)
        self.setInitialSceneBtn.setObjectName("setInitialSceneBtn")
        self.verticalLayout_3.addWidget(self.setInitialSceneBtn)
        self.horizontalLayout.addLayout(self.verticalLayout_3)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 27
Project: superboucle   Author: Vampouille   File: port_manager_ui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(320, 295)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.portList = QtWidgets.QListWidget(Dialog)
        self.portList.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.portList.setSizeIncrement(QtCore.QSize(100, 100))
        self.portList.setMovement(QtWidgets.QListView.Static)
        self.portList.setResizeMode(QtWidgets.QListView.Adjust)
        self.portList.setObjectName("portList")
        self.horizontalLayout.addWidget(self.portList)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.addPortBtn = QtWidgets.QPushButton(Dialog)
        self.addPortBtn.setObjectName("addPortBtn")
        self.verticalLayout_3.addWidget(self.addPortBtn)
        self.removePortBtn = QtWidgets.QPushButton(Dialog)
        self.removePortBtn.setObjectName("removePortBtn")
        self.verticalLayout_3.addWidget(self.removePortBtn)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_3.addItem(spacerItem)
        self.loadPortlistBtn = QtWidgets.QPushButton(Dialog)
        self.loadPortlistBtn.setObjectName("loadPortlistBtn")
        self.verticalLayout_3.addWidget(self.loadPortlistBtn)
        self.savePortlistBtn = QtWidgets.QPushButton(Dialog)
        self.savePortlistBtn.setObjectName("savePortlistBtn")
        self.verticalLayout_3.addWidget(self.savePortlistBtn)
        self.horizontalLayout.addLayout(self.verticalLayout_3)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
        self.autoconnectCBox = QtWidgets.QCheckBox(Dialog)
        self.autoconnectCBox.setObjectName("autoconnectCBox")
        self.gridLayout.addWidget(self.autoconnectCBox, 1, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 28
Project: superboucle   Author: Vampouille   File: playlist_ui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(320, 333)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.playlistList = QtWidgets.QListWidget(Dialog)
        self.playlistList.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.playlistList.setSizeIncrement(QtCore.QSize(100, 100))
        self.playlistList.setMovement(QtWidgets.QListView.Static)
        self.playlistList.setResizeMode(QtWidgets.QListView.Adjust)
        self.playlistList.setObjectName("playlistList")
        self.horizontalLayout.addWidget(self.playlistList)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.loadSongBtn = QtWidgets.QPushButton(Dialog)
        self.loadSongBtn.setObjectName("loadSongBtn")
        self.verticalLayout_3.addWidget(self.loadSongBtn)
        self.addSongsBtn = QtWidgets.QPushButton(Dialog)
        self.addSongsBtn.setObjectName("addSongsBtn")
        self.verticalLayout_3.addWidget(self.addSongsBtn)
        self.removeSongBtn = QtWidgets.QPushButton(Dialog)
        self.removeSongBtn.setObjectName("removeSongBtn")
        self.verticalLayout_3.addWidget(self.removeSongBtn)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_3.addItem(spacerItem)
        self.loadPlaylistBtn = QtWidgets.QPushButton(Dialog)
        self.loadPlaylistBtn.setObjectName("loadPlaylistBtn")
        self.verticalLayout_3.addWidget(self.loadPlaylistBtn)
        self.savePlaylistBtn = QtWidgets.QPushButton(Dialog)
        self.savePlaylistBtn.setObjectName("savePlaylistBtn")
        self.verticalLayout_3.addWidget(self.savePlaylistBtn)
        self.horizontalLayout.addLayout(self.verticalLayout_3)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 29
Project: autokey   Author: autokey   File: centralwidget.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, list_widget: QListWidget, app):
        logging.Handler.__init__(self)
        self.widget = list_widget
        self.app = app
        self.level = logging.DEBUG

        root_logger = logging.getLogger()
        log_format = "%(message)s"
        root_logger.addHandler(self)
        self.setFormatter(logging.Formatter(log_format)) 
Example 30
Project: Dwarf   Author: iGio90   File: dialog_list.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None, setup_list_cb=None, setup_list_cb_args=None,
                 double_click_to_accept=False, checkable=False):
        super(ListDialog, self).__init__(parent)

        self.right_click_handler = None

        layout = QVBoxLayout(self)
        self.list = DwarfListView()  # QListWidget()

        self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        if double_click_to_accept:
            self.list.doubleClicked.connect(self.accept)

        if setup_list_cb is not None:
            setup_list_cb(self.list, setup_list_cb_args)

        layout.addWidget(self.list)
        if checkable:
            buttons = QHBoxLayout()
            select_all = QPushButton('select all')
            select_all.clicked.connect(self.select_all)
            buttons.addWidget(select_all)
            unselect_all = QPushButton('unselect all')
            unselect_all.clicked.connect(self.unselect_all)
            buttons.addWidget(unselect_all)
            ok = QPushButton('ok')
            ok.clicked.connect(self.accept)
            buttons.addWidget(ok)
            cancel = QPushButton('cancel')
            cancel.clicked.connect(self.close)
            buttons.addWidget(cancel)
            layout.addLayout(buttons)