예제 #1
0
    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)))
예제 #2
0
 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
0
 def __init__(self, values):
     QAbstractListModel.__init__(self)
     try:
         values = sorted(values)
     except TypeError:
         pass
     self._values = list(values)
예제 #4
0
    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
0
 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
0
        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
0
 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
0
 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
0
 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
0
        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
예제 #11
0
    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
0
파일: __init__.py 프로젝트: jul/KhtNotes
    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)
예제 #13
0
파일: models.py 프로젝트: Joev-/Streaman
 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
0
    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)
예제 #15
0
 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: "******",
             self.SIZE: "ITEM_SIZE",
             self.URL: "ITEM_URL",
             self.TITLE: "title",
             self.SUBTITLE: "subtitle",
         }
     )
예제 #16
0
    def __init__(self, server, timeout=5000):
        QAbstractListModel.__init__(self)

        self._loading = False
        self._show = TorrentModel.SHOW_ALL
        self._torrents = []
        self._visibles = []
        self.setRoleNames({self.ID       : 'TORRENT_ID',
                           self.NAME     : 'TORRENT_NAME',
                           self.STATUS   : 'TORRENT_STATUS',
                           self.RATIO    : 'TORRENT_RATIO',
                           self.PRIORITY : 'TORRENT_PRIORITY',
                           self.ETA      : 'TORRENT_ETA',
                           self.SIZE     : 'TORRENT_SIZE',
                           self.COMPLETED: 'TORRENT_COMPLETED',
                           self.PROGRESS : 'TORRENT_PROGRESS',
                           self.TITLE    : 'title'})

        self._server = server
        self._server.clientConnected.connect(self.reset)
        self._server.clientDisconnected.connect(self.reset)
        self._server.torrentAdded.connect(self._onTorrentAdded)
        self._server.torrentRemoved.connect(self._onTorrentRemoved)
        self._server.torrentUpdated.connect(self._onTorrentUpdate)
예제 #17
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.obj = MyObject()
     self.obj.setObjectName(object_name)
예제 #18
0
파일: address.py 프로젝트: khertan/BitPurse
 def __init__(self, ):
     self._addresses = []
     QAbstractListModel.__init__(self)
     self.setRoleNames(dict(enumerate(AddressesModel.COLUMNS)))
예제 #19
0
파일: listdemo.py 프로젝트: hzgnjupt/python
 def __init__(self, persons):
     QAbstractListModel.__init__(self)
     self.persons = persons
예제 #20
0
 def __init__(self):
     _OptionsModelMixin.__init__(self)
     QAbstractListModel.__init__(self)
예제 #21
0
 def __init__(self, model_types=None):
     QAbstractListModel.__init__(self)
     if model_types is None:
         model_types = []
     self._model_types = list(model_types)
예제 #22
0
 def __init__(self, objects=None):
     QAbstractListModel.__init__(self)
     if objects is None:
         objects = []
     self._objects = objects
     self.setRoleNames({0: 'modelData', 1: 'section'})
예제 #23
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._collisions = sorted(COLLISIONS)
예제 #24
0
 def __init__(self, auto_connect=False, parent=None):
     QAbstractListModel.__init__(self, parent)
     if auto_connect:
         self.reset_data()
예제 #25
0
 def __init__(self, auto_connect=False, parent=None):
     QAbstractListModel.__init__(self, parent)
     if auto_connect:
         self.reset_data()
예제 #26
0
 def __init__(self, transitions=None):
     QAbstractListModel.__init__(self)
     self._transitions = transitions or []
예제 #27
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.obj = MyObject()
     self.obj.setObjectName(object_name)
예제 #28
0
파일: model.py 프로젝트: travnick/gpodder
 def __init__(self, objects=None):
     QAbstractListModel.__init__(self)
     if objects is None:
         objects = []
     self._objects = objects
     self.setRoleNames({Qt.DisplayRole: "modelData", Qt.DecorationRole: "section"})
예제 #29
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._detectors = []
예제 #30
0
파일: address.py 프로젝트: khertan/BitPurse
 def __init__(self, ):
     self._transactions = []
     QAbstractListModel.__init__(self)
     self.setRoleNames(dict(enumerate(TransactionsModel.COLUMNS)))
예제 #31
0
 def __init__(self, query, display_column):
     QAbstractListModel.__init__(self)
     self._query = query
     self._query.add_sort(display_column, True)
     self._column_name = display_column
     self._data = None
예제 #32
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._particles = sorted(PARTICLES)
 def __init__(self, ):
     self._pages = {}
     QAbstractListModel.__init__(self)
     self.setRoleNames(dict(enumerate(PagesModel.COLUMNS)))
     self._filter = None
     self.loadData()
예제 #34
0
파일: __init__.py 프로젝트: obris/gpodder
 def __init__(self, objects=None):
     QAbstractListModel.__init__(self)
     if objects is None:
         objects = []
     self._objects = objects
     self.setRoleNames({0: 'modelData', 1: 'section'})
예제 #35
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._list_series = []