本文整理汇总了Python中PyQt5.Qt.QAbstractItemModel类的典型用法代码示例。如果您正苦于以下问题:Python QAbstractItemModel类的具体用法?Python QAbstractItemModel怎么用?Python QAbstractItemModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QAbstractItemModel类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, cover_thread_count=2, detail_thread_count=4):
QAbstractItemModel.__init__(self)
self.DRM_LOCKED_ICON = QPixmap(I('drm-locked.png')).scaledToHeight(64,
Qt.SmoothTransformation)
self.DRM_UNLOCKED_ICON = QPixmap(I('drm-unlocked.png')).scaledToHeight(64,
Qt.SmoothTransformation)
self.DRM_UNKNOWN_ICON = QPixmap(I('dialog_question.png')).scaledToHeight(64,
Qt.SmoothTransformation)
self.DONATE_ICON = QPixmap(I('donate.png')).scaledToHeight(16,
Qt.SmoothTransformation)
self.DOWNLOAD_ICON = QPixmap(I('arrow-down.png')).scaledToHeight(16,
Qt.SmoothTransformation)
# All matches. Used to determine the order to display
# self.matches because the SearchFilter returns
# matches unordered.
self.all_matches = []
# Only the showing matches.
self.matches = []
self.query = ''
self.filterable_query = False
self.search_filter = SearchFilter()
self.cover_pool = CoverThreadPool(cover_thread_count)
self.details_pool = DetailsThreadPool(detail_thread_count)
self.filter_results_dispatcher = FunctionDispatcher(self.filter_results)
self.got_result_details_dispatcher = FunctionDispatcher(self.got_result_details)
self.sort_col = 2
self.sort_order = Qt.AscendingOrder
示例2: __init__
def __init__(self, all_books):
QAbstractItemModel.__init__(self)
self.books = all_books
self.all_books = all_books
self.filter = ''
self.search_filter = SearchFilter(all_books)
self.sort_col = 0
self.sort_order = Qt.AscendingOrder
示例3: __init__
def __init__(self, show_only_user_plugins=False):
QAbstractItemModel.__init__(self)
SearchQueryParser.__init__(self, ['all'])
self.show_only_user_plugins = show_only_user_plugins
self.icon = QIcon(I('plugins.png'))
p = QIcon(self.icon).pixmap(64, 64, QIcon.Disabled, QIcon.On)
self.disabled_icon = QIcon(p)
self._p = p
self.populate()
示例4: __init__
def __init__(self, parent):
QAbstractItemModel.__init__(self, parent)
self.rules = ()
self.sort_on_count = True
self.num_size = 1
self.num_unused = 0
self.build_maps()
self.main_font = f = QFontDatabase.systemFont(QFontDatabase.FixedFont)
f.setBold(True), f.setPointSize(parent.font().pointSize() + 2)
self.italic_font = f = QFont(parent.font())
f.setItalic(True)
示例5: __init__
def __init__(self, *args):
QAbstractItemModel.__init__(self, *args)
SearchQueryParser.__init__(self, locations=["all"])
self.default_icon = QIcon(I("news.png"))
self.custom_icon = QIcon(I("user_profile.png"))
self.builtin_recipe_collection = get_builtin_recipe_collection()
self.scheduler_config = SchedulerConfig()
try:
with zipfile.ZipFile(P("builtin_recipes.zip", allow_user_override=False), "r") as zf:
self.favicons = dict([(x.filename, x) for x in zf.infolist() if x.filename.endswith(".png")])
except:
self.favicons = {}
self.do_refresh()
示例6: __init__
def __init__(self, plugins):
QAbstractItemModel.__init__(self)
self.NO_DRM_ICON = QIcon(I('ok.png'))
self.DONATE_ICON = QIcon()
self.DONATE_ICON.addFile(I('donate.png'), QSize(16, 16))
self.all_matches = plugins
self.matches = plugins
self.filter = ''
self.search_filter = SearchFilter(self.all_matches)
self.sort_col = 1
self.sort_order = Qt.AscendingOrder
示例7: flags
def flags(self, index):
defaultFlags = QAbstractItemModel.flags(self, index)
if index.isValid():
return Qt.ItemIsEditable | Qt.ItemIsDragEnabled | \
Qt.ItemIsDropEnabled | defaultFlags
else:
return Qt.ItemIsDropEnabled | defaultFlags
示例8: __init__
def __init__(self, keyboard, parent=None):
QAbstractItemModel.__init__(self, parent)
SearchQueryParser.__init__(self, ['all'])
self.keyboard = keyboard
groups = sorted(keyboard.groups, key=sort_key)
shortcut_map = {k:v.copy() for k, v in
self.keyboard.shortcuts.iteritems()}
for un, s in shortcut_map.iteritems():
s['keys'] = tuple(self.keyboard.keys_map.get(un, ()))
s['unique_name'] = un
s['group'] = [g for g, names in self.keyboard.groups.iteritems() if un in
names][0]
group_map = {group:sorted(names, key=lambda x:
sort_key(shortcut_map[x]['name'])) for group, names in
self.keyboard.groups.iteritems()}
self.data = [Node(group_map, shortcut_map, group) for group in groups]
示例9: __init__
def __init__(self, parent=None):
QAbstractItemModel.__init__(self, parent)
self.categories = ((_('Favorites'), ()), # {{{
(_('European scripts'), (
(_('Armenian'), (0x530, 0x58F)),
(_('Armenian ligatures'), (0xFB13, 0xFB17)),
(_('Coptic'), (0x2C80, 0x2CFF)),
(_('Coptic in Greek block'), (0x3E2, 0x3EF)),
(_('Cypriot syllabary'), (0x10800, 0x1083F)),
(_('Cyrillic'), (0x400, 0x4FF)),
(_('Cyrillic supplement'), (0x500, 0x52F)),
(_('Cyrillic extended A'), (0x2DE0, 0x2DFF)),
(_('Cyrillic extended B'), (0xA640, 0xA69F)),
(_('Georgian'), (0x10A0, 0x10FF)),
(_('Georgian supplement'), (0x2D00, 0x2D2F)),
(_('Glagolitic'), (0x2C00, 0x2C5F)),
(_('Gothic'), (0x10330, 0x1034F)),
(_('Greek and Coptic'), (0x370, 0x3FF)),
(_('Greek extended'), (0x1F00, 0x1FFF)),
(_('Latin, Basic & Latin-1 supplement'), (0x20, 0xFF)),
(_('Latin extended A'), (0x100, 0x17F)),
(_('Latin extended B'), (0x180, 0x24F)),
(_('Latin extended C'), (0x2C60, 0x2C7F)),
(_('Latin extended D'), (0xA720, 0xA7FF)),
(_('Latin extended additional'), (0x1E00, 0x1EFF)),
(_('Latin ligatures'), (0xFB00, 0xFB06)),
(_('Fullwidth Latin letters'), (0xFF00, 0xFF5E)),
(_('Linear B syllabary'), (0x10000, 0x1007F)),
(_('Linear B ideograms'), (0x10080, 0x100FF)),
(_('Ogham'), (0x1680, 0x169F)),
(_('Old italic'), (0x10300, 0x1032F)),
(_('Phaistos disc'), (0x101D0, 0x101FF)),
(_('Runic'), (0x16A0, 0x16FF)),
(_('Shavian'), (0x10450, 0x1047F)),
)),
(_('Phonetic symbols'), (
(_('IPA extensions'), (0x250, 0x2AF)),
(_('Phonetic extensions'), (0x1D00, 0x1D7F)),
(_('Phonetic extensions supplement'), (0x1D80, 0x1DBF)),
(_('Modifier tone letters'), (0xA700, 0xA71F)),
(_('Spacing modifier letters'), (0x2B0, 0x2FF)),
(_('Superscripts and subscripts'), (0x2070, 0x209F)),
)),
(_('Combining diacritics'), (
(_('Combining diacritical marks'), (0x300, 0x36F)),
(_('Combining diacritical marks for symbols'), (0x20D0, 0x20FF)),
(_('Combining diacritical marks supplement'), (0x1DC0, 0x1DFF)),
(_('Combining half marks'), (0xFE20, 0xFE2F)),
)),
(_('African scripts'), (
(_('Bamum'), (0xA6A0, 0xA6FF)),
(_('Bamum supplement'), (0x16800, 0x16A3F)),
(_('Egyptian hieroglyphs'), (0x13000, 0x1342F)),
(_('Ethiopic'), (0x1200, 0x137F)),
(_('Ethiopic supplement'), (0x1380, 0x139F)),
(_('Ethiopic extended'), (0x2D80, 0x2DDF)),
(_('Ethiopic extended A'), (0xAB00, 0xAB2F)),
(_('Meroitic cursive'), (0x109A0, 0x109FF)),
(_('Meroitic hieroglyphs'), (0x10980, 0x1099F)),
(_('N\'Ko'), (0x7C0, 0x7FF)),
(_('Osmanya'), (0x10480, 0x104AF)),
(_('Tifinagh'), (0x2D30, 0x2D7F)),
(_('Vai'), (0xA500, 0xA63F)),
)),
(_('Middle Eastern scripts'), (
(_('Arabic'), (0x600, 0x6FF)),
(_('Arabic supplement'), (0x750, 0x77F)),
(_('Arabic extended A'), (0x8A0, 0x8FF)),
(_('Arabic presentation forms A'), (0xFB50, 0xFDFF)),
(_('Arabic presentation forms B'), (0xFE70, 0xFEFF)),
(_('Avestan'), (0x10B00, 0x10B3F)),
(_('Carian'), (0x102A0, 0x102DF)),
(_('Cuneiform'), (0x12000, 0x123FF)),
(_('Cuneiform numbers and punctuation'), (0x12400, 0x1247F)),
(_('Hebrew'), (0x590, 0x5FF)),
(_('Hebrew presentation forms'), (0xFB1D, 0xFB4F)),
(_('Imperial Aramaic'), (0x10840, 0x1085F)),
(_('Inscriptional Pahlavi'), (0x10B60, 0x10B7F)),
(_('Inscriptional Parthian'), (0x10B40, 0x10B5F)),
(_('Lycian'), (0x10280, 0x1029F)),
(_('Lydian'), (0x10920, 0x1093F)),
(_('Mandaic'), (0x840, 0x85F)),
(_('Old Persian'), (0x103A0, 0x103DF)),
(_('Old South Arabian'), (0x10A60, 0x10A7F)),
(_('Phoenician'), (0x10900, 0x1091F)),
(_('Samaritan'), (0x800, 0x83F)),
(_('Syriac'), (0x700, 0x74F)),
(_('Ugaritic'), (0x10380, 0x1039F)),
)),
(_('Central Asian scripts'), (
(_('Mongolian'), (0x1800, 0x18AF)),
(_('Old Turkic'), (0x10C00, 0x10C4F)),
(_('Phags-pa'), (0xA840, 0xA87F)),
(_('Tibetan'), (0xF00, 0xFFF)),
)),
#.........这里部分代码省略.........
示例10: flags
def flags(self, index):
ans = QAbstractItemModel.flags(self, index)
ip = index.internalPointer()
if getattr(ip, 'is_shortcut', False):
ans |= Qt.ItemIsEditable
return ans
示例11: flags
def flags(self, index):
if index.column() == 0:
return QAbstractItemModel.flags(self, index) | Qt.ItemIsUserCheckable
return QAbstractItemModel.flags(self, index)
示例12: flags
def flags(self, index):
if index.column() == self.ENABLED_COL:
return QAbstractItemModel.flags(self, index) | Qt.ItemIsUserCheckable
else:
return QAbstractItemModel.flags(self, index)
示例13: __init__
def __init__(self, parent=None):
QAbstractItemModel.__init__(self, parent)
self.categories = (
(_("Favorites"), ()), # {{{
(
_("European scripts"),
(
(_("Armenian"), (0x530, 0x58F)),
(_("Armenian ligatures"), (0xFB13, 0xFB17)),
(_("Coptic"), (0x2C80, 0x2CFF)),
(_("Coptic in Greek block"), (0x3E2, 0x3EF)),
(_("Cypriot Syllabary"), (0x10800, 0x1083F)),
(_("Cyrillic"), (0x400, 0x4FF)),
(_("Cyrillic Supplement"), (0x500, 0x52F)),
(_("Cyrillic Extended-A"), (0x2DE0, 0x2DFF)),
(_("Cyrillic Extended-B"), (0xA640, 0xA69F)),
(_("Georgian"), (0x10A0, 0x10FF)),
(_("Georgian Supplement"), (0x2D00, 0x2D2F)),
(_("Glagolitic"), (0x2C00, 0x2C5F)),
(_("Gothic"), (0x10330, 0x1034F)),
(_("Greek and Coptic"), (0x370, 0x3FF)),
(_("Greek Extended"), (0x1F00, 0x1FFF)),
(_("Latin, Basic & Latin-1 Supplement"), (0x20, 0xFF)),
(_("Latin Extended-A"), (0x100, 0x17F)),
(_("Latin Extended-B"), (0x180, 0x24F)),
(_("Latin Extended-C"), (0x2C60, 0x2C7F)),
(_("Latin Extended-D"), (0xA720, 0xA7FF)),
(_("Latin Extended Additional"), (0x1E00, 0x1EFF)),
(_("Latin ligatures"), (0xFB00, 0xFB06)),
(_("Fullwidth Latin letters"), (0xFF00, 0xFF5E)),
(_("Linear B Syllabary"), (0x10000, 0x1007F)),
(_("Linear B Ideograms"), (0x10080, 0x100FF)),
(_("Ogham"), (0x1680, 0x169F)),
(_("Old Italic"), (0x10300, 0x1032F)),
(_("Phaistos Disc"), (0x101D0, 0x101FF)),
(_("Runic"), (0x16A0, 0x16FF)),
(_("Shavian"), (0x10450, 0x1047F)),
),
),
(
_("Phonetic Symbols"),
(
(_("IPA Extensions"), (0x250, 0x2AF)),
(_("Phonetic Extensions"), (0x1D00, 0x1D7F)),
(_("Phonetic Extensions Supplement"), (0x1D80, 0x1DBF)),
(_("Modifier Tone Letters"), (0xA700, 0xA71F)),
(_("Spacing Modifier Letters"), (0x2B0, 0x2FF)),
(_("Superscripts and Subscripts"), (0x2070, 0x209F)),
),
),
(
_("Combining Diacritics"),
(
(_("Combining Diacritical Marks"), (0x300, 0x36F)),
(_("Combining Diacritical Marks for Symbols"), (0x20D0, 0x20FF)),
(_("Combining Diacritical Marks Supplement"), (0x1DC0, 0x1DFF)),
(_("Combining Half Marks"), (0xFE20, 0xFE2F)),
),
),
(
_("African Scripts"),
(
(_("Bamum"), (0xA6A0, 0xA6FF)),
(_("Bamum Supplement"), (0x16800, 0x16A3F)),
(_("Egyptian Hieroglyphs"), (0x13000, 0x1342F)),
(_("Ethiopic"), (0x1200, 0x137F)),
(_("Ethiopic Supplement"), (0x1380, 0x139F)),
(_("Ethiopic Extended"), (0x2D80, 0x2DDF)),
(_("Ethiopic Extended-A"), (0xAB00, 0xAB2F)),
(_("Meroitic Cursive"), (0x109A0, 0x109FF)),
(_("Meroitic Hieroglyphs*"), (0x10980, 0x1099F)),
(_("N'Ko"), (0x7C0, 0x7FF)),
(_("Osmanya"), (0x10480, 0x104AF)),
(_("Tifinagh"), (0x2D30, 0x2D7F)),
(_("Vai"), (0xA500, 0xA63F)),
),
),
(
_("Middle Eastern Scripts"),
(
(_("Arabic"), (0x600, 0x6FF)),
(_("Arabic Supplement"), (0x750, 0x77F)),
(_("Arabic Extended-A"), (0x8A0, 0x8FF)),
(_("Arabic Presentation Forms-A"), (0xFB50, 0xFDFF)),
(_("Arabic Presentation Forms-B"), (0xFE70, 0xFEFF)),
(_("Avestan"), (0x10B00, 0x10B3F)),
(_("Carian"), (0x102A0, 0x102DF)),
(_("Cuneiform"), (0x12000, 0x123FF)),
(_("Cuneiform Numbers and Punctuation"), (0x12400, 0x1247F)),
(_("Hebrew"), (0x590, 0x5FF)),
(_("Hebrew Presentation Forms"), (0xFB1D, 0xFB4F)),
(_("Imperial Aramaic"), (0x10840, 0x1085F)),
(_("Inscriptional Pahlavi"), (0x10B60, 0x10B7F)),
(_("Inscriptional Parthian"), (0x10B40, 0x10B5F)),
(_("Lycian"), (0x10280, 0x1029F)),
(_("Lydian"), (0x10920, 0x1093F)),
(_("Mandaic"), (0x840, 0x85F)),
(_("Old Persian"), (0x103A0, 0x103DF)),
(_("Old South Arabian"), (0x10A60, 0x10A7F)),
(_("Phoenician"), (0x10900, 0x1091F)),
#.........这里部分代码省略.........