Skip to content

Commit

Permalink
Merge pull request #14 from mcb64/master
Browse files Browse the repository at this point in the history
Put orientation on main screen.
  • Loading branch information
mcb64 authored Apr 10, 2024
2 parents 80d326f + 36a36e4 commit 52cba5b
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 50 deletions.
181 changes: 132 additions & 49 deletions camviewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1119</width>
<height>992</height>
<height>1022</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -481,50 +481,56 @@ Vmin\</string>
<string>Camera</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="labelCamera">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="3" column="1">
<widget class="QLabel" name="label_dataRate">
<property name="minimumSize">
<size>
<width>45</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Camera</string>
</property>
<property name="buddy">
<cstring>comboBoxCamera</cstring>
<string>-</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_20">
<item row="3" column="2">
<widget class="QLabel" name="label_disp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Connected</string>
<string>Display Rate</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_data">
<item row="0" column="0">
<widget class="QLabel" name="labelCamera">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data Rate</string>
<string>Camera</string>
</property>
<property name="buddy">
<cstring>comboBoxCamera</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_dataRate">
<item row="3" column="4">
<widget class="QLabel" name="label_dispRate">
<property name="minimumSize">
<size>
<width>45</width>
Expand All @@ -536,20 +542,33 @@ Vmin\</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QLabel" name="label_dispRate">
<property name="minimumSize">
<size>
<width>45</width>
<height>0</height>
</size>
<item row="1" column="2">
<widget class="QLabel" name="label_connected">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>-</string>
<string>NO</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_data">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data Rate</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="5">
<item row="5" column="0" colspan="5">
<layout class="QHBoxLayout" name="LensLayout">
<item>
<widget class="QLabel" name="labelLens">
Expand Down Expand Up @@ -606,40 +625,104 @@ Vmin\</string>
</item>
</layout>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_disp">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_20">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Display Rate</string>
<string>Connected</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_connected">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="0" column="2" colspan="3">
<widget class="QComboBox" name="comboBoxCamera"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>NO</string>
<string>Orientation</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<widget class="QComboBox" name="comboBoxCamera"/>
<item row="4" column="2" colspan="3">
<widget class="QComboBox" name="comboBoxOrientation">
<item>
<property name="text">
<string>None</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon0.xpm</normaloff>:/icons/icon0.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>90deg</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon90.xpm</normaloff>:/icons/icon90.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>180deg</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon180.xpm</normaloff>:/icons/icon180.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>270deg</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon270.xpm</normaloff>:/icons/icon270.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>Flip</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon0F.xpm</normaloff>:/icons/icon0F.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>Flip+90deg</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon90F.xpm</normaloff>:/icons/icon90F.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>Flip+180deg</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon180F.xpm</normaloff>:/icons/icon180F.xpm</iconset>
</property>
</item>
<item>
<property name="text">
<string>Flip+270deg</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icons/icon270F.xpm</normaloff>:/icons/icon270F.xpm</iconset>
</property>
</item>
</widget>
</item>
</layout>
</widget>
Expand Down
8 changes: 7 additions & 1 deletion camviewer_ui_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 18 additions & 0 deletions param.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 52cba5b

Please sign in to comment.