def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(679, 462) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.OpenCommBtn = QtWidgets.QPushButton(self.centralwidget) self.OpenCommBtn.setGeometry(QtCore.QRect(30, 50, 141, 23)) self.OpenCommBtn.setObjectName("OpenCommBtn") self.CloseCommBtn = QtWidgets.QPushButton(self.centralwidget) self.CloseCommBtn.setGeometry(QtCore.QRect(30, 90, 141, 23)) self.CloseCommBtn.setObjectName("CloseCommBtn") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(30, 150, 141, 191)) self.groupBox.setObjectName("groupBox") self.IntTimeEdt = QtWidgets.QLineEdit(self.groupBox) self.IntTimeEdt.setGeometry(QtCore.QRect(10, 50, 51, 20)) self.IntTimeEdt.setObjectName("IntTimeEdt") self.NumAvgEdt = QtWidgets.QLineEdit(self.groupBox) self.NumAvgEdt.setGeometry(QtCore.QRect(10, 100, 51, 20)) self.NumAvgEdt.setObjectName("NumAvgEdt") self.NumMeasEdt = QtWidgets.QLineEdit(self.groupBox) self.NumMeasEdt.setGeometry(QtCore.QRect(10, 150, 51, 20)) self.NumMeasEdt.setObjectName("NumMeasEdt") self.label = QtWidgets.QLabel(self.groupBox) self.label.setGeometry(QtCore.QRect(10, 30, 111, 16)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.groupBox) self.label_2.setGeometry(QtCore.QRect(10, 80, 111, 16)) self.label_2.setObjectName("label_2") self.label_3 = QtWidgets.QLabel(self.groupBox) self.label_3.setGeometry(QtCore.QRect(10, 130, 131, 16)) self.label_3.setObjectName("label_3") self.StartMeasBtn = QtWidgets.QPushButton(self.centralwidget) self.StartMeasBtn.setGeometry(QtCore.QRect(30, 370, 141, 23)) self.StartMeasBtn.setObjectName("StartMeasBtn") self.StopMeasBtn = QtWidgets.QPushButton(self.centralwidget) self.StopMeasBtn.setGeometry(QtCore.QRect(30, 410, 141, 23)) self.StopMeasBtn.setObjectName("StopMeasBtn") self.plot = RenderArea(self.centralwidget) self.plot.setGeometry(QtCore.QRect(190, 50, 471, 391)) self.plot.setObjectName("plot") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.OpenCommBtn, self.CloseCommBtn) MainWindow.setTabOrder(self.CloseCommBtn, self.IntTimeEdt) MainWindow.setTabOrder(self.IntTimeEdt, self.NumAvgEdt) MainWindow.setTabOrder(self.NumAvgEdt, self.NumMeasEdt) MainWindow.setTabOrder(self.NumMeasEdt, self.StartMeasBtn) MainWindow.setTabOrder(self.StartMeasBtn, self.StopMeasBtn)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.setMinimumSize(QtCore.QSize(432, 200)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("../graphics/gavlab_logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) MainWindow.setUnifiedTitleAndToolBarOnMac(False) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.numsat_label = QtGui.QLabel(self.centralwidget) self.numsat_label.setGeometry(QtCore.QRect(0, 30, 151, 21)) self.numsat_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.numsat_label.setObjectName("numsat_label") self.lcdNumber = QtGui.QLCDNumber(self.centralwidget) self.lcdNumber.setGeometry(QtCore.QRect(150, 110, 280, 80)) self.lcdNumber.setFrameShape(QtGui.QFrame.WinPanel) self.lcdNumber.setFrameShadow(QtGui.QFrame.Raised) self.lcdNumber.setSmallDecimalPoint(False) self.lcdNumber.setSegmentStyle(QtGui.QLCDNumber.Flat) self.lcdNumber.setObjectName("lcdNumber") self.line = QtGui.QFrame(self.centralwidget) self.line.setGeometry(QtCore.QRect(7, 90, 421, 16)) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName("line") self.err_label = QtGui.QLabel(self.centralwidget) self.err_label.setGeometry(QtCore.QRect(0, 140, 111, 16)) self.err_label.setLayoutDirection(QtCore.Qt.LeftToRight) self.err_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.err_label.setObjectName("err_label") self.render_area = RenderArea(self.centralwidget) self.render_area.setGeometry(QtCore.QRect(150, 0, 280, 90)) self.render_area.setMinimumSize(QtCore.QSize(10, 10)) self.render_area.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.render_area.setStyleSheet("background: rgb(0, 0, 0);") self.render_area.setObjectName("render_area") MainWindow.setCentralWidget(self.centralwidget) self.toolBar = QtGui.QToolBar(MainWindow) self.toolBar.setObjectName("toolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GPS Status", None, QtGui.QApplication.UnicodeUTF8)) self.numsat_label.setText(QtGui.QApplication.translate("MainWindow", "Connected Satellites", None, QtGui.QApplication.UnicodeUTF8)) self.err_label.setText(QtGui.QApplication.translate("MainWindow", "Error Value (m)", None, QtGui.QApplication.UnicodeUTF8)) self.toolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "toolBar", None, QtGui.QApplication.UnicodeUTF8))
def __init__(self): QtGui.QMainWindow.__init__(self) self.logging = True self.logFileName = "d:\pygps.log" self.online = True self.setGeometry(0, 0, 512, 512) self.setWindowTitle('PyGps') self.renderArea = RenderArea(self) self.setCentralWidget(self.renderArea) self.olddata = "" self.maxDopAllowed = "6" #add zoom buttons #assign slots #center the main window in the desktop self.center() if self.logging and self.online: self.logfh = open(self.logFileName, "w") if self.online: #TODO: make selection of BT devices self.fh = bluetooth.BluetoothSocket(bluetooth.RFCOMM) #self.fh.setblocking(False) try: self.fh.connect(("00:0D:B5:31:58:58", 1)) #assign socket notifier self.notifier = QtCore.QSocketNotifier(self.fh.fileno(), QtCore.QSocketNotifier.Read) self.connect(self.notifier, QtCore.SIGNAL("activated(int)"), self.readBTData) except bluetooth.btcommon.BluetoothError, ex: print "Error: %s" % ex
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1000, 602) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setObjectName("groupBox") self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.render_area = RenderArea(self.groupBox) self.render_area.setMinimumSize(QtCore.QSize(525, 475)) self.render_area.setStyleSheet("background: rgb(0, 0, 0);") self.render_area.setObjectName("render_area") self.verticalLayout_2.addWidget(self.render_area) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.toggle_simulation = QtGui.QPushButton(self.groupBox) self.toggle_simulation.setObjectName("toggle_simulation") self.horizontalLayout.addWidget(self.toggle_simulation) self.reset_simulation = QtGui.QPushButton(self.groupBox) self.reset_simulation.setObjectName("reset_simulation") self.horizontalLayout.addWidget(self.reset_simulation) self.sim_time_slider = QtGui.QSlider(self.groupBox) self.sim_time_slider.setMinimum(1) self.sim_time_slider.setMaximum(3) self.sim_time_slider.setPageStep(1) self.sim_time_slider.setProperty("value", 2) self.sim_time_slider.setOrientation(QtCore.Qt.Horizontal) self.sim_time_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.sim_time_slider.setTickInterval(1) self.sim_time_slider.setObjectName("sim_time_slider") self.horizontalLayout.addWidget(self.sim_time_slider) self.sim_time_label = QtGui.QLabel(self.groupBox) self.sim_time_label.setMaximumSize(QtCore.QSize(16777215, 24)) self.sim_time_label.setObjectName("sim_time_label") self.horizontalLayout.addWidget(self.sim_time_label) self.graph_button = QtGui.QToolButton(self.groupBox) self.graph_button.setObjectName("graph_button") self.horizontalLayout.addWidget(self.graph_button) self.verticalLayout_2.addLayout(self.horizontalLayout) self.gridLayout.addWidget(self.groupBox, 0, 0, 2, 1) self.groupBox_2 = QtGui.QGroupBox(self.centralwidget) self.groupBox_2.setMinimumSize(QtCore.QSize(400, 284)) self.groupBox_2.setMaximumSize(QtCore.QSize(400, 16777215)) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout = QtGui.QVBoxLayout(self.groupBox_2) self.verticalLayout.setObjectName("verticalLayout") self.label = QtGui.QLabel(self.groupBox_2) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.left_wheel_spinbox = QtGui.QDoubleSpinBox(self.groupBox_2) self.left_wheel_spinbox.setDecimals(6) self.left_wheel_spinbox.setMinimum(-10.0) self.left_wheel_spinbox.setMaximum(10.0) self.left_wheel_spinbox.setSingleStep(0.1) self.left_wheel_spinbox.setProperty("value", 1.0) self.left_wheel_spinbox.setObjectName("left_wheel_spinbox") self.verticalLayout.addWidget(self.left_wheel_spinbox) self.left_wheel_slider = QtGui.QSlider(self.groupBox_2) self.left_wheel_slider.setMinimum(-10) self.left_wheel_slider.setMaximum(10) self.left_wheel_slider.setOrientation(QtCore.Qt.Horizontal) self.left_wheel_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.left_wheel_slider.setTickInterval(1) self.left_wheel_slider.setObjectName("left_wheel_slider") self.verticalLayout.addWidget(self.left_wheel_slider) self.label_2 = QtGui.QLabel(self.groupBox_2) self.label_2.setObjectName("label_2") self.verticalLayout.addWidget(self.label_2) self.right_wheel_spinbox = QtGui.QDoubleSpinBox(self.groupBox_2) self.right_wheel_spinbox.setDecimals(6) self.right_wheel_spinbox.setMinimum(-10.0) self.right_wheel_spinbox.setMaximum(10.0) self.right_wheel_spinbox.setSingleStep(0.1) self.right_wheel_spinbox.setProperty("value", 2.0) self.right_wheel_spinbox.setObjectName("right_wheel_spinbox") self.verticalLayout.addWidget(self.right_wheel_spinbox) self.right_wheel_slider = QtGui.QSlider(self.groupBox_2) self.right_wheel_slider.setMinimum(-10) self.right_wheel_slider.setMaximum(10) self.right_wheel_slider.setOrientation(QtCore.Qt.Horizontal) self.right_wheel_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.right_wheel_slider.setTickInterval(1) self.right_wheel_slider.setObjectName("right_wheel_slider") self.verticalLayout.addWidget(self.right_wheel_slider) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.gridLayout.addWidget(self.groupBox_2, 0, 1, 1, 1) self.groupBox_3 = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth()) self.groupBox_3.setSizePolicy(sizePolicy) self.groupBox_3.setMinimumSize(QtCore.QSize(400, 284)) self.groupBox_3.setMaximumSize(QtCore.QSize(400, 16777215)) self.groupBox_3.setObjectName("groupBox_3") self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_3 = QtGui.QLabel(self.groupBox_3) self.label_3.setObjectName("label_3") self.verticalLayout_3.addWidget(self.label_3) self.linear_velocity_spinbox = QtGui.QDoubleSpinBox(self.groupBox_3) self.linear_velocity_spinbox.setDecimals(6) self.linear_velocity_spinbox.setMinimum(-10.0) self.linear_velocity_spinbox.setMaximum(10.0) self.linear_velocity_spinbox.setSingleStep(0.1) self.linear_velocity_spinbox.setObjectName("linear_velocity_spinbox") self.verticalLayout_3.addWidget(self.linear_velocity_spinbox) self.linear_velocity_slider = QtGui.QSlider(self.groupBox_3) self.linear_velocity_slider.setMinimum(-10) self.linear_velocity_slider.setMaximum(10) self.linear_velocity_slider.setOrientation(QtCore.Qt.Horizontal) self.linear_velocity_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.linear_velocity_slider.setTickInterval(1) self.linear_velocity_slider.setObjectName("linear_velocity_slider") self.verticalLayout_3.addWidget(self.linear_velocity_slider) self.label_4 = QtGui.QLabel(self.groupBox_3) self.label_4.setObjectName("label_4") self.verticalLayout_3.addWidget(self.label_4) self.angular_velocity_spinbox = QtGui.QDoubleSpinBox(self.groupBox_3) self.angular_velocity_spinbox.setDecimals(6) self.angular_velocity_spinbox.setMinimum(-10.0) self.angular_velocity_spinbox.setMaximum(10.0) self.angular_velocity_spinbox.setSingleStep(0.1) self.angular_velocity_spinbox.setObjectName("angular_velocity_spinbox") self.verticalLayout_3.addWidget(self.angular_velocity_spinbox) self.angular_velocity_slider = QtGui.QSlider(self.groupBox_3) self.angular_velocity_slider.setMinimum(-10) self.angular_velocity_slider.setMaximum(10) self.angular_velocity_slider.setOrientation(QtCore.Qt.Horizontal) self.angular_velocity_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.angular_velocity_slider.setTickInterval(1) self.angular_velocity_slider.setObjectName("angular_velocity_slider") self.verticalLayout_3.addWidget(self.angular_velocity_slider) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem1) self.gridLayout.addWidget(self.groupBox_3, 1, 1, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(679, 462) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.OpenCommBtn = QtWidgets.QPushButton(self.centralwidget) self.OpenCommBtn.setGeometry(QtCore.QRect(30, 50, 141, 23)) self.OpenCommBtn.setObjectName("OpenCommBtn") self.CloseCommBtn = QtWidgets.QPushButton(self.centralwidget) self.CloseCommBtn.setGeometry(QtCore.QRect(30, 90, 141, 23)) self.CloseCommBtn.setObjectName("CloseCommBtn") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(30, 150, 141, 191)) self.groupBox.setObjectName("groupBox") self.IntTimeEdt = QtWidgets.QLineEdit(self.groupBox) self.IntTimeEdt.setGeometry(QtCore.QRect(10, 50, 51, 20)) self.IntTimeEdt.setObjectName("IntTimeEdt") self.NumAvgEdt = QtWidgets.QLineEdit(self.groupBox) self.NumAvgEdt.setGeometry(QtCore.QRect(10, 100, 51, 20)) self.NumAvgEdt.setObjectName("NumAvgEdt") self.NumMeasEdt = QtWidgets.QLineEdit(self.groupBox) self.NumMeasEdt.setGeometry(QtCore.QRect(10, 150, 51, 20)) self.NumMeasEdt.setObjectName("NumMeasEdt") self.label = QtWidgets.QLabel(self.groupBox) self.label.setGeometry(QtCore.QRect(10, 30, 111, 16)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.groupBox) self.label_2.setGeometry(QtCore.QRect(10, 80, 111, 16)) self.label_2.setObjectName("label_2") self.label_3 = QtWidgets.QLabel(self.groupBox) self.label_3.setGeometry(QtCore.QRect(10, 130, 131, 16)) self.label_3.setObjectName("label_3") self.StartMeasBtn = QtWidgets.QPushButton(self.centralwidget) self.StartMeasBtn.setGeometry(QtCore.QRect(30, 370, 141, 23)) self.StartMeasBtn.setObjectName("StartMeasBtn") self.StopMeasBtn = QtWidgets.QPushButton(self.centralwidget) self.StopMeasBtn.setGeometry(QtCore.QRect(30, 410, 141, 23)) self.StopMeasBtn.setObjectName("StopMeasBtn") self.plot = RenderArea(self.centralwidget) self.plot.setGeometry(QtCore.QRect(190, 50, 471, 391)) self.plot.setObjectName("plot") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.OpenCommBtn, self.CloseCommBtn) MainWindow.setTabOrder(self.CloseCommBtn, self.IntTimeEdt) MainWindow.setTabOrder(self.IntTimeEdt, self.NumAvgEdt) MainWindow.setTabOrder(self.NumAvgEdt, self.NumMeasEdt) MainWindow.setTabOrder(self.NumMeasEdt, self.StartMeasBtn) MainWindow.setTabOrder(self.StartMeasBtn, self.StopMeasBtn) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.OpenCommBtn.setText(_translate("MainWindow", "Open Communication")) self.CloseCommBtn.setText( _translate("MainWindow", "Close Communication")) self.groupBox.setTitle( _translate("MainWindow", "Measurement Parameters")) self.label.setText(_translate("MainWindow", "Integration Time [ms]")) self.label_2.setText(_translate("MainWindow", "Number of Averages")) self.label_3.setText(_translate("MainWindow", "Number of Measurements")) self.StartMeasBtn.setText( _translate("MainWindow", "Start Measurements")) self.StopMeasBtn.setText(_translate("MainWindow", "Stop Measurements"))
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.sysPath = os.path.join(sys.path[0], "") self.logging = True self.logFileName = self.sysPath + "_pygps.log" self.online = False self.maxZoom = 16 self.setGeometry(0, 0, 512, 512) self.setWindowTitle('PyGps') self.deviceAddress = Bluetooth_Search(self) #render area self.renderArea = RenderArea(self) self.renderArea.move(0, 0) #label lat lon self.label_latlon = QtGui.QLabel(self) self.label_latlon.setMinimumSize(135, 45) self.label_latlon.move(0, 0) self.label_latlon.show() #zoom buttons self.zoomin_button = self.createButton("+", QtGui.QColor("white"), self.zoomIn) self.zoomout_button = self.createButton("-", QtGui.QColor("white"), self.zoomOut) #zoom panel - zoom buttons container self.zoom_panel = QtGui.QLabel(self) self.zoom_panel.setMinimumSize(40, 60) zoom_layout = QtGui.QVBoxLayout() zoom_layout.addWidget(self.zoomin_button) zoom_layout.addWidget(self.zoomout_button) self.zoom_panel.setLayout(zoom_layout) self.zoom_panel.move(0, 60) self.zoom_panel.show() self.settings_panel = QtGui.QLabel(self) self.settings_panel.setMinimumSize(40, 40) self.settings_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter) self.settings_panel.setPixmap( QtGui.QPixmap("./32px-Crystal_Clear_action_configure.png")) size = self.geometry() self.settings_panel.move(size.width() - 40, 0) self.settings_panel.show() self.speed_panel = QtGui.QLabel(self) self.speed_panel.setMinimumSize(160, 35) self.speed_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignRight) #print self.speed_panel.alignment() self.speed_panel.setObjectName("speed") self.speed_panel.move(size.width() / 2 - 75, size.height() - 35) self.olddata = "" #add zoom buttons #assign slots #center the main window in the desktop self.center() if self.logging and self.online: self.logfh = open(self.logFileName, "w") if self.online: #TODO: make selection of BT devices self.fh = bluetooth.BluetoothSocket(bluetooth.RFCOMM) #self.fh.setblocking(False) try: self.fh.connect((self.deviceAddress.deviceId, 1)) #("00:0D:B5:31:58:58", 1)) #assign socket notifier self.notifier = QtCore.QSocketNotifier( self.fh.fileno(), QtCore.QSocketNotifier.Read) self.connect(self.notifier, QtCore.SIGNAL("activated(int)"), self.readBTData) except bluetooth.btcommon.BluetoothError, ex: print "Error: %s" % ex
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.sysPath = os.path.join(sys.path[0], "") self.logging = True self.logFileName = self.sysPath + "_pygps.log" self.online = False self.maxZoom = 16 self.setGeometry(0, 0, 512, 512) self.setWindowTitle('PyGps') self.deviceAddress = Bluetooth_Search(self) #render area self.renderArea = RenderArea(self) self.renderArea.move(0,0) #label lat lon self.label_latlon = QtGui.QLabel(self) self.label_latlon.setMinimumSize(135, 45) self.label_latlon.move(0,0) self.label_latlon.show() #zoom buttons self.zoomin_button = self.createButton("+", QtGui.QColor("white"), self.zoomIn) self.zoomout_button = self.createButton("-", QtGui.QColor("white"), self.zoomOut) #zoom panel - zoom buttons container self.zoom_panel = QtGui.QLabel(self) self.zoom_panel.setMinimumSize(40, 60) zoom_layout = QtGui.QVBoxLayout() zoom_layout.addWidget(self.zoomin_button) zoom_layout.addWidget(self.zoomout_button) self.zoom_panel.setLayout(zoom_layout) self.zoom_panel.move(0,60) self.zoom_panel.show() self.settings_panel = QtGui.QLabel(self) self.settings_panel.setMinimumSize(40, 40) self.settings_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter) self.settings_panel.setPixmap(QtGui.QPixmap("./32px-Crystal_Clear_action_configure.png")) size = self.geometry() self.settings_panel.move(size.width()-40, 0) self.settings_panel.show() self.speed_panel = QtGui.QLabel(self) self.speed_panel.setMinimumSize(160, 35) self.speed_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignRight) #print self.speed_panel.alignment() self.speed_panel.setObjectName("speed") self.speed_panel.move(size.width()/2 - 75, size.height() - 35) self.olddata = "" #add zoom buttons #assign slots #center the main window in the desktop self.center() if self.logging and self.online: self.logfh = open(self.logFileName, "w") if self.online: #TODO: make selection of BT devices self.fh = bluetooth.BluetoothSocket(bluetooth.RFCOMM) #self.fh.setblocking(False) try: self.fh.connect((self.deviceAddress.deviceId, 1)) #("00:0D:B5:31:58:58", 1)) #assign socket notifier self.notifier = QtCore.QSocketNotifier(self.fh.fileno(), QtCore.QSocketNotifier.Read) self.connect(self.notifier, QtCore.SIGNAL("activated(int)"), self.readBTData) except bluetooth.btcommon.BluetoothError, ex: print "Error: %s" % ex
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1000, 602) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setObjectName("groupBox") self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.render_area = RenderArea(self.groupBox) self.render_area.setMinimumSize(QtCore.QSize(525, 475)) self.render_area.setStyleSheet("background: rgb(0, 0, 0);") self.render_area.setObjectName("render_area") self.verticalLayout_2.addWidget(self.render_area) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.toggle_simulation = QtGui.QPushButton(self.groupBox) self.toggle_simulation.setObjectName("toggle_simulation") self.horizontalLayout.addWidget(self.toggle_simulation) self.reset_simulation = QtGui.QPushButton(self.groupBox) self.reset_simulation.setObjectName("reset_simulation") self.horizontalLayout.addWidget(self.reset_simulation) self.sim_time_slider = QtGui.QSlider(self.groupBox) self.sim_time_slider.setMinimum(1) self.sim_time_slider.setMaximum(3) self.sim_time_slider.setPageStep(1) self.sim_time_slider.setProperty("value", 2) self.sim_time_slider.setOrientation(QtCore.Qt.Horizontal) self.sim_time_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.sim_time_slider.setTickInterval(1) self.sim_time_slider.setObjectName("sim_time_slider") self.horizontalLayout.addWidget(self.sim_time_slider) self.sim_time_label = QtGui.QLabel(self.groupBox) self.sim_time_label.setMaximumSize(QtCore.QSize(16777215, 24)) self.sim_time_label.setObjectName("sim_time_label") self.horizontalLayout.addWidget(self.sim_time_label) self.graph_button = QtGui.QToolButton(self.groupBox) self.graph_button.setObjectName("graph_button") self.horizontalLayout.addWidget(self.graph_button) self.verticalLayout_2.addLayout(self.horizontalLayout) self.gridLayout.addWidget(self.groupBox, 0, 0, 2, 1) self.groupBox_2 = QtGui.QGroupBox(self.centralwidget) self.groupBox_2.setMinimumSize(QtCore.QSize(400, 284)) self.groupBox_2.setMaximumSize(QtCore.QSize(400, 16777215)) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout = QtGui.QVBoxLayout(self.groupBox_2) self.verticalLayout.setObjectName("verticalLayout") self.label = QtGui.QLabel(self.groupBox_2) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.left_wheel_spinbox = QtGui.QDoubleSpinBox(self.groupBox_2) self.left_wheel_spinbox.setDecimals(6) self.left_wheel_spinbox.setMinimum(-10.0) self.left_wheel_spinbox.setMaximum(10.0) self.left_wheel_spinbox.setSingleStep(0.1) self.left_wheel_spinbox.setProperty("value", 1.0) self.left_wheel_spinbox.setObjectName("left_wheel_spinbox") self.verticalLayout.addWidget(self.left_wheel_spinbox) self.left_wheel_slider = QtGui.QSlider(self.groupBox_2) self.left_wheel_slider.setMinimum(-10) self.left_wheel_slider.setMaximum(10) self.left_wheel_slider.setOrientation(QtCore.Qt.Horizontal) self.left_wheel_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.left_wheel_slider.setTickInterval(1) self.left_wheel_slider.setObjectName("left_wheel_slider") self.verticalLayout.addWidget(self.left_wheel_slider) self.label_2 = QtGui.QLabel(self.groupBox_2) self.label_2.setObjectName("label_2") self.verticalLayout.addWidget(self.label_2) self.right_wheel_spinbox = QtGui.QDoubleSpinBox(self.groupBox_2) self.right_wheel_spinbox.setDecimals(6) self.right_wheel_spinbox.setMinimum(-10.0) self.right_wheel_spinbox.setMaximum(10.0) self.right_wheel_spinbox.setSingleStep(0.1) self.right_wheel_spinbox.setProperty("value", 2.0) self.right_wheel_spinbox.setObjectName("right_wheel_spinbox") self.verticalLayout.addWidget(self.right_wheel_spinbox) self.right_wheel_slider = QtGui.QSlider(self.groupBox_2) self.right_wheel_slider.setMinimum(-10) self.right_wheel_slider.setMaximum(10) self.right_wheel_slider.setOrientation(QtCore.Qt.Horizontal) self.right_wheel_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.right_wheel_slider.setTickInterval(1) self.right_wheel_slider.setObjectName("right_wheel_slider") self.verticalLayout.addWidget(self.right_wheel_slider) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.gridLayout.addWidget(self.groupBox_2, 0, 1, 1, 1) self.groupBox_3 = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.groupBox_3.sizePolicy().hasHeightForWidth()) self.groupBox_3.setSizePolicy(sizePolicy) self.groupBox_3.setMinimumSize(QtCore.QSize(400, 284)) self.groupBox_3.setMaximumSize(QtCore.QSize(400, 16777215)) self.groupBox_3.setObjectName("groupBox_3") self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_3 = QtGui.QLabel(self.groupBox_3) self.label_3.setObjectName("label_3") self.verticalLayout_3.addWidget(self.label_3) self.linear_velocity_spinbox = QtGui.QDoubleSpinBox(self.groupBox_3) self.linear_velocity_spinbox.setDecimals(6) self.linear_velocity_spinbox.setMinimum(-10.0) self.linear_velocity_spinbox.setMaximum(10.0) self.linear_velocity_spinbox.setSingleStep(0.1) self.linear_velocity_spinbox.setObjectName("linear_velocity_spinbox") self.verticalLayout_3.addWidget(self.linear_velocity_spinbox) self.linear_velocity_slider = QtGui.QSlider(self.groupBox_3) self.linear_velocity_slider.setMinimum(-10) self.linear_velocity_slider.setMaximum(10) self.linear_velocity_slider.setOrientation(QtCore.Qt.Horizontal) self.linear_velocity_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.linear_velocity_slider.setTickInterval(1) self.linear_velocity_slider.setObjectName("linear_velocity_slider") self.verticalLayout_3.addWidget(self.linear_velocity_slider) self.label_4 = QtGui.QLabel(self.groupBox_3) self.label_4.setObjectName("label_4") self.verticalLayout_3.addWidget(self.label_4) self.angular_velocity_spinbox = QtGui.QDoubleSpinBox(self.groupBox_3) self.angular_velocity_spinbox.setDecimals(6) self.angular_velocity_spinbox.setMinimum(-10.0) self.angular_velocity_spinbox.setMaximum(10.0) self.angular_velocity_spinbox.setSingleStep(0.1) self.angular_velocity_spinbox.setObjectName("angular_velocity_spinbox") self.verticalLayout_3.addWidget(self.angular_velocity_spinbox) self.angular_velocity_slider = QtGui.QSlider(self.groupBox_3) self.angular_velocity_slider.setMinimum(-10) self.angular_velocity_slider.setMaximum(10) self.angular_velocity_slider.setOrientation(QtCore.Qt.Horizontal) self.angular_velocity_slider.setTickPosition(QtGui.QSlider.TicksAbove) self.angular_velocity_slider.setTickInterval(1) self.angular_velocity_slider.setObjectName("angular_velocity_slider") self.verticalLayout_3.addWidget(self.angular_velocity_slider) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem1) self.gridLayout.addWidget(self.groupBox_3, 1, 1, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.sysPath = os.path.join(sys.path[0], "") #self.deviceAddress = Bluetooth_Search(self) #self.deviceStatus = Bluetooth_Search(self) self.logging = True self.logFileName = self.sysPath + "_pygps.log" #self.online = self.deviceAddress.deviceId self.online = False self.maxZoom = 16 self.setGeometry(0, 0, 512, 512) self.setWindowTitle('PyGps') #render area self.renderArea = RenderArea(self) self.renderArea.move(0, 0) #label lat lon self.label_latlon = QtGui.QLabel(self) self.label_latlon.setMinimumSize(135, 45) self.label_latlon.move(0, 0) self.label_latlon.show() #zoom buttons self.zoomin_button = self.createButton("+", QtGui.QColor("white"), self.zoomIn) self.zoomout_button = self.createButton("-", QtGui.QColor("white"), self.zoomOut) #zoom panel - zoom buttons container self.zoom_panel = QtGui.QLabel(self) self.zoom_panel.setMinimumSize(40, 60) zoom_layout = QtGui.QVBoxLayout() zoom_layout.addWidget(self.zoomin_button) zoom_layout.addWidget(self.zoomout_button) self.zoom_panel.setLayout(zoom_layout) self.zoom_panel.move(0, 60) self.zoom_panel.show() #self.settings_panel = QtGui.QLabel(self) self.settings_panel = Pygps.MyLabel(self) self.settings_panel.setMinimumSize(40, 40) self.settings_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter) self.settings_panel.setPixmap( QtGui.QPixmap("./32px-Crystal_Clear_action_configure.png")) size = self.geometry() self.settings_panel.move(size.width() - 40, 0) self.settings_panel.show() self.bt_panel = Pygps.MyLabel(self) self.bt_panel.setMinimumSize(40, 40) self.bt_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter) self.bt_panel.setPixmap(QtGui.QPixmap("./Bluetooth_32.png")) #size = self.geometry() self.bt_panel.move(size.width() - 40, 42) self.bt_panel.show() self.speed_panel = QtGui.QLabel(self) self.speed_panel.setMinimumSize(160, 35) self.speed_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignRight) #print self.speed_panel.alignment() self.speed_panel.setObjectName("speed") self.speed_panel.move(size.width() / 2 - 75, size.height() - 35) self.olddata = "" #add zoom buttons #assign slots #center the main window in the desktop self.center() self.timer = QtCore.QTimer()
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.sysPath = os.path.join(sys.path[0], "") #self.deviceAddress = Bluetooth_Search(self) #self.deviceStatus = Bluetooth_Search(self) self.logging = True self.logFileName = self.sysPath + "_pygps.log" #self.online = self.deviceAddress.deviceId self.online = False self.maxZoom = 16 self.setGeometry(0, 0, 512, 512) self.setWindowTitle('PyGps') #render area self.renderArea = RenderArea(self) self.renderArea.move(0,0) #label lat lon self.label_latlon = QtGui.QLabel(self) self.label_latlon.setMinimumSize(135, 45) self.label_latlon.move(0,0) self.label_latlon.show() #zoom buttons self.zoomin_button = self.createButton("+", QtGui.QColor("white"), self.zoomIn) self.zoomout_button = self.createButton("-", QtGui.QColor("white"), self.zoomOut) #zoom panel - zoom buttons container self.zoom_panel = QtGui.QLabel(self) self.zoom_panel.setMinimumSize(40, 60) zoom_layout = QtGui.QVBoxLayout() zoom_layout.addWidget(self.zoomin_button) zoom_layout.addWidget(self.zoomout_button) self.zoom_panel.setLayout(zoom_layout) self.zoom_panel.move(0,60) self.zoom_panel.show() #self.settings_panel = QtGui.QLabel(self) self.settings_panel = Pygps.MyLabel(self) self.settings_panel.setMinimumSize(40, 40) self.settings_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter) self.settings_panel.setPixmap(QtGui.QPixmap("./32px-Crystal_Clear_action_configure.png")) size = self.geometry() self.settings_panel.move(size.width()-40, 0) self.settings_panel.show() self.bt_panel = Pygps.MyLabel(self) self.bt_panel.setMinimumSize(40, 40) self.bt_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter) self.bt_panel.setPixmap(QtGui.QPixmap("./Bluetooth_32.png")) #size = self.geometry() self.bt_panel.move(size.width()-40, 42) self.bt_panel.show() self.speed_panel = QtGui.QLabel(self) self.speed_panel.setMinimumSize(160, 35) self.speed_panel.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignRight) #print self.speed_panel.alignment() self.speed_panel.setObjectName("speed") self.speed_panel.move(size.width()/2 - 75, size.height() - 35) self.olddata = "" #add zoom buttons #assign slots #center the main window in the desktop self.center() self.timer = QtCore.QTimer()