[add] colorized table
This commit is contained in:
parent
b02a0e8f9a
commit
18926610cf
23
PyLoT.py
23
PyLoT.py
@ -2817,6 +2817,16 @@ class MainWindow(QMainWindow):
|
|||||||
event.addNotes(notes)
|
event.addNotes(notes)
|
||||||
self.fill_eventbox()
|
self.fill_eventbox()
|
||||||
|
|
||||||
|
def set_background_color(items, color):
|
||||||
|
for item in items:
|
||||||
|
item.setBackground(color)
|
||||||
|
|
||||||
|
def set_foreground_color(items, color):
|
||||||
|
for item in items:
|
||||||
|
item.setForeground(color)
|
||||||
|
|
||||||
|
current_event = self.get_current_event()
|
||||||
|
|
||||||
# generate delete icon
|
# generate delete icon
|
||||||
del_icon = QIcon()
|
del_icon = QIcon()
|
||||||
del_icon.addPixmap(QPixmap(':/icons/delete.png'))
|
del_icon.addPixmap(QPixmap(':/icons/delete.png'))
|
||||||
@ -2880,9 +2890,6 @@ class MainWindow(QMainWindow):
|
|||||||
item_test = QtGui.QTableWidgetItem()
|
item_test = QtGui.QTableWidgetItem()
|
||||||
item_notes = QtGui.QTableWidgetItem()
|
item_notes = QtGui.QTableWidgetItem()
|
||||||
|
|
||||||
# manipulate items
|
|
||||||
item_ref.setBackground(self._ref_test_colors['ref'])
|
|
||||||
item_test.setBackground(self._ref_test_colors['test'])
|
|
||||||
item_path.setText(event.path)
|
item_path.setText(event.path)
|
||||||
if hasattr(event, 'origins'):
|
if hasattr(event, 'origins'):
|
||||||
if event.origins:
|
if event.origins:
|
||||||
@ -2921,6 +2928,16 @@ class MainWindow(QMainWindow):
|
|||||||
item_nmp, item_nap, item_ref, item_test, item_notes]
|
item_nmp, item_nap, item_ref, item_test, item_notes]
|
||||||
self.project._table.append(column)
|
self.project._table.append(column)
|
||||||
|
|
||||||
|
if index%2:
|
||||||
|
set_background_color(column, QtGui.QColor(*(245, 245, 245, 255)))
|
||||||
|
|
||||||
|
if event == current_event:
|
||||||
|
set_foreground_color(column, QtGui.QColor(*(0, 143, 143, 255)))
|
||||||
|
|
||||||
|
# manipulate items
|
||||||
|
item_ref.setBackground(self._ref_test_colors['ref'])
|
||||||
|
item_test.setBackground(self._ref_test_colors['test'])
|
||||||
|
|
||||||
for r_index, row in enumerate(self.project._table):
|
for r_index, row in enumerate(self.project._table):
|
||||||
for c_index, item in enumerate(row):
|
for c_index, item in enumerate(row):
|
||||||
if type(item) == QtGui.QTableWidgetItem:
|
if type(item) == QtGui.QTableWidgetItem:
|
||||||
|
Loading…
Reference in New Issue
Block a user