當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QAbstractTableModel類代碼示例

本文整理匯總了Python中PySide.QtCore.QAbstractTableModel的典型用法代碼示例。如果您正苦於以下問題:Python QAbstractTableModel類的具體用法?Python QAbstractTableModel怎麽用?Python QAbstractTableModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了QAbstractTableModel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

    def __init__(self, runner=None):
        _OptionsModelMixin.__init__(self)
        QAbstractTableModel.__init__(self)

        self._runner = runner

        def _column0(runner, options):
            return str(options)
        def _column1(runner, options):
            STATE_ICONS = \
                {LocalRunner.STATE_QUEUED: getIcon('media-playback-pause'),
                 LocalRunner.STATE_RUNNING: getIcon('media-playback-start'),
                 LocalRunner.STATE_SIMULATED: getIcon('face-smile'),
                 LocalRunner.STATE_ERROR: getIcon('face-sad')}
            try:
                return STATE_ICONS.get(runner.options_state(options))
            except KeyError:
                return None
        def _column2(runner, options):
            try:
                progress = runner.options_progress(options) * 100
            except KeyError:
                progress = 0.0
            return '{0:n}%'.format(progress)
        def _column3(runner, options):
            try:
                return runner.options_status(options)
            except KeyError:
                return ''

        self._data_getter = {0: _column0, 1: _column1, 2: _column2, 3: _column3}
開發者ID:pymontecarlo,項目名稱:pymontecarlo-gui,代碼行數:31,代碼來源:runner.py

示例2: __init__

 def __init__(self, results, headerdata, parent=None, *args): 
     """ datain: a list of lists
         headerdata: a list of strings
     """
     QAbstractTableModel.__init__(self, parent, *args) 
     #self.arraydata = datain
     self.headerdata = headerdata
     self.results = results
開發者ID:bordstein,項目名稱:hamster,代碼行數:8,代碼來源:whooshresmodel.py

示例3: __init__

 def __init__(self, dataset = Dataset(), parent = None):
     '''Construtor de DatasetModel. 
     
     Parâmetros:
     
     dataset    : objeto Dataset para ser atribuído a *_dataset*
     '''
     QAbstractTableModel.__init__(self, parent)
     self._dataset = dataset
開發者ID:davidevandro,項目名稱:ProjetoFinal,代碼行數:9,代碼來源:model_dataset.py

示例4: flags

    def flags(self, index):
        if not index.isValid():
            return Qt.ItemIsEnabled

        # If the column is the vary parameter then we want the user to be able to check/uncheck the box
        if index.column() == 1:
            return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable)

        return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
開發者ID:nleehone,項目名稱:qt_lmfit_table,代碼行數:9,代碼來源:qt_lmfit_table_model.py

示例5: __init__

    def __init__(self):
        """ Build the Transactions Table """
        QAbstractTableModel.__init__(self)
        self.columns = self.getColumns()

        self.roleResponses = {Qt.DisplayRole:self.getData,
                              Qt.EditRole:self.getData,
                              Qt.ToolTipRole:self.getTip,
                              Qt.StatusTipRole:self.getTip,
                              Qt.TextAlignmentRole:self.getTextAlignment}
開發者ID:cloew,項目名稱:PersonalAccountingSoftware,代碼行數:10,代碼來源:table_model.py

示例6: __init__

    def __init__ ( self, editor, parent ):
        """ Initialise the object.
        """
        QAbstractTableModel.__init__( self, parent )

        self.setSupportedDragActions( Qt.CopyAction | Qt.MoveAction )

        self._editor = editor
        self._row    = editor.data_row_for
        self._font   = set()
開發者ID:davidmorrill,項目名稱:facets,代碼行數:10,代碼來源:grid_editor.py

示例7: __init__

 def __init__(self, dados = [], parent = None):
     '''Construtor de DatasetModel. 
     
     Parâmetros:
     
     dados   : objeto Dataset para ser atribuído a *_dataset*
     '''
     QAbstractTableModel.__init__(self, parent)
     self._dados = dados
     self._estatistica = dados.describe()
開發者ID:davidevandro,項目名稱:ProjetoFinal,代碼行數:10,代碼來源:model_estatistica_nominal.py

示例8: __init__

 def __init__(self, tabList=None, parent=None):
     QAbstractTableModel.__init__(self, parent)
     self.__headers = [
         'Char', 'Freq', 'ASCII', 'Huff', u'Ĉ ASCII', u'Ĉ Huff']
     if tabList is None:
         tabList = [['' for x in range(len(self.__headers))]]
     for x in range(len(tabList)):
         missingCols = len(self.__headers) - len(tabList[x])
         for x in range(missingCols):
             tabList[x].append('/')
     self.__tabList = tabList
     self.hlRow = []
開發者ID:mathieufrh,項目名稱:huffmanwizard,代碼行數:12,代碼來源:huffgui.py

示例9: flags

    def flags(self, index):
        """ Define editable cells

        :param index:
        """
        if not index.isValid():
            return Qt.ItemIsEnabled

        if index.column() in [NODE_NAME, NODE_FILE]:
            return Qt.ItemFlags(
                QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)

        return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
開發者ID:Bioeden,項目名稱:dbMayaTextureToolkit,代碼行數:13,代碼來源:mttModel.py

示例10: mimeTypes

    def mimeTypes ( self ):
        """ Returns the set of mime types that drag data can be encoded in.
        """
        result = QAbstractTableModel.mimeTypes( self )
        result.append( PythonMimeType )

        return result
開發者ID:davidmorrill,項目名稱:facets,代碼行數:7,代碼來源:grid_editor.py

示例11: flagsRule

 def flagsRule(self, index):
     row = index.row()
     if (index.column() == COLUMN.VALUE and
         (row == RULE_ROW.NAME or row == RULE_ROW.VARIABLE or row == RULE_ROW.MATH)):
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         return None
開發者ID:byteman1,項目名稱:BioPARKIN,代碼行數:7,代碼來源:sbml_entitytablemodel.py

示例12: flagsGeneral

 def flagsGeneral(self, index):
     row = index.row()
     if index.column() == COLUMN.VALUE and row == 1: # 1 is hardcoded; "Name" always has to be at 2nd position
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         #return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
         return None
開發者ID:moritzwade,項目名稱:BioPARKIN,代碼行數:7,代碼來源:sbml_entitytablemodel.py

示例13: flagsEvent

 def flagsEvent(self, index):
     row = index.row()
     if (index.column() == COLUMN.VALUE and
         (row == EVENT_ROW.NAME or row == EVENT_ROW.TARGET or row == EVENT_ROW.EXPRESSION or row == EVENT_ROW.TRIGGEREXPRESSION)):
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         return None
開發者ID:byteman1,項目名稱:BioPARKIN,代碼行數:7,代碼來源:sbml_entitytablemodel.py

示例14: flags

 def flags(self, index):
     """ Set the item flags at the given index. Seems like we're 
         implementing this function just to see how it's done, as we 
         manually adjust each tableView to have NoEditTriggers.
     """
     if not index.isValid():
         return Qt.ItemIsEnabled
     return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
開發者ID:vVvSHADOWvVv,項目名稱:sAB,代碼行數:8,代碼來源:tablemodel.py

示例15: setData

    def setData ( self, index, value, role ):
        """ Reimplemented to allow setting data.
        """
        if role == Qt.EditRole:
            # This works because a Facets Editor will have already set the value
            # on the object, and so we don't need to do anything here:
            return True

        return QAbstractTableModel.setData( self, index, value, role )
開發者ID:davidmorrill,項目名稱:facets,代碼行數:9,代碼來源:grid_editor.py


注:本文中的PySide.QtCore.QAbstractTableModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。