当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QAbstractTableModel类代码示例

本文整理汇总了Python中spyderlib.qt.QtCore.QAbstractTableModel的典型用法代码示例。如果您正苦于以下问题:Python QAbstractTableModel类的具体用法?Python QAbstractTableModel怎么用?Python QAbstractTableModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QAbstractTableModel类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, data, format="%.3f", xlabels=None, ylabels=None,
                 readonly=False, parent=None):
        QAbstractTableModel.__init__(self)

        self.dialog = parent
        self.changes = {}
        self.xlabels = xlabels
        self.ylabels = ylabels
        self.readonly = readonly
        self.test_array = np.array([0], dtype=data.dtype)

        # for complex numbers, shading will be based on absolute value
        # but for all other types it will be the real part
        if data.dtype in (np.complex64, np.complex128):
            self.color_func = np.abs
        else:
            self.color_func = np.real
        
        # Backgroundcolor settings
        huerange = [.66, .99] # Hue
        self.sat = .7 # Saturation
        self.val = 1. # Value
        self.alp = .6 # Alpha-channel

        self._data = data
        self._format = format
        
        self.total_rows = self._data.shape[0]
        self.total_cols = self._data.shape[1]
        size = self.total_rows * self.total_cols
        
        try:
            self.vmin = np.nanmin(self.color_func(data))
            self.vmax = np.nanmax(self.color_func(data))
            if self.vmax == self.vmin:
                self.vmin -= 1
            self.hue0 = huerange[0]
            self.dhue = huerange[1]-huerange[0]
            self.bgcolor_enabled = True
        except TypeError:
            self.vmin = None
            self.vmax = None
            self.hue0 = None
            self.dhue = None
            self.bgcolor_enabled = False
        
        # Use paging when the total size, number of rows or number of
        # columns is too large
        if size > LARGE_SIZE:
            self.rows_loaded = self.ROWS_TO_LOAD
            self.cols_loaded = self.COLS_TO_LOAD
        else:
            if self.total_rows > LARGE_NROWS:
                self.rows_loaded = self.ROWS_TO_LOAD
            else:
                self.rows_loaded = self.total_rows
            if self.total_cols > LARGE_COLS:
                self.cols_loaded = self.COLS_TO_LOAD
            else:
                self.cols_loaded = self.total_cols
开发者ID:da-woods,项目名称:spyder,代码行数:60,代码来源:arrayeditor.py

示例2: __init__

 def __init__(self, parent, data):
     QAbstractTableModel.__init__(self, parent)
     if data is None:
         data = {}
     self._data = None
     self.breakpoints = None
     self.set_data(data)    
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:7,代码来源:breakpointsgui.py

示例3: flags

 def flags(self, index):
     if not index.isValid():
         return Qt.ItemIsEnabled
     column = index.column()
     if column in (MOD1, MOD2, MOD3, KEY):
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
开发者ID:ftsiadimos,项目名称:spyder,代码行数:8,代码来源:shortcuts.py

示例4: __init__

    def __init__(self, parent):
        QAbstractTableModel.__init__(self)
        self.shortcuts = []
        self._parent = parent
        self.letters = ''
        self.label = QLabel()
        self.widths = []

        # Needed to compensate for the HTMLDelegate color selection unawarness
        palette = parent.palette()
        self.text_color = palette.text().color().name()
        self.text_color_highlight = palette.highlightedText().color().name()
开发者ID:ptocca,项目名称:spyder,代码行数:12,代码来源:shortcuts.py

示例5: __init__

    def __init__(self, dataFrame, format="%.3g", parent=None):
        QAbstractTableModel.__init__(self)
        self.dialog = parent
        self.df = dataFrame
        self._format = format
        self.bgcolor_enabled = True
        self.complex_intran = None

        huerange = [.66, .99]  # Hue
        self.sat = .7  # Saturation
        self.val = 1.  # Value
        self.alp = .6  # Alpha-channel
        self.hue0 = huerange[0]
        self.dhue = huerange[1]-huerange[0]
        self.max_min_col = None
        self.max_min_col_update()
        self.colum_avg_enabled = True
        self.colum_avg(1)
开发者ID:jromang,项目名称:spyderlib,代码行数:18,代码来源:dataframeeditor.py

示例6: __init__

    def __init__(self, dataFrame, format="%.3g", parent=None):
        QAbstractTableModel.__init__(self)
        self.dialog = parent
        self.df = dataFrame
        self.df_index = dataFrame.index.tolist()
        self.df_header = dataFrame.columns.tolist()
        self._format = format
        self.complex_intran = None
        
        self.total_rows = self.df.shape[0]
        self.total_cols = self.df.shape[1]
        size = self.total_rows * self.total_cols

        huerange = [.66, .99]  # Hue
        self.sat = .7  # Saturation
        self.val = 1.  # Value
        self.alp = .6  # Alpha-channel
        self.hue0 = huerange[0]
        self.dhue = huerange[1]-huerange[0]
        self.max_min_col = None
        if size < LARGE_SIZE:
            self.max_min_col_update()
            self.colum_avg_enabled = True
            self.bgcolor_enabled = True
            self.colum_avg(1)
        else:
            self.colum_avg_enabled = False
            self.bgcolor_enabled = False
            self.colum_avg(0)

        # Use paging when the total size, number of rows or number of
        # columns is too large
        if size > LARGE_SIZE:
            self.rows_loaded = self.ROWS_TO_LOAD
            self.cols_loaded = self.COLS_TO_LOAD
        else:
            if self.total_rows > LARGE_NROWS:
                self.rows_loaded = self.ROWS_TO_LOAD
            else:
                self.rows_loaded = self.total_rows
            if self.total_cols > LARGE_COLS:
                self.cols_loaded = self.COLS_TO_LOAD
            else:
                self.cols_loaded = self.total_cols
开发者ID:gyenney,项目名称:Tools,代码行数:44,代码来源:dataframeeditor.py

示例7: __init__

    def __init__(self, data, format="%.3f", xlabels=None, ylabels=None,
                 readonly=False, parent=None):
        QAbstractTableModel.__init__(self)

        self.dialog = parent
        self.changes = {}
        self.xlabels = xlabels
        self.ylabels = ylabels
        self.readonly = readonly
        self.test_array = np.array([0], dtype=data.dtype)

        # for complex numbers, shading will be based on absolute value
        # but for all other types it will be the real part
        if data.dtype in (np.complex64, np.complex128):
            self.color_func = np.abs
        else:
            self.color_func = np.real
        
        # Backgroundcolor settings
        huerange = [.66, .99] # Hue
        self.sat = .7 # Saturation
        self.val = 1. # Value
        self.alp = .6 # Alpha-channel

        self._data = data
        self._format = format
        
        try:
            self.vmin = self.color_func(data).min()
            self.vmax = self.color_func(data).max()
            if self.vmax == self.vmin:
                self.vmin -= 1
            self.hue0 = huerange[0]
            self.dhue = huerange[1]-huerange[0]
            self.bgcolor_enabled = True
        except TypeError:
            self.vmin = None
            self.vmax = None
            self.hue0 = None
            self.dhue = None
            self.bgcolor_enabled = False
开发者ID:jromang,项目名称:spyderlib,代码行数:41,代码来源:arrayeditor.py

示例8: flags

 def flags(self, index):
     """Set editable flag"""
     if not index.isValid():
         return Qt.ItemIsEnabled
     return Qt.ItemFlags(QAbstractTableModel.flags(self, index)|
                         Qt.ItemIsEditable)
开发者ID:da-woods,项目名称:spyder,代码行数:6,代码来源:arrayeditor.py

示例9: flags

 def flags(self, index):
     """Set flags"""
     if index.column() == 0:
         return Qt.ItemIsEnabled | Qt.ItemIsSelectable
     return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
                         Qt.ItemIsEditable)
开发者ID:gyenney,项目名称:Tools,代码行数:6,代码来源:dataframeeditor.py

示例10: __init__

 def __init__(self, parent, dependencies):
     QAbstractTableModel.__init__(self, parent)
     self.dependencies = None
     self.set_data(dependencies)
开发者ID:rthouvenin,项目名称:spyder,代码行数:4,代码来源:dependencies.py

示例11: flags

 def flags(self, index):
     """Qt Override."""
     if not index.isValid():
         return Qt.ItemIsEnabled
     return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:5,代码来源:shortcuts.py

示例12: __init__

 def __init__(self, data=[], parent=None):
     QAbstractTableModel.__init__(self, parent)
     self._data = data
开发者ID:gyenney,项目名称:Tools,代码行数:3,代码来源:importwizard.py

示例13: __init__

 def __init__(self):
     QAbstractTableModel.__init__(self)
     self.shortcuts = []
开发者ID:jromang,项目名称:spyderlib,代码行数:3,代码来源:shortcuts.py


注:本文中的spyderlib.qt.QtCore.QAbstractTableModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。