本文整理汇总了Python中PyQt4.Qt.QListWidget.storage方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.storage方法的具体用法?Python QListWidget.storage怎么用?Python QListWidget.storage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QListWidget
的用法示例。
在下文中一共展示了QListWidget.storage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.Qt import QListWidget [as 别名]
# 或者: from PyQt4.Qt.QListWidget import storage [as 别名]
def __init__(self, dev, ignored_folders=None, parent=None):
QDialog.__init__(self, parent)
self.l = l = QVBoxLayout()
self.setLayout(l)
self.la = la = QLabel(
"<p>"
+ _("<b>Scanned folders:</b>")
+ " "
+ _("You can select which top level folders calibre will " "scan when searching this device for books.")
)
la.setWordWrap(True)
l.addWidget(la)
self.tabs = QTabWidget(self)
l.addWidget(self.tabs)
self.widgets = []
for storage in dev.filesystem_cache.entries:
w = QListWidget(self)
w.storage = storage
self.tabs.addTab(w, storage.name)
self.widgets.append(w)
for child in sorted(storage.folders, key=attrgetter("name")):
i = QListWidgetItem(child.name)
i.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
i.setCheckState(
Qt.Unchecked
if dev.is_folder_ignored(storage, child.name, ignored_folders=ignored_folders)
else Qt.Checked
)
w.addItem(i)
self.bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.bb.accepted.connect(self.accept)
self.bb.rejected.connect(self.reject)
self.sab = self.bb.addButton(_("Select &All"), self.bb.ActionRole)
self.sab.clicked.connect(self.select_all)
self.snb = self.bb.addButton(_("Select &None"), self.bb.ActionRole)
self.snb.clicked.connect(self.select_none)
l.addWidget(self.bb)
self.setWindowTitle(_("Choose folders to scan"))
self.setWindowIcon(QIcon(I("devices/tablet.png")))
self.resize(500, 500)