Skip to content

Commit

Permalink
Change calc groupBox title alignment (to the right) and update ui
Browse files Browse the repository at this point in the history
  • Loading branch information
hannalee2 committed Sep 25, 2024
1 parent 142fb2b commit 9257d43
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 547 deletions.
9 changes: 4 additions & 5 deletions parallax/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, model, reticle_selector, stage_controller):
self.reticle = None
self.stage_controller = stage_controller

self.ui = loadUi(os.path.join(ui_dir, "calc_move.ui"), self)
self.ui = loadUi(os.path.join(ui_dir, "calc.ui"), self)
self.setWindowTitle(f"Calculator")
self.setWindowFlags(Qt.Window | Qt.WindowMinimizeButtonHint | \
Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint)
Expand Down Expand Up @@ -236,7 +236,7 @@ def _disable(self, sn):
group_box = self.findChild(QGroupBox, f"groupBox_{sn}")
group_box.setEnabled(False)
group_box.setStyleSheet("background-color: #333333;")
group_box.setTitle(f"{sn} (Uncalibrated)")
group_box.setTitle(f"(Uncalibrated) {sn}")

def _enable(self, sn):
# Find the QGroupBox for the stage
Expand All @@ -251,11 +251,11 @@ def _create_stage_groupboxes(self):
for sn in self.model.stages.keys():
# Load the QGroupBox from the calc_QGroupBox.ui file
group_box = QGroupBox(self)
#loadUi(os.path.join(ui_dir, "calc_QGroupBox.ui"), group_box) # TODO
loadUi(os.path.join(ui_dir, "calc_QGroupBox_move.ui"), group_box)
loadUi(os.path.join(ui_dir, "calc_QGroupBox.ui"), group_box)

# Set the visible title of the QGroupBox to sn
group_box.setTitle(f"{sn}")
group_box.setAlignment(Qt.AlignRight) # title alignment to the right

# Append _{sn} to the QGroupBox object name
group_box.setObjectName(f"groupBox_{sn}")
Expand All @@ -274,7 +274,6 @@ def _create_stage_groupboxes(self):
# Add the newly created QGroupBox to the layout
widget_count = self.ui.verticalLayout_QBox.count()
self.ui.verticalLayout_QBox.insertWidget(widget_count - 1, group_box)
#self.ui.verticalLayout_QBox.addWidget(group_box)

def _connect_move_stage_buttons(self):
stop_button = self.ui.findChild(QPushButton, f"stopAllStages")
Expand Down
2 changes: 1 addition & 1 deletion parallax/screen_coords_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _clicked_position(self, camera_name, pos):
global_coords = self._get_global_coords_BA(camera_name, pos)
if global_coords is None:
return

global_coords = np.round(global_coords*1000, decimals=1)
reticle_name = self.reticle_selector.currentText()
if "Proj" not in reticle_name:
Expand Down
59 changes: 55 additions & 4 deletions ui/calc.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>890</width>
<height>347</height>
<width>953</width>
<height>638</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -39,15 +39,32 @@ QPushButton#startButton:disabled:checked {
}
QPushButton#startButton:disabled:!checked {
background-color: lightGreen;
}
QMessageBox {
background-color: rgb(00,00,00);
color: #FFFFFF;
}
QMessageBox QLabel {
color: #FFFFFF;
}
QMessageBox QPushButton {
background-color: rgb(50,50,50);
color: #FFFFFF;
}
QMessageBox QPushButton:hover {
background-color: rgb(100, 30, 30);
}
QMessageBox QPushButton:pressed {
background-color: rgb(224, 0, 0);
}</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>861</width>
<height>621</height>
<width>921</width>
<height>601</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_T">
Expand Down Expand Up @@ -132,6 +149,40 @@ QPushButton#startButton:disabled:!checked {
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="stopAllStages">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>resources/stop-sign.png</normaloff>resources/stop-sign.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
Expand Down
86 changes: 66 additions & 20 deletions ui/calc_QGroupBox.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>829</width>
<height>123</height>
<width>914</width>
<height>130</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>750</width>
<height>100</height>
<height>130</height>
</size>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -41,13 +41,31 @@ QPushButton#startButton:disabled:checked {
}
QPushButton#startButton:disabled:!checked {
background-color: lightGreen;
}

QMessageBox {
background-color: rgb(00,00,00);
color: #FFFFFF;
}
QMessageBox QLabel {
color: #FFFFFF;
}
QMessageBox QPushButton {
background-color: rgb(50,50,50);
color: #FFFFFF;
}
QMessageBox QPushButton:hover {
background-color: rgb(100, 30, 30);
}
QMessageBox QPushButton:pressed {
background-color: rgb(224, 0, 0);
}</string>
</property>
<widget class="QLineEdit" name="globalY">
<property name="geometry">
<rect>
<x>140</x>
<y>40</y>
<x>130</x>
<y>58</y>
<width>100</width>
<height>40</height>
</rect>
Expand All @@ -72,8 +90,8 @@ QPushButton#startButton:disabled:!checked {
<widget class="QLineEdit" name="globalZ">
<property name="geometry">
<rect>
<x>250</x>
<y>40</y>
<x>240</x>
<y>58</y>
<width>100</width>
<height>40</height>
</rect>
Expand All @@ -98,8 +116,8 @@ QPushButton#startButton:disabled:!checked {
<widget class="QLineEdit" name="globalX">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<x>20</x>
<y>58</y>
<width>100</width>
<height>40</height>
</rect>
Expand All @@ -124,8 +142,8 @@ QPushButton#startButton:disabled:!checked {
<widget class="QLineEdit" name="localX">
<property name="geometry">
<rect>
<x>410</x>
<y>40</y>
<x>400</x>
<y>58</y>
<width>100</width>
<height>40</height>
</rect>
Expand All @@ -145,8 +163,8 @@ QPushButton#startButton:disabled:!checked {
<widget class="QPushButton" name="convert">
<property name="geometry">
<rect>
<x>360</x>
<y>50</y>
<x>350</x>
<y>68</y>
<width>40</width>
<height>21</height>
</rect>
Expand Down Expand Up @@ -175,8 +193,8 @@ QPushButton#startButton:disabled:!checked {
<widget class="QLineEdit" name="localZ">
<property name="geometry">
<rect>
<x>630</x>
<y>40</y>
<x>620</x>
<y>58</y>
<width>100</width>
<height>40</height>
</rect>
Expand All @@ -202,8 +220,8 @@ QPushButton#startButton:disabled:!checked {
<widget class="QLineEdit" name="localY">
<property name="geometry">
<rect>
<x>520</x>
<y>40</y>
<x>510</x>
<y>58</y>
<width>100</width>
<height>40</height>
</rect>
Expand All @@ -229,9 +247,9 @@ QPushButton#startButton:disabled:!checked {
<widget class="QPushButton" name="ClearBtn">
<property name="geometry">
<rect>
<x>750</x>
<y>50</y>
<width>61</width>
<x>740</x>
<y>68</y>
<width>51</width>
<height>23</height>
</rect>
</property>
Expand All @@ -250,6 +268,34 @@ QPushButton#startButton:disabled:!checked {
<string>Clear</string>
</property>
</widget>
<widget class="QPushButton" name="moveStageXY">
<property name="geometry">
<rect>
<x>810</x>
<y>58</y>
<width>61</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>resources/move_xy0.png</normaloff>resources/move_xy0.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</widget>
<tabstops>
<tabstop>globalX</tabstop>
Expand Down
Loading

0 comments on commit 9257d43

Please sign in to comment.