Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
UW-Glance
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
Eva Schiffer
UW-Glance
Commits
f15f083b
Commit
f15f083b
authored
8 years ago
by
Eva Schiffer
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request
#17
from adesmet-ssec/gui-sync-variables
Smart GUI variable selection
parents
50654e96
e219ba43
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyglance/glance/gui_view.py
+39
-3
39 additions, 3 deletions
pyglance/glance/gui_view.py
with
39 additions
and
3 deletions
pyglance/glance/gui_view.py
+
39
−
3
View file @
f15f083b
...
...
@@ -251,7 +251,8 @@ class GlanceGUIView (QtGui.QWidget) :
grid_layout
.
addWidget
(
QtGui
.
QLabel
(
"
variable name:
"
),
currentRow
,
1
)
variableSelection
=
QtGui
.
QComboBox
()
variableSelection
.
setDisabled
(
True
)
variableSelection
.
activated
.
connect
(
partial
(
self
.
reportVariableSelected
,
file_prefix
=
file_prefix
))
variableSelection
.
currentIndexChanged
.
connect
(
partial
(
self
.
reportVariableSelected
,
file_prefix
=
file_prefix
))
variableSelection
.
lastSelected
=
"
InvalidStringThatShouldNeverExist
"
self
.
widgetInfo
[
file_prefix
][
'
variable
'
]
=
variableSelection
grid_layout
.
addWidget
(
variableSelection
,
currentRow
,
2
,
1
,
3
)
...
...
@@ -515,14 +516,30 @@ class GlanceGUIView (QtGui.QWidget) :
def
reportVariableSelected
(
self
,
file_prefix
=
None
)
:
"""
when a variable is selected for one of the files, report it to any user update listener
s
when a variable is selected for one of the files, report it to any user update listener
"""
selectionText
=
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
currentText
()
lastSelected
=
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
lastSelected
if
selectionText
==
lastSelected
:
return
# let our listeners know the user selected a variable
for
listener
in
self
.
userUpdateListeners
:
listener
.
userSelectedVariable
(
file_prefix
,
selectionText
)
# If both files had the same named variable selected, try to
# keep them in sync. We only do this for A so that by manipulating
# B, the use can desync them if they wish.
if
file_prefix
==
A_CONST
:
other
=
B_CONST
if
self
.
widgetInfo
[
other
][
'
variable
'
].
currentText
()
==
lastSelected
:
i
=
self
.
widgetInfo
[
other
][
'
variable
'
].
findText
(
selectionText
)
if
i
!=
-
1
:
i
=
self
.
widgetInfo
[
other
][
'
variable
'
].
setCurrentIndex
(
i
)
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
lastSelected
=
selectionText
def
reportOverrideChange
(
self
,
file_prefix
=
None
)
:
"""
...
...
@@ -874,13 +891,32 @@ class GlanceGUIView (QtGui.QWidget) :
# if we got a new variable list, set up the appropriate drop down list
if
variable_list
is
not
None
:
# Cache now, because clear/addItems will change it as a side effect
last_selected
=
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
lastSelected
# set up the list of selectable variables for analysis
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
clear
()
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
addItems
(
variable_list
)
# If the new file has the same variable name we were just
# displaying, default to it.
i
=
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
findText
(
last_selected
)
if
i
!=
-
1
:
selected_variable
=
last_selected
else
:
# That didn't work? Well, can we find a variable name
# matching what the other field is displaying?
if
file_prefix
==
A_CONST
:
other
=
B_CONST
else
:
other
=
A_CONST
other_string
=
self
.
widgetInfo
[
other
][
'
variable
'
].
currentText
()
i
=
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
findText
(
other_string
)
if
i
!=
-
1
:
selected_variable
=
last_selected
# set the selected variable
tempPosition
=
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
findText
(
selected_variable
)
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
setCurrentIndex
(
tempPosition
)
self
.
widgetInfo
[
file_prefix
][
'
variable
'
].
lastSelected
=
selected_variable
# set the override
self
.
widgetInfo
[
file_prefix
][
'
override
'
].
setChecked
(
use_fill_override
)
...
...
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