Example #1
0
    def _setupUI(self):
        self._overlay = Gtk.Overlay()
        self.pack_start(self._overlay, True, True, 0)

        # Video screen renderer object initialize
        self.video_widget = VideoWidget(self)
        self.video_widget.set_size_request(self._size[0], self._size[1])

        self._overlay.add(self.video_widget)

        self._evtbox = Gtk.EventBox()
        self._evtbox.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK)
        self._overlay.add_overlay(self._evtbox)

        ''''if self.__source is None:
            self.logo = Gtk.Image()
            self.logo.set_from_file(os.path.join(self.app.RESOURCE_PATH, 'purun_nvr.png'))
            self.logo.set_halign(Gtk.Align.CENTER)
            self.logo.set_valign(Gtk.Align.CENTER)
            self._overlay.add_overlay(self.logo)'''

        # bottom part config
        # Device name setting
        cam_name = Gtk.Label(self.get_camera_name())
        cam_name.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('white'))
        cam_name.modify_font(Pango.FontDescription('sans 16'))
        cam_name.set_halign(Gtk.Align.CENTER)
        cam_name.set_valign(Gtk.Align.END)
        cam_name.set_margin_bottom(10)
        print(cam_name.get_text())

        self._overlay.add_overlay(cam_name)

        # record info
        # recording image setting
        hbox = Gtk.HBox()
        hbox.set_halign(Gtk.Align.END)
        hbox.set_valign(Gtk.Align.END)
        hbox.set_margin_bottom(10)

        self._rec_image = Gtk.Image()
        self._rec_image.set_from_stock(self.RECORD_IMAGE, Gtk.IconSize.LARGE_TOOLBAR)
        self._rec_image.set_margin_right(5)
        hbox.pack_start(self._rec_image, False, False, 0)

        self._rec_text = Gtk.Label(self.NOT_RECORD)
        self._rec_text.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('white'))
        self._rec_text.set_margin_right(10)
        hbox.pack_start(self._rec_text, False, False, 0)

        self._overlay.add_overlay(hbox)
        self.show_all()
Example #2
0
    def __init__(self):
        super().__init__()

        # Note: object variables that have the self.__[name] means that they are private
        # The user (if we give the code to other people, they should not be touching this at all) should not be able to see this
        # Private variables are usually used within the class only
        self.__windowTitle = "TITLE"
        self.__defaultSize = QtCore.QSize(1080, 720)
        self.videowidget = VideoWidget()
        self.__setupMainWindow()
Example #3
0
    def setupUi(self, FaceDetection):
        FaceDetection.setObjectName("FaceDetection")
        FaceDetection.setEnabled(True)
        FaceDetection.resize(992, 562)
        FaceDetection.setMinimumSize(QtCore.QSize(992, 562))
        FaceDetection.setMaximumSize(QtCore.QSize(16777215, 562))
        self.centralwidget = QtGui.QWidget(FaceDetection)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_7 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.video = VideoWidget(self.centralwidget)
        self.video.setMinimumSize(QtCore.QSize(640, 480))
        self.video.setMaximumSize(QtCore.QSize(640, 480))
        self.video.setAutoFillBackground(False)
        self.video.setObjectName("video")
        self.verticalLayout.addWidget(self.video)
        self.horizontal_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.horizontal_speed.sizePolicy().hasHeightForWidth())
        self.horizontal_speed.setSizePolicy(sizePolicy)
        self.horizontal_speed.setCursor(QtCore.Qt.SizeHorCursor)
        self.horizontal_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.horizontal_speed.setMinimum(-100)
        self.horizontal_speed.setMaximum(100)
        self.horizontal_speed.setPageStep(0)
        self.horizontal_speed.setOrientation(QtCore.Qt.Horizontal)
        self.horizontal_speed.setObjectName("horizontal_speed")
        self.verticalLayout.addWidget(self.horizontal_speed)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.vertical_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.vertical_speed.sizePolicy().hasHeightForWidth())
        self.vertical_speed.setSizePolicy(sizePolicy)
        self.vertical_speed.setCursor(QtCore.Qt.SizeVerCursor)
        self.vertical_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.vertical_speed.setMinimum(-100)
        self.vertical_speed.setMaximum(100)
        self.vertical_speed.setPageStep(0)
        self.vertical_speed.setOrientation(QtCore.Qt.Vertical)
        self.vertical_speed.setObjectName("vertical_speed")
        self.horizontalLayout.addWidget(self.vertical_speed)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.groupBox_3 = QtGui.QGroupBox(self.centralwidget)
        self.groupBox_3.setObjectName("groupBox_3")
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.serial_select = QtGui.QComboBox(self.groupBox_3)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.serial_select.sizePolicy().hasHeightForWidth())
        self.serial_select.setSizePolicy(sizePolicy)
        self.serial_select.setCursor(QtCore.Qt.PointingHandCursor)
        self.serial_select.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.serial_select.setObjectName("serial_select")
        self.serial_select.addItem("")
        self.verticalLayout_3.addWidget(self.serial_select)
        self.log = QtGui.QTextEdit(self.groupBox_3)
        self.log.setEnabled(True)
        self.log.setUndoRedoEnabled(True)
        self.log.setReadOnly(True)
        self.log.setObjectName("log")
        self.verticalLayout_3.addWidget(self.log)
        self.command_edit = QtGui.QLineEdit(self.groupBox_3)
        self.command_edit.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.command_edit.sizePolicy().hasHeightForWidth())
        self.command_edit.setSizePolicy(sizePolicy)
        self.command_edit.setPlaceholderText("Command")
        self.command_edit.setObjectName("command_edit")
        self.verticalLayout_3.addWidget(self.command_edit)
        self.verticalLayout_2.addWidget(self.groupBox_3)
        self.fanbox = QtGui.QGroupBox(self.centralwidget)
        self.fanbox.setEnabled(False)
        self.fanbox.setMaximumSize(QtCore.QSize(16777215, 184))
        self.fanbox.setObjectName("fanbox")
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.fanbox)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.fan_enabled = QtGui.QCheckBox(self.fanbox)
        self.fan_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.fan_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.fan_enabled.setObjectName("fan_enabled")
        self.verticalLayout_6.addWidget(self.fan_enabled)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.speed_dial = QtGui.QDial(self.fanbox)
        self.speed_dial.setCursor(QtCore.Qt.PointingHandCursor)
        self.speed_dial.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.speed_dial.setMaximum(100)
        self.speed_dial.setSliderPosition(80)
        self.speed_dial.setOrientation(QtCore.Qt.Horizontal)
        self.speed_dial.setInvertedAppearance(False)
        self.speed_dial.setInvertedControls(False)
        self.speed_dial.setObjectName("speed_dial")
        self.horizontalLayout_3.addWidget(self.speed_dial)
        self.speed_label = QtGui.QLabel(self.fanbox)
        self.speed_label.setAlignment(QtCore.Qt.AlignLeading
                                      | QtCore.Qt.AlignLeft
                                      | QtCore.Qt.AlignVCenter)
        self.speed_label.setObjectName("speed_label")
        self.horizontalLayout_3.addWidget(self.speed_label)
        self.verticalLayout_6.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.addWidget(self.fanbox)
        self.movementbox = QtGui.QGroupBox(self.centralwidget)
        self.movementbox.setEnabled(False)
        self.movementbox.setObjectName("movementbox")
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.movementbox)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.faces_enabled = QtGui.QCheckBox(self.movementbox)
        self.faces_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.faces_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.faces_enabled.setObjectName("faces_enabled")
        self.verticalLayout_4.addWidget(self.faces_enabled)
        self.verticalLayout_2.addWidget(self.movementbox)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.verticalLayout_7.addLayout(self.horizontalLayout)
        FaceDetection.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar()
        self.menubar.setGeometry(QtCore.QRect(0, 0, 992, 22))
        self.menubar.setObjectName("menubar")
        self.menuBioRob_FaceDetection = QtGui.QMenu(self.menubar)
        self.menuBioRob_FaceDetection.setObjectName("menuBioRob_FaceDetection")
        self.menuAbout = QtGui.QMenu(self.menubar)
        self.menuAbout.setObjectName("menuAbout")
        FaceDetection.setMenuBar(self.menubar)
        self.menuBioRob_FaceDetection.addSeparator()
        self.menubar.addAction(self.menuBioRob_FaceDetection.menuAction())
        self.menubar.addAction(self.menuAbout.menuAction())

        self.retranslateUi(FaceDetection)
        QtCore.QObject.connect(self.faces_enabled,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.horizontal_speed.setDisabled)
        QtCore.QObject.connect(self.faces_enabled,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.vertical_speed.setDisabled)
        QtCore.QObject.connect(self.fan_enabled,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.speed_dial.setDisabled)
        QtCore.QMetaObject.connectSlotsByName(FaceDetection)
Example #4
0
class Ui_FaceDetection(object):
    def setupUi(self, FaceDetection):
        FaceDetection.setObjectName("FaceDetection")
        FaceDetection.setEnabled(True)
        FaceDetection.resize(992, 562)
        FaceDetection.setMinimumSize(QtCore.QSize(992, 562))
        FaceDetection.setMaximumSize(QtCore.QSize(16777215, 562))
        self.centralwidget = QtGui.QWidget(FaceDetection)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_7 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.video = VideoWidget(self.centralwidget)
        self.video.setMinimumSize(QtCore.QSize(640, 480))
        self.video.setMaximumSize(QtCore.QSize(640, 480))
        self.video.setAutoFillBackground(False)
        self.video.setObjectName("video")
        self.verticalLayout.addWidget(self.video)
        self.horizontal_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.horizontal_speed.sizePolicy().hasHeightForWidth())
        self.horizontal_speed.setSizePolicy(sizePolicy)
        self.horizontal_speed.setCursor(QtCore.Qt.SizeHorCursor)
        self.horizontal_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.horizontal_speed.setMinimum(-100)
        self.horizontal_speed.setMaximum(100)
        self.horizontal_speed.setPageStep(0)
        self.horizontal_speed.setOrientation(QtCore.Qt.Horizontal)
        self.horizontal_speed.setObjectName("horizontal_speed")
        self.verticalLayout.addWidget(self.horizontal_speed)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.vertical_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.vertical_speed.sizePolicy().hasHeightForWidth())
        self.vertical_speed.setSizePolicy(sizePolicy)
        self.vertical_speed.setCursor(QtCore.Qt.SizeVerCursor)
        self.vertical_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.vertical_speed.setMinimum(-100)
        self.vertical_speed.setMaximum(100)
        self.vertical_speed.setPageStep(0)
        self.vertical_speed.setOrientation(QtCore.Qt.Vertical)
        self.vertical_speed.setObjectName("vertical_speed")
        self.horizontalLayout.addWidget(self.vertical_speed)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.groupBox_3 = QtGui.QGroupBox(self.centralwidget)
        self.groupBox_3.setObjectName("groupBox_3")
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.serial_select = QtGui.QComboBox(self.groupBox_3)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.serial_select.sizePolicy().hasHeightForWidth())
        self.serial_select.setSizePolicy(sizePolicy)
        self.serial_select.setCursor(QtCore.Qt.PointingHandCursor)
        self.serial_select.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.serial_select.setObjectName("serial_select")
        self.serial_select.addItem("")
        self.verticalLayout_3.addWidget(self.serial_select)
        self.log = QtGui.QTextEdit(self.groupBox_3)
        self.log.setEnabled(True)
        self.log.setUndoRedoEnabled(True)
        self.log.setReadOnly(True)
        self.log.setObjectName("log")
        self.verticalLayout_3.addWidget(self.log)
        self.command_edit = QtGui.QLineEdit(self.groupBox_3)
        self.command_edit.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.command_edit.sizePolicy().hasHeightForWidth())
        self.command_edit.setSizePolicy(sizePolicy)
        self.command_edit.setPlaceholderText("Command")
        self.command_edit.setObjectName("command_edit")
        self.verticalLayout_3.addWidget(self.command_edit)
        self.verticalLayout_2.addWidget(self.groupBox_3)
        self.fanbox = QtGui.QGroupBox(self.centralwidget)
        self.fanbox.setEnabled(False)
        self.fanbox.setMaximumSize(QtCore.QSize(16777215, 184))
        self.fanbox.setObjectName("fanbox")
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.fanbox)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.fan_enabled = QtGui.QCheckBox(self.fanbox)
        self.fan_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.fan_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.fan_enabled.setObjectName("fan_enabled")
        self.verticalLayout_6.addWidget(self.fan_enabled)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.speed_dial = QtGui.QDial(self.fanbox)
        self.speed_dial.setCursor(QtCore.Qt.PointingHandCursor)
        self.speed_dial.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.speed_dial.setMaximum(100)
        self.speed_dial.setSliderPosition(80)
        self.speed_dial.setOrientation(QtCore.Qt.Horizontal)
        self.speed_dial.setInvertedAppearance(False)
        self.speed_dial.setInvertedControls(False)
        self.speed_dial.setObjectName("speed_dial")
        self.horizontalLayout_3.addWidget(self.speed_dial)
        self.speed_label = QtGui.QLabel(self.fanbox)
        self.speed_label.setAlignment(QtCore.Qt.AlignLeading
                                      | QtCore.Qt.AlignLeft
                                      | QtCore.Qt.AlignVCenter)
        self.speed_label.setObjectName("speed_label")
        self.horizontalLayout_3.addWidget(self.speed_label)
        self.verticalLayout_6.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.addWidget(self.fanbox)
        self.movementbox = QtGui.QGroupBox(self.centralwidget)
        self.movementbox.setEnabled(False)
        self.movementbox.setObjectName("movementbox")
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.movementbox)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.faces_enabled = QtGui.QCheckBox(self.movementbox)
        self.faces_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.faces_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.faces_enabled.setObjectName("faces_enabled")
        self.verticalLayout_4.addWidget(self.faces_enabled)
        self.verticalLayout_2.addWidget(self.movementbox)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.verticalLayout_7.addLayout(self.horizontalLayout)
        FaceDetection.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar()
        self.menubar.setGeometry(QtCore.QRect(0, 0, 992, 22))
        self.menubar.setObjectName("menubar")
        self.menuBioRob_FaceDetection = QtGui.QMenu(self.menubar)
        self.menuBioRob_FaceDetection.setObjectName("menuBioRob_FaceDetection")
        self.menuAbout = QtGui.QMenu(self.menubar)
        self.menuAbout.setObjectName("menuAbout")
        FaceDetection.setMenuBar(self.menubar)
        self.menuBioRob_FaceDetection.addSeparator()
        self.menubar.addAction(self.menuBioRob_FaceDetection.menuAction())
        self.menubar.addAction(self.menuAbout.menuAction())

        self.retranslateUi(FaceDetection)
        QtCore.QObject.connect(self.faces_enabled,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.horizontal_speed.setDisabled)
        QtCore.QObject.connect(self.faces_enabled,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.vertical_speed.setDisabled)
        QtCore.QObject.connect(self.fan_enabled,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.speed_dial.setDisabled)
        QtCore.QMetaObject.connectSlotsByName(FaceDetection)

    def retranslateUi(self, FaceDetection):
        FaceDetection.setWindowTitle(
            QtGui.QApplication.translate("FaceDetection",
                                         "BioRob FaceDetection", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.groupBox_3.setTitle(
            QtGui.QApplication.translate("FaceDetection", "Connection", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.serial_select.setItemText(
            0,
            QtGui.QApplication.translate("FaceDetection", "Not Connected",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.log.setHtml(
            QtGui.QApplication.translate(
                "FaceDetection",
                "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'Lucida Grande\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
                "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>",
                None, QtGui.QApplication.UnicodeUTF8))
        self.fanbox.setTitle(
            QtGui.QApplication.translate("FaceDetection", "Fan", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.fan_enabled.setText(
            QtGui.QApplication.translate("FaceDetection", "Automatic", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.speed_label.setText(
            QtGui.QApplication.translate("FaceDetection", "80 %", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.movementbox.setTitle(
            QtGui.QApplication.translate("FaceDetection", "Movement", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.faces_enabled.setText(
            QtGui.QApplication.translate("FaceDetection", "Follow faces", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.menuBioRob_FaceDetection.setTitle(
            QtGui.QApplication.translate("FaceDetection",
                                         "BioRob FaceDetection", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.menuAbout.setTitle(
            QtGui.QApplication.translate("FaceDetection", "About", None,
                                         QtGui.QApplication.UnicodeUTF8))
Example #5
0
class CameraWidget(Gtk.VBox):
    IS_LINUX = sys.platform.startswith("linux")
    NOT_RECORD = "Don't Recording."
    RECORDING = "Now Recording..."
    RECORD_IMAGE = Gtk.STOCK_MEDIA_RECORD

    def __init__(self, app, name, source={'ip': '127.0.0.1', 'port': 6001}, dest={'ip': '127.0.0.1', 'port': 5001}, size=(640, 360)):
        super(CameraWidget, self).__init__()

        self.app = app
        self.is_recording = False
        self.__camera_bin = None

        self.set_source(source, dest)
        self.__set_camera_name(name)
        self.set_size(size)
        self._setupUI()

    def _setupUI(self):
        self._overlay = Gtk.Overlay()
        self.pack_start(self._overlay, True, True, 0)

        # Video screen renderer object initialize
        self.video_widget = VideoWidget(self)
        self.video_widget.set_size_request(self._size[0], self._size[1])

        self._overlay.add(self.video_widget)

        self._evtbox = Gtk.EventBox()
        self._evtbox.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK)
        self._overlay.add_overlay(self._evtbox)

        ''''if self.__source is None:
            self.logo = Gtk.Image()
            self.logo.set_from_file(os.path.join(self.app.RESOURCE_PATH, 'purun_nvr.png'))
            self.logo.set_halign(Gtk.Align.CENTER)
            self.logo.set_valign(Gtk.Align.CENTER)
            self._overlay.add_overlay(self.logo)'''

        # bottom part config
        # Device name setting
        cam_name = Gtk.Label(self.get_camera_name())
        cam_name.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('white'))
        cam_name.modify_font(Pango.FontDescription('sans 16'))
        cam_name.set_halign(Gtk.Align.CENTER)
        cam_name.set_valign(Gtk.Align.END)
        cam_name.set_margin_bottom(10)
        print(cam_name.get_text())

        self._overlay.add_overlay(cam_name)

        # record info
        # recording image setting
        hbox = Gtk.HBox()
        hbox.set_halign(Gtk.Align.END)
        hbox.set_valign(Gtk.Align.END)
        hbox.set_margin_bottom(10)

        self._rec_image = Gtk.Image()
        self._rec_image.set_from_stock(self.RECORD_IMAGE, Gtk.IconSize.LARGE_TOOLBAR)
        self._rec_image.set_margin_right(5)
        hbox.pack_start(self._rec_image, False, False, 0)

        self._rec_text = Gtk.Label(self.NOT_RECORD)
        self._rec_text.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('white'))
        self._rec_text.set_margin_right(10)
        hbox.pack_start(self._rec_text, False, False, 0)

        self._overlay.add_overlay(hbox)
        self.show_all()

    def set_popup_menu(self, func, data=None):
        self._evtbox.connect('button-release-event', func, data)

    def __createCameraBin(self, source, dest):
        if self.__camera_bin is not None:
            self.__camera_bin = None

        self.__camera_bin = CameraBin(source, dest, self.app, self.get_camera_name().lower())
        self.__camera_bin.connect('recording', self._on_video_recording)

    def _on_video_recording(self, cambin, bRecord):
        self.is_recording = bRecord
        if self.is_recording:
            def record_blink():
                while self.is_recording:
                    if self._rec_image.get_opacity() > 0.3:
                        self._rec_image.set_opacity(0.3)
                    else:
                        self._rec_image.set_opacity(1.0)

                    time.sleep(1)

            t = threading.Thread(target=record_blink)
            t.setDaemon(True)
            t.start()

            self._rec_text.set_text(self.RECORDING)
        else:
            self._rec_image.set_opacity(1.0)
            self._rec_text.set_text(self.NOT_RECORD)

    def get_size(self):
        return self._size

    def set_size(self, size):
        if not isinstance(size, tuple):
            print("Not compatible argument type.")
            return False

        self._size = size
        self.set_size_request(size[0], size[1]+20)
        return True

    def get_bin(self):
        return self.__camera_bin

    def get_camera_name(self):
        return self.__name

    def __set_camera_name(self, name):
        self.__name = name

    def get_source(self):
        return self.__source

    def set_source(self, source, dest):
        self.__source = source
        if source is not None:
            self.__createCameraBin(source, dest)
Example #6
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1920, 1080)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.fileTableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.fileTableWidget.setMaximumSize(QtCore.QSize(375, 16777215))
        self.fileTableWidget.setSizeAdjustPolicy(
            QtWidgets.QAbstractScrollArea.AdjustToContents)
        self.fileTableWidget.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self.fileTableWidget.setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectRows)
        self.fileTableWidget.setHorizontalScrollMode(
            QtWidgets.QAbstractItemView.ScrollPerPixel)
        self.fileTableWidget.setShowGrid(False)
        self.fileTableWidget.setCornerButtonEnabled(False)
        self.fileTableWidget.setObjectName("fileTableWidget")
        self.fileTableWidget.setColumnCount(2)
        self.fileTableWidget.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.fileTableWidget.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.fileTableWidget.setHorizontalHeaderItem(1, item)
        self.fileTableWidget.horizontalHeader().setDefaultSectionSize(60)
        self.fileTableWidget.horizontalHeader().setHighlightSections(False)
        self.fileTableWidget.horizontalHeader().setStretchLastSection(True)
        self.fileTableWidget.verticalHeader().setVisible(False)
        self.verticalLayout_2.addWidget(self.fileTableWidget)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        spacerItem = QtWidgets.QSpacerItem(20, 20,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout_6 = QtWidgets.QVBoxLayout()
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.videoWidget = VideoWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.videoWidget.sizePolicy().hasHeightForWidth())
        self.videoWidget.setSizePolicy(sizePolicy)
        self.videoWidget.setMinimumSize(QtCore.QSize(10, 0))
        self.videoWidget.setObjectName("videoWidget")
        self.verticalLayout_6.addWidget(self.videoWidget)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.currentVideoTime = QtWidgets.QLabel(self.centralwidget)
        self.currentVideoTime.setObjectName("currentVideoTime")
        self.horizontalLayout_3.addWidget(self.currentVideoTime)
        spacerItem1 = QtWidgets.QSpacerItem(20, 20,
                                            QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem1)
        self.horizontalSlider = QtWidgets.QSlider(self.centralwidget)
        self.horizontalSlider.setMaximum(999)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setInvertedAppearance(False)
        self.horizontalSlider.setInvertedControls(False)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.horizontalLayout_3.addWidget(self.horizontalSlider)
        spacerItem2 = QtWidgets.QSpacerItem(20, 20,
                                            QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem2)
        self.fullVideoTime = QtWidgets.QLabel(self.centralwidget)
        self.fullVideoTime.setObjectName("fullVideoTime")
        self.horizontalLayout_3.addWidget(self.fullVideoTime)
        self.verticalLayout_6.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        spacerItem3 = QtWidgets.QSpacerItem(30, 20,
                                            QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem3)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.playButton = QtWidgets.QPushButton(self.centralwidget)
        self.playButton.setObjectName("playButton")
        self.horizontalLayout_2.addWidget(self.playButton)
        self.pauseButton = QtWidgets.QPushButton(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.pauseButton.sizePolicy().hasHeightForWidth())
        self.pauseButton.setSizePolicy(sizePolicy)
        self.pauseButton.setObjectName("pauseButton")
        self.horizontalLayout_2.addWidget(self.pauseButton)
        spacerItem5 = QtWidgets.QSpacerItem(20, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem5)
        spacerItem6 = QtWidgets.QSpacerItem(30, 20,
                                            QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem6)
        self.verticalLayout_6.addLayout(self.horizontalLayout_2)
        self.horizontalLayout.addLayout(self.verticalLayout_6)
        spacerItem7 = QtWidgets.QSpacerItem(20, 20,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem7)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.labelTableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.labelTableWidget.setMaximumSize(QtCore.QSize(300, 16777215))
        self.labelTableWidget.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self.labelTableWidget.setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectRows)
        self.labelTableWidget.setShowGrid(False)
        self.labelTableWidget.setObjectName("labelTableWidget")
        self.labelTableWidget.setColumnCount(2)
        self.labelTableWidget.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.labelTableWidget.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.labelTableWidget.setHorizontalHeaderItem(1, item)
        self.labelTableWidget.horizontalHeader().setDefaultSectionSize(120)
        self.labelTableWidget.horizontalHeader().setHighlightSections(False)
        self.labelTableWidget.horizontalHeader().setMinimumSectionSize(9)
        self.labelTableWidget.horizontalHeader().setStretchLastSection(True)
        self.labelTableWidget.verticalHeader().setVisible(False)
        self.verticalLayout.addWidget(self.labelTableWidget)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.boundingBoxCheckbox = QtWidgets.QCheckBox(self.centralwidget)
        self.boundingBoxCheckbox.setObjectName("boundingBoxCheckbox")
        self.verticalLayout.addWidget(self.boundingBoxCheckbox)
        self.showLabelsCheckbox = QtWidgets.QCheckBox(self.centralwidget)
        self.showLabelsCheckbox.setObjectName("showLabelsCheckbox")
        self.verticalLayout.addWidget(self.showLabelsCheckbox)
        self.showLaneLinesCheckbox = QtWidgets.QCheckBox(self.centralwidget)
        self.showLaneLinesCheckbox.setObjectName("showLaneLinesCheckbox")
        self.verticalLayout.addWidget(self.showLaneLinesCheckbox)
        self.horizontalLayout.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setObjectName("toolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.actionOpenFolder = QtWidgets.QAction(MainWindow)
        self.actionOpenFolder.setObjectName("actionOpenFolder")
        self.actionProcessVideos = QtWidgets.QAction(MainWindow)
        self.actionProcessVideos.setObjectName("actionProcessVideos")
        self.actionInfo = QtWidgets.QAction(MainWindow)
        self.actionInfo.setObjectName("actionInfo")
        self.actionDelete_Predictions_For_Selected_Videos = QtWidgets.QAction(
            MainWindow)
        self.actionDelete_Predictions_For_Selected_Videos.setObjectName(
            "actionDelete_Predictions_For_Selected_Videos")
        self.actionRemove_Selected_Videos = QtWidgets.QAction(MainWindow)
        self.actionRemove_Selected_Videos.setObjectName(
            "actionRemove_Selected_Videos")
        self.toolBar.addAction(self.actionInfo)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionOpenFolder)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionProcessVideos)
        self.toolBar.addSeparator()
        self.toolBar.addAction(
            self.actionDelete_Predictions_For_Selected_Videos)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionRemove_Selected_Videos)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #7
0
    def setupUi(self, FaceDetection):
        FaceDetection.setObjectName("FaceDetection")
        FaceDetection.setEnabled(True)
        FaceDetection.resize(992, 562)
        FaceDetection.setMinimumSize(QtCore.QSize(992, 562))
        FaceDetection.setMaximumSize(QtCore.QSize(16777215, 562))
        self.centralwidget = QtGui.QWidget(FaceDetection)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_7 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.video = VideoWidget(self.centralwidget)
        self.video.setMinimumSize(QtCore.QSize(640, 480))
        self.video.setMaximumSize(QtCore.QSize(640, 480))
        self.video.setAutoFillBackground(False)
        self.video.setObjectName("video")
        self.verticalLayout.addWidget(self.video)
        self.horizontal_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.horizontal_speed.sizePolicy().hasHeightForWidth())
        self.horizontal_speed.setSizePolicy(sizePolicy)
        self.horizontal_speed.setCursor(QtCore.Qt.SizeHorCursor)
        self.horizontal_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.horizontal_speed.setMinimum(-100)
        self.horizontal_speed.setMaximum(100)
        self.horizontal_speed.setPageStep(0)
        self.horizontal_speed.setOrientation(QtCore.Qt.Horizontal)
        self.horizontal_speed.setObjectName("horizontal_speed")
        self.verticalLayout.addWidget(self.horizontal_speed)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.vertical_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.vertical_speed.sizePolicy().hasHeightForWidth())
        self.vertical_speed.setSizePolicy(sizePolicy)
        self.vertical_speed.setCursor(QtCore.Qt.SizeVerCursor)
        self.vertical_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.vertical_speed.setMinimum(-100)
        self.vertical_speed.setMaximum(100)
        self.vertical_speed.setPageStep(0)
        self.vertical_speed.setOrientation(QtCore.Qt.Vertical)
        self.vertical_speed.setObjectName("vertical_speed")
        self.horizontalLayout.addWidget(self.vertical_speed)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.groupBox_3 = QtGui.QGroupBox(self.centralwidget)
        self.groupBox_3.setObjectName("groupBox_3")
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.serial_select = QtGui.QComboBox(self.groupBox_3)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.serial_select.sizePolicy().hasHeightForWidth())
        self.serial_select.setSizePolicy(sizePolicy)
        self.serial_select.setCursor(QtCore.Qt.PointingHandCursor)
        self.serial_select.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.serial_select.setObjectName("serial_select")
        self.serial_select.addItem("")
        self.verticalLayout_3.addWidget(self.serial_select)
        self.log = QtGui.QTextEdit(self.groupBox_3)
        self.log.setEnabled(True)
        self.log.setUndoRedoEnabled(True)
        self.log.setReadOnly(True)
        self.log.setObjectName("log")
        self.verticalLayout_3.addWidget(self.log)
        self.command_edit = QtGui.QLineEdit(self.groupBox_3)
        self.command_edit.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.command_edit.sizePolicy().hasHeightForWidth())
        self.command_edit.setSizePolicy(sizePolicy)
        self.command_edit.setPlaceholderText("Command")
        self.command_edit.setObjectName("command_edit")
        self.verticalLayout_3.addWidget(self.command_edit)
        self.verticalLayout_2.addWidget(self.groupBox_3)
        self.fanbox = QtGui.QGroupBox(self.centralwidget)
        self.fanbox.setEnabled(False)
        self.fanbox.setMaximumSize(QtCore.QSize(16777215, 184))
        self.fanbox.setObjectName("fanbox")
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.fanbox)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.fan_enabled = QtGui.QCheckBox(self.fanbox)
        self.fan_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.fan_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.fan_enabled.setObjectName("fan_enabled")
        self.verticalLayout_6.addWidget(self.fan_enabled)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.speed_dial = QtGui.QDial(self.fanbox)
        self.speed_dial.setCursor(QtCore.Qt.PointingHandCursor)
        self.speed_dial.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.speed_dial.setMaximum(100)
        self.speed_dial.setSliderPosition(80)
        self.speed_dial.setOrientation(QtCore.Qt.Horizontal)
        self.speed_dial.setInvertedAppearance(False)
        self.speed_dial.setInvertedControls(False)
        self.speed_dial.setObjectName("speed_dial")
        self.horizontalLayout_3.addWidget(self.speed_dial)
        self.speed_label = QtGui.QLabel(self.fanbox)
        self.speed_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.speed_label.setObjectName("speed_label")
        self.horizontalLayout_3.addWidget(self.speed_label)
        self.verticalLayout_6.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.addWidget(self.fanbox)
        self.movementbox = QtGui.QGroupBox(self.centralwidget)
        self.movementbox.setEnabled(False)
        self.movementbox.setObjectName("movementbox")
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.movementbox)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.faces_enabled = QtGui.QCheckBox(self.movementbox)
        self.faces_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.faces_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.faces_enabled.setObjectName("faces_enabled")
        self.verticalLayout_4.addWidget(self.faces_enabled)
        self.verticalLayout_2.addWidget(self.movementbox)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.verticalLayout_7.addLayout(self.horizontalLayout)
        FaceDetection.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar()
        self.menubar.setGeometry(QtCore.QRect(0, 0, 992, 22))
        self.menubar.setObjectName("menubar")
        self.menuBioRob_FaceDetection = QtGui.QMenu(self.menubar)
        self.menuBioRob_FaceDetection.setObjectName("menuBioRob_FaceDetection")
        self.menuAbout = QtGui.QMenu(self.menubar)
        self.menuAbout.setObjectName("menuAbout")
        FaceDetection.setMenuBar(self.menubar)
        self.menuBioRob_FaceDetection.addSeparator()
        self.menubar.addAction(self.menuBioRob_FaceDetection.menuAction())
        self.menubar.addAction(self.menuAbout.menuAction())

        self.retranslateUi(FaceDetection)
        QtCore.QObject.connect(self.faces_enabled, QtCore.SIGNAL("toggled(bool)"), self.horizontal_speed.setDisabled)
        QtCore.QObject.connect(self.faces_enabled, QtCore.SIGNAL("toggled(bool)"), self.vertical_speed.setDisabled)
        QtCore.QObject.connect(self.fan_enabled, QtCore.SIGNAL("toggled(bool)"), self.speed_dial.setDisabled)
        QtCore.QMetaObject.connectSlotsByName(FaceDetection)
Example #8
0
class Ui_FaceDetection(object):
    def setupUi(self, FaceDetection):
        FaceDetection.setObjectName("FaceDetection")
        FaceDetection.setEnabled(True)
        FaceDetection.resize(992, 562)
        FaceDetection.setMinimumSize(QtCore.QSize(992, 562))
        FaceDetection.setMaximumSize(QtCore.QSize(16777215, 562))
        self.centralwidget = QtGui.QWidget(FaceDetection)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_7 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.video = VideoWidget(self.centralwidget)
        self.video.setMinimumSize(QtCore.QSize(640, 480))
        self.video.setMaximumSize(QtCore.QSize(640, 480))
        self.video.setAutoFillBackground(False)
        self.video.setObjectName("video")
        self.verticalLayout.addWidget(self.video)
        self.horizontal_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.horizontal_speed.sizePolicy().hasHeightForWidth())
        self.horizontal_speed.setSizePolicy(sizePolicy)
        self.horizontal_speed.setCursor(QtCore.Qt.SizeHorCursor)
        self.horizontal_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.horizontal_speed.setMinimum(-100)
        self.horizontal_speed.setMaximum(100)
        self.horizontal_speed.setPageStep(0)
        self.horizontal_speed.setOrientation(QtCore.Qt.Horizontal)
        self.horizontal_speed.setObjectName("horizontal_speed")
        self.verticalLayout.addWidget(self.horizontal_speed)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.vertical_speed = QtGui.QSlider(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.vertical_speed.sizePolicy().hasHeightForWidth())
        self.vertical_speed.setSizePolicy(sizePolicy)
        self.vertical_speed.setCursor(QtCore.Qt.SizeVerCursor)
        self.vertical_speed.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.vertical_speed.setMinimum(-100)
        self.vertical_speed.setMaximum(100)
        self.vertical_speed.setPageStep(0)
        self.vertical_speed.setOrientation(QtCore.Qt.Vertical)
        self.vertical_speed.setObjectName("vertical_speed")
        self.horizontalLayout.addWidget(self.vertical_speed)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.groupBox_3 = QtGui.QGroupBox(self.centralwidget)
        self.groupBox_3.setObjectName("groupBox_3")
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.serial_select = QtGui.QComboBox(self.groupBox_3)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.serial_select.sizePolicy().hasHeightForWidth())
        self.serial_select.setSizePolicy(sizePolicy)
        self.serial_select.setCursor(QtCore.Qt.PointingHandCursor)
        self.serial_select.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.serial_select.setObjectName("serial_select")
        self.serial_select.addItem("")
        self.verticalLayout_3.addWidget(self.serial_select)
        self.log = QtGui.QTextEdit(self.groupBox_3)
        self.log.setEnabled(True)
        self.log.setUndoRedoEnabled(True)
        self.log.setReadOnly(True)
        self.log.setObjectName("log")
        self.verticalLayout_3.addWidget(self.log)
        self.command_edit = QtGui.QLineEdit(self.groupBox_3)
        self.command_edit.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.command_edit.sizePolicy().hasHeightForWidth())
        self.command_edit.setSizePolicy(sizePolicy)
        self.command_edit.setPlaceholderText("Command")
        self.command_edit.setObjectName("command_edit")
        self.verticalLayout_3.addWidget(self.command_edit)
        self.verticalLayout_2.addWidget(self.groupBox_3)
        self.fanbox = QtGui.QGroupBox(self.centralwidget)
        self.fanbox.setEnabled(False)
        self.fanbox.setMaximumSize(QtCore.QSize(16777215, 184))
        self.fanbox.setObjectName("fanbox")
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.fanbox)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.fan_enabled = QtGui.QCheckBox(self.fanbox)
        self.fan_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.fan_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.fan_enabled.setObjectName("fan_enabled")
        self.verticalLayout_6.addWidget(self.fan_enabled)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.speed_dial = QtGui.QDial(self.fanbox)
        self.speed_dial.setCursor(QtCore.Qt.PointingHandCursor)
        self.speed_dial.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.speed_dial.setMaximum(100)
        self.speed_dial.setSliderPosition(80)
        self.speed_dial.setOrientation(QtCore.Qt.Horizontal)
        self.speed_dial.setInvertedAppearance(False)
        self.speed_dial.setInvertedControls(False)
        self.speed_dial.setObjectName("speed_dial")
        self.horizontalLayout_3.addWidget(self.speed_dial)
        self.speed_label = QtGui.QLabel(self.fanbox)
        self.speed_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.speed_label.setObjectName("speed_label")
        self.horizontalLayout_3.addWidget(self.speed_label)
        self.verticalLayout_6.addLayout(self.horizontalLayout_3)
        self.verticalLayout_2.addWidget(self.fanbox)
        self.movementbox = QtGui.QGroupBox(self.centralwidget)
        self.movementbox.setEnabled(False)
        self.movementbox.setObjectName("movementbox")
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.movementbox)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.faces_enabled = QtGui.QCheckBox(self.movementbox)
        self.faces_enabled.setCursor(QtCore.Qt.PointingHandCursor)
        self.faces_enabled.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.faces_enabled.setObjectName("faces_enabled")
        self.verticalLayout_4.addWidget(self.faces_enabled)
        self.verticalLayout_2.addWidget(self.movementbox)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.verticalLayout_7.addLayout(self.horizontalLayout)
        FaceDetection.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar()
        self.menubar.setGeometry(QtCore.QRect(0, 0, 992, 22))
        self.menubar.setObjectName("menubar")
        self.menuBioRob_FaceDetection = QtGui.QMenu(self.menubar)
        self.menuBioRob_FaceDetection.setObjectName("menuBioRob_FaceDetection")
        self.menuAbout = QtGui.QMenu(self.menubar)
        self.menuAbout.setObjectName("menuAbout")
        FaceDetection.setMenuBar(self.menubar)
        self.menuBioRob_FaceDetection.addSeparator()
        self.menubar.addAction(self.menuBioRob_FaceDetection.menuAction())
        self.menubar.addAction(self.menuAbout.menuAction())

        self.retranslateUi(FaceDetection)
        QtCore.QObject.connect(self.faces_enabled, QtCore.SIGNAL("toggled(bool)"), self.horizontal_speed.setDisabled)
        QtCore.QObject.connect(self.faces_enabled, QtCore.SIGNAL("toggled(bool)"), self.vertical_speed.setDisabled)
        QtCore.QObject.connect(self.fan_enabled, QtCore.SIGNAL("toggled(bool)"), self.speed_dial.setDisabled)
        QtCore.QMetaObject.connectSlotsByName(FaceDetection)

    def retranslateUi(self, FaceDetection):
        FaceDetection.setWindowTitle(QtGui.QApplication.translate("FaceDetection", "BioRob FaceDetection", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox_3.setTitle(QtGui.QApplication.translate("FaceDetection", "Connection", None, QtGui.QApplication.UnicodeUTF8))
        self.serial_select.setItemText(0, QtGui.QApplication.translate("FaceDetection", "Not Connected", None, QtGui.QApplication.UnicodeUTF8))
        self.log.setHtml(QtGui.QApplication.translate("FaceDetection", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Lucida Grande\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        self.fanbox.setTitle(QtGui.QApplication.translate("FaceDetection", "Fan", None, QtGui.QApplication.UnicodeUTF8))
        self.fan_enabled.setText(QtGui.QApplication.translate("FaceDetection", "Automatic", None, QtGui.QApplication.UnicodeUTF8))
        self.speed_label.setText(QtGui.QApplication.translate("FaceDetection", "80 %", None, QtGui.QApplication.UnicodeUTF8))
        self.movementbox.setTitle(QtGui.QApplication.translate("FaceDetection", "Movement", None, QtGui.QApplication.UnicodeUTF8))
        self.faces_enabled.setText(QtGui.QApplication.translate("FaceDetection", "Follow faces", None, QtGui.QApplication.UnicodeUTF8))
        self.menuBioRob_FaceDetection.setTitle(QtGui.QApplication.translate("FaceDetection", "BioRob FaceDetection", None, QtGui.QApplication.UnicodeUTF8))
        self.menuAbout.setTitle(QtGui.QApplication.translate("FaceDetection", "About", None, QtGui.QApplication.UnicodeUTF8))