Skip to content
Snippets Groups Projects
Commit 83375d25 authored by Kien Le's avatar Kien Le
Browse files

Move and resize the WF and TPS dialogs

Move and resize the waveform and TPS dialogs based on size of the screen
parent e8f3304b
No related branches found
No related tags found
1 merge request!218Fix program not fitting on low resolution screens
......@@ -36,6 +36,31 @@ def fix_relative_paths() -> None:
os.chdir(current_file_dir)
def resize_windows(main_window: MainWindow):
"""
Resize the pre-defined windows in the program so that they fit well on all
screen resolutions. Any windows that are created when they are shown will
have their parents handle their resizing or do it themselves.
"""
screen_size = QtWidgets.QApplication.primaryScreen().size().toTuple()
screen_width, screen_height = screen_size
main_window.resize(screen_width * 1, screen_height * 1)
main_window.waveform_dlg.resize(screen_width * (2 / 3),
screen_height * (2 / 3))
main_window.tps_dlg.resize(screen_width * (2 / 3), screen_height * (2 / 3))
main_right_x = (main_window.x() + main_window.frameSize().width())
# This offset is based on the hard-coded geometry previously assigned to
# the waveform and TPS dialogs
wf_tps_x_offset = 50
# We are moving the TPS dialog so that it is slightly offset from the right
# edge of the main window
tps_dlg_x = main_right_x - main_window.tps_dlg.width() - wf_tps_x_offset
wf_tps_y = 50
main_window.waveform_dlg.move(wf_tps_x_offset, wf_tps_y)
main_window.tps_dlg.move(tps_dlg_x, wf_tps_y)
def check_if_user_want_to_reset_config() -> bool:
"""
Show a dialog asking the user if they want to reset the config.
......@@ -83,6 +108,7 @@ def main():
sys.exit(1)
config.apply_config(wnd)
resize_windows(wnd)
wnd.show()
sys.exit(app.exec_())
......
......@@ -40,7 +40,6 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
"""
self.date_format: str = 'YYYY-MM-DD'
self.setGeometry(50, 50, 1200, 800)
self.setWindowTitle("TPS Plot")
main_layout = QtWidgets.QVBoxLayout()
......
......@@ -77,7 +77,6 @@ class WaveformDialog(QtWidgets.QWidget):
date_format: format for date
"""
self.date_format: str = 'YYYY-MM-DD'
self.setGeometry(50, 10, 1600, 700)
self.setWindowTitle("Raw Data Plot")
main_layout = QtWidgets.QVBoxLayout()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment