Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zhang, Tong
Online Model App
Commits
a07fcabe
Commit
a07fcabe
authored
Jul 27, 2021
by
Tong Zhang
Browse files
ENH: Add controls for auto scaling.
parent
eb47d53f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/myApp/app.py
View file @
a07fcabe
...
...
@@ -125,6 +125,10 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
self
.
quad_info_btn
.
clicked
.
connect
(
self
.
on_query_quad_info
)
self
.
elem_info_btn
.
clicked
.
connect
(
self
.
on_query_elem_info
)
# auto xyscale
self
.
on_auto_xlim
()
self
.
on_auto_ylim
()
@
pyqtSlot
(
'QString'
)
def
on_quad1_name_changed
(
self
,
name
:
str
)
->
None
:
"""When the current selected quad name is changed, do:
...
...
@@ -340,6 +344,37 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
for
o
in
self
.
ellipse_area
.
findChildren
(
MatplotlibBaseWidget
):
o
.
setTightLayoutToggle
(
enabled
)
@
pyqtSlot
()
def
on_auto_xlim
(
self
):
"""Auto set xlimit.
"""
x0
,
x1
=
0
,
1
for
o
in
self
.
ellipse_area
.
findChildren
(
MatplotlibBaseWidget
):
o
.
set_autoscale
()
x0_
,
x1_
=
o
.
axes
.
get_xlim
()
if
x0_
<
x0
:
x0
=
x0_
if
x1_
>
x1
:
x1
=
x1_
self
.
xlim_x1_lineEdit
.
setText
(
f
'
{
x0
:.
1
f
}
'
)
self
.
xlim_x2_lineEdit
.
setText
(
f
'
{
x1
:.
1
f
}
'
)
@
pyqtSlot
()
def
on_auto_ylim
(
self
):
"""Auto set ylimit.
"""
y0
,
y1
=
0
,
1
for
o
in
self
.
ellipse_area
.
findChildren
(
MatplotlibBaseWidget
):
o
.
set_autoscale
()
y0_
,
y1_
=
o
.
axes
.
get_ylim
()
if
y0_
<
y0
:
y0
=
y0_
if
y1_
>
y1
:
y1
=
y1_
self
.
ylim_y1_lineEdit
.
setText
(
f
'
{
y0
:.
1
f
}
'
)
self
.
ylim_y2_lineEdit
.
setText
(
f
'
{
y1
:.
1
f
}
'
)
if
__name__
==
"__main__"
:
from
PyQt5.QtWidgets
import
QApplication
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment