Ejemplo n.º 1
0
    def __init__(self, appdata: CnaData, name: str):
        self.scene = QGraphicsScene()
        QGraphicsView.__init__(self, self.scene)
        palette = self.palette()
        palette.setColor(QPalette.Base, Qt.white)
        self.setPalette(palette)

        self.appdata = appdata
        self.name = name
        self.setAcceptDrops(True)
        self.drag = False
        self.reaction_boxes: Dict[str, ReactionBox] = {}
        self._zoom = 0
        self.drag = False
        self.drag_start = None

        # initial scale
        self._zoom = self.appdata.project.maps[self.name]["zoom"]
        if self._zoom > 0:
            for _ in range(1, self._zoom):
                self.scale(INCREASE_FACTOR, INCREASE_FACTOR)
        if self._zoom < 0:
            for _ in range(self._zoom, -1):
                self.scale(DECREASE_FACTOR, DECREASE_FACTOR)

        # connect events to methods
        self.horizontalScrollBar().valueChanged.connect(self.on_hbar_change)
        self.verticalScrollBar().valueChanged.connect(self.on_vbar_change)
Ejemplo n.º 2
0
    def mouseReleaseEvent(self, event):
        """Manage the mouse releasing.

        Args:
            event(QMouseEvent): Mouse event.
        """
        QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 3
0
    def mouseReleaseEvent(self, event):
        """Manage the mouse releasing.

        Args:
            event(QMouseEvent): Mouse event.
        """
        QGraphicsView.mouseReleaseEvent(self, event)
Ejemplo n.º 4
0
 def mousePressEvent(self, e):
     # シーン上のマウス位置を取得する
     pos = self.mapToScene(e.pos())
     if e.button() == Qt.LeftButton:
         if e.modifiers() == Qt.NoModifier:
             pass
         elif e.modifiers() == Qt.AltModifier:
             self.setDragMode(QGraphicsView.ScrollHandDrag)
     QGraphicsView.mousePressEvent(self, e)
Ejemplo n.º 5
0
    def mousePressEvent(self, event):
        """Manage the mouse pressing.

        Args:
            event(QMouseEvent): Mouse event.
        """
        QGraphicsView.mousePressEvent(self, event)
        if event.buttons() == Qt.LeftButton:
            self._lastMousePos = event.pos()
Ejemplo n.º 6
0
    def mousePressEvent(self, event):
        """Manage the mouse pressing.

        Args:
            event(QMouseEvent): Mouse event.
        """
        QGraphicsView.mousePressEvent(self, event)
        if event.buttons() == Qt.LeftButton:
            self._lastMousePos = event.pos()
Ejemplo n.º 7
0
    def mouseMoveEvent(self, event):
        """Manage the mouse movement while it is pressed.

        Args:
            event(QMouseEvent): Mouse event.
        """
        QGraphicsView.mouseMoveEvent(self, event)
        if event.buttons() == Qt.LeftButton:
            delta = self._lastMousePos - event.pos()
            self._lastMousePos = event.pos()
            self.scene().translate(delta.x(), delta.y())
Ejemplo n.º 8
0
    def resizeEvent(self, event):
        """Resize the widget. Reimplemented from `QGraphicsView`.

        Resize the `MapGraphicsScene`.

        Args:
            event(QResizeEvent): Resize event.
        """
        QGraphicsView.resizeEvent(self, event)
        size = event.size()
        self.scene().setSize(size.width(), size.height())
Ejemplo n.º 9
0
    def mouseMoveEvent(self, event):
        """Manage the mouse movement while it is pressed.

        Args:
            event(QMouseEvent): Mouse event.
        """
        QGraphicsView.mouseMoveEvent(self, event)
        if event.buttons() == Qt.LeftButton:
            delta = self._lastMousePos - event.pos()
            self._lastMousePos = event.pos()
            self.scene().translate(delta.x(), delta.y())
Ejemplo n.º 10
0
    def resizeEvent(self, event):
        """Resize the widget. Reimplemented from `QGraphicsView`.

        Resize the `MapGraphicsScene`.

        Args:
            event(QResizeEvent): Resize event.
        """
        QGraphicsView.resizeEvent(self, event)
        size = event.size()
        self.scene().setSize(size.width(), size.height())
Ejemplo n.º 11
0
    def __init__(self, tileSource=None, parent=None):
        """Constructor.

        Args:
            tileSource(MapTileSource): Source for the tiles, default `MapTileSourceOSM`.
            parent(QObject): Parent object, default `None`
        """
        QGraphicsView.__init__(self, parent=parent)
        if tileSource is None:
            tileSource = MapTileSourceOSM()
        scene = MapGraphicsScene(tileSource)
        self.setScene(scene)
        self._lastMousePos = None
Ejemplo n.º 12
0
    def __init__(self, tileSource=None, parent=None):
        """Constructor.

        Args:
            tileSource(MapTileSource): Source for the tiles, default `MapTileSourceOSM`.
            parent(QObject): Parent object, default `None`
        """
        QGraphicsView.__init__(self, parent=parent)
        if tileSource is None:
            tileSource = MapTileSourceOSM()
        scene = MapGraphicsScene(tileSource)
        self.setScene(scene)
        self._lastMousePos = None
Ejemplo n.º 13
0
    def resizeEvent(self, *args, **kwargs):
        """
        allow widget to resize with the rectangle...
        """
        # there has to be a better way to set this...

        # =======================================================================
        # resize widget
        # =======================================================================
        rect = self.geometry()
        self.scene().setSceneRect(
            rect.topLeft().x(),
            rect.topLeft().y(),
            rect.width(),
            rect.height()
        )

        # update gradient
        self.scene().drawGradient()

        # update crosshair
        # RGBA Crosshair
        self.__updateRGBACrosshairOnResize()

        # Linear crosshair
        # main_widget = getWidgetAncestorByName(self, "ColorInputWidget")
        # direction = main_widget.getLinearCrosshairDirection()
        # self.__updateLinearCrosshairOnResize(direction)
        self.scene().linear_crosshair_item.updateGeometry(self.width(), self.height())
        self.setPreviousSize(rect)
        return QGraphicsView.resizeEvent(self, *args, **kwargs)
Ejemplo n.º 14
0
    def mouseReleaseEvent(self, *args, **kwargs):
        # reset everything back to default state

        # reset gradient
        self.__hideRGBACrosshair(False)
        self.__hideLinearCrosshair(True)
        self.scene().gradient_type = attrs.RGBA
        self.scene().drawGradient()

        # reset picking attrs
        self._picking = False
        self._black_select = False

        # reset cursor
        self.unsetCursor()
        QCursor.setPos(self._orig_pos)

        # disable labels
        color_gradient_widget = getWidgetAncestor(self, ColorGradientDelegate)
        color_arg_widgets_dict = color_gradient_widget.header_widget.getWidgetDict()
        for color_arg in color_arg_widgets_dict:
            color_arg_widgets_dict[color_arg].setSelected(False)

        # update rgba crosshair pos
        self.scene().updateRGBACrosshair()

        return QGraphicsView.mouseReleaseEvent(self, *args, **kwargs)
Ejemplo n.º 15
0
    def mouseMoveEvent(self, event, *args, **kwargs):
        """
        This move event will determine if the values should be updated
        this will need to update the hsv/rgba moves aswell
        """
        if self._picking:
            self._getColor(event)

        return QGraphicsView.mouseMoveEvent(self, event, *args, **kwargs)
Ejemplo n.º 16
0
 def geriAl(self):
     self.dimensions4 = self.capture4.read()[1].shape[1::-1]
     scene3 = QGraphicsScene(self)
     pixmap4 = QPixmap(*self.dimensions4)
     self.pixmapItem7 = scene3.addPixmap(pixmap4)
     self.view8 = QGraphicsView(self)
     timer4 = QTimer(self)
     timer4.setInterval(int(1000/fps))
     timer4.timeout.connect(self.get_frame2)
     timer4.start()
     self.tabwidget.addTab(self.view8, "GERİ ALINAN KAMERA KAYDI")
     self.view8.setScene(scene3)
     self.tabwidget.addTab(self.tableWidget3, "GERİ ALINAN TELEMETRİ VERİLERİ")
     self.tableWidget3.horizontalHeader().setStyleSheet("font: bold 9px;")
     with open('telemetri_verileri.csv', "r") as fileInput:
         for row in csv.reader(fileInput):    
             self.tableWidget3.insertRow(self.tableWidget3.rowCount())
             for i in range(17):
                 self.tableWidget3.setItem(self.tableWidget3.rowCount()-1,i,QTableWidgetItem(str(row[i])))
Ejemplo n.º 17
0
        def setup_gfx_ui():
            # design overview
            self.motor_display_view = QGraphicsView()
            self.motor_display_scene = QGraphicsScene()
            self.motor_display_view.setScene(self.motor_display_scene)
            self.motor_display_view.show()

            # sliced cross section
            self.grain_slice_view = QGraphicsView()
            self.grain_slice_scene = QGraphicsScene()
            self.grain_slice_view.setScene(self.grain_slice_scene)
            self.grain_slice_view.show()

            # splitter
            self.splt_gfx = QSplitter(Qt.Horizontal)
            self.splt_gfx.addWidget(self.motor_display_view)
            self.splt_gfx.addWidget(self.grain_slice_view)
            self.splt_gfx.setStretchFactor(0, 10)
            self.splt_gfx.setStretchFactor(1, 3)
            self.splt_gfx.setMinimumHeight(50)
Ejemplo n.º 18
0
 def __init__(self, item) -> None:
     QGraphicsView.__init__(self)
     scene = QGraphicsScene(self)
     self.setScene(scene)
     item.setMinimumSize(QSize(150, 150))
     item.setMaximum(36000)
     item.setSingleStep(100)
     item.setPageStep(100)
     item.setInvertedAppearance(True)
     item.setWrapping(True)
     item.setNotchTarget(.1)
     item.setNotchesVisible(True)
     graphics_item = scene.addWidget(item)
     graphics_item.setRotation(-90)
     # make the QGraphicsView invisible.
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setFixedHeight(item.height())
     self.setFixedWidth(item.width())
     self.setStyleSheet("border: 0px;")
Ejemplo n.º 19
0
        def setup_gfx_ui():
            # design overview
            self.motor_display_view = QGraphicsView()
            self.motor_display_scene = QGraphicsScene()
            self.motor_display_view.setScene(self.motor_display_scene)
            self.motor_display_view.show()

            # sliced cross section
            self.grain_slice_view = QGraphicsView()
            self.grain_slice_scene = QGraphicsScene()
            self.grain_slice_view.setScene(self.grain_slice_scene)
            self.grain_slice_view.show()

            # splitter
            self.splt_gfx = QSplitter(Qt.Horizontal)
            self.splt_gfx.addWidget(self.motor_display_view)
            self.splt_gfx.addWidget(self.grain_slice_view)
            self.splt_gfx.setStretchFactor(0, 10)
            self.splt_gfx.setStretchFactor(1, 3)
            self.splt_gfx.setMinimumHeight(50)
Ejemplo n.º 20
0
class DesignTab(QWidget):
    def __init__(self):
        super(DesignTab, self).__init__()
        self.setup_ui()
        self.grain_dialog = None

        self.btn_new_grain.clicked.connect(self.create_grain_dialog)

    def create_grain_dialog(self):
        self.grain_dialog = NewGrainDialog()
        self.grain_dialog.show()
        self.grain_dialog.activateWindow()
        self.grain_dialog.raise_()

    def setup_ui(self):
        sp = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.setSizePolicy(sp)

        def setup_grain_design():
            # grain table view
            master = QHBoxLayout(self)
            master.addWidget(QTableView())

            # grain design controls
            controls = QVBoxLayout(self)
            # add a push button
            self.btn_new_grain = QPushButton(self.tr("New Grain"))
            self.btn_new_grain.setMinimumHeight(50)
            controls.addWidget(self.btn_new_grain)

            # add a dividing line
            line = QFrame()
            line.setFrameShape(QFrame.HLine)
            line.setFrameShadow(QFrame.Sunken)
            controls.addSpacing(5)
            controls.addWidget(line)

            # rest of the controls buttons
            self.btn_edit_grain = QPushButton(self.tr("Edit"))
            self.btn_edit_grain.setMinimumHeight(30)
            controls.addWidget(self.btn_edit_grain)
            self.btn_delete_Grain = QPushButton(self.tr("Delete"))
            self.btn_delete_Grain.setMinimumHeight(30)
            controls.addWidget(self.btn_delete_Grain)

            # move grain up and down
            moveup = QHBoxLayout()
            self.btn_move_up = QToolButton()
            self.btn_move_up.setArrowType(Qt.UpArrow)
            moveup.addWidget(self.btn_move_up)
            moveup.addWidget(QLabel(self.tr("Move Up")))
            controls.addLayout(moveup)

            movedown = QHBoxLayout()
            self.btn_move_down = QToolButton()
            self.btn_move_down.setArrowType(Qt.DownArrow)
            movedown.addWidget(self.btn_move_down)
            movedown.addWidget(QLabel(self.tr("Move Down")))
            controls.addLayout(movedown)
            controls.addStretch()

            # add info for motor design
            fl_propellant_info = QFormLayout()
            gb_motor_info = QGroupBox(self.tr("Propellant Info"))
            gb_motor_info.setLayout(fl_propellant_info)

            self.lbl_num_grains = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Number of Segments:")),
                                      self.lbl_num_grains)
            self.lbl_motor_dia = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Motor Diameter:")),
                                      self.lbl_motor_dia)
            self.lbl_motor_len = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Propellant Length:")),
                                      self.lbl_motor_len)
            self.lbl_prop_mass = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Propellant Mass:")),
                                      self.lbl_prop_mass)
            self.lbl_volume_loading = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Volume Loading:")),
                                      self.lbl_volume_loading)

            # set group box's layout
            controls.addWidget(gb_motor_info)

            # setup master layout
            master.addLayout(controls)
            self.gb_design = QGroupBox(self.tr("Grain Design"))
            self.gb_design.setLayout(master)

        def setup_chamber_design():
            # master layout
            master = QVBoxLayout()
            # master group box
            self.gb_chamber = QGroupBox(self.tr("Chamber Design"))

            # nozzle settings button
            self.btn_nozzle_settings = QPushButton(self.tr("Edit Nozzle"))
            self.btn_nozzle_settings.setMinimumHeight(50)
            master.addWidget(self.btn_nozzle_settings)

            # nozzle info pane
            fl_nozzle_info = QFormLayout()
            gb_nozzle = QGroupBox(self.tr("Nozzle Info"))
            gb_nozzle.setLayout(fl_nozzle_info)

            self.lbl_nozzle_throat = QLabel()
            fl_nozzle_info.addRow(QLabel(self.tr("Throat Diameter:")),
                                  self.lbl_nozzle_throat)
            self.lbl_nozzle_exit = QLabel()
            fl_nozzle_info.addRow(QLabel(self.tr("Exit Diameter:")),
                                  self.lbl_nozzle_exit)
            self.lbl_nozzle_expansion_ratio = QLabel()
            fl_nozzle_info.addRow(QLabel(self.tr("Expansion Ratio:")),
                                  self.lbl_nozzle_expansion_ratio)
            # add group box to master
            master.addWidget(gb_nozzle)
            master.addStretch()

            # overall motor info pane
            fl_motor_info = QFormLayout()
            gb_motor = QGroupBox(self.tr("Motor Info"))
            gb_motor.setLayout(fl_motor_info)

            self.lbl_kn = QLabel()
            fl_motor_info.addRow(QLabel(self.tr("Kn:")), self.lbl_kn)
            self.lbl_port_throat = QLabel()
            fl_motor_info.addRow(QLabel(self.tr("Port/Throat Ratio:")),
                                 self.lbl_port_throat)

            master.addWidget(gb_motor)
            self.gb_chamber.setLayout(master)

        def setup_gfx_ui():
            # design overview
            self.motor_display_view = QGraphicsView()
            self.motor_display_scene = QGraphicsScene()
            self.motor_display_view.setScene(self.motor_display_scene)
            self.motor_display_view.show()

            # sliced cross section
            self.grain_slice_view = QGraphicsView()
            self.grain_slice_scene = QGraphicsScene()
            self.grain_slice_view.setScene(self.grain_slice_scene)
            self.grain_slice_view.show()

            # splitter
            self.splt_gfx = QSplitter(Qt.Horizontal)
            self.splt_gfx.addWidget(self.motor_display_view)
            self.splt_gfx.addWidget(self.grain_slice_view)
            self.splt_gfx.setStretchFactor(0, 10)
            self.splt_gfx.setStretchFactor(1, 3)
            self.splt_gfx.setMinimumHeight(50)

        setup_grain_design()
        setup_chamber_design()
        setup_gfx_ui()

        self.splt_grain_design = QSplitter(Qt.Horizontal)
        self.splt_grain_design.addWidget(self.gb_design)
        self.splt_grain_design.addWidget(self.gb_chamber)
        self.splt_grain_design.setStretchFactor(0, 10)
        self.splt_grain_design.setStretchFactor(1, 3)

        self.splt_main = QSplitter(Qt.Vertical)
        self.splt_main.addWidget(self.splt_grain_design)
        self.splt_main.addWidget(self.splt_gfx)
        self.splt_main.setSizes([300, 150])

        layout = QVBoxLayout()
        layout.addWidget(self.splt_main)
        self.setLayout(layout)
Ejemplo n.º 21
0
 def close(self):
     self.scene().close()
     QGraphicsView.close(self)
 def mouseReleaseEvent(self, event):
     event.ignore()
     QGraphicsView.mouseReleaseEvent(self, event)
 def mouseMoveEvent(self, event):
     event.ignore()
     QGraphicsView.mouseMoveEvent(self, event)
Ejemplo n.º 24
0
 def close(self):
     self.scene().close()
     QGraphicsView.close(self)
Ejemplo n.º 25
0
 def wheelEvent(self, ev: QWheelEvent):
     # GraphicsLayoutWidget forcibly ignores if an event was accepted, and changes its state to ignored.
     # This causes parents to have no knowledge of if its children accepted the event or not.
     # To prevent that behavior, we only process the event if it wasn't accepted.
     if not ev.isAccepted():
         QGraphicsView.wheelEvent(self, ev)
Ejemplo n.º 26
0
class DesignTab(QWidget):
    def __init__(self):
        super(DesignTab, self).__init__()
        self.setup_ui()
        self.grain_dialog = None

        self.btn_new_grain.clicked.connect(self.create_grain_dialog)

    def create_grain_dialog(self):
        self.grain_dialog = NewGrainDialog()
        self.grain_dialog.show()
        self.grain_dialog.activateWindow()
        self.grain_dialog.raise_()

    def setup_ui(self):
        sp = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.setSizePolicy(sp)

        def setup_grain_design():
            # grain table view
            master = QHBoxLayout(self)
            master.addWidget(QTableView())

            # grain design controls
            controls = QVBoxLayout(self)
            # add a push button
            self.btn_new_grain = QPushButton(self.tr("New Grain"))
            self.btn_new_grain.setMinimumHeight(50)
            controls.addWidget(self.btn_new_grain)

            # add a dividing line
            line = QFrame()
            line.setFrameShape(QFrame.HLine)
            line.setFrameShadow(QFrame.Sunken)
            controls.addSpacing(5)
            controls.addWidget(line)

            # rest of the controls buttons
            self.btn_edit_grain = QPushButton(self.tr("Edit"))
            self.btn_edit_grain.setMinimumHeight(30)
            controls.addWidget(self.btn_edit_grain)
            self.btn_delete_Grain = QPushButton(self.tr("Delete"))
            self.btn_delete_Grain.setMinimumHeight(30)
            controls.addWidget(self.btn_delete_Grain)

            # move grain up and down
            moveup = QHBoxLayout()
            self.btn_move_up = QToolButton()
            self.btn_move_up.setArrowType(Qt.UpArrow)
            moveup.addWidget(self.btn_move_up)
            moveup.addWidget(QLabel(self.tr("Move Up")))
            controls.addLayout(moveup)

            movedown = QHBoxLayout()
            self.btn_move_down = QToolButton()
            self.btn_move_down.setArrowType(Qt.DownArrow)
            movedown.addWidget(self.btn_move_down)
            movedown.addWidget(QLabel(self.tr("Move Down")))
            controls.addLayout(movedown)
            controls.addStretch()

            # add info for motor design
            fl_propellant_info = QFormLayout()
            gb_motor_info = QGroupBox(self.tr("Propellant Info"))
            gb_motor_info.setLayout(fl_propellant_info)

            self.lbl_num_grains = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Number of Segments:")), self.lbl_num_grains)
            self.lbl_motor_dia = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Motor Diameter:")), self.lbl_motor_dia)
            self.lbl_motor_len = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Propellant Length:")), self.lbl_motor_len)
            self.lbl_prop_mass = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Propellant Mass:")), self.lbl_prop_mass)
            self.lbl_volume_loading = QLabel()
            fl_propellant_info.addRow(QLabel(self.tr("Volume Loading:")), self.lbl_volume_loading)

            # set group box's layout
            controls.addWidget(gb_motor_info)

            # setup master layout
            master.addLayout(controls)
            self.gb_design = QGroupBox(self.tr("Grain Design"))
            self.gb_design.setLayout(master)

        def setup_chamber_design():
            # master layout
            master = QVBoxLayout()
            # master group box
            self.gb_chamber = QGroupBox(self.tr("Chamber Design"))

            # nozzle settings button
            self.btn_nozzle_settings = QPushButton(self.tr("Edit Nozzle"))
            self.btn_nozzle_settings.setMinimumHeight(50)
            master.addWidget(self.btn_nozzle_settings)

            # nozzle info pane
            fl_nozzle_info = QFormLayout()
            gb_nozzle = QGroupBox(self.tr("Nozzle Info"))
            gb_nozzle.setLayout(fl_nozzle_info)

            self.lbl_nozzle_throat = QLabel()
            fl_nozzle_info.addRow(QLabel(self.tr("Throat Diameter:")), self.lbl_nozzle_throat)
            self.lbl_nozzle_exit = QLabel()
            fl_nozzle_info.addRow(QLabel(self.tr("Exit Diameter:")), self.lbl_nozzle_exit)
            self.lbl_nozzle_expansion_ratio = QLabel()
            fl_nozzle_info.addRow(QLabel(self.tr("Expansion Ratio:")), self.lbl_nozzle_expansion_ratio)
            # add group box to master
            master.addWidget(gb_nozzle)
            master.addStretch()

            # overall motor info pane
            fl_motor_info = QFormLayout()
            gb_motor = QGroupBox(self.tr("Motor Info"))
            gb_motor.setLayout(fl_motor_info)

            self.lbl_kn = QLabel()
            fl_motor_info.addRow(QLabel(self.tr("Kn:")), self.lbl_kn)
            self.lbl_port_throat = QLabel()
            fl_motor_info.addRow(QLabel(self.tr("Port/Throat Ratio:")), self.lbl_port_throat)

            master.addWidget(gb_motor)
            self.gb_chamber.setLayout(master)

        def setup_gfx_ui():
            # design overview
            self.motor_display_view = QGraphicsView()
            self.motor_display_scene = QGraphicsScene()
            self.motor_display_view.setScene(self.motor_display_scene)
            self.motor_display_view.show()

            # sliced cross section
            self.grain_slice_view = QGraphicsView()
            self.grain_slice_scene = QGraphicsScene()
            self.grain_slice_view.setScene(self.grain_slice_scene)
            self.grain_slice_view.show()

            # splitter
            self.splt_gfx = QSplitter(Qt.Horizontal)
            self.splt_gfx.addWidget(self.motor_display_view)
            self.splt_gfx.addWidget(self.grain_slice_view)
            self.splt_gfx.setStretchFactor(0, 10)
            self.splt_gfx.setStretchFactor(1, 3)
            self.splt_gfx.setMinimumHeight(50)

        setup_grain_design()
        setup_chamber_design()
        setup_gfx_ui()

        self.splt_grain_design = QSplitter(Qt.Horizontal)
        self.splt_grain_design.addWidget(self.gb_design)
        self.splt_grain_design.addWidget(self.gb_chamber)
        self.splt_grain_design.setStretchFactor(0, 10)
        self.splt_grain_design.setStretchFactor(1, 3)

        self.splt_main = QSplitter(Qt.Vertical)
        self.splt_main.addWidget(self.splt_grain_design)
        self.splt_main.addWidget(self.splt_gfx)
        self.splt_main.setSizes([300, 150])

        layout = QVBoxLayout()
        layout.addWidget(self.splt_main)
        self.setLayout(layout)
Ejemplo n.º 27
0
    def setLength(self, length):
        self._length = length

    def spacing(self):
        return self._spacing

    def setSpacing(self, spacing):
        self._spacing = spacing


if __name__ == '__main__':
    import sys
    from qtpy.QtWidgets import QApplication, QGraphicsView, QGraphicsScene
    from qtpy.QtGui import QCursor
    app = QApplication(sys.argv)
    v = QGraphicsView()
    s = QGraphicsScene()
    v.setSceneRect(0, 0, 200, 200)
    v.setScene(s)
    # GRADIENT
    g = drawColorTypeGradient(attrs.HUE, 100, 100)
    g.setFinalStop(0, 300)
    s.setBackgroundBrush(QBrush(g))

    #LINE
    l = DualColoredLineSegment()
    l.setLine(0, 0, 300, 300)
    s.addItem(l)

    v.show()
    v.move(QCursor.pos())
Ejemplo n.º 28
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.kalibredurumu=0
     self.stopflag =False
     self.dosya_yol=''
     self.resize(1926, 1006)
     self.frame_gl=QFrame()    
     opengl=QOpenGLWidget(parent=self.frame_gl)
     self.setWindowIcon(QIcon("logo1.png"))
     self.setAutoFillBackground(True)      
     oImage=QImage("ekran8.png")
     sImage=oImage.scaled(QSize(1926, 1020))
     palette=QPalette()
     palette.setBrush(QPalette.Window, QBrush(sImage))                        
     self.setPalette(palette)
     self.bosluk=QLabel("    ")
     self.genelhbox=QHBoxLayout()
     self.firstvb=QVBoxLayout()
     self.logo=QLabel()
     self.motorkontrolu = QGroupBox("Manuel Tahrik Komutu")
     self.motorbasla=QPushButton("BAŞLA")
     self.motordur=QPushButton("DUR")
     self.motorbasla.setFixedHeight(27)
     self.motordur.setFixedHeight(27)
     self.motorbasla.clicked.connect(self.motorBasla)
     self.motordur.clicked.connect(self.motorDur)
     self.motor=QVBoxLayout()
     self.motor.addWidget(self.motorbasla)
     self.motor.addWidget(self.motordur)
     self.motorkontrolu.setLayout(self.motor)
     self.splitter8 = QSplitter()
     self.splitter8.setOrientation(Qt.Vertical)
     self.logo.setFixedHeight(150)
     self.logo.setFixedWidth(190)
     self.logo.setPixmap(QPixmap("logo4.PNG"))        
     self.logo.setAlignment(Qt.AlignTop)
     self.takimno=QLabel("Takım No:56701")
     self.takimno.setFont(QFont("Comic Sans MS",11,QFont.Bold))
     self.hata1=0
     self.portyap=QHBoxLayout()
     scene2 = QGraphicsScene(self)
     self.gpslongitude=[33.7115]
     self.gpslatitude=[38.3980]
     try:
         self.capture = cv2.VideoCapture(camera_index)
         self.dimensions = self.capture.read()[1].shape[1::-1]
         pixmap2 = QPixmap(*self.dimensions)
         self.pixmapItem2 = scene2.addPixmap(pixmap2) 
     except AttributeError:
         self.hata1=1
     self.view2 = QGraphicsView(self)
     self.view2.setScene(scene2)
     self.view2.setFixedHeight(430)
     self.view2.setFixedWidth(335)
     self.view3 = MapGraphicsView(tileSource=MapTileSourceHere()) #tileSource=MapTileSourceOSM("map.osm")
     self.view3.scene().setCenter(self.gpslongitude[0], self.gpslatitude[0])
     self.view3.setOptimizationFlag(QGraphicsView.DontSavePainterState, True)
     self.view3.setRenderHint(QPainter.Antialiasing, True)
     self.view3.setRenderHint(QPainter.SmoothPixmapTransform, True)
     self.z=0
     self.y=0
     self.frame=QFrame()
     self.resize(1926, 1006)
     self.view3.setFixedWidth(335)
     self.view3.setFixedHeight(407)
     self.twovb=QVBoxLayout()
     self.view3.setStyleSheet("border:1px solid #000000")
     self.threevb=QVBoxLayout()
     self.threevbh=QHBoxLayout()
     self.threevbh.addWidget(self.logo) 
     self.threevbh.addWidget(self.takimno)
     self.firstvb.addLayout(self.threevbh)
     self.firstvb.addWidget(self.view2)
     self.tableWidget3=QTableWidget()
     self.tableWidget3.setEditTriggers(QTableWidget.NoEditTriggers)
     self.tableWidget3.setColumnCount(17)
     self.tableWidget3.setHorizontalHeaderLabels(str("TAKIM NO;PAKET NUMARASI;GÖNDERME SAATİ;BASINÇ;YÜKSEKLİK;İNİŞ HIZI;SICAKLIK;PİL GERİLİMİ;GPS LATITUDE;GPS LONGITUDE;GPS ALTITUDE;UYDU STATÜSÜ;PITCH;ROLL;YAW;DÖNÜŞ SAYISI;VİDEO AKTARIM BİLGİSİ").split(";"))
     self.tableWidget3.verticalHeader().hide()
     self.tableWidget3.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
     self.tableWidget3.horizontalScrollBar().hide()
     self.tableWidget3.setStyleSheet("font:9px;")
     self.tableWidget3.setColumnWidth(0,59)
     self.tableWidget3.setColumnWidth(1,98)
     self.tableWidget3.setColumnWidth(2,95)
     self.tableWidget3.setColumnWidth(3,45)
     self.tableWidget3.setColumnWidth(4,60)
     self.tableWidget3.setColumnWidth(5,53)
     self.tableWidget3.setColumnWidth(6,51)
     self.tableWidget3.setColumnWidth(7,71)
     self.tableWidget3.setColumnWidth(8,77)
     self.tableWidget3.setColumnWidth(9,89)
     self.tableWidget3.setColumnWidth(10,77)
     self.tableWidget3.setColumnWidth(11,84)
     self.tableWidget3.setColumnWidth(12,38)
     self.tableWidget3.setColumnWidth(13,32)
     self.tableWidget3.setColumnWidth(14,31)
     self.tableWidget3.setColumnWidth(15,80)
     self.tableWidget3.setColumnWidth(16,151)
     self.splitter10 = QSplitter()
     self.splitter10.setOrientation(Qt.Vertical)
     self.twovbhb1=QHBoxLayout()
     self.twovbhb12=QHBoxLayout()
     self.twovbhb13=QHBoxLayout()
     self.twovbhb14=QHBoxLayout()
     self.twovbhb15=QHBoxLayout()
     self.twovbhb16=QHBoxLayout()
     self.twovbvb1=QVBoxLayout()
     self.twovbhb2=QHBoxLayout()
     self.twovbhb3=QHBoxLayout()
     self.twovbvb2=QVBoxLayout()
     self.uydu_statu=["Görev Başladı","Uçuş Bekleniyor","Model Uydu Yükselmekte","Model Uydu İnişte","Görev Yükü Taşıyıcıdan Ayrıldı","Görev Yükü Kurtarılmayı Bekliyor","Görev Tamamlandı"]
     self.port=QLabel("Port:")
     self.port2=QLabel("Port:")
     self.port.setFixedWidth(50)
     
     self.port.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.ports=QComboBox()
     self.ports.setFixedWidth(150)
     self.ports.addItems([''])
     self.ports.addItems(self.portlar())
     self.ports.setStyleSheet("font: bold 15px;")
     self.groupbox2 = QGroupBox("1. Seri Port Yapılandırması")     
     self.groupbox1 = QGroupBox("Ayrılma Yüksekliği Değiştirme") 
     self.groupbox5 = QGroupBox("2. Seri Port Yapılandırması")
     self.yukseklikQHB=QHBoxLayout()        
     self.yukseklikd=QLabel("Ayrılma Yüksekliğini Giriniz:")
     self.yukseklikd.setFixedWidth(240)
     self.yukseklik=QLineEdit()
     self.yukseklikgonder=QPushButton("GÖNDER")
     self.yukseklikgonder.clicked.connect(self.yukseklikGonder)
     self.yukseklikQHB.addWidget(self.yukseklikd)
     self.yukseklikQHB.addWidget(self.yukseklik)
     self.yukseklikQHB.addWidget(self.yukseklikgonder)
     self.groupbox1.setLayout(self.yukseklikQHB)
     self.start=QPushButton("BAŞLA")
     self.start.setFont(QFont("Comic Sans MS",9,))
     self.start.clicked.connect(self.Start)
     self.start.setInputMethodHints(Qt.ImhNone)
     
     self.baudrates=QLabel("Baudrate:")
     self.baudrates.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.baudrate=QComboBox()
     self.baudrate.setFixedWidth(100)
     self.baudrate.addItems(["","9600","19200","115200", "38400"])
     self.baudrate.setStyleSheet("font: bold 15px;")
     self.baudrates.setFixedWidth(80)
     
     self.port2.setFixedWidth(50)
     self.port2.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.ports2=QComboBox()
     self.ports2.setFixedWidth(150)
     self.ports2.addItems([''])
     self.ports2.addItems(self.portlar())
     self.ports2.setStyleSheet("font: bold 15px;")
     self.groupbox11 = QGroupBox("Seri Port Yapılandırması")        
     self.start2=QPushButton("BAŞLA")
     self.start2.setFont(QFont("Comic Sans MS",9,))
     self.start2.clicked.connect(self.Start2)
     self.baudrates2=QLabel("Baudrate:")
     self.baudrates2.setFont(QFont("Comic Sans MS",10,QFont.Bold))
     self.baudrate2=QComboBox()
     self.baudrate2.setFixedWidth(100)
     self.baudrate2.addItems(["","9600","19200","115200", "38400"])
     self.baudrate2.setStyleSheet("font: bold 15px;")
     self.baudrates2.setFixedWidth(80)
     
     self.gerial=QPushButton("GERİ AL")
     self.gerial.setFixedHeight(27)
     self.twovbhb15.addWidget(self.gerial)
     self.kalibrasyon=QPushButton("KALİBRE ET")
     self.kalibrasyon.setFixedHeight(27)
     self.kalibrasyon.setFixedWidth(85)
     self.kalibrasyon.clicked.connect(self.KalibrEt)
     self.ayarlar=QVBoxLayout()
     self.diger_ayarlar_ac=QPushButton("AÇ")
     self.diger_ayarlar_kapat=QPushButton("KAPAT")
     self.diger_ayarlar_ac.setFixedHeight(27)
     self.diger_ayarlar_kapat.setFixedHeight(27)
     self.ayarlar.addWidget(self.diger_ayarlar_ac)
     self.ayarlar.addWidget(self.diger_ayarlar_kapat)
     self.diger_ayarlar_ac.clicked.connect(self.ayarlarAc)
     self.diger_ayarlar_kapat.clicked.connect(self.ayarlarKapat)
     self.gerial.clicked.connect(self.geriAl)
     self.iletimdurumu=QLabel("Video İletim Durumu:")
     self.ayırma=QPushButton("AYIR")
     self.ayırma.clicked.connect(self.Ayir)
     self.kalibrasyon.setFont(QFont("Comic Sans MS",9))
     self.ayırma.setFixedWidth(85)
     self.ayırma.setFixedHeight(27)
     self.gerial.setFixedWidth(113)
     self.groupbox4 = QGroupBox("Ayrılma Komutu")
     self.groupbox10 = QGroupBox("Ayarlar")
     self.groupbox8 = QGroupBox("Kalibrasyon Komutu")
     self.groupbox3 = QGroupBox("Verileri Arayüze Geri Alma Komutu")
     self.groupbox10.setLayout(self.ayarlar)
     self.groupbox8.setLayout(self.twovbhb16)
     self.groupbox3.setLayout(self.twovbhb15)
     self.twovbhb14.addWidget(self.ayırma)
     self.twovbhb16.addWidget(self.kalibrasyon)
     self.groupbox4.setLayout(self.twovbhb14)
     self.ayırma.setFont(QFont("Comic Sans MS",9))
     self.gerial.setFont(QFont("Comic Sans MS",9))
     self.packetcount=QLabel("Paket Numarası:")
     self.packetcount2=QLabel()
     self.packetcount.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.packetcount2.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.packetcount.setFixedWidth(137)
     self.missiontime=QLabel("Gönderme Saati:")
     self.missiontime2=QLabel()
     self.missiontime2.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.missiontime.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.missiontime.setFixedWidth(157)
     self.start.setInputMethodHints(Qt.ImhNone)
     self.dosyasecs=QLabel("Dosya Seç:")
     self.dosyasecs.setFixedHeight(20)
     self.dosyasecs.setFixedWidth(90)
     self.dosyasecs.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.dosyasec=QPushButton("...")
     self.dosyasec.setFixedHeight(27)
     self.dosyasec.clicked.connect(self.Dosyasec)
     self.stop=QPushButton("DUR")
     self.stop.setInputMethodHints(Qt.ImhNone)
     self.stop.clicked.connect(self.Stop)
     self.stop.setFont(QFont("Comic Sans MS",9))
     
     self.stop2=QPushButton("DUR")
     self.stop2.setInputMethodHints(Qt.ImhNone)
     self.stop2.clicked.connect(self.Stop2)
     self.stop2.setFont(QFont("Comic Sans MS",9))
     
     self.dosyasec.setFixedHeight(20)
     self.dosyasec.setFixedWidth(20)
     self.gonder=QPushButton("GÖNDER")
     self.gonder.setFixedHeight(27)
     self.gonder.setDisabled(True)
     self.gonder.setFixedWidth(110)
     self.gonder.setFont(QFont("Comic Sans MS",9,))
     self.groupbox = QGroupBox("Video Aktarımı")
     self.iletimdurumu.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.gbvx=QVBoxLayout()
     self.gbx=QHBoxLayout()
     self.gbx.addWidget(self.dosyasecs)
     self.gbx.addWidget(self.dosyasec)
     self.gbx.addWidget(self.gonder)
     self.gbvx.addLayout(self.gbx)
     self.gbvx.addWidget(self.iletimdurumu)
     self.groupbox.setLayout(self.gbvx) 
     self.gonder.clicked.connect(self.Gonder)
     self.twovbhb18=QHBoxLayout()
     self.twovbhb18.addWidget(self.port2)
     self.twovbhb18.addWidget(self.ports2)
     self.twovbhb18.addWidget(self.baudrates2)
     self.twovbhb18.addWidget(self.baudrate2)
     
     self.twovbhb19=QHBoxLayout()
     self.twovbhb19.addWidget(self.start2)
     self.twovbhb19.addWidget(self.stop2)
     
     self.twovbhb13.addWidget(self.port)
     self.twovbhb13.addWidget(self.ports)
     self.twovbhb13.addWidget(self.baudrates)
     self.twovbhb13.addWidget(self.baudrate)
     self.twovbhb12.addWidget(self.start)
     self.twovbhb12.addWidget(self.stop)
     self.twovbvb1.addLayout(self.twovbhb13)
     self.twovbvb1.addLayout(self.twovbhb12)
     self.twovbvb2.addLayout(self.twovbhb18)
     self.twovbvb2.addLayout(self.twovbhb19)
     self.groupbox2.setLayout(self.twovbvb1)
     self.groupbox5.setLayout(self.twovbvb2)
     self.portyap.addWidget(self.groupbox2)  
     self.portyap.addWidget(self.groupbox5)
     self.groupbox11.setLayout(self.portyap)
     self.splitter10.addWidget(self.groupbox11)
     self.splitter10.addWidget(self.groupbox1)
     self.twovbhb1.addWidget(self.groupbox4)
     self.twovbhb1.addWidget(self.groupbox10)
     self.twovbhb1.addWidget(self.motorkontrolu)
     self.twovbhb1.addWidget(self.groupbox3)
     self.twovbhb1.addWidget(self.groupbox8)
     self.twovbhb1.addWidget(self.groupbox)
     scene = QGraphicsScene(self)
     try:
         pixmap = QPixmap(*self.dimensions)
         self.pixmapItem = scene.addPixmap(pixmap)
     except AttributeError:
         print('devam')
     view = QGraphicsView(self)
     view.setScene(scene)
     if self.hata1==0:
         timer = QTimer(self)
         timer.setInterval(int(1000/fps))
         timer.timeout.connect(self.get_frame)
         timer.start()
     self.temp=[]
     self.pressure=list()
     self.voltage=list()
     self.altitude=list()
     self.inishiz=list()
     self.gpsaltitude=list()
     self.timer=list()
     self.tableWidget2=QTableWidget()
     self.tableWidget2.setEditTriggers(QTableWidget.NoEditTriggers)
     self.tableWidget2.setColumnCount(17)   
     self.tableWidget2.setHorizontalHeaderLabels(str("TAKIM NO;PAKET NUMARASI;GÖNDERME SAATİ;BASINÇ;YÜKSEKLİK;İNİŞ HIZI;SICAKLIK;PİL GERİLİMİ;GPS LATITUDE;GPS LONGITUDE;GPS ALTITUDE;UYDU STATÜSÜ;PITCH;ROLL;YAW;DÖNÜŞ SAYISI;VİDEO AKTARIM BİLGİSİ").split(";"))
     self.tableWidget2.verticalHeader().hide()
     self.tableWidget2.horizontalHeader().setStyleSheet("font: bold 7px;")
     self.tableWidget2.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
     self.tableWidget2.horizontalScrollBar().hide()
     self.tableWidget2.setStyleSheet("font:9px;")
     self.tableWidget2.setColumnWidth(0,59)
     self.tableWidget2.setColumnWidth(1,98)
     self.tableWidget2.setColumnWidth(2,97)
     self.tableWidget2.setColumnWidth(3,49)
     self.tableWidget2.setColumnWidth(4,61)
     self.tableWidget2.setColumnWidth(5,52)
     self.tableWidget2.setColumnWidth(6,52)
     self.tableWidget2.setColumnWidth(7,70)
     self.tableWidget2.setColumnWidth(8,80)
     self.tableWidget2.setColumnWidth(9,90)
     self.tableWidget2.setColumnWidth(10,77)
     self.tableWidget2.setColumnWidth(11,85)
     self.tableWidget2.setColumnWidth(12,38)
     self.tableWidget2.setColumnWidth(13,34)
     self.tableWidget2.setColumnWidth(14,33)
     self.tableWidget2.setColumnWidth(15,81)
     self.tableWidget2.setColumnWidth(16,134)
     self.tableWidget2.horizontalHeader().setStyleSheet("font: bold 9px;")
     self.tableWidget2.setFixedHeight(195)
     self.tableWidget=QTableWidget()
     self.tableWidget.setEditTriggers(QTableWidget.NoEditTriggers)
     self.tableWidget.setColumnCount(17)
     self.tableWidget.setHorizontalHeaderLabels(str("TAKIM NO;PAKET NUMARASI;GÖNDERME SAATİ;BASINÇ;YÜKSEKLİK;İNİŞ HIZI;SICAKLIK;PİL GERİLİMİ;GPS LATITUDE;GPS LONGITUDE;GPS ALTITUDE;UYDU STATÜSÜ;PITCH;ROLL;YAW;DÖNÜŞ SAYISI;VİDEO AKTARIM BİLGİSİ").split(";"))
     self.tableWidget.verticalHeader().hide()
     self.tableWidget.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
     self.tableWidget.horizontalScrollBar().hide()
     self.tableWidget.setStyleSheet("font:9px;")
     self.tableWidget.setColumnWidth(0,59)
     self.tableWidget.setColumnWidth(1,98)
     self.tableWidget.setColumnWidth(2,95)
     self.tableWidget.setColumnWidth(3,45)
     self.tableWidget.setColumnWidth(4,60)
     self.tableWidget.setColumnWidth(5,53)
     self.tableWidget.setColumnWidth(6,51)
     self.tableWidget.setColumnWidth(7,71)
     self.tableWidget.setColumnWidth(8,77)
     self.tableWidget.setColumnWidth(9,89)
     self.tableWidget.setColumnWidth(10,77)
     self.tableWidget.setColumnWidth(11,84)
     self.tableWidget.setColumnWidth(12,38)
     self.tableWidget.setColumnWidth(13,32)
     self.tableWidget.setColumnWidth(14,31)
     self.tableWidget.setColumnWidth(15,80)
     self.tableWidget.setColumnWidth(16,151)
     self.tableWidget.horizontalHeader().setStyleSheet("font: bold 9px;")
     self.splitter1 = QSplitter()
     self.splitter1.setOrientation(Qt.Vertical)
     self.splitter2 = QSplitter()
     self.splitter2.setOrientation(Qt.Horizontal)
     self.ayarlarbolum=QVBoxLayout()
     self.ayarlarbolum.addWidget(self.groupbox11)
     self.splitter3 = QSplitter()
     self.splitter3.setOrientation(Qt.Horizontal)
     self.splitter4 = QSplitter()
     self.splitter4.setOrientation(Qt.Horizontal)
     self.dates2=[]
     self.brush = pg.mkBrush(color=(128,128,128))
     self.axis = DateAxis(orientation='bottom')
     self.axis2 = DateAxis(orientation='bottom')
     self.axis3 = DateAxis(orientation='bottom')
     self.axis4 = DateAxis(orientation='bottom')
     self.axis5 = DateAxis(orientation='bottom')
     self.axis6 = DateAxis(orientation='bottom')
     self.pw = pg.PlotWidget(axisItems={'bottom': self.axis},  title="PlotItem")
     self.pw2 = pg.PlotWidget(axisItems={'bottom': self.axis2},  title="PlotItem")
     self.pw3 = pg.PlotWidget(axisItems={'bottom': self.axis3}, title="PlotItem")
     self.pw4 = pg.PlotWidget(axisItems={'bottom': self.axis4}, title="PlotItem")
     self.pw5 = pg.PlotWidget(axisItems={'bottom': self.axis5},  title="PlotItem")
     self.pw6 = pg.PlotWidget(axisItems={'bottom': self.axis6},  title="PlotItem")
     self.pen = pg.mkPen(color=(0, 0, 0))
     self.pw.setBackground('w')
     self.pw.setTitle('<span style=\"color:black;font-size:17px\">YÜKSEKLİK(m)</span>')
     self.pw.setLabel('left', '<span style=\"color:black;font-size:17px\">m</span>')
     self.pw.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
     self.data_line =  self.pw.plot(self.dates2, self.altitude,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
     self.pw2.setBackground('w')
     self.pw2.setTitle('<span style=\"color:black;font-size:17px\">SICAKLIK(°C)</span>')
     self.pw2.setLabel('left', '<span style=\"color:black;font-size:17px\">°C</span>')
     self.pw2.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
     self.data_line2 =  self.pw2.plot(self.dates2, self.temp,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
     self.pw3.setBackground('w')
     self.pw3.setTitle('<span style=\"color:black;font-size:17px\">BASINÇ(Pa)</span>')
     self.pw3.setLabel('left', '<span style=\"color:black;font-size:17px\">Pa</span>')
     self.pw3.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
     self.data_line3 =  self.pw3.plot(self.dates2, self.pressure,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
     self.pw4.setBackground('w')
     self.pw4.setTitle('<span style=\"color:black;font-size:17px\">PİL GERİLİMİ(V)</span>')
     self.pw4.setLabel('left', '<span style=\"color:black;font-size:17px\">V</span>')
     self.pw4.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
     self.data_line4 =  self.pw4.plot(self.dates2, self.voltage,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
     self.pw5.setBackground('w')
     self.pw5.setTitle('<span style=\"color:black;font-size:17px\">İNİŞ HIZI(m/s)</span>')
     self.pw5.setLabel('left', '<span style=\"color:black;font-size:17px\">m/s</span>')
     self.pw5.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
     self.data_line5 =  self.pw5.plot(self.dates2, self.gpsaltitude,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
     self.pw6.setBackground('w')
     self.pw6.setTitle('<span style=\"color:black;font-size:17px\">GPS ALTITUDE(m)</span>')
     self.pw6.setLabel('left','<span style=\"color:black;font-size:17px\">m</span>')
     self.pw6.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
     self.data_line6 =  self.pw6.plot(self.dates2, self.inishiz,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
     self.splitter3.addWidget(self.pw)
     self.splitter3.addWidget(self.pw2)
     self.splitter3.addWidget(self.pw3)
     self.splitter2.addWidget(self.pw4)
     self.splitter2.addWidget(self.pw5)
     self.splitter2.addWidget(self.pw6)
     self.splitter1.addWidget(self.splitter3)
     self.splitter1.addWidget(self.splitter2)
     self.splitter4.addWidget(self.tableWidget2)
     self.splitter1.addWidget(self.splitter4)
     self.kamera2=QLabel()
     self.splitter8.addWidget(self.kamera2)
     layout = QGridLayout()
     self.view5 = MapGraphicsView(tileSource=MapTileSourceHere()) #tileSource=MapTileSourceOSM("map.osm")
     self.view5.scene().setCenter(self.gpslongitude[0], self.gpslatitude[0])
     self.view5.setOptimizationFlag(QGraphicsView.DontSavePainterState, True)
     self.view5.setRenderHint(QPainter.Antialiasing, True)
     self.view5.setRenderHint(QPainter.SmoothPixmapTransform, True)
     self.tabwidget = QTabWidget()
     self.capture4 = cv2.VideoCapture()
     self.kamera3=QLabel()
     self.tabwidget.addTab(self.splitter1, "GRAFİKLER")
     self.tabwidget.addTab(self.tableWidget, "TELEMETRİ VERİLERİ")
     self.tabwidget.addTab(self.view5, "HARİTA")
     self.tabwidget.addTab(view, "KAMERA KAYDI")        
     self.tabwidget.setStyleSheet("font: bold 14px;")
     layout.addWidget(self.tabwidget, 0, 0) 
     self.tabwidget.blockSignals(False)
     self.twovbhb3.addWidget(self.packetcount)
     self.twovbhb3.addWidget(self.packetcount2)
     self.twovbhb3.addWidget(self.missiontime)
     self.twovbhb3.addWidget(self.missiontime2)
     self.twovb.addLayout(self.twovbhb1)
     self.twovb.addLayout(self.twovbhb3)
     self.twovb.addLayout(layout)     
     self.prog=QProgressBar(self)
     self.prog.setMaximum(100)
     self.prog.setUpdatesEnabled(True)
     self.prog.setValue(0)
     self.prog.setAlignment(Qt.AlignCenter)
     self.prog.setStyleSheet("QProgressBar{border: 2px solid grey; border-radius: 5px;}")
     self.prog.setStyleSheet("::chunk{background-color: #42C9EB; width: 10px; margin:1.2px; align:center}")
     self.prog.setFixedWidth(335)
     self.prog.setFixedHeight(42)
     self.prog.setFont(QFont("Comic Sans MS",13,QFont.Bold))
     self.listem=QListWidget()
     self.addg=QBrush(QColor(0,255,127))#(156, 239, 130)
     self.listem.setStyleSheet("font:bold 13px rgb(4, 199, 234)")
     self.listem.setFont(QFont("Comic Sans MS",10))
     self.listem.setFixedHeight(163)
     self.listem.setFixedWidth(335)
     self.listem.setSelectionMode(QListWidget.MultiSelection)
     self.listem.setAutoFillBackground(True)
     self.softws=QLabel("       UYDU STATÜSÜ")
     self.softws.setFont(QFont("Comic Sans MS",18,QFont.Bold))
     self.listemitem=["Görev Başladı","Uçuş Bekleniyor","Model Uydu Yükselmekte","Model Uydu İnişte","Görev Yükü Taşıyıcı'dan Ayrıldı","Görev Yükü Kurtarılmayı Bekliyor","Görev Tamamlandı"]
     self.listem.setFont(QFont("Comic Sans MS",14))
     self.z=0
     for i in self.listemitem:
         self.listem.addItem(i)
     self.softws.setFixedWidth(335)
     self.softws.setFixedHeight(60)
     self.softws.setStyleSheet("background-color: #e6e6e6; border:1px solid #000000")
     self.listem.setStyleSheet("background-color: #e6e6e6")
     filename = "gorevyuku.STL"
     self.frames =QFrame()
     self.vl =QVBoxLayout()
     self.reader = vtk.vtkSTLReader()
     self.reader.SetFileName(filename)
     self.coneMapper2 = vtk.vtkPolyDataMapper()
     self.vtkWidget = QVTKRenderWindowInteractor(self.frames)
     self.vl.addWidget(self.vtkWidget)
     self.iren =self.vtkWidget.GetRenderWindow().GetInteractor()
     self.ren = vtk.vtkRenderer()
     self.prev=0
     WIDTH=335
     HEIGHT=400       
     self.frames.setFixedWidth(335)
     self.frames.setFixedHeight(330)
     self.start.setDisabled(False)
     self.transform = vtk.vtkTransform()
     self.transform.RotateX(-90)
     self.transform.RotateY(0)
     self.transform.RotateZ(0)
     self.transformFilter=vtk.vtkTransformPolyDataFilter()
     self.transformFilter.SetTransform(self.transform)
     self.transformFilter.SetInputConnection(self.reader.GetOutputPort())
     self.transformFilter.Update()
     if vtk.VTK_MAJOR_VERSION <= 5:
         self.coneMapper2.SetInput(self.transformFilter.GetOutput())
     else:
         self.coneMapper2.SetInputConnection(self.transformFilter.GetOutputPort())
     self.actor2 = vtk.vtkActor()
     self.actor2.SetMapper(self.coneMapper2)
     self.frames.setLayout(self.vl)
     self.frames.setLineWidth(0.6)
     self.frames.setStyleSheet("border:1px solid #000000; background-color:#7FD5FF")
     self.actor2.GetProperty().SetColor(0.5,0.5,0.5)# (R,G,B)
     self.actor2.SetScale(1, 1, 1)
     self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
     self.ren.AddActor(self.actor2)
     self.ren.SetBackground(0.496,0.832,0.996)
     self.iren.Initialize()
     self.iren.Start()
     self.koordinat=QLabel("PITCH:           ROLL:           YAW:")
     self.mesafe=QLabel("MESAFE:")
     self.gpslo=QLabel("GPS LONGITUDE:")
     self.gpsal=QLabel("GPS LATITUDE:")
     self.koordinat.setFixedHeight(60)
     self.koordinat.setFixedWidth(335)
     self.koordinat.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
     self.mesafe.setFixedHeight(60)
     self.mesafe.setFixedWidth(335)
     self.mesafe.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
     self.gpslo.setFixedHeight(60)
     self.gpslo.setFixedWidth(335)
     self.gpslo.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
     self.gpsal.setFixedHeight(60)
     self.gpsal.setFixedWidth(335)
     self.gpsal.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
     self.stated=QLabel("Uydu Statüsü:")
     self.stated.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.koordinat.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.koordinat.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.mesafe.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.gpslo.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.gpsal.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.kaynak=QLabel("Görev Tamamlanma Yüzdesi:")
     self.kaynak.setFont(QFont("Comic Sans MS",9,QFont.Bold))
     self.kaynak.setFixedHeight(25)
     self.syc=0
     self.ilkveri=0
     self.onceki_gps_lon=0.000000
     self.onceki_gps_lat=0.000000
     self.threevb.addWidget(self.kaynak) 
     self.threevb.addWidget(self.prog)  
     self.threevb.addWidget(self.stated)
     self.threevb.addWidget(self.softws)
     self.threevb.addWidget(self.listem) 
     self.firstvb.addWidget(self.frames)
     self.firstvb.addWidget(self.koordinat)
     self.threevb.addWidget(self.view3)
     self.threevb.addWidget(self.gpsal)
     self.threevb.addWidget(self.gpslo)         
     self.threevb.addWidget(self.mesafe)
     self.genelhbox.addLayout(self.firstvb)
     self.genelhbox.addLayout(self.twovb)
     self.genelhbox.addLayout(self.threevb)
     self.setLayout(self.genelhbox)
     
     self.oran=0
     
     self.setWindowTitle("Grizu-263 Uzay Takımı| Yer İstasyonu")
     self.show()
Ejemplo n.º 29
0
class Pencere(QWidget):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.kalibredurumu=0
        self.stopflag =False
        self.dosya_yol=''
        self.resize(1926, 1006)
        self.frame_gl=QFrame()    
        opengl=QOpenGLWidget(parent=self.frame_gl)
        self.setWindowIcon(QIcon("logo1.png"))
        self.setAutoFillBackground(True)      
        oImage=QImage("ekran8.png")
        sImage=oImage.scaled(QSize(1926, 1020))
        palette=QPalette()
        palette.setBrush(QPalette.Window, QBrush(sImage))                        
        self.setPalette(palette)
        self.bosluk=QLabel("    ")
        self.genelhbox=QHBoxLayout()
        self.firstvb=QVBoxLayout()
        self.logo=QLabel()
        self.motorkontrolu = QGroupBox("Manuel Tahrik Komutu")
        self.motorbasla=QPushButton("BAŞLA")
        self.motordur=QPushButton("DUR")
        self.motorbasla.setFixedHeight(27)
        self.motordur.setFixedHeight(27)
        self.motorbasla.clicked.connect(self.motorBasla)
        self.motordur.clicked.connect(self.motorDur)
        self.motor=QVBoxLayout()
        self.motor.addWidget(self.motorbasla)
        self.motor.addWidget(self.motordur)
        self.motorkontrolu.setLayout(self.motor)
        self.splitter8 = QSplitter()
        self.splitter8.setOrientation(Qt.Vertical)
        self.logo.setFixedHeight(150)
        self.logo.setFixedWidth(190)
        self.logo.setPixmap(QPixmap("logo4.PNG"))        
        self.logo.setAlignment(Qt.AlignTop)
        self.takimno=QLabel("Takım No:56701")
        self.takimno.setFont(QFont("Comic Sans MS",11,QFont.Bold))
        self.hata1=0
        self.portyap=QHBoxLayout()
        scene2 = QGraphicsScene(self)
        self.gpslongitude=[33.7115]
        self.gpslatitude=[38.3980]
        try:
            self.capture = cv2.VideoCapture(camera_index)
            self.dimensions = self.capture.read()[1].shape[1::-1]
            pixmap2 = QPixmap(*self.dimensions)
            self.pixmapItem2 = scene2.addPixmap(pixmap2) 
        except AttributeError:
            self.hata1=1
        self.view2 = QGraphicsView(self)
        self.view2.setScene(scene2)
        self.view2.setFixedHeight(430)
        self.view2.setFixedWidth(335)
        self.view3 = MapGraphicsView(tileSource=MapTileSourceHere()) #tileSource=MapTileSourceOSM("map.osm")
        self.view3.scene().setCenter(self.gpslongitude[0], self.gpslatitude[0])
        self.view3.setOptimizationFlag(QGraphicsView.DontSavePainterState, True)
        self.view3.setRenderHint(QPainter.Antialiasing, True)
        self.view3.setRenderHint(QPainter.SmoothPixmapTransform, True)
        self.z=0
        self.y=0
        self.frame=QFrame()
        self.resize(1926, 1006)
        self.view3.setFixedWidth(335)
        self.view3.setFixedHeight(407)
        self.twovb=QVBoxLayout()
        self.view3.setStyleSheet("border:1px solid #000000")
        self.threevb=QVBoxLayout()
        self.threevbh=QHBoxLayout()
        self.threevbh.addWidget(self.logo) 
        self.threevbh.addWidget(self.takimno)
        self.firstvb.addLayout(self.threevbh)
        self.firstvb.addWidget(self.view2)
        self.tableWidget3=QTableWidget()
        self.tableWidget3.setEditTriggers(QTableWidget.NoEditTriggers)
        self.tableWidget3.setColumnCount(17)
        self.tableWidget3.setHorizontalHeaderLabels(str("TAKIM NO;PAKET NUMARASI;GÖNDERME SAATİ;BASINÇ;YÜKSEKLİK;İNİŞ HIZI;SICAKLIK;PİL GERİLİMİ;GPS LATITUDE;GPS LONGITUDE;GPS ALTITUDE;UYDU STATÜSÜ;PITCH;ROLL;YAW;DÖNÜŞ SAYISI;VİDEO AKTARIM BİLGİSİ").split(";"))
        self.tableWidget3.verticalHeader().hide()
        self.tableWidget3.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
        self.tableWidget3.horizontalScrollBar().hide()
        self.tableWidget3.setStyleSheet("font:9px;")
        self.tableWidget3.setColumnWidth(0,59)
        self.tableWidget3.setColumnWidth(1,98)
        self.tableWidget3.setColumnWidth(2,95)
        self.tableWidget3.setColumnWidth(3,45)
        self.tableWidget3.setColumnWidth(4,60)
        self.tableWidget3.setColumnWidth(5,53)
        self.tableWidget3.setColumnWidth(6,51)
        self.tableWidget3.setColumnWidth(7,71)
        self.tableWidget3.setColumnWidth(8,77)
        self.tableWidget3.setColumnWidth(9,89)
        self.tableWidget3.setColumnWidth(10,77)
        self.tableWidget3.setColumnWidth(11,84)
        self.tableWidget3.setColumnWidth(12,38)
        self.tableWidget3.setColumnWidth(13,32)
        self.tableWidget3.setColumnWidth(14,31)
        self.tableWidget3.setColumnWidth(15,80)
        self.tableWidget3.setColumnWidth(16,151)
        self.splitter10 = QSplitter()
        self.splitter10.setOrientation(Qt.Vertical)
        self.twovbhb1=QHBoxLayout()
        self.twovbhb12=QHBoxLayout()
        self.twovbhb13=QHBoxLayout()
        self.twovbhb14=QHBoxLayout()
        self.twovbhb15=QHBoxLayout()
        self.twovbhb16=QHBoxLayout()
        self.twovbvb1=QVBoxLayout()
        self.twovbhb2=QHBoxLayout()
        self.twovbhb3=QHBoxLayout()
        self.twovbvb2=QVBoxLayout()
        self.uydu_statu=["Görev Başladı","Uçuş Bekleniyor","Model Uydu Yükselmekte","Model Uydu İnişte","Görev Yükü Taşıyıcıdan Ayrıldı","Görev Yükü Kurtarılmayı Bekliyor","Görev Tamamlandı"]
        self.port=QLabel("Port:")
        self.port2=QLabel("Port:")
        self.port.setFixedWidth(50)
        
        self.port.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.ports=QComboBox()
        self.ports.setFixedWidth(150)
        self.ports.addItems([''])
        self.ports.addItems(self.portlar())
        self.ports.setStyleSheet("font: bold 15px;")
        self.groupbox2 = QGroupBox("1. Seri Port Yapılandırması")     
        self.groupbox1 = QGroupBox("Ayrılma Yüksekliği Değiştirme") 
        self.groupbox5 = QGroupBox("2. Seri Port Yapılandırması")
        self.yukseklikQHB=QHBoxLayout()        
        self.yukseklikd=QLabel("Ayrılma Yüksekliğini Giriniz:")
        self.yukseklikd.setFixedWidth(240)
        self.yukseklik=QLineEdit()
        self.yukseklikgonder=QPushButton("GÖNDER")
        self.yukseklikgonder.clicked.connect(self.yukseklikGonder)
        self.yukseklikQHB.addWidget(self.yukseklikd)
        self.yukseklikQHB.addWidget(self.yukseklik)
        self.yukseklikQHB.addWidget(self.yukseklikgonder)
        self.groupbox1.setLayout(self.yukseklikQHB)
        self.start=QPushButton("BAŞLA")
        self.start.setFont(QFont("Comic Sans MS",9,))
        self.start.clicked.connect(self.Start)
        self.start.setInputMethodHints(Qt.ImhNone)
        
        self.baudrates=QLabel("Baudrate:")
        self.baudrates.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.baudrate=QComboBox()
        self.baudrate.setFixedWidth(100)
        self.baudrate.addItems(["","9600","19200","115200", "38400"])
        self.baudrate.setStyleSheet("font: bold 15px;")
        self.baudrates.setFixedWidth(80)
        
        self.port2.setFixedWidth(50)
        self.port2.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.ports2=QComboBox()
        self.ports2.setFixedWidth(150)
        self.ports2.addItems([''])
        self.ports2.addItems(self.portlar())
        self.ports2.setStyleSheet("font: bold 15px;")
        self.groupbox11 = QGroupBox("Seri Port Yapılandırması")        
        self.start2=QPushButton("BAŞLA")
        self.start2.setFont(QFont("Comic Sans MS",9,))
        self.start2.clicked.connect(self.Start2)
        self.baudrates2=QLabel("Baudrate:")
        self.baudrates2.setFont(QFont("Comic Sans MS",10,QFont.Bold))
        self.baudrate2=QComboBox()
        self.baudrate2.setFixedWidth(100)
        self.baudrate2.addItems(["","9600","19200","115200", "38400"])
        self.baudrate2.setStyleSheet("font: bold 15px;")
        self.baudrates2.setFixedWidth(80)
        
        self.gerial=QPushButton("GERİ AL")
        self.gerial.setFixedHeight(27)
        self.twovbhb15.addWidget(self.gerial)
        self.kalibrasyon=QPushButton("KALİBRE ET")
        self.kalibrasyon.setFixedHeight(27)
        self.kalibrasyon.setFixedWidth(85)
        self.kalibrasyon.clicked.connect(self.KalibrEt)
        self.ayarlar=QVBoxLayout()
        self.diger_ayarlar_ac=QPushButton("AÇ")
        self.diger_ayarlar_kapat=QPushButton("KAPAT")
        self.diger_ayarlar_ac.setFixedHeight(27)
        self.diger_ayarlar_kapat.setFixedHeight(27)
        self.ayarlar.addWidget(self.diger_ayarlar_ac)
        self.ayarlar.addWidget(self.diger_ayarlar_kapat)
        self.diger_ayarlar_ac.clicked.connect(self.ayarlarAc)
        self.diger_ayarlar_kapat.clicked.connect(self.ayarlarKapat)
        self.gerial.clicked.connect(self.geriAl)
        self.iletimdurumu=QLabel("Video İletim Durumu:")
        self.ayırma=QPushButton("AYIR")
        self.ayırma.clicked.connect(self.Ayir)
        self.kalibrasyon.setFont(QFont("Comic Sans MS",9))
        self.ayırma.setFixedWidth(85)
        self.ayırma.setFixedHeight(27)
        self.gerial.setFixedWidth(113)
        self.groupbox4 = QGroupBox("Ayrılma Komutu")
        self.groupbox10 = QGroupBox("Ayarlar")
        self.groupbox8 = QGroupBox("Kalibrasyon Komutu")
        self.groupbox3 = QGroupBox("Verileri Arayüze Geri Alma Komutu")
        self.groupbox10.setLayout(self.ayarlar)
        self.groupbox8.setLayout(self.twovbhb16)
        self.groupbox3.setLayout(self.twovbhb15)
        self.twovbhb14.addWidget(self.ayırma)
        self.twovbhb16.addWidget(self.kalibrasyon)
        self.groupbox4.setLayout(self.twovbhb14)
        self.ayırma.setFont(QFont("Comic Sans MS",9))
        self.gerial.setFont(QFont("Comic Sans MS",9))
        self.packetcount=QLabel("Paket Numarası:")
        self.packetcount2=QLabel()
        self.packetcount.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.packetcount2.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.packetcount.setFixedWidth(137)
        self.missiontime=QLabel("Gönderme Saati:")
        self.missiontime2=QLabel()
        self.missiontime2.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.missiontime.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.missiontime.setFixedWidth(157)
        self.start.setInputMethodHints(Qt.ImhNone)
        self.dosyasecs=QLabel("Dosya Seç:")
        self.dosyasecs.setFixedHeight(20)
        self.dosyasecs.setFixedWidth(90)
        self.dosyasecs.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.dosyasec=QPushButton("...")
        self.dosyasec.setFixedHeight(27)
        self.dosyasec.clicked.connect(self.Dosyasec)
        self.stop=QPushButton("DUR")
        self.stop.setInputMethodHints(Qt.ImhNone)
        self.stop.clicked.connect(self.Stop)
        self.stop.setFont(QFont("Comic Sans MS",9))
        
        self.stop2=QPushButton("DUR")
        self.stop2.setInputMethodHints(Qt.ImhNone)
        self.stop2.clicked.connect(self.Stop2)
        self.stop2.setFont(QFont("Comic Sans MS",9))
        
        self.dosyasec.setFixedHeight(20)
        self.dosyasec.setFixedWidth(20)
        self.gonder=QPushButton("GÖNDER")
        self.gonder.setFixedHeight(27)
        self.gonder.setDisabled(True)
        self.gonder.setFixedWidth(110)
        self.gonder.setFont(QFont("Comic Sans MS",9,))
        self.groupbox = QGroupBox("Video Aktarımı")
        self.iletimdurumu.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.gbvx=QVBoxLayout()
        self.gbx=QHBoxLayout()
        self.gbx.addWidget(self.dosyasecs)
        self.gbx.addWidget(self.dosyasec)
        self.gbx.addWidget(self.gonder)
        self.gbvx.addLayout(self.gbx)
        self.gbvx.addWidget(self.iletimdurumu)
        self.groupbox.setLayout(self.gbvx) 
        self.gonder.clicked.connect(self.Gonder)
        self.twovbhb18=QHBoxLayout()
        self.twovbhb18.addWidget(self.port2)
        self.twovbhb18.addWidget(self.ports2)
        self.twovbhb18.addWidget(self.baudrates2)
        self.twovbhb18.addWidget(self.baudrate2)
        
        self.twovbhb19=QHBoxLayout()
        self.twovbhb19.addWidget(self.start2)
        self.twovbhb19.addWidget(self.stop2)
        
        self.twovbhb13.addWidget(self.port)
        self.twovbhb13.addWidget(self.ports)
        self.twovbhb13.addWidget(self.baudrates)
        self.twovbhb13.addWidget(self.baudrate)
        self.twovbhb12.addWidget(self.start)
        self.twovbhb12.addWidget(self.stop)
        self.twovbvb1.addLayout(self.twovbhb13)
        self.twovbvb1.addLayout(self.twovbhb12)
        self.twovbvb2.addLayout(self.twovbhb18)
        self.twovbvb2.addLayout(self.twovbhb19)
        self.groupbox2.setLayout(self.twovbvb1)
        self.groupbox5.setLayout(self.twovbvb2)
        self.portyap.addWidget(self.groupbox2)  
        self.portyap.addWidget(self.groupbox5)
        self.groupbox11.setLayout(self.portyap)
        self.splitter10.addWidget(self.groupbox11)
        self.splitter10.addWidget(self.groupbox1)
        self.twovbhb1.addWidget(self.groupbox4)
        self.twovbhb1.addWidget(self.groupbox10)
        self.twovbhb1.addWidget(self.motorkontrolu)
        self.twovbhb1.addWidget(self.groupbox3)
        self.twovbhb1.addWidget(self.groupbox8)
        self.twovbhb1.addWidget(self.groupbox)
        scene = QGraphicsScene(self)
        try:
            pixmap = QPixmap(*self.dimensions)
            self.pixmapItem = scene.addPixmap(pixmap)
        except AttributeError:
            print('devam')
        view = QGraphicsView(self)
        view.setScene(scene)
        if self.hata1==0:
            timer = QTimer(self)
            timer.setInterval(int(1000/fps))
            timer.timeout.connect(self.get_frame)
            timer.start()
        self.temp=[]
        self.pressure=list()
        self.voltage=list()
        self.altitude=list()
        self.inishiz=list()
        self.gpsaltitude=list()
        self.timer=list()
        self.tableWidget2=QTableWidget()
        self.tableWidget2.setEditTriggers(QTableWidget.NoEditTriggers)
        self.tableWidget2.setColumnCount(17)   
        self.tableWidget2.setHorizontalHeaderLabels(str("TAKIM NO;PAKET NUMARASI;GÖNDERME SAATİ;BASINÇ;YÜKSEKLİK;İNİŞ HIZI;SICAKLIK;PİL GERİLİMİ;GPS LATITUDE;GPS LONGITUDE;GPS ALTITUDE;UYDU STATÜSÜ;PITCH;ROLL;YAW;DÖNÜŞ SAYISI;VİDEO AKTARIM BİLGİSİ").split(";"))
        self.tableWidget2.verticalHeader().hide()
        self.tableWidget2.horizontalHeader().setStyleSheet("font: bold 7px;")
        self.tableWidget2.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
        self.tableWidget2.horizontalScrollBar().hide()
        self.tableWidget2.setStyleSheet("font:9px;")
        self.tableWidget2.setColumnWidth(0,59)
        self.tableWidget2.setColumnWidth(1,98)
        self.tableWidget2.setColumnWidth(2,97)
        self.tableWidget2.setColumnWidth(3,49)
        self.tableWidget2.setColumnWidth(4,61)
        self.tableWidget2.setColumnWidth(5,52)
        self.tableWidget2.setColumnWidth(6,52)
        self.tableWidget2.setColumnWidth(7,70)
        self.tableWidget2.setColumnWidth(8,80)
        self.tableWidget2.setColumnWidth(9,90)
        self.tableWidget2.setColumnWidth(10,77)
        self.tableWidget2.setColumnWidth(11,85)
        self.tableWidget2.setColumnWidth(12,38)
        self.tableWidget2.setColumnWidth(13,34)
        self.tableWidget2.setColumnWidth(14,33)
        self.tableWidget2.setColumnWidth(15,81)
        self.tableWidget2.setColumnWidth(16,134)
        self.tableWidget2.horizontalHeader().setStyleSheet("font: bold 9px;")
        self.tableWidget2.setFixedHeight(195)
        self.tableWidget=QTableWidget()
        self.tableWidget.setEditTriggers(QTableWidget.NoEditTriggers)
        self.tableWidget.setColumnCount(17)
        self.tableWidget.setHorizontalHeaderLabels(str("TAKIM NO;PAKET NUMARASI;GÖNDERME SAATİ;BASINÇ;YÜKSEKLİK;İNİŞ HIZI;SICAKLIK;PİL GERİLİMİ;GPS LATITUDE;GPS LONGITUDE;GPS ALTITUDE;UYDU STATÜSÜ;PITCH;ROLL;YAW;DÖNÜŞ SAYISI;VİDEO AKTARIM BİLGİSİ").split(";"))
        self.tableWidget.verticalHeader().hide()
        self.tableWidget.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
        self.tableWidget.horizontalScrollBar().hide()
        self.tableWidget.setStyleSheet("font:9px;")
        self.tableWidget.setColumnWidth(0,59)
        self.tableWidget.setColumnWidth(1,98)
        self.tableWidget.setColumnWidth(2,95)
        self.tableWidget.setColumnWidth(3,45)
        self.tableWidget.setColumnWidth(4,60)
        self.tableWidget.setColumnWidth(5,53)
        self.tableWidget.setColumnWidth(6,51)
        self.tableWidget.setColumnWidth(7,71)
        self.tableWidget.setColumnWidth(8,77)
        self.tableWidget.setColumnWidth(9,89)
        self.tableWidget.setColumnWidth(10,77)
        self.tableWidget.setColumnWidth(11,84)
        self.tableWidget.setColumnWidth(12,38)
        self.tableWidget.setColumnWidth(13,32)
        self.tableWidget.setColumnWidth(14,31)
        self.tableWidget.setColumnWidth(15,80)
        self.tableWidget.setColumnWidth(16,151)
        self.tableWidget.horizontalHeader().setStyleSheet("font: bold 9px;")
        self.splitter1 = QSplitter()
        self.splitter1.setOrientation(Qt.Vertical)
        self.splitter2 = QSplitter()
        self.splitter2.setOrientation(Qt.Horizontal)
        self.ayarlarbolum=QVBoxLayout()
        self.ayarlarbolum.addWidget(self.groupbox11)
        self.splitter3 = QSplitter()
        self.splitter3.setOrientation(Qt.Horizontal)
        self.splitter4 = QSplitter()
        self.splitter4.setOrientation(Qt.Horizontal)
        self.dates2=[]
        self.brush = pg.mkBrush(color=(128,128,128))
        self.axis = DateAxis(orientation='bottom')
        self.axis2 = DateAxis(orientation='bottom')
        self.axis3 = DateAxis(orientation='bottom')
        self.axis4 = DateAxis(orientation='bottom')
        self.axis5 = DateAxis(orientation='bottom')
        self.axis6 = DateAxis(orientation='bottom')
        self.pw = pg.PlotWidget(axisItems={'bottom': self.axis},  title="PlotItem")
        self.pw2 = pg.PlotWidget(axisItems={'bottom': self.axis2},  title="PlotItem")
        self.pw3 = pg.PlotWidget(axisItems={'bottom': self.axis3}, title="PlotItem")
        self.pw4 = pg.PlotWidget(axisItems={'bottom': self.axis4}, title="PlotItem")
        self.pw5 = pg.PlotWidget(axisItems={'bottom': self.axis5},  title="PlotItem")
        self.pw6 = pg.PlotWidget(axisItems={'bottom': self.axis6},  title="PlotItem")
        self.pen = pg.mkPen(color=(0, 0, 0))
        self.pw.setBackground('w')
        self.pw.setTitle('<span style=\"color:black;font-size:17px\">YÜKSEKLİK(m)</span>')
        self.pw.setLabel('left', '<span style=\"color:black;font-size:17px\">m</span>')
        self.pw.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
        self.data_line =  self.pw.plot(self.dates2, self.altitude,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
        self.pw2.setBackground('w')
        self.pw2.setTitle('<span style=\"color:black;font-size:17px\">SICAKLIK(°C)</span>')
        self.pw2.setLabel('left', '<span style=\"color:black;font-size:17px\">°C</span>')
        self.pw2.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
        self.data_line2 =  self.pw2.plot(self.dates2, self.temp,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
        self.pw3.setBackground('w')
        self.pw3.setTitle('<span style=\"color:black;font-size:17px\">BASINÇ(Pa)</span>')
        self.pw3.setLabel('left', '<span style=\"color:black;font-size:17px\">Pa</span>')
        self.pw3.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
        self.data_line3 =  self.pw3.plot(self.dates2, self.pressure,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
        self.pw4.setBackground('w')
        self.pw4.setTitle('<span style=\"color:black;font-size:17px\">PİL GERİLİMİ(V)</span>')
        self.pw4.setLabel('left', '<span style=\"color:black;font-size:17px\">V</span>')
        self.pw4.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
        self.data_line4 =  self.pw4.plot(self.dates2, self.voltage,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
        self.pw5.setBackground('w')
        self.pw5.setTitle('<span style=\"color:black;font-size:17px\">İNİŞ HIZI(m/s)</span>')
        self.pw5.setLabel('left', '<span style=\"color:black;font-size:17px\">m/s</span>')
        self.pw5.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
        self.data_line5 =  self.pw5.plot(self.dates2, self.gpsaltitude,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
        self.pw6.setBackground('w')
        self.pw6.setTitle('<span style=\"color:black;font-size:17px\">GPS ALTITUDE(m)</span>')
        self.pw6.setLabel('left','<span style=\"color:black;font-size:17px\">m</span>')
        self.pw6.setLabel('bottom', '<span style=\"color:black;font-size:17px\">Gönderme Saati(h:min:s)</span>')
        self.data_line6 =  self.pw6.plot(self.dates2, self.inishiz,pen=self.pen,symbol='o', symbolSize=10, symbolBrush=(self.brush))
        self.splitter3.addWidget(self.pw)
        self.splitter3.addWidget(self.pw2)
        self.splitter3.addWidget(self.pw3)
        self.splitter2.addWidget(self.pw4)
        self.splitter2.addWidget(self.pw5)
        self.splitter2.addWidget(self.pw6)
        self.splitter1.addWidget(self.splitter3)
        self.splitter1.addWidget(self.splitter2)
        self.splitter4.addWidget(self.tableWidget2)
        self.splitter1.addWidget(self.splitter4)
        self.kamera2=QLabel()
        self.splitter8.addWidget(self.kamera2)
        layout = QGridLayout()
        self.view5 = MapGraphicsView(tileSource=MapTileSourceHere()) #tileSource=MapTileSourceOSM("map.osm")
        self.view5.scene().setCenter(self.gpslongitude[0], self.gpslatitude[0])
        self.view5.setOptimizationFlag(QGraphicsView.DontSavePainterState, True)
        self.view5.setRenderHint(QPainter.Antialiasing, True)
        self.view5.setRenderHint(QPainter.SmoothPixmapTransform, True)
        self.tabwidget = QTabWidget()
        self.capture4 = cv2.VideoCapture()
        self.kamera3=QLabel()
        self.tabwidget.addTab(self.splitter1, "GRAFİKLER")
        self.tabwidget.addTab(self.tableWidget, "TELEMETRİ VERİLERİ")
        self.tabwidget.addTab(self.view5, "HARİTA")
        self.tabwidget.addTab(view, "KAMERA KAYDI")        
        self.tabwidget.setStyleSheet("font: bold 14px;")
        layout.addWidget(self.tabwidget, 0, 0) 
        self.tabwidget.blockSignals(False)
        self.twovbhb3.addWidget(self.packetcount)
        self.twovbhb3.addWidget(self.packetcount2)
        self.twovbhb3.addWidget(self.missiontime)
        self.twovbhb3.addWidget(self.missiontime2)
        self.twovb.addLayout(self.twovbhb1)
        self.twovb.addLayout(self.twovbhb3)
        self.twovb.addLayout(layout)     
        self.prog=QProgressBar(self)
        self.prog.setMaximum(100)
        self.prog.setUpdatesEnabled(True)
        self.prog.setValue(0)
        self.prog.setAlignment(Qt.AlignCenter)
        self.prog.setStyleSheet("QProgressBar{border: 2px solid grey; border-radius: 5px;}")
        self.prog.setStyleSheet("::chunk{background-color: #42C9EB; width: 10px; margin:1.2px; align:center}")
        self.prog.setFixedWidth(335)
        self.prog.setFixedHeight(42)
        self.prog.setFont(QFont("Comic Sans MS",13,QFont.Bold))
        self.listem=QListWidget()
        self.addg=QBrush(QColor(0,255,127))#(156, 239, 130)
        self.listem.setStyleSheet("font:bold 13px rgb(4, 199, 234)")
        self.listem.setFont(QFont("Comic Sans MS",10))
        self.listem.setFixedHeight(163)
        self.listem.setFixedWidth(335)
        self.listem.setSelectionMode(QListWidget.MultiSelection)
        self.listem.setAutoFillBackground(True)
        self.softws=QLabel("       UYDU STATÜSÜ")
        self.softws.setFont(QFont("Comic Sans MS",18,QFont.Bold))
        self.listemitem=["Görev Başladı","Uçuş Bekleniyor","Model Uydu Yükselmekte","Model Uydu İnişte","Görev Yükü Taşıyıcı'dan Ayrıldı","Görev Yükü Kurtarılmayı Bekliyor","Görev Tamamlandı"]
        self.listem.setFont(QFont("Comic Sans MS",14))
        self.z=0
        for i in self.listemitem:
            self.listem.addItem(i)
        self.softws.setFixedWidth(335)
        self.softws.setFixedHeight(60)
        self.softws.setStyleSheet("background-color: #e6e6e6; border:1px solid #000000")
        self.listem.setStyleSheet("background-color: #e6e6e6")
        filename = "gorevyuku.STL"
        self.frames =QFrame()
        self.vl =QVBoxLayout()
        self.reader = vtk.vtkSTLReader()
        self.reader.SetFileName(filename)
        self.coneMapper2 = vtk.vtkPolyDataMapper()
        self.vtkWidget = QVTKRenderWindowInteractor(self.frames)
        self.vl.addWidget(self.vtkWidget)
        self.iren =self.vtkWidget.GetRenderWindow().GetInteractor()
        self.ren = vtk.vtkRenderer()
        self.prev=0
        WIDTH=335
        HEIGHT=400       
        self.frames.setFixedWidth(335)
        self.frames.setFixedHeight(330)
        self.start.setDisabled(False)
        self.transform = vtk.vtkTransform()
        self.transform.RotateX(-90)
        self.transform.RotateY(0)
        self.transform.RotateZ(0)
        self.transformFilter=vtk.vtkTransformPolyDataFilter()
        self.transformFilter.SetTransform(self.transform)
        self.transformFilter.SetInputConnection(self.reader.GetOutputPort())
        self.transformFilter.Update()
        if vtk.VTK_MAJOR_VERSION <= 5:
            self.coneMapper2.SetInput(self.transformFilter.GetOutput())
        else:
            self.coneMapper2.SetInputConnection(self.transformFilter.GetOutputPort())
        self.actor2 = vtk.vtkActor()
        self.actor2.SetMapper(self.coneMapper2)
        self.frames.setLayout(self.vl)
        self.frames.setLineWidth(0.6)
        self.frames.setStyleSheet("border:1px solid #000000; background-color:#7FD5FF")
        self.actor2.GetProperty().SetColor(0.5,0.5,0.5)# (R,G,B)
        self.actor2.SetScale(1, 1, 1)
        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
        self.ren.AddActor(self.actor2)
        self.ren.SetBackground(0.496,0.832,0.996)
        self.iren.Initialize()
        self.iren.Start()
        self.koordinat=QLabel("PITCH:           ROLL:           YAW:")
        self.mesafe=QLabel("MESAFE:")
        self.gpslo=QLabel("GPS LONGITUDE:")
        self.gpsal=QLabel("GPS LATITUDE:")
        self.koordinat.setFixedHeight(60)
        self.koordinat.setFixedWidth(335)
        self.koordinat.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
        self.mesafe.setFixedHeight(60)
        self.mesafe.setFixedWidth(335)
        self.mesafe.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
        self.gpslo.setFixedHeight(60)
        self.gpslo.setFixedWidth(335)
        self.gpslo.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
        self.gpsal.setFixedHeight(60)
        self.gpsal.setFixedWidth(335)
        self.gpsal.setStyleSheet("font:bold 15px; background-color: #e6e6e6; border:1px solid #000000")
        self.stated=QLabel("Uydu Statüsü:")
        self.stated.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.koordinat.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.koordinat.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.mesafe.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.gpslo.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.gpsal.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.kaynak=QLabel("Görev Tamamlanma Yüzdesi:")
        self.kaynak.setFont(QFont("Comic Sans MS",9,QFont.Bold))
        self.kaynak.setFixedHeight(25)
        self.syc=0
        self.ilkveri=0
        self.onceki_gps_lon=0.000000
        self.onceki_gps_lat=0.000000
        self.threevb.addWidget(self.kaynak) 
        self.threevb.addWidget(self.prog)  
        self.threevb.addWidget(self.stated)
        self.threevb.addWidget(self.softws)
        self.threevb.addWidget(self.listem) 
        self.firstvb.addWidget(self.frames)
        self.firstvb.addWidget(self.koordinat)
        self.threevb.addWidget(self.view3)
        self.threevb.addWidget(self.gpsal)
        self.threevb.addWidget(self.gpslo)         
        self.threevb.addWidget(self.mesafe)
        self.genelhbox.addLayout(self.firstvb)
        self.genelhbox.addLayout(self.twovb)
        self.genelhbox.addLayout(self.threevb)
        self.setLayout(self.genelhbox)
        
        self.oran=0
        
        self.setWindowTitle("Grizu-263 Uzay Takımı| Yer İstasyonu")
        self.show()
    def yukseklikGonder(self):
        ser.write(self.yukseklik.text())
    def mesafe_hesapla(self,lat1,long1,lat2,long2):
        radius=6371*1000
        dlat=(lat2-lat1)*math.pi/180
        dlong=(long2-long1)*math.pi/180
        lat1=lat1*math.pi/180
        lat2=lat2*math.pi/180
        a=math.sin(dlat/2)*math.sin(dlat/2)+math.cos(math.radians(lat1))*math.cos(math.radians(lat2))*math.sin(dlong/2)*math.sin(dlong/2)
        c=2*math.atan2(math.sqrt(a), math.sqrt(1-a))
        distance=radius*c
        return distance
    def KalibrEt(self):
        ser.write(b'1')
        self.kalibredurumu=1
        self.prev=0
        for i in range(0,6):
            self.listem.item(i).setBackground(Qt.transparent)
        self.listem.item(0).setBackground(self.addg)
        self.listem.setCurrentRow(0)
        
    def Ayir(self):
        ser.write(b'2')
    def motorBasla(self):
        ser.write(b'3')
    def motorDur(self):
        ser.write(b'4')
    def Start(self):
        self.onceki1=0
        self.onceki2=0
        self.onceki3=0        
        if str(self.ports.currentText())== str('') and str(self.baudrate.currentText())== str(''):
            print("Port Seçmediniz veya Baudrate Seçmediniz!!") 
        else:
            self.start.setDisabled(True)
            h=['Takım Numarası', 'Paket Numarası', 'Gönderim Saati', 'Basınç', 'Yükseklik', 'İniş Hızı', 'Sıcaklık', 'Pil Gerilimi', 'GPS Latitude', 'GPS Longitude', 'GPS Altitude', 'Uydu Statüsü', 'Pitch', 'Roll', 'Yaw', 'Dönüş Sayısı', 'Video Aktarım Bilgisi']
            with open('telemetri_verileri.csv', 'w', newline='') as f:
                thewriter=csv.writer(f)
                thewriter.writerow(h)
            ser.port=str(self.ports.currentText())
            ser.baudrate=int(self.baudrate.currentText())
            ser.timeout=0.5
            ser.open()
            self.runnable = Runnable(self)
            QtCore.QThreadPool.globalInstance().start(self.runnable)
            self.listem.setCurrentRow(self.z)   
            self.listem.item(self.z).setBackground(self.addg)
            self.stated.setText("Uydu Statüsü:"+str("Görev Başladı"))
            QtCore.QMetaObject.invokeMethod(self.prog, "setValue", QtCore.Qt.QueuedConnection,QtCore.Q_ARG(int, 1))
    def Start2(self):   
        self.mySerial=serialThreadClass()
        self.mySerial.start()
        if str(self.ports2.currentText())== str('') and str(self.baudrate2.currentText())== str(''):
            print("Port Seçmediniz veya Baudrate Seçmediniz!!") 
        else:
            
            self.start2.setDisabled(True)
            
            print('girdim')
            
            
    def cizdir(self):
        if len(self.gpslongitude)==2:
            pointItem = self.view3.scene().addCircle(self.gpslongitude[1], self.gpslatitude[1], 5.0)
            pointItem.setBrush(Qt.green)
            pointItem.setPen(QPen(Qt.NoPen))
            pointItem.setToolTip('%f, %f' % (self.gpslongitude[1],self.gpslatitude[1]))
            pointItem.setFlag(QGraphicsItem.ItemIsSelectable, True)
            pointItem2 = self.view5.scene().addCircle(self.gpslongitude[1], self.gpslatitude[1], 5.0)
            pointItem2.setBrush(Qt.green)
            pointItem2.setPen(QPen(Qt.NoPen))
            pointItem2.setToolTip('%f, %f' % (self.gpslongitude[1],self.gpslatitude[1]))
            pointItem2.setFlag(QGraphicsItem.ItemIsSelectable, True)
        else:
            pointItem = self.view3.scene().addCircle(self.gpslong, self.gpslat, 5.0)
            pointItem.setBrush(Qt.blue)
            pointItem.setPen(QPen(Qt.NoPen))
            pointItem.setToolTip('%f, %f' % (self.gpslong,self.gpslat))
            pointItem.setFlag(QGraphicsItem.ItemIsSelectable, True)
            pointItem2 = self.view5.scene().addCircle(self.gpslong, self.gpslat, 5.0)
            pointItem2.setBrush(Qt.blue)
            pointItem2.setToolTip('%f, %f' % (self.gpslong,self.gpslat))
            pointItem2.setFlag(QGraphicsItem.ItemIsSelectable, True)          
        self.view3.scene().update()
        self.view3.setOptimizationFlag(QGraphicsView.DontSavePainterState, True)
        self.view3.setRenderHint(QPainter.Antialiasing, True)
        self.view3.setRenderHint(QPainter.SmoothPixmapTransform, True)
        self.view5.scene().update()
        self.view5.setOptimizationFlag(QGraphicsView.DontSavePainterState, True)
        self.view5.setRenderHint(QPainter.Antialiasing, True)
        self.view5.setRenderHint(QPainter.SmoothPixmapTransform, True)
        self.view3.scene().setItemIndexMethod(QGraphicsScene.NoIndex)
        self.view3.setTransformationAnchor(QGraphicsView.AnchorUnderMouse)
        self.view3.setResizeAnchor(QGraphicsView.AnchorViewCenter)
        self.view5.scene().setItemIndexMethod(QGraphicsScene.NoIndex)
        self.view5.setTransformationAnchor(QGraphicsView.AnchorUnderMouse)
        self.view5.setResizeAnchor(QGraphicsView.AnchorViewCenter)
    def get_frame(self):
        _, frame = self.capture.read()
        out.write(frame)
        image = QImage(frame, *self.dimensions, QImage.Format_RGB888).rgbSwapped()
        image2 = QImage(frame, *self.dimensions, QImage.Format_RGB888).rgbSwapped()
        pixmap = QPixmap.fromImage(image)
        pixmap2 = QPixmap.fromImage(image2)
        self.pixmapItem.setPixmap(pixmap) 
        self.pixmapItem2.setPixmap(pixmap2)   
    def Gonder(self):
        print('dosya buradaaa: '+self.dosya_yol)
        os.system(f'ffmpeg -i %s -c:v libx264 -preset ultrafast -crf 50 -c:a copy video5.mp4' % self.dosya_yol)
        cap = cv2.VideoCapture('video5.mp4')
        while(cap.isOpened()):
            ret, rame=cap.read()
            if not ret:
                print('Görüntü Alınamadı')
                gonderilecek_foto_say=int(self.syc/10)
                for i in range(0, 10):
                    son=i*gonderilecek_foto_say
                    image=open("outimage%s.jpg" % son, 'rb')
                    image_read= image.read()
                    image_64_encode= base64.encodestring(image_read)
                    with open("asdfg%s.txt" % i, "w") as imageFile:
                        strx=imageFile.write(image_64_encode.decode('utf-8'))
                break
            im=Image.fromarray(rame)
            im.save("outimage%s.jpg" % self.syc)
            self.syc+=1
        myfile = open('portyap.txt','w')
        myfile.writelines(str(self.baudrate2.currentText())+","+str(self.ports2.currentText())+","+str(self.syc)+"\n")
        myfile.writelines(str(self.baudrate.currentText())+","+str(self.ports.currentText()))
        myfile.close()
        cmd="python untitled10.py"
        proc = QProcess()
        proc.start(cmd)
        proc.startDetached(cmd)
    def ayarlarAc(self):
        self.tabwidget.addTab(self.splitter10, "AYARLAR")
    def ayarlarKapat(self):
        self.tabwidget.addTab(self.view8, "GERİ ALINAN KAMERA KAYDI")
    def geriAl(self):
        self.dimensions4 = self.capture4.read()[1].shape[1::-1]
        scene3 = QGraphicsScene(self)
        pixmap4 = QPixmap(*self.dimensions4)
        self.pixmapItem7 = scene3.addPixmap(pixmap4)
        self.view8 = QGraphicsView(self)
        timer4 = QTimer(self)
        timer4.setInterval(int(1000/fps))
        timer4.timeout.connect(self.get_frame2)
        timer4.start()
        self.tabwidget.addTab(self.view8, "GERİ ALINAN KAMERA KAYDI")
        self.view8.setScene(scene3)
        self.tabwidget.addTab(self.tableWidget3, "GERİ ALINAN TELEMETRİ VERİLERİ")
        self.tableWidget3.horizontalHeader().setStyleSheet("font: bold 9px;")
        with open('telemetri_verileri.csv', "r") as fileInput:
            for row in csv.reader(fileInput):    
                self.tableWidget3.insertRow(self.tableWidget3.rowCount())
                for i in range(17):
                    self.tableWidget3.setItem(self.tableWidget3.rowCount()-1,i,QTableWidgetItem(str(row[i])))
    def Stop(self):
        out.release()
        self.capture.release()
        self.stop.setDisabled(True)
        self.stopflag = True
        self.capture4 = cv2.VideoCapture('kamera_kaydi.avi')
        self.listem.setCurrentRow(6)
        self.listem.item(6).setBackground(self.addg)
        self.stated.setText("Uydu Statüsü:"+str("Görev Tamamlandı"))
        QtCore.QMetaObject.invokeMethod(self.prog, "setValue",QtCore.Qt.QueuedConnection,QtCore.Q_ARG(int, 100))
    def Stop2(self):
        self.stop2.setDisabled(True)
        self.stopflag2 = True

    def get_frame2(self):
        _, frame = self.capture4.read()
        image = QImage(frame, *self.dimensions4, QImage.Format_RGB888).rgbSwapped()
        pixmap4 = QPixmap.fromImage(image)
        self.pixmapItem7.setPixmap(pixmap4)
        if self.capture4.isOpened()==False:
            self.capture4.release()
            timer4.stop()
            timer4.release()
    def portlar(self):
        if sys.platform.startswith('win'):
            ports = ['COM%s' % (i + 1) for i in range(256)]
        elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
            ports = glob.glob('/dev/tty[A-Za-z]*')
        elif sys.platform.startswith('darwin'):
            ports = glob.glob('/dev/tty.*')
        else:
            raise EnvironmentError('Unsupported platform')
        result = []
        for port in ports:
            try:
                s = serial.Serial(port)
                s.close()
                result.append(port)
            except (OSError, serial.SerialException):
                pass
        return result
    def Dosyasec(self):
        root=Tk()
        root.withdraw() 
        root.filename = askopenfilename()
        print(root.filename)
        if root.filename:
            self.iletimdurumu.setText('Video İletim Durumu:Dosya Seçildi')
            self.gonder.setDisabled(False)
            st = os.stat(root.filename)
            #dosya_yol=st.st_size
            self.dosya_yol=str(root.filename)
            
        else:
            self.iletimdurumu.setText('Video İletim Durumu:Dosya Seçilmedi')
Ejemplo n.º 30
0
    def mousePressEvent(self, event, *args, **kwargs):
        """
        Attrs:
            _picking (bool): tells the widget that the user is now attempting
                to pick a value
            _in_gradient_widget (bool) tells the widget that the cursor is
                in the gradient widget
        """
        modifiers = QApplication.keyboardModifiers()
        button = event.button()
        if button in [Qt.LeftButton, Qt.RightButton, Qt.MiddleButton]:
            # move rgba

            # HSV
            self._picking = True
            self._black_select = False
            self._in_gradient_widget = True
            self._orig_pos = QCursor.pos()
            # setup default crosshair
            self.__hideRGBACrosshair(True)
            self.__hideLinearCrosshair(False)

            # RGB
            main_widget = getWidgetAncestor(self, ColorGradientDelegate)
            color = main_widget.color()
            pos = QPoint(0, 0)

            # TODO Check hack after upgrading to 5.15
            # katana is not registering the alt + mmb?
            if modifiers in [Qt.AltModifier, Qt.ControlModifier]:
                # RED
                if button == Qt.LeftButton:
                    pos = QPoint(color.redF() * self.width(), color.redF() * self.height())
                    self.scene().gradient_type = attrs.RED
                # GREEN
                elif button == Qt.MiddleButton:
                    pos = QPoint(color.greenF() * self.width(), color.greenF() * self.height())
                    self.scene().gradient_type = attrs.GREEN
                # BLUE
                elif button == Qt.RightButton:
                    pos = QPoint(color.blueF() * self.width(), color.blueF() * self.height())
                    self.scene().gradient_type = attrs.BLUE

            # HSV
            else:
                if button == Qt.LeftButton:
                    self.__hideRGBACrosshair(False)
                    self.__hideLinearCrosshair(True)
                    self.scene().gradient_type = attrs.RGBA
                # VALUE
                elif button == Qt.MiddleButton:
                    pos = QPoint(color.valueF() * self.width(), color.valueF() * self.height())
                    self.scene().gradient_type = attrs.VALUE
                # SATURATION
                elif button == Qt.RightButton:
                    pos = QPoint(color.saturationF() * self.width(), color.saturationF() * self.height())
                    self.scene().gradient_type = attrs.SATURATION

            # update display label to show selected value
            color_gradient_widget = getWidgetAncestor(self, ColorGradientDelegate)
            color_arg_widgets_dict = color_gradient_widget.header_widget.getWidgetDict()
            if self.scene().gradient_type != attrs.RGBA:
                color_arg_widgets_dict[self.scene().gradient_type].setSelected(True)

            # draw gradient / hide cursor
            self.scene().drawGradient()

            # set up cursor
            self.setCursor(Qt.BlankCursor)
            if pos:
                self.scene().linear_crosshair_item.setCrosshairPos(pos)
                QCursor.setPos(self.mapToGlobal(pos))

        return QGraphicsView.mousePressEvent(self, event, *args, **kwargs)
Ejemplo n.º 31
0
 def mouseReleaseEvent(self, e):
     QGraphicsView.mouseReleaseEvent(self, e)
     if e.button() == Qt.LeftButton:
         self.setDragMode(QGraphicsView.NoDrag)