當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QAbstractListModel類代碼示例

本文整理匯總了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)
開發者ID:pymontecarlo,項目名稱:pymontecarlo-gui,代碼行數:7,代碼來源:summary.py

示例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()
開發者ID:PySide,項目名稱:bugzilaQML,代碼行數:25,代碼來源:BuglistModel.py

示例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)))
開發者ID:RitchieFlick,項目名稱:FVS,代碼行數:7,代碼來源:list_modell.py

示例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 = {}
開發者ID:Jonney,項目名稱:Khweeteur,代碼行數:34,代碼來源:list_model.py

示例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
開發者ID:flexdimension,項目名稱:GitGrown_old,代碼行數:8,代碼來源:PyListModel.py

示例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())
開發者ID:pymontecarlo,項目名稱:pymontecarlo-gui,代碼行數:8,代碼來源:limit.py

示例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)}
開發者ID:dakerfp,項目名稱:comics-reader,代碼行數:9,代碼來源:xkcdModel.py

示例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)
開發者ID:AnadoluPanteri,項目名稱:Wleux,代碼行數:9,代碼來源:__init__.py

示例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
開發者ID:khertan,項目名稱:KhtSimpleText,代碼行數:11,代碼來源:documentsModel.py

示例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)
開發者ID:jul,項目名稱:KhtNotes,代碼行數:12,代碼來源:__init__.py

示例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)
開發者ID:flexdimension,項目名稱:GitGrown_old,代碼行數:12,代碼來源:DictListModel.py

示例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
開發者ID:pymontecarlo,項目名稱:pymontecarlo-gui,代碼行數:12,代碼來源:model.py

示例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)
開發者ID:Joev-,項目名稱:Streaman,代碼行數:10,代碼來源:models.py

示例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",
         }
     )
開發者ID:renatofilho,項目名稱:transmission-client,代碼行數:20,代碼來源:SearchModel.py

示例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)
開發者ID:jfoote,項目名稱:trollbox,代碼行數:20,代碼來源:image_model.py


注:本文中的PySide.QtCore.QAbstractListModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。