コード例 #1
0
    def __update(self):
        """Update the current description.
        """
        if self.__currentIndex != -1:
            index = self.model().index(self.__currentIndex, 0)
        else:
            index = QModelIndex()

        if not index.isValid():
            description = ""
            name = ""
            path = ""
            svg = NO_PREVIEW_SVG
        else:
            description = index.data(Qt.WhatsThisRole)
            if description:
                description = description
            else:
                description = "No description."

            description = escape(description)
            description = description.replace("\n", "<br/>")

            name = index.data(Qt.DisplayRole)
            if name:
                name = name
            else:
                name = "Untitled"

            name = escape(name)
            path = str(index.data(Qt.StatusTipRole))
            svg = str(index.data(previewmodel.ThumbnailSVGRole))

        desc_text = self.__template.format(description=description, name=name)

        self.__label.setText(desc_text)

        self.__path.setText(contractuser(path))

        if not svg:
            svg = NO_PREVIEW_SVG

        if svg:
            self.__image.load(QByteArray(svg.encode("utf-8")))
コード例 #2
0
 def rowCount(self, parent=QModelIndex()):
     return 0 if parent.isValid() else self.n_attributes
コード例 #3
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def insert(self, i, val):
     self.beginInsertRows(QModelIndex(), i, i)
     self._list.insert(i, val)
     self._other_data.insert(i, _store())
     self.endInsertRows()
コード例 #4
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 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()
コード例 #5
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def insertRows(self, row, count, parent=QModelIndex()):
     self.beginInsertRows(parent, row, row + count - 1)
     self._table[row:row] = [[''] * self.columnCount()
                             for _ in range(count)]
     self.endInsertRows()
     return True
コード例 #6
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def parent(self, index=QModelIndex()):
     """Reimplemented from `QAbstractTableModel.parent`."""
     return QModelIndex()
コード例 #7
0
ファイル: owwordlist.py プロジェクト: larazupan/orange3-text
 def setModelData(self, editor: QLineEdit, model: PyListModel,
                  index: QModelIndex):
     model[index.row()].name = str(editor.text())
コード例 #8
0
 def removeRows(self, row, count, parent=QModelIndex()):
     # reimplemented
     return False
コード例 #9
0
ファイル: owcolor.py プロジェクト: zyblx/orange3
 def columnCount(parent=QModelIndex()):
     return 0 if parent.isValid() else 3
コード例 #10
0
ファイル: owcolor.py プロジェクト: zyblx/orange3
 def columnCount(self, parent=QModelIndex()):
     if parent.isValid():
         return 0
     return 1 + max((len(row.var.values) for row in self.attrdescs),
                    default=0)
コード例 #11
0
 def rowCount(self, parent=QModelIndex(), *args, **kwargs):
     return 0 if parent.isValid() or self.word_index is None else len(
         self.word_index)
コード例 #12
0
 def rowCount(self, parent=QModelIndex()):
     if parent.isValid():
         return 0
     else:
         return len(self._source_key)
コード例 #13
0
 def parent(self, child):
     return QModelIndex()
コード例 #14
0
 def index(self, row, column=0, parent=QModelIndex()):
     if not parent.isValid():
         return self.createIndex(row, column, object=row)
     else:
         return QModelIndex()
コード例 #15
0
ファイル: preprocess.py プロジェクト: vishalbelsare/orange3
 def _closeRequested(self, row):
     model = self.model()
     assert 0 <= row < model.rowCount()
     model.removeRows(row, 1, QModelIndex())
コード例 #16
0
ファイル: owkmeans.py プロジェクト: haojia632/orange3
 def columnCount(self, index=QModelIndex()):
     return 1
コード例 #17
0
 def columnCount(self, parent=QModelIndex()):
     if parent.isValid():
         return 0
     else:
         return len(self.__headers)
コード例 #18
0
ファイル: owwordlist.py プロジェクト: larazupan/orange3-text
 def setEditorData(self, editor: QLineEdit, index: QModelIndex):
     word_list = index.data(Qt.DisplayRole)
     editor.setText(word_list.name)
コード例 #19
0
 def createEditor(self, parent: QWidget, _: QStyleOptionViewItem,
                  index: QModelIndex) -> VariableEditor:
     variable = index.data(VariableRole)
     values = index.data(ValuesRole)
     return _create_editor(variable, values, parent, self._commit_data)
コード例 #20
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def columnCount(self, parent=QModelIndex()):
     return 0 if parent.isValid() else max(map(len, self._table), default=0)
コード例 #21
0
 def setEditorData(self, editor: VariableEditor, index: QModelIndex):
     editor.value = index.model().data(index, ValueRole)
コード例 #22
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def columnCount(self, parent=QModelIndex()):
     """Reimplemented from `QAbstractTableModel.columnCount`."""
     return 0 if parent.isValid() else self.__columnCount
コード例 #23
0
 def sizeHint(self, _: QStyleOptionViewItem, index: QModelIndex) -> QSize:
     return _create_editor(index.data(role=VariableRole), np.array([0]),
                           None, lambda: 1).sizeHint()
コード例 #24
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def insertColumns(self, column, count, parent=QModelIndex()):
     self.beginInsertColumns(parent, column, column + count - 1)
     for row in self._table:
         row[column:column] = [''] * count
     self.endInsertColumns()
     return True
コード例 #25
0
 def index(self, row, col, parent=QModelIndex()):
     return self.createIndex(row, col, 0)
コード例 #26
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def parent(self, index=QModelIndex()):
     return QModelIndex()
コード例 #27
0
 def rowCount(self, index=QModelIndex()):
     if index.isValid():
         return 0
     else:
         return len(self._data)
コード例 #28
0
ファイル: itemmodels.py プロジェクト: ycechung/orange3
 def rowCount(self, parent=QModelIndex()):
     return 0 if parent.isValid() else len(self)
コード例 #29
0
 def columnCount(self, index=QModelIndex()):
     return len(self._header)
コード例 #30
0
 def columnCount(self, parent=QModelIndex()):
     return 0 if parent.isValid() else len(self.Columns)
コード例 #31
0
ファイル: owkmeans.py プロジェクト: haojia632/orange3
 def rowCount(self, index=QModelIndex()):
     return 0 if index.isValid() else len(self.scores)