-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_window_overlay.py
96 lines (81 loc) · 3.82 KB
/
main_window_overlay.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# This file is part of Camino.
# Copyright (C) 2017 Manuel Luitz <[email protected]>
#
# Camino is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Camino is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Camino. If not, see <http://www.gnu.org/licenses/>.
#
from PyQt4 import QtCore, QtGui
import main_window
from gps_bar_plot import GPSBarPlot
from gps_satellite_plot import GPSSatellitePlot
from combo_box_ship_type import QComboBoxShipType
from about import About
class UiOverlayWindow(main_window.Ui_MainWindow):
def __init__(self, parent=None):
super(UiOverlayWindow, self).__init__(parent)
def setupUi(self, MainWindow):
super(UiOverlayWindow, self).setupUi(MainWindow)
# Add the custom GPS widget
layout = QtGui.QVBoxLayout()
self.widgetGPSBarPlot.setLayout(layout)
self.gpsBarPlot = GPSBarPlot(self.widgetGPSBarPlot)
layout.addWidget(self.gpsBarPlot)
# self.gpsBarPlot.setGeometry(QtCore.QRect(10, 10, 500, 200))
# Add the custom GPS satellites widget
layout = QtGui.QVBoxLayout()
self.widgetGPSSatellitePlot.setLayout(layout)
self.gpsSatellitePlot = GPSSatellitePlot(self.widgetGPSSatellitePlot)
layout.addWidget(self.gpsSatellitePlot)
# Add the connection status label to statusbar
self.label_connection_status = QtGui.QLabel()
self.label_connection_status_led = QtGui.QLabel()
self.statusbar.addPermanentWidget(self.label_connection_status)
self.statusbar.addPermanentWidget(self.label_connection_status_led)
self.setStatusDisconnected()
# About Dialog
self.aboutWindow = About(self)
self.actionAbout.triggered.connect(self.aboutWindow.show)
def setStatusConnected(self, device=None):
pixmap = QtGui.QPixmap('res/led-on.svg')
# pixmap = pixmap.scaled(self.statusbar.size()*0.4, QtCore.Qt.KeepAspectRatio)
self.label_connection_status_led.setPixmap(pixmap)
label = "Connected"
if device is not None:
label = "Connected to " + device
self.label_connection_status.setText(label)
def setStatusDisconnected(self):
pixmap = QtGui.QPixmap('res/led-off.svg')
# pixmap = pixmap.scaled(self.statusbar.size()*0.4, QtCore.Qt.KeepAspectRatio)
self.label_connection_status_led.setPixmap(pixmap)
self.label_connection_status.setText("Disonnected")
def showStatusBarMessage(self, text, timeout=1000.0):
self.statusbar.showMessage(text, timeout)
def clearGPSViews(self):
self.gpsBarPlot.resetData()
self.gpsSatellitePlot.resetData()
self.lineEditLatitude.clear()
self.lineEditLongitude.clear()
self.lineEditAltitude.clear()
self.lineEditSpeedOverGround.clear()
def updateGPSData(self, gpggaMessage):
self.lineEditLatitude.setText(gpggaMessage.getLatitudeString())
self.lineEditLongitude.setText(gpggaMessage.getLongitudeString())
self.lineEditAltitude.setText(gpggaMessage.getAltitudeString())
def updateSpeedOverGround(self, gpvtgMessage):
if self.settings.units.isMetric():
self.lineEditSpeedOverGround.setText(gpvtgMessage.getSpeedOverGroundStringMetric())
elif self.settings.units.isImperial():
self.lineEditSpeedOverGround.setText(gpvtgMessage.getSpeedOverGroundStringImperial())