Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nexus
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Software Public
PASSOFT
nexus
Commits
98dac4a7
Commit
98dac4a7
authored
1 year ago
by
Destiny Kuehn
Committed by
Maeva Pourpoint
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix issues
#52
parent
dc7f5af3
No related branches found
Branches containing commit
No related tags found
1 merge request
!21
Fix issues #52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nexus/ChannelSelectDialog.py
+22
-9
22 additions, 9 deletions
nexus/ChannelSelectDialog.py
with
22 additions
and
9 deletions
nexus/ChannelSelectDialog.py
+
22
−
9
View file @
98dac4a7
#!/usr/bin/env python
# -*- coding: utf-8 -*-*#
'''
"""
Dialog for selecting channels from a station
Lloyd Carothers
IRIS/PASSCAL
'''
"""
import
sys
import
os
from
PySide6.QtWidgets
import
(
QDialog
,
QApplication
,
QTableWidgetItem
,
)
from
PySide6.QtCore
import
Qt
from
PySide6.QtWidgets
import
QApplication
,
QTableWidgetItem
from
PySide6.QtUiTools
import
loadUiType
from
.obspyImproved
import
utc_to_str
def
load_ui
(
filename
):
'''
"""
Helper function
Load a ui file relative to this source file
'''
"""
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
filename
)
try
:
ret
=
loadUiType
(
path
)
...
...
@@ -33,6 +32,7 @@ def load_ui(filename):
class
ChannelSelectDialog
(
*
load_ui
(
'
ChannelSelectDialog.ui
'
)):
def
__init__
(
self
,
station
,
parent
=
None
):
self
.
station
=
station
self
.
chan_map
=
{}
super
().
__init__
(
parent
)
self
.
setupUi
()
...
...
@@ -43,13 +43,26 @@ class ChannelSelectDialog(*load_ui('ChannelSelectDialog.ui')):
self
.
selected_channels
.
append
(
self
.
chan_map
[
row
])
super
().
accept
()
def
sort_table
(
self
,
column
):
"""
Sort Channel Select Dialog table based on column
header selected by user.
"""
row_map
=
{
0
:
'
location_code
'
,
1
:
'
code
'
,
2
:
'
sample_rate
'
,
3
:
'
start_date
'
,
4
:
'
end_date
'
}
order
=
self
.
tableWidget
.
horizontalHeader
().
sortIndicatorOrder
()
descending
=
False
if
order
==
Qt
.
AscendingOrder
else
True
self
.
chan_map
=
{
ind
:
v
for
ind
,
(
_
,
v
)
in
enumerate
(
sorted
(
self
.
chan_map
.
items
(),
key
=
lambda
item
:
getattr
(
item
[
1
],
row_map
[
column
]),
reverse
=
descending
))}
def
setupUi
(
self
):
super
().
setupUi
(
self
)
self
.
setWindowTitle
(
'
Select channels
'
)
self
.
label
.
setText
(
'
Station: {}
'
.
format
(
self
.
station
.
code
))
self
.
tableWidget
.
setRowCount
(
len
(
self
.
station
))
self
.
tableWidget
.
horizontalHeader
().
sectionClicked
.
connect
(
self
.
sort_table
)
# Add channels
self
.
chan_map
=
{}
for
row
,
chan
in
enumerate
(
self
.
station
):
for
col
,
value
in
enumerate
(
(
'
{:>2s}
'
.
format
(
chan
.
location_code
),
...
...
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