Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CFA Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JOSSOUD Olivier
CFA Analysis
Commits
35e5f302
Commit
35e5f302
authored
5 years ago
by
JOSSOUD Olivier
Browse files
Options
Downloads
Patches
Plain Diff
ConductCalib. Highlight selected row of "set" table.
parent
887e3dbf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/uim/conductcalibuim.py
+4
-0
4 additions, 0 deletions
src/uim/conductcalibuim.py
src/utils.py
+32
-0
32 additions, 0 deletions
src/utils.py
with
36 additions
and
0 deletions
src/uim/conductcalibuim.py
+
4
−
0
View file @
35e5f302
...
...
@@ -116,6 +116,8 @@ class ConductCalibUim:
steps_item
.
setText
(
str
(
calib_run
.
instant_config_df
[
"
step
"
].
max
()))
self
.
main_ui
.
conduct_tablewidget_set
.
setItem
(
row_id
,
self
.
STEPS_COL
,
steps_item
)
utils
.
highlight_row
(
self
.
main_ui
.
conduct_tablewidget_set
,
row_id
)
def
change_selected_run
(
self
,
row
:
int
,
column
:
int
):
# Get run identifier (date and time concatenated)
identifier
=
self
.
main_ui
.
conduct_tablewidget_set
.
item
(
row
,
self
.
DATE_COL
).
text
()
\
...
...
@@ -126,6 +128,8 @@ class ConductCalibUim:
self
.
current_calib_run
=
calib_run
utils
.
highlight_row
(
self
.
main_ui
.
conduct_tablewidget_set
,
row
)
self
.
__update_run_plot__
(
calib_run
,
self
.
current_channel
)
self
.
__update_run_table__
(
calib_run
,
self
.
current_channel
)
...
...
This diff is collapsed.
Click to expand it.
src/utils.py
+
32
−
0
View file @
35e5f302
...
...
@@ -2,6 +2,8 @@ import pyqtgraph as pg
import
datetime
import
pandas
as
pd
import
numpy
as
np
from
PyQt5.QtWidgets
import
QTableWidget
from
PyQt5.QtGui
import
QColor
def
pd_time_to_epoch_ms
(
series
:
pd
.
Series
)
->
list
:
...
...
@@ -13,8 +15,10 @@ def pd_time_to_epoch_ms(series: pd.Series) -> list:
def
datetime64_to_epoch_ms
(
datetimes_list
:
np
.
ndarray
)
->
list
:
return
[
float
(
instant
)
/
1e9
for
instant
in
datetimes_list
]
####################################################################
# Graphics
class
TimeAxisItem
(
pg
.
AxisItem
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -24,3 +28,31 @@ class TimeAxisItem(pg.AxisItem):
def
tickStrings
(
self
,
values
,
scale
,
spacing
):
return
[
datetime
.
datetime
.
fromtimestamp
(
value
).
strftime
(
"
%H:%M:%S
"
)
for
value
in
values
]
def
highlight_row
(
table
:
QTableWidget
,
highlighted_row_id
:
int
,
highlighted_row_color
:
QColor
=
QColor
(
173
,
216
,
230
),
other_rows_color
:
QColor
=
QColor
(
255
,
255
,
255
))
->
None
:
"""
Highlight a table
'
s row by changing its background color.
Parameters
----------
table: PyQt5.QtWidgets.QTableWidget
Table whose row should be highlighted.
highlighted_row_id: int
Index (first row is 0) of the row which should be highlighted.
highlighted_row_color: PyQt5.QtGui.QColor
Background color of the highlighted row. Default is light blue.
other_rows_color: PyQt5.QtGui.QColor
Background color of the other rows of the table. Default is white.
Returns
-------
Nothing, modify the input ``table``
"""
for
row_id
in
range
(
table
.
rowCount
()):
if
row_id
==
highlighted_row_id
:
row_color
=
highlighted_row_color
else
:
row_color
=
other_rows_color
for
column_id
in
range
(
table
.
columnCount
()):
table
.
item
(
row_id
,
column_id
).
setBackground
(
row_color
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment