def __init__(self, rows=0, cols=0, parent=None): """ StandardWidgetSheet(rows: int, cols: int, parent: QWidget) -> StandardWidgetSheet Construct a sheet with rows x cols cells """ QtGui.QTableWidget.__init__(self, 0, 0, parent) palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(235, 235, 235)) self.setPalette(palette) self.setSelectionMode(QtGui.QAbstractItemView.NoSelection) self.fitToWindow = False self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.setHorizontalHeader( StandardWidgetHeaderView(QtCore.Qt.Horizontal, self)) self.horizontalHeader().setSelectionModel(self.selectionModel()) self.connect(self.horizontalHeader(), QtCore.SIGNAL('sectionCountChanged(int, int)'), self.updateColumnLabels) self.connect(self.horizontalHeader(), QtCore.SIGNAL('sectionMoved(int,int,int)'), self.columnMoved) self.connect(self.horizontalHeader(), QtCore.SIGNAL('sectionPressed(int)'), self.forceColumnMultiSelect) self.setVerticalHeader( StandardWidgetHeaderView(QtCore.Qt.Vertical, self)) self.verticalHeader().setSelectionModel(self.selectionModel()) self.connect(self.verticalHeader(), QtCore.SIGNAL('sectionCountChanged(int, int)'), self.updateRowLabels) self.connect(self.verticalHeader(), QtCore.SIGNAL('sectionMoved(int,int,int)'), self.rowMoved) self.connect(self.verticalHeader(), QtCore.SIGNAL('sectionPressed(int)'), self.forceRowMultiSelect) # A hack to force the select all button in single click mode cornerButton = self.findChild(QtGui.QAbstractButton) if cornerButton: self.connect(cornerButton, QtCore.SIGNAL('clicked()'), self.forceSheetSelect) self.delegate = StandardWidgetItemDelegate(self) self.setItemDelegate(self.delegate) self.helpers = CellHelpers(parent, CellResizer(self)) self.setRowCount(rows) self.setColumnCount(cols) self.setFitToWindow(True) self.connect(self, QtCore.SIGNAL('cellActivated(int, int, bool)'), self.selectCell) self.activeCell = (-1, -1)
def __init__(self, tabWidget, row=1, col=1): """ StandardSingleCellSheetTab(row: int, col: int) -> StandardSingleCellSheetTab Initialize with the vertical layout containing only a single widget """ QtGui.QWidget.__init__(self, None) StandardWidgetSheetTabInterface.__init__(self) self.type = 'StandardSingleCellSheetTab' self.tabWidget = tabWidget self.vLayout = QtGui.QVBoxLayout() self.vLayout.setSpacing(0) self.vLayout.setMargin(0) self.setLayout(self.vLayout) self.cell = QtGui.QWidget() self.layout().addWidget(self.cell) self.helpers = CellHelpers(self) self.toolBars = {} self.blankCellToolBar = None self.pipelineInfo = {}