本文整理匯總了Python中PySide.QtCore.QAbstractListModel類的典型用法代碼示例。如果您正苦於以下問題:Python QAbstractListModel類的具體用法?Python QAbstractListModel怎麽用?Python QAbstractListModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了QAbstractListModel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, values):
QAbstractListModel.__init__(self)
try:
values = sorted(values)
except TypeError:
pass
self._values = list(values)
示例2: __init__
def __init__(self, parent = None):
QAbstractListModel.__init__(self, parent)
self.manager = QNetworkAccessManager(self)
self.manager.finished[QNetworkReply].connect(self.replyFinished)
self._timeStamp = ""
self._statistics = {
'P1' : 0,
'P2' : 0,
'P3' : 0,
'P4' : 0,
'P5' : 0,
'FIXED' : 0,
'UNCONFIRMED' : 0,
'---' : 0
}
self._bugs = []
self._maxValue = 0
self.setRoleNames({self.ID : 'BUG_ID',
self.STATUS : 'BUG_STATUS',
self.PRIORITY : 'BUG_PRIORITY',
self.ASSIGNEE : 'BUG_ASSIGNEE',
self.SUMARY : 'BUG_SUMMARY',
self.COMPONENT: 'BUG_COMPONENT',
self.COMMENTS : 'BUG_COMMENTS'})
self.update()
示例3: __init__
def __init__(self, datensatz):
QAbstractListModel.__init__(self)
self.datensatz = datensatz
# Erstellt ein Attribut durch welchen die einzelnen 'verpackten'
# Datensätze in QML angesprochen werden können
self.setRoleNames(dict(enumerate(ListenModell.KOLONNEN)))
示例4: __init__
def __init__(self):
if self._model_instances is None:
# This is the first time an instance of this class is
# being instantiated. Register the atexit handler to
# ensure the state get saved on exit.
self.__class__._model_instances = []
atexit.register(KhweetsModel.save_all_config, lazily=False)
self._model_instances.append(weakref.ref(self))
QAbstractListModel.__init__(self)
# Cache the passed data list as a class member.
# Status is a dict mapping uids to status
self.statuses = {}
# UIDs is an array of the UIDs in the current data set.
self.uids = []
self.avatars = {}
self.now = time.time()
self.nothing_really_loaded = True
self.call = None
self.max_created_at = None
self.new_message_horizon = self.now
self.khweets_limit = 10000
try:
self.default_avatar = QPixmap('/opt/usr/share/icons/hicolor/48x48/hildon/general_default_avatar.png')
except:
self.default_avatar = None
self.data_cache = {}
示例5: __init__
def __init__(self, items = None, roles = None, parent = None):
QAbstractListModel.__init__(self, parent)
if items is None or roles is None :
return
self.setData(items, roles)
self.selectedValue = None
self.selectedKey = None
示例6: __init__
def __init__(self, limits_text=None):
QAbstractListModel.__init__(self)
if limits_text is None:
limits_text = {}
self._limits_text = limits_text.copy()
self._limits = list(limits_text.keys())
示例7: __init__
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
self.setRoleNames({Qt.DisplayRole: 'titleText', Qt.ToolTipRole: 'altText', Qt.UserRole: 'comicUrl'})
self._validRoles = [Qt.DisplayRole, Qt.ToolTipRole, Qt.UserRole]
lastComicInfo = json.loads(urlopen('http://xkcd.com/info.0.json').read())
if not lastComicInfo:
raise IOError('Could not fetch XKCD comic.')
self._lastComicId = lastComicInfo['num']
self._cache = {lastComicInfo['num']: XkcdModel._filterComicInfos(lastComicInfo)}
示例8: __init__
def __init__(self, ):
self._wallpapers = None
self._currentpage = 1
self._running = False
self._previouspage = 0
self._nextpage = 0
QAbstractListModel.__init__(self)
self.setRoleNames(dict(enumerate(WallpapersModel.COLUMNS)))
self.loadPage(1)
示例9: __init__
def __init__(self, currentDoc=None,
settings=None):
self._documents = {}
self.settings = settings
self._currentPath = settings.lastOpenedFolder
if ((not os.path.exists(self._currentPath)) or
(not settings.useLastOpenedFolder)):
self._currentPath = os.path.expanduser('~')
QAbstractListModel.__init__(self)
self.setRoleNames(dict(enumerate(DocumentsModel.COLUMNS)))
self.currentDoc = currentDoc
示例10: __init__
def __init__(self, ):
self._notes = {}
QAbstractListModel.__init__(self)
self.setRoleNames(dict(enumerate(NotesModel.COLUMNS)))
self._filter = None
self._filteredNotes = self._notes
if not os.path.exists(Note.NOTESPATH):
try:
os.mkdir(Note.NOTESPATH)
except Exception, e:
print 'Can t create note storage folder', str(e)
示例11: __init__
def __init__(self, dictList = None, parent = None):
QAbstractListModel.__init__(self, parent)
self.items = None
self.selectedValue = None
self.selectedKey = None
self.selectedIndex = None
if dictList is None or len(dictList) == 0:
return
self.setData(dictList)
示例12: __init__
def __init__(self, models_text=None):
QAbstractListModel.__init__(self)
if models_text is None:
models_text = {}
self._models_text = models_text.copy()
self._models = {}
for model in models_text.keys():
self._models.setdefault(model.type, []).append(model)
self._model_type = None
示例13: flags
def flags(self, index):
"""
Model specific implementation.
Sets the item flags at the given index.
TODO: Rework this implementation. Streams should NOT be editable(?)
"""
if not index.isValid():
return Qt.ItemIsEnabled
return Qt.ItemFlags(QAbstractListModel.flags(self, index) |
Qt.ItemIsEditable)
示例14: __init__
def __init__(self, term=None):
QAbstractListModel.__init__(self)
self._page = None
self._term = term
self._torrents = []
self._isLoading = False
self._thread = None
self.refresh()
self.setRoleNames(
{
self.NAME: "ITEM_NAME",
self.SEEDERS: "ITEM_SEEDERS",
self.LEECHERS: "ITEM_LEECHERS",
self.USER: "ITEM_USER",
self.SIZE: "ITEM_SIZE",
self.URL: "ITEM_URL",
self.TITLE: "title",
self.SUBTITLE: "subtitle",
}
)
示例15: __init__
def __init__(self, parent=None, troll_dir=None):
QAbstractListModel.__init__(self, parent)
# load data from disk
default = os.path.expanduser(os.path.join("~", ".trollbox"))
self.troll_dir = troll_dir if troll_dir else default
if not os.path.exists(self.troll_dir):
os.mkdir(self.troll_dir)
image_dir = os.path.join(self.troll_dir, "images")
if not os.path.exists(image_dir):
os.mkdir(image_dir)
self.metadata_path = os.path.join(self.troll_dir, "metadata.json")
if os.path.exists(self.metadata_path):
metadata = json.load(open(self.metadata_path, "rt"))
else:
metadata = []
self.images = []
for url, tags, rel_path in metadata:
self.addImage(url, tags, rel_path)