Skip to content

Commit ba7a3f6

Browse files
committed
Added morse code image
1 parent 9523a28 commit ba7a3f6

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
124 KB
Loading

src/surface/gui/gui/widgets/tabs/morse_tab.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
from pathlib import Path
12
from threading import Thread
23
from time import sleep
34

5+
from ament_index_python.packages import get_package_share_directory
6+
from PyQt6.QtCore import Qt
47
from PyQt6.QtCore import pyqtSignal, pyqtSlot
5-
from PyQt6.QtGui import QFont
8+
from PyQt6.QtGui import QFont, QPixmap
69
from PyQt6.QtWidgets import (
710
QGridLayout,
811
QHBoxLayout,
912
QLabel,
1013
QLineEdit,
1114
QPushButton,
15+
QVBoxLayout,
1216
QWidget,
1317
)
1418
from rclpy.qos import qos_profile_system_default
@@ -66,7 +70,9 @@ def __init__(self) -> None:
6670

6771
root_layout = QHBoxLayout()
6872
left_layout = QGridLayout()
73+
right_layout = QVBoxLayout()
6974
root_layout.addLayout(left_layout)
75+
root_layout.addLayout(right_layout)
7076

7177
self.line_edit = QLineEdit()
7278
self.line_edit.setPlaceholderText('Enter word')
@@ -86,6 +92,21 @@ def __init__(self) -> None:
8692

8793
self.set_light_signal.connect(self.set_light)
8894

95+
map_path = str(
96+
Path(get_package_share_directory('gui')) / 'images' / 'morse_code.png'
97+
)
98+
map_pixmap = QPixmap(map_path)
99+
map_label = QLabel()
100+
map_label.setPixmap(
101+
map_pixmap.scaled(
102+
600,
103+
600,
104+
Qt.AspectRatioMode.KeepAspectRatio,
105+
Qt.TransformationMode.SmoothTransformation,
106+
)
107+
)
108+
right_layout.addWidget(map_label)
109+
89110
self.setLayout(root_layout)
90111

91112
def button_callback(self) -> None:

0 commit comments

Comments
 (0)