Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_event(self):
current_row = self.table.selectedIndexes()[0].row()
pos = int(self.table.item(current_row, 0).data(Qt.DisplayRole))
self.table.setSortingEnabled(False)
self.table.insertRow(current_row)
self.table.setItem(current_row, 0, IntTableWidgetItem(pos))
self.table.setItem(current_row, 1, IntTableWidgetItem(0))
self.table.setItem(current_row, 2, QTableWidgetItem("New Annotation"))
self.table.setSortingEnabled(True)
def __init__(self, parent, onset, duration, description):
super().__init__(parent)
self.setWindowTitle("Edit Annotations")
self.table = QTableWidget(len(onset), 3)
for row, annotation in enumerate(zip(onset, duration, description)):
self.table.setItem(row, 0, IntTableWidgetItem(annotation[0]))
self.table.setItem(row, 1, IntTableWidgetItem(annotation[1]))
self.table.setItem(row, 2, QTableWidgetItem(annotation[2]))
self.table.setHorizontalHeaderLabels(["Onset", "Duration", "Type"])
self.table.horizontalHeader().setStretchLastSection(True)
self.table.verticalHeader().setVisible(False)
self.table.setShowGrid(False)
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table.setSortingEnabled(True)
self.table.sortByColumn(0, Qt.AscendingOrder)
vbox = QVBoxLayout(self)
vbox.addWidget(self.table)
hbox = QHBoxLayout()
self.add_button = QPushButton("+")
self.remove_button = QPushButton("-")
buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
def __init__(self, parent, pos, desc):
super().__init__(parent)
self.setWindowTitle("Edit Events")
self.table = QTableWidget(len(pos), 2)
for row, (p, d) in enumerate(zip(pos, desc)):
self.table.setItem(row, 0, IntTableWidgetItem(p))
self.table.setItem(row, 1, IntTableWidgetItem(d))
self.table.setHorizontalHeaderLabels(["Position", "Type"])
self.table.horizontalHeader().setStretchLastSection(True)
self.table.verticalHeader().setVisible(False)
self.table.setShowGrid(False)
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table.setSortingEnabled(True)
self.table.sortByColumn(0, Qt.AscendingOrder)
vbox = QVBoxLayout(self)
vbox.addWidget(self.table)
hbox = QHBoxLayout()
self.add_button = QPushButton("+")
self.remove_button = QPushButton("-")
buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Cancel)
def __init__(self, parent, pos, desc):
super().__init__(parent)
self.setWindowTitle("Edit Events")
self.table = QTableWidget(len(pos), 2)
for row, (p, d) in enumerate(zip(pos, desc)):
self.table.setItem(row, 0, IntTableWidgetItem(p))
self.table.setItem(row, 1, IntTableWidgetItem(d))
self.table.setHorizontalHeaderLabels(["Position", "Type"])
self.table.horizontalHeader().setStretchLastSection(True)
self.table.verticalHeader().setVisible(False)
self.table.setShowGrid(False)
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table.setSortingEnabled(True)
self.table.sortByColumn(0, Qt.AscendingOrder)
vbox = QVBoxLayout(self)
vbox.addWidget(self.table)
hbox = QHBoxLayout()
self.add_button = QPushButton("+")
self.remove_button = QPushButton("-")
buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
def add_event(self):
current_row = self.table.selectedIndexes()[0].row()
pos = int(self.table.item(current_row, 0).data(Qt.DisplayRole))
self.table.setSortingEnabled(False)
self.table.insertRow(current_row)
self.table.setItem(current_row, 0, IntTableWidgetItem(pos))
self.table.setItem(current_row, 1, IntTableWidgetItem(0))
self.table.setItem(current_row, 2, QTableWidgetItem("New Annotation"))
self.table.setSortingEnabled(True)
def add_event(self):
current_row = self.table.selectedIndexes()[0].row()
pos = int(self.table.item(current_row, 0).data(Qt.DisplayRole))
self.table.setSortingEnabled(False)
self.table.insertRow(current_row)
self.table.setItem(current_row, 0, IntTableWidgetItem(pos))
self.table.setItem(current_row, 1, IntTableWidgetItem(0))
self.table.setSortingEnabled(True)
def add_event(self):
current_row = self.table.selectedIndexes()[0].row()
pos = int(self.table.item(current_row, 0).data(Qt.DisplayRole))
self.table.setSortingEnabled(False)
self.table.insertRow(current_row)
self.table.setItem(current_row, 0, IntTableWidgetItem(pos))
self.table.setItem(current_row, 1, IntTableWidgetItem(0))
self.table.setSortingEnabled(True)