def __init__(self, data, parent=None, *args): QAbstractListModel.__init__(self, parent, *args) self._data = data self._roles = {} self._file = None self._just_created = False
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 self._count = None
def __init__(self, conn): QAbstractListModel.__init__(self) self._conn = conn self._data = [('', '', 0)] self._rolesindex = { Qt.DisplayRole: 0, Qt.UserRole: 1, Qt.UserRole+1: 2}
def __init__(self, logs): QAbstractListModel.__init__(self) # late init self.window = None self.__logs_obj = logs self.__logs = []
def __init__(self, general_text_visible=True, general_text=None): QAbstractListModel.__init__(self) self._state = None self._filter_enable = True self._general_visible = general_text_visible self._callback = ProviderStateModelCallback(self) if general_text is None: general_text = 'GENERAL_TEXT' self._general_text = general_text
def removeData(self, row): if row < 0 | row > len(self._m_data): return data = self._m_data[row] QAbstractListModel.beginRemoveRows(self, QModelIndex(), row, row) self._m_data.remove(data) QAbstractListModel.endRemoveRows(self)
def duplicateData(self, row): if row < 0 | row > len(self._m_data): return data = self._m_data[row] rowOfInsert = row + 1 QAbstractListModel.beginInsertRows(self, QModelIndex(), rowOfInsert, rowOfInsert) self._m_data.insert(rowOfInsert, data) QAbstractListModel.endInsertRows(self)
def __init__(self, torrent_client, logs, on_peer_limit): QAbstractListModel.__init__(self) self.__logs = logs self.__torrent_client = torrent_client self.__filter_status = None self.__on_peer_limit = on_peer_limit self.__torrents = self._fetch_torrents() self.REFETCH_SIGNAL.connect(self.on_refetch) self.__stop_interval = set_interval(lambda: self.REFETCH_SIGNAL.emit(), 1)
def growPopulation(self): growthFactor = 0.01 / self.RAND_MAX count = len(self._m_data) for i in range(0, count): self._m_data[ i].population += self._m_data[i].population * random.randint( 1, self.RAND_MAX) * growthFactor startIndex = QAbstractListModel.index(self, 0, 0) endIndex = QAbstractListModel.index(self, count - 1, 0) self.dataChanged.emit(startIndex, endIndex, [self.Roles.PopulationRole])
def __init__(self, me, preview_dler, gameset=None): QAbstractListModel.__init__(self) self._me = me self._preview_dler = preview_dler self._gameitems = {} self._itemlist = [] # For queries self._gameset = gameset if self._gameset is not None: self._gameset.newGame.connect(self.add_game) self._gameset.newClosedGame.connect(self.remove_game) for game in self._gameset.values(): self.add_game(game)
def __init__(self, parent=None): QAbstractListModel.__init__(self, parent) self._layerStack = [] self.selectionModel = QItemSelectionModel(self) self.selectionModel.selectionChanged.connect(self.updateGUI) self.selectionModel.selectionChanged.connect(self._onSelectionChanged) self._movingRows = False QTimer.singleShot(0, self.updateGUI) def _handleRemovedLayer(layer): # Layerstacks *own* the layers they hold, and thus are # responsible for cleaning them up when they are removed: layer.clean_up() self.layerRemoved.connect(_handleRemovedLayer)
def __init__(self, model, parent=None): QAbstractListModel.__init__(self, parent=parent) self.spectra_model = model self.combinations = [] self.selected_xtal_family = None self.ignore_family_constrain = False if len(self.spectra_model.collection) > 0: self.combinations = sorted(set.union(*[ i.spect_xtal_unique_combinations for i in self.spectra_model.collection ]), key=lambda x: x.combi_string) self.spectra_model.rowsInserted.connect(self.scan_and_add_entries) for stuff in self.combinations: stuff.q_checked_state = Qt.Unchecked
def __init__(self): QAbstractListModel.__init__(self) self.list_mes = [ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre", ]
def itemData(self, index): mapping = QAbstractListModel.itemData(self, index) if self._is_index_valid_for(index, self._other_data): items = list(self._other_data[index.row()].items()) else: items = [] for key, value in items: mapping[key] = value return mapping
def mimeData(self, indexlist): if len(indexlist) <= 0: return None items = [self[i.row()] for i in indexlist] mime = QAbstractListModel.mimeData(self, indexlist) data = pickle.dumps(vars) mime.set_data(self.MIME_TYPE, QByteArray(data)) mime._items = items return mime
def dropMimeData(self, mime, action, row, column, parent): if action == Qt.IgnoreAction: return True if not mime.hasFormat(self.MIME_TYPE): return False if hasattr(mime, "_vars"): vars_ = mime._vars else: desc = str(mime.data(self.MIME_TYPE)) vars_ = pickle.loads(desc) return QAbstractListModel.dropMimeData( self, mime, action, row, column, parent)
def dropMimeData(self, mime, action, row, column, parent): if action == Qt.IgnoreAction: return True if not mime.hasFormat(self.MIME_TYPE): return False if hasattr(mime, "_vars"): vars_ = mime._vars else: desc = str(mime.data(self.MIME_TYPE)) vars_ = pickle.loads(desc) return QAbstractListModel.dropMimeData(self, mime, action, row, column, parent)
def setData(self, index, value, role=Qt.EditRole): if index.isValid(): marker = self._markers[index.row()] if role == MarkerModel.PositionRole: return marker.setPosition(value) elif role == MarkerModel.NameRole: return marker.setName(value) elif role == MarkerModel.ColorRole: return marker.setColor(value) self.dataChanged.emit(index, index) return True return QAbstractListModel.setData(self, index, value, role)
def setData(self, index, value, role=Qt.EditRole): if index.isValid(): marker = self._markers[index.row()] if role == MarkerModel.position_role: return marker.setPosition(value) elif role == MarkerModel.color_role: return marker.setColor(value) elif role == MarkerModel.event_id_role: return marker.setEventId(value) elif role == MarkerModel.highlight_role: return marker.setHighlight(value) self.dataChanged.emit(index, index) return QAbstractListModel.setData(self, index, value, role)
def flags(self, index): """ Public method to get flags for an item. @param index index of the node cell (QModelIndex) @return flags (Qt.ItemFlags) """ if index.row() < 0 or index.row() >= self.rowCount(index.parent()): return Qt.NoItemFlags defaultFlags = QAbstractListModel.flags(self, index) itm = self.__manager.downloads()[index.row()] if itm.downloadedSuccessfully(): return defaultFlags | Qt.ItemIsDragEnabled return defaultFlags
def flags(self, index): if index.column() == 0: return QAbstractListModel.flags(self, index) | Qt.ItemIsEditable return QAbstractListModel.flags(self, index)
def __init__(self): QAbstractListModel.__init__(self) self.list_division = ["A", "B", "C", "D", "E"]
def __init__(self): QAbstractListModel.__init__(self) self.list_turno = ["Mañana", "Tarde"]
def __init__(self): QAbstractListModel.__init__(self) self.list_grado = [1, 2, 3, 4, 5, 6, 7]
def __init__(self, datain, parent=None, *args): """ datain: a list where each item is a row """ QAbstractListModel.__init__(self, parent, *args) self.listdata = datain
def __init__(self, department_list: [Department], check_state=Qt.Unchecked): QAbstractListModel.__init__(self) self.department_list = [[dep, check_state] for dep in department_list]
def __init__( self ): QAbstractListModel.__init__( self ) self._data_model = []
def __init__(self, parent=None, *args): """ datain: a list where each item is a row """ QAbstractListModel.__init__(self, parent, *args)
def __init__(self): QAbstractListModel.__init__(self) self.shortcuts = []
def index(self, row, column=0, parent=QModelIndex()): if self._is_index_valid_for(row, self) and column == 0: return QAbstractListModel.createIndex(self, row, column, parent) else: return QModelIndex()
def flags(self, index): if index.isValid(): return QAbstractListModel.flags(self, index) | Qt.ItemIsUserCheckable return QAbstractListModel.flags(self, index)
def __init__(self): QAbstractListModel.__init__(self) self.widgets = []
def mimeTypes(self): return self.MIME_TYPES + list(QAbstractListModel.mimeTypes(self))
def __init__(self, databaseFile): QAbstractListModel.__init__(self) self.db = ShortcutDatabase(databaseFile) self.shortcuts = self.db.selectShortcut("")
def __init__(self, parent, *args, **kwargs): QAbstractListModel.__init__(self, parent, *args, **kwargs) self._parent = parent self._xpath = "//grouping"
def __init__(self, itemcls, data, parent=None): QAbstractListModel.__init__(self, parent) AbstractQtModel.__init__(self, itemcls, data)
def __init__(self, parent=None, *args): """ datain: a list where each item is a row """ QAbstractListModel.__init__(self, parent, *args) self.es_themes = [] self.selected_theme_index = 0
def __init__(self, session): QAbstractListModel.__init__(self) self.session = session self._cards = []
def __init__(self, tree, xpath, parent=None): QAbstractListModel.__init__(self, parent=parent) self._tree=tree self._xpath=xpath
def __init__(self, parent=None): QAbstractListModel.__init__(self) self._list = []
def __init__(self, data=None, parent=None): QAbstractListModel.__init__(self, parent) self._data = data