Ejemplo n.º 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)))
Ejemplo n.º 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()
Ejemplo n.º 3
0
 def __init__(self, values):
     QAbstractListModel.__init__(self)
     try:
         values = sorted(values)
     except TypeError:
         pass
     self._values = list(values)
Ejemplo n.º 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 = {}
Ejemplo n.º 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
Ejemplo n.º 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())
Ejemplo n.º 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)}
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 12
0
    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)
Ejemplo n.º 13
0
 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)
Ejemplo n.º 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)
Ejemplo n.º 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",
         }
     )
Ejemplo n.º 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)
Ejemplo n.º 17
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.obj = MyObject()
     self.obj.setObjectName(object_name)
Ejemplo n.º 18
0
 def __init__(self, ):
     self._addresses = []
     QAbstractListModel.__init__(self)
     self.setRoleNames(dict(enumerate(AddressesModel.COLUMNS)))
Ejemplo n.º 19
0
 def __init__(self, persons):
     QAbstractListModel.__init__(self)
     self.persons = persons
Ejemplo n.º 20
0
 def __init__(self):
     _OptionsModelMixin.__init__(self)
     QAbstractListModel.__init__(self)
Ejemplo n.º 21
0
 def __init__(self, model_types=None):
     QAbstractListModel.__init__(self)
     if model_types is None:
         model_types = []
     self._model_types = list(model_types)
Ejemplo n.º 22
0
 def __init__(self, objects=None):
     QAbstractListModel.__init__(self)
     if objects is None:
         objects = []
     self._objects = objects
     self.setRoleNames({0: 'modelData', 1: 'section'})
Ejemplo n.º 23
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._collisions = sorted(COLLISIONS)
Ejemplo n.º 24
0
 def __init__(self, auto_connect=False, parent=None):
     QAbstractListModel.__init__(self, parent)
     if auto_connect:
         self.reset_data()
Ejemplo n.º 25
0
 def __init__(self, auto_connect=False, parent=None):
     QAbstractListModel.__init__(self, parent)
     if auto_connect:
         self.reset_data()
Ejemplo n.º 26
0
 def __init__(self, transitions=None):
     QAbstractListModel.__init__(self)
     self._transitions = transitions or []
Ejemplo n.º 27
0
 def __init__(self, parent=None):
     QAbstractListModel.__init__(self, parent)
     self.obj = MyObject()
     self.obj.setObjectName(object_name)
Ejemplo n.º 28
0
 def __init__(self, objects=None):
     QAbstractListModel.__init__(self)
     if objects is None:
         objects = []
     self._objects = objects
     self.setRoleNames({Qt.DisplayRole: "modelData", Qt.DecorationRole: "section"})
Ejemplo n.º 29
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._detectors = []
Ejemplo n.º 30
0
 def __init__(self, ):
     self._transactions = []
     QAbstractListModel.__init__(self)
     self.setRoleNames(dict(enumerate(TransactionsModel.COLUMNS)))
Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 34
0
 def __init__(self, objects=None):
     QAbstractListModel.__init__(self)
     if objects is None:
         objects = []
     self._objects = objects
     self.setRoleNames({0: 'modelData', 1: 'section'})
Ejemplo n.º 35
0
 def __init__(self):
     QAbstractListModel.__init__(self)
     self._list_series = []