Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
WEISS
Software Repositories
SNAPPY
scikit-surgerydavinci
Commits
00a42b7b
Commit
00a42b7b
authored
Mar 13, 2019
by
Thomas Dowrick
Browse files
Issue
#11
: Add button to take screenshot
parent
9ef39a05
Pipeline
#1665
failed with stages
in 15 minutes and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
sksurgerydavinci/ui/gui.py
View file @
00a42b7b
...
...
@@ -3,6 +3,7 @@
# pylint: disable=fixme, attribute-defined-outside-init
# pylint: disable=no-name-in-module, too-many-public-methods
import
os
import
datetime
from
PySide2.QtCore
import
Qt
,
Signal
from
PySide2.QtWidgets
import
QSlider
,
QVBoxLayout
,
QHBoxLayout
,
\
QLabel
,
QPushButton
,
\
...
...
@@ -33,13 +34,14 @@ class UI(QWidget):
self
.
controls_vbox
=
QVBoxLayout
()
self
.
opacity_box
=
QHBoxLayout
()
self
.
visiblity_buttons
=
QHBoxLayout
()
self
.
other_buttons
=
Q
H
BoxLayout
()
self
.
other_buttons
=
Q
V
BoxLayout
()
self
.
add_vtk_overlay_window
(
overlay_window
)
self
.
add_opacity_slider
()
self
.
layout
.
addLayout
(
self
.
visiblity_buttons
)
self
.
layout
.
addLayout
(
self
.
other_buttons
)
self
.
add_exit_button
()
self
.
add_record_buttons
()
self
.
screen
=
None
self
.
screen_geometry
=
None
...
...
@@ -81,6 +83,19 @@ class UI(QWidget):
self
.
exit_button
.
setStyleSheet
(
style_sheet
)
self
.
other_buttons
.
addWidget
(
self
.
exit_button
)
def
add_record_buttons
(
self
):
""" Add buttons to take screenshot and record video. """
self
.
screenshot_button
=
QPushButton
(
'Take screenshot'
)
self
.
screenshot_button
.
clicked
.
connect
(
self
.
on_screenshot_clicked
)
self
.
record_button
=
QPushButton
(
'Record video'
)
self
.
record_button
.
clicked
.
connect
(
self
.
on_record_clicked
)
self
.
record_buttons_layout
=
QHBoxLayout
()
self
.
record_buttons_layout
.
addWidget
(
self
.
screenshot_button
)
self
.
record_buttons_layout
.
addWidget
(
self
.
record_button
)
self
.
other_buttons
.
addLayout
(
self
.
record_buttons_layout
)
def
on_exit_clicked
(
self
):
""" Close the application when the exit button has been clicked"""
...
...
@@ -95,6 +110,15 @@ class UI(QWidget):
self
.
exit_signal
.
emit
()
QApplication
.
exit
()
def
on_screenshot_clicked
(
self
):
""" Save a screenshot to disk, using date and time as filename """
fname
=
datetime
.
datetime
.
now
().
strftime
(
"%Y-%m-%d.%H-%M-%S"
)
+
'.png'
self
.
vtk_overlay
.
save_scene_to_file
(
fname
)
def
on_record_clicked
(
self
):
""" Start recording a video using current time as filename """
pass
def
add_vtk_models
(
self
,
vtk_models
):
""" Add VTK models to the UI and vtk_overlay_window
...
...
Write
Preview
Supports
Markdown
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