From 36a36e4ed226a10df5cc6def21313d040e9d92d7 Mon Sep 17 00:00:00 2001 From: Michael Browne Date: Wed, 10 Apr 2024 14:48:19 -0700 Subject: [PATCH] Put orientation on main screen. --- camviewer.ui | 181 +++++++++++++++++++++++++++++++------------ camviewer_ui_impl.py | 8 +- param.py | 18 +++++ 3 files changed, 157 insertions(+), 50 deletions(-) diff --git a/camviewer.ui b/camviewer.ui index a0aea9f..0f48650 100644 --- a/camviewer.ui +++ b/camviewer.ui @@ -7,7 +7,7 @@ 0 0 1119 - 992 + 1022 @@ -481,37 +481,40 @@ Vmin\ Camera - - - - - 0 - 0 - + + + + + 45 + 0 + - Camera - - - comboBoxCamera + - - - + + 0 0 + + + 75 + 0 + + - Connected + Display Rate - - + + 0 @@ -519,12 +522,15 @@ Vmin\ - Data Rate + Camera + + + comboBoxCamera - - + + 45 @@ -536,20 +542,33 @@ Vmin\ - - - - - 45 - 0 - + + + + + 0 + 0 + - - + NO + + + + + + + + 0 + 0 + + + + Data Rate - + @@ -606,40 +625,104 @@ Vmin\ - - + + 0 0 - - - 75 - 0 - - - Display Rate + Connected - - - - - 0 - 0 - - + + + + + - NO + Orientation - - + + + + + None + + + + :/icons/icon0.xpm:/icons/icon0.xpm + + + + + 90deg + + + + :/icons/icon90.xpm:/icons/icon90.xpm + + + + + 180deg + + + + :/icons/icon180.xpm:/icons/icon180.xpm + + + + + 270deg + + + + :/icons/icon270.xpm:/icons/icon270.xpm + + + + + Flip + + + + :/icons/icon0F.xpm:/icons/icon0F.xpm + + + + + Flip+90deg + + + + :/icons/icon90F.xpm:/icons/icon90F.xpm + + + + + Flip+180deg + + + + :/icons/icon180F.xpm:/icons/icon180F.xpm + + + + + Flip+270deg + + + + :/icons/icon270F.xpm:/icons/icon270F.xpm + + + diff --git a/camviewer_ui_impl.py b/camviewer_ui_impl.py index c5d7628..af979a1 100644 --- a/camviewer_ui_impl.py +++ b/camviewer_ui_impl.py @@ -496,6 +496,7 @@ def __init__( self.discoTimer.timeout.connect(self.do_disco) self.ui.average.returnPressed.connect(self.onAverageSet) + self.ui.comboBoxOrientation.currentIndexChanged.connect(self.onOrientationSelect) self.ui.orient0.triggered.connect(lambda: self.setOrientation(param.ORIENT0)) self.ui.orient90.triggered.connect(lambda: self.setOrientation(param.ORIENT90)) self.ui.orient180.triggered.connect( @@ -1256,7 +1257,12 @@ def onfileSave(self): print("fileSave failed:", e) QMessageBox.warning(self, "File Save Failed", str(e)) - def setOrientation(self, orientation, reorient=True): + def onOrientationSelect(self, index): + self.setOrientation(param.idx2orient[index], fromCombo=True) + + def setOrientation(self, orientation, reorient=True, fromCombo=False): + if not fromCombo: + self.ui.comboBoxOrientation.setCurrentIndex(param.orient2idx[orientation]) self.ui.orient0.setChecked(orientation == param.ORIENT0) self.ui.orient90.setChecked(orientation == param.ORIENT90) self.ui.orient180.setChecked(orientation == param.ORIENT180) diff --git a/param.py b/param.py index 9607772..891b915 100644 --- a/param.py +++ b/param.py @@ -10,6 +10,24 @@ ORIENT270 = 6 ORIENT270F = 7 +orient2idx = {ORIENT0: 0, + ORIENT90: 1, + ORIENT180: 2, + ORIENT270: 3, + ORIENT0F: 4, + ORIENT90F: 5, + ORIENT180F: 6, + ORIENT270F: 7} + +idx2orient = { 0: ORIENT0, + 1: ORIENT90, + 2: ORIENT180, + 3: ORIENT270, + 4: ORIENT0F, + 5: ORIENT90F, + 6: ORIENT180F, + 7: ORIENT270F} + orientation = 0 # These are all *image* variables.