def __init__(self, base): QAbstractItemModel.__init__(self) self.base = base File.setBase(self.base) self.__root = Resource() self.refresh()
def flags(self, index): if not index.isValid(): return Qt.ItemIsEnabled try: node = self.nodeFromIndex(index) if node.Type is not sbml_entities.TYPE.NONE: return Qt.ItemFlags(QAbstractItemModel.flags(self, index) | Qt.ItemIsEditable) # editable item except: pass return Qt.ItemFlags(QAbstractItemModel.flags(self, index)) # non-editable item
def flags(self, index): if not index.isValid(): return Qt.ItemIsEnabled try: node = self.nodeFromIndex(index) if node.Type is not sbml_entities.TYPE.NONE: return Qt.ItemFlags( QAbstractItemModel.flags(self, index) | Qt.ItemIsEditable) # editable item except: pass return Qt.ItemFlags(QAbstractItemModel.flags( self, index)) # non-editable item
def headerData(self, p_int, Qt_Orientation, int_role=None): if int_role == Qt.DisplayRole: if Qt_Orientation == Qt.Horizontal: return self.alphabet[p_int] if Qt_Orientation == Qt.Vertical: return 'q{0}'.format(self.states[p_int+1]) return QAbstractItemModel.headerData(self, p_int, Qt_Orientation, int_role)
def headerData(self, p_int, Qt_Orientation, int_role=None): if int_role == Qt.DisplayRole: if Qt_Orientation == Qt.Horizontal: return self.alphabet[p_int] if Qt_Orientation == Qt.Vertical: return 'q{0}'.format(self.states[p_int + 1]) return QAbstractItemModel.headerData(self, p_int, Qt_Orientation, int_role)
def __init__(self, filename, parent=None): """ Creates a new AnalysisModel. ``filename`` is a xml file, containing the strings to display. """ QAbstractItemModel.__init__(self, parent) self.filename = filename self.strings = etree.parse(self.filename) # assign initial id for xml root item (``stringlist``) self.strings.getroot().set('id', '0') # increasing counter to auto-assign ids # initial counter value is the maximum of all ids, that were already # stored inside the xml file. This avoids double-assignment of ids. self.all_ids_in_tree = etree.XPath('//*/attribute::id') ids = map(int, self.all_ids_in_tree(self.strings)) initial = max(ids) + 1 self.id_counter = count(initial) # a xpath selector to find an element with a specific id self.select_by_id = etree.XPath('//*[@id=$id]') # find all elements, that have id attributes self.select_elements_with_id = etree.XPath('//*[@id]')
def __init__(self): """ :return: """ QAbstractItemModel.__init__(self) self.__service = None self.__state_current_data = None self.__state_cond = {} # now sql condition self._state_root = TreeNode(None) # data root self.__state_list = [] # data list self.__state_check = [] # checked list self.__state_fields_name = [] # fields CN name self.__state_fields_id = [] # data table field name self.__state_edit_fields = [] self.__state_select = {} self.__state_editable = False self.__state_chk_able = True
def flags(self, index): _flag = QAbstractItemModel.flags(self, index) if index.isValid(): if self.__state_editable and \ self.__state_fields_id[index.column()] in self.__state_edit_fields: _flag |= Qt.ItemIsEditable _flag |= Qt.ItemIsDragEnabled _flag |= Qt.ItemIsDropEnabled _flag |= Qt.ItemIsEnabled _flag |= Qt.ItemIsSelectable else: _flag |= Qt.ItemIsDropEnabled if index.column() == 0 and self.__state_chk_able: _flag |= Qt.ItemIsUserCheckable return _flag
def __init__(self): QAbstractItemModel.__init__(self) NodeContainer.__init__(self) self._dummyNodes = set() # dummy nodes' reference have to be kept to avoid segfault
def reset(self): self.invalidate() self._ref2node = {} self._dummyNodes = set() QAbstractItemModel.reset(self)
def flags(self, index): if not index.isValid(): return Qt.ItemIsEnabled return Qt.ItemFlags(QAbstractItemModel.flags(self, index))
def __init__(self, wordSet): QAbstractItemModel.__init__(self) self._wordSet = wordSet
def reset(self): self.rootNodes = self._getRootNodes() QAbstractItemModel.reset(self)
def __init__(self): QAbstractItemModel.__init__(self) self.rootNodes = self._getRootNodes()