コード例 #1
0
ファイル: ResourceModel.py プロジェクト: Ingener74/Jupiter
 def __init__(self, base):
     QAbstractItemModel.__init__(self)
     
     self.base = base
     File.setBase(self.base)
     
     self.__root = Resource()
     
     self.refresh()
コード例 #2
0
 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
コード例 #3
0
    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
コード例 #4
0
 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)
コード例 #5
0
 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)
コード例 #6
0
 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]')
コード例 #7
0
    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
コード例 #8
0
    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
コード例 #9
0
ファイル: tree_model.py プロジェクト: pszostek/python-dev
 def __init__(self):
     QAbstractItemModel.__init__(self)
     NodeContainer.__init__(self)
     self._dummyNodes = set() # dummy nodes' reference have to be kept to avoid segfault
コード例 #10
0
ファイル: tree_model.py プロジェクト: pszostek/python-dev
 def reset(self):
     self.invalidate()
     self._ref2node = {}
     self._dummyNodes = set()
     QAbstractItemModel.reset(self)
コード例 #11
0
 def flags(self, index):
     if not index.isValid():
         return Qt.ItemIsEnabled
     return Qt.ItemFlags(QAbstractItemModel.flags(self, index))
コード例 #12
0
 def __init__(self, wordSet):
     QAbstractItemModel.__init__(self)
     
     self._wordSet = wordSet
コード例 #13
0
 def reset(self):
     self.rootNodes = self._getRootNodes()
     QAbstractItemModel.reset(self)
コード例 #14
0
 def __init__(self):
     QAbstractItemModel.__init__(self)
     self.rootNodes = self._getRootNodes()