33 from python_qt_binding.QtCore
import Qt
34 from python_qt_binding.QtGui
import QColor
35 from python_qt_binding.QtWidgets
import QDialog, QDialogButtonBox, QGroupBox, QHBoxLayout, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout, QWidget
41 super(ListDialog, self).
__init__(parent)
48 self.
_button_box = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
49 self._button_box.accepted.connect(self.
save)
50 self._button_box.rejected.connect(self.reject)
52 self.setWindowTitle(title)
67 w_item = QListWidgetItem()
68 w_item.setText(item[0])
69 w_item.setFlags(w_item.flags() | Qt.ItemIsUserCheckable)
70 w_item.setCheckState(Qt.Checked
if item[1]
else Qt.Unchecked)
71 self._list_widget.addItem(w_item)
72 self._list_widget.setMinimumWidth(self._list_widget.sizeHintForColumn(0) + 5)
76 if item.checkState() == Qt.Checked:
77 item.setBackground(QColor(
"#ffffb2"))
79 item.setBackground(QColor(
"#ffffff"))
84 item = self._list_widget.item(i)
85 if item.checkState() == Qt.Checked:
86 self.selected_items.append(item.text())
91 error_code = super(ListDialog, self).
exec_()
def highlight_checked(item)
def create_list_widget(self, items)
def __init__(self, title, items, parent)