class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(500, 360)
        self.button_play = QtWidgets.QPushButton(Form)
        self.button_play.setGeometry(QtCore.QRect(9, 290, 40, 40))
        self.button_play.setText("")
        icon = QtGui.QIcon.fromTheme("SP_MediaPlay")
        self.button_play.setIcon(icon)
        self.button_play.setObjectName("button_play")
        self.button_play.setIcon(self.style().standardIcon(
            QStyle.SP_MediaPlay))
        self.video = None
        if sys.platform == "darwin":  # for MacOS
            from PyQt5.QtWidgets import QMacCocoaViewContainer
            self.video = QMacCocoaViewContainer(0, parent=Form)
        else:
            self.video = QtWidgets.QFrame(parent=Form)
        self.video.setGeometry(QtCore.QRect(9, 0, 500, 280))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.video.sizePolicy().hasHeightForWidth())
        self.video.setSizePolicy(sizePolicy)
        self.video.setObjectName("video")
        self.button_pause = QtWidgets.QPushButton(Form)
        self.button_pause.setGeometry(QtCore.QRect(54, 290, 40, 40))
        self.button_pause.setText("")
        self.button_pause.setObjectName("button_pause")
        self.button_pause.setIcon(self.style().standardIcon(
            QStyle.SP_MediaPause))
        self.time_slider = QtWidgets.QSlider(Form)
        self.time_slider.setGeometry(QtCore.QRect(140, 300, 301, 22))
        self.time_slider.setOrientation(QtCore.Qt.Horizontal)
        self.time_slider.setObjectName("time_slider")
        self.label_time_passed = QtWidgets.QLabel(Form)
        self.label_time_passed.setGeometry(QtCore.QRect(100, 300, 61, 20))
        self.label_time_passed.setObjectName("label_time_passed")
        self.label_time_left = QtWidgets.QLabel(Form)
        self.label_time_left.setGeometry(QtCore.QRect(450, 300, 60, 16))
        self.label_time_left.setObjectName("label_time_left")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.label_time_passed.setText(_translate("Form", "00:00"))
        self.label_time_left.setText(_translate("Form", "-00:00"))
Exemplo n.º 2
0
class Ui_hydraMainWindow(object):
    def setupUi(self, hydraMainWindow):
        hydraMainWindow.setObjectName("hydraMainWindow")
        hydraMainWindow.resize(642, 400)
        hydraMainWindow.setMinimumSize(QtCore.QSize(0, 400))
        hydraMainWindow.setFocusPolicy(QtCore.Qt.StrongFocus)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(self.resource_path("hydra_icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        hydraMainWindow.setWindowIcon(icon)
        hydraMainWindow.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(136, 138, 133);")
        self.centralwidget = QtWidgets.QWidget(hydraMainWindow)
        self.centralwidget.setStyleSheet("background-color: rgb(0, 0, 0);")
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        if sys.platform == "darwin": # for MacOS
            from PyQt5.QtWidgets import QMacCocoaViewContainer	
            self.videoFrame = QMacCocoaViewContainer(self.centralwidget)
        else:
            self.videoFrame = QtWidgets.QFrame(self.centralwidget)
            self.videoFrame.setStyleSheet("")
            self.videoFrame.setFrameShape(QtWidgets.QFrame.StyledPanel)
            self.videoFrame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.videoFrame.setObjectName("videoFrame")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.videoFrame)
        self.gridLayout_3.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
        self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_3.setHorizontalSpacing(0)
        self.gridLayout_3.setVerticalSpacing(6)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.frame_2 = QtWidgets.QFrame(self.videoFrame)
        self.frame_2.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.frame_2.setStyleSheet("background-color: rgb(0, 0, 0);")
        self.frame_2.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame_2.setObjectName("frame_2")
        self.gridLayout_3.addWidget(self.frame_2, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.videoFrame, 0, 0, 1, 1)
        self.controlsFrame = QtWidgets.QFrame(self.centralwidget)
        self.controlsFrame.setMinimumSize(QtCore.QSize(0, 40))
        self.controlsFrame.setMaximumSize(QtCore.QSize(16777215, 40))
        self.controlsFrame.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(85, 87, 83);")
        self.controlsFrame.setObjectName("controlsFrame")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.controlsFrame)
        self.horizontalLayout.setContentsMargins(2, 0, 2, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.openMediaButton = QtWidgets.QPushButton(self.controlsFrame)
        self.openMediaButton.setMinimumSize(QtCore.QSize(32, 26))
        self.openMediaButton.setMaximumSize(QtCore.QSize(32, 26))
        self.openMediaButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.openMediaButton.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(self.resource_path("open_vid.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.openMediaButton.setIcon(icon1)
        self.openMediaButton.setIconSize(QtCore.QSize(20, 20))
        self.openMediaButton.setObjectName("openMediaButton")
        self.horizontalLayout.addWidget(self.openMediaButton)
        self.openPlaylistButton = QtWidgets.QPushButton(self.controlsFrame)
        self.openPlaylistButton.setMinimumSize(QtCore.QSize(32, 26))
        self.openPlaylistButton.setMaximumSize(QtCore.QSize(32, 26))
        self.openPlaylistButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.openPlaylistButton.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(self.resource_path("load_playlist.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.openPlaylistButton.setIcon(icon2)
        self.openPlaylistButton.setIconSize(QtCore.QSize(20, 20))
        self.openPlaylistButton.setObjectName("openPlaylistButton")
        self.horizontalLayout.addWidget(self.openPlaylistButton)
        self.previousMediaButton = QtWidgets.QPushButton(self.controlsFrame)
        self.previousMediaButton.setMinimumSize(QtCore.QSize(32, 26))
        self.previousMediaButton.setMaximumSize(QtCore.QSize(32, 26))
        self.previousMediaButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.previousMediaButton.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(self.resource_path("previous_media.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.previousMediaButton.setIcon(icon3)
        self.previousMediaButton.setIconSize(QtCore.QSize(20, 20))
        self.previousMediaButton.setObjectName("previousMediaButton")
        self.horizontalLayout.addWidget(self.previousMediaButton)
        self.playPauseButton = QtWidgets.QPushButton(self.controlsFrame)
        self.playPauseButton.setMinimumSize(QtCore.QSize(32, 26))
        self.playPauseButton.setMaximumSize(QtCore.QSize(32, 26))
        self.playPauseButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.playPauseButton.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(self.resource_path("play.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.playPauseButton.setIcon(icon4)
        self.playPauseButton.setIconSize(QtCore.QSize(20, 20))
        self.playPauseButton.setObjectName("playPauseButton")
        self.horizontalLayout.addWidget(self.playPauseButton)
        self.stopButton = QtWidgets.QPushButton(self.controlsFrame)
        self.stopButton.setMinimumSize(QtCore.QSize(32, 26))
        self.stopButton.setMaximumSize(QtCore.QSize(32, 26))
        self.stopButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.stopButton.setText("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(self.resource_path("stop.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.stopButton.setIcon(icon5)
        self.stopButton.setIconSize(QtCore.QSize(20, 20))
        self.stopButton.setObjectName("stopButton")
        self.horizontalLayout.addWidget(self.stopButton)
        self.repeatButton = QtWidgets.QPushButton(self.controlsFrame)
        self.repeatButton.setMinimumSize(QtCore.QSize(32, 26))
        self.repeatButton.setMaximumSize(QtCore.QSize(32, 26))
        self.repeatButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.repeatButton.setText("")
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(self.resource_path("repeat_off.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.repeatButton.setIcon(icon6)
        self.repeatButton.setIconSize(QtCore.QSize(20, 20))
        self.repeatButton.setCheckable(True)
        self.repeatButton.setObjectName("repeatButton")
        self.horizontalLayout.addWidget(self.repeatButton)
        self.nextMediaButton = QtWidgets.QPushButton(self.controlsFrame)
        self.nextMediaButton.setMinimumSize(QtCore.QSize(32, 26))
        self.nextMediaButton.setMaximumSize(QtCore.QSize(32, 26))
        self.nextMediaButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.nextMediaButton.setText("")
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(self.resource_path("next_media.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.nextMediaButton.setIcon(icon7)
        self.nextMediaButton.setIconSize(QtCore.QSize(20, 20))
        self.nextMediaButton.setObjectName("nextMediaButton")
        self.horizontalLayout.addWidget(self.nextMediaButton)
        self.line = QtWidgets.QFrame(self.controlsFrame)
        self.line.setFrameShape(QtWidgets.QFrame.VLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.horizontalLayout.addWidget(self.line)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.progressSlider = QtWidgets.QSlider(self.controlsFrame)
        self.progressSlider.setMinimumSize(QtCore.QSize(225, 0))
        self.progressSlider.setFocusPolicy(QtCore.Qt.NoFocus)
        self.progressSlider.setStyleSheet("background-color: rgb(85, 87, 83);")
        self.progressSlider.setMaximum(1000)
        self.progressSlider.setPageStep(20)
        self.progressSlider.setOrientation(QtCore.Qt.Horizontal)
        self.progressSlider.setObjectName("progressSlider")
        self.verticalLayout.addWidget(self.progressSlider)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(-1, -1, -1, 5)
        self.horizontalLayout_2.setSpacing(0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.currentTimeLabel = QtWidgets.QLabel(self.controlsFrame)
        self.currentTimeLabel.setMaximumSize(QtCore.QSize(16777215, 10))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.currentTimeLabel.setFont(font)
        self.currentTimeLabel.setObjectName("currentTimeLabel")
        self.horizontalLayout_2.addWidget(self.currentTimeLabel)
        self.totalDurationLabel = QtWidgets.QLabel(self.controlsFrame)
        self.totalDurationLabel.setMaximumSize(QtCore.QSize(16777215, 10))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.totalDurationLabel.setFont(font)
        self.totalDurationLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.totalDurationLabel.setObjectName("totalDurationLabel")
        self.horizontalLayout_2.addWidget(self.totalDurationLabel)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.line_2 = QtWidgets.QFrame(self.controlsFrame)
        self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_2.setObjectName("line_2")
        self.horizontalLayout.addWidget(self.line_2)
        self.volumeSlider = QtWidgets.QSlider(self.controlsFrame)
        self.volumeSlider.setMinimumSize(QtCore.QSize(109, 0))
        self.volumeSlider.setMaximumSize(QtCore.QSize(109, 16777215))
        self.volumeSlider.setFocusPolicy(QtCore.Qt.NoFocus)
        self.volumeSlider.setMaximum(100)
        self.volumeSlider.setPageStep(5)
        self.volumeSlider.setProperty("value", 100)
        self.volumeSlider.setOrientation(QtCore.Qt.Horizontal)
        self.volumeSlider.setObjectName("volumeSlider")
        self.horizontalLayout.addWidget(self.volumeSlider)
        self.gridLayout.addWidget(self.controlsFrame, 1, 0, 1, 1)
        hydraMainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(hydraMainWindow)
        QtCore.QMetaObject.connectSlotsByName(hydraMainWindow)

    def retranslateUi(self, hydraMainWindow):
        _translate = QtCore.QCoreApplication.translate
        hydraMainWindow.setWindowTitle(_translate("hydraMainWindow", "Hydra Player"))
        self.openMediaButton.setToolTip(_translate("hydraMainWindow", "Open media file (F)"))
        self.openPlaylistButton.setToolTip(_translate("hydraMainWindow", "Open playlist (A)"))
        self.previousMediaButton.setToolTip(_translate("hydraMainWindow", "Previous (B)"))
        self.playPauseButton.setToolTip(_translate("hydraMainWindow", "Play (SPACE BAR)"))
        self.stopButton.setToolTip(_translate("hydraMainWindow", "Stop (S)"))
        self.repeatButton.setToolTip(_translate("hydraMainWindow", "Repeat OFF (R)"))
        self.nextMediaButton.setToolTip(_translate("hydraMainWindow", "Next (N)"))
        self.currentTimeLabel.setText(_translate("hydraMainWindow", "00:00:00"))
        self.totalDurationLabel.setText(_translate("hydraMainWindow", "00:00:00"))
        self.volumeSlider.setToolTip(_translate("hydraMainWindow", "Volume"))

    def resource_path(self, relative_path):
        if hasattr(sys, '_MEIPASS'):
            return os.path.join(sys._MEIPASS, relative_path)
        return os.path.join(os.path.abspath("."), relative_path)
    def createUI(self):
        """Set up the user interface, signals & slots
        """
        self.widget = QWidget(self)
        self.setCentralWidget(self.widget)
        self.widget.setStyleSheet("background: '#EEEEEE';")

        image_path = os.getcwd() + "/mamaro/babybedPNG/login0.png"
        image_profile = QtGui.QImage(image_path)  #QImage object

        lbl1 = QtWidgets.QLabel('bluetoothstate', self)
        lbl1.setObjectName('bluetoothstate')
        lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile))
        lbl1.setScaledContents(True)
        lbl1.setGeometry(48, 38, 195, 120)
        lbl1.resize(lbl1.sizeHint())

        #create background
        lbl1 = QtWidgets.QLabel('back1', self)
        lbl1.setObjectName('back1')
        lbl1.setText("")
        lbl1.setFont(QtGui.QFont("ms gothic", 28))
        lbl1.setStyleSheet("background: 'white';")
        lbl1.setGeometry(0, 120, 297, 296)

        lbl1 = QtWidgets.QLabel('back2', self)
        lbl1.setObjectName('back2')
        lbl1.setText("")
        lbl1.setFont(QtGui.QFont("ms gothic", 28))
        lbl1.setStyleSheet("background: 'white';")
        lbl1.setGeometry(0, 420, 297, 296)

        lbl1 = QtWidgets.QLabel('back3', self)
        lbl1.setObjectName('back3')
        lbl1.setText("")
        lbl1.setFont(QtGui.QFont("ms gothic", 28))
        lbl1.setStyleSheet("background: 'white';")
        lbl1.setGeometry(0, 720, 297, 296)
        #create background

        #create icon
        image_path = os.getcwd() + "/mamaro/babybedPNG/height0.png"
        image_profile = QtGui.QImage(image_path)  #QImage object

        lbl1 = QtWidgets.QLabel('heighticon', self)
        lbl1.setObjectName('heighticon')
        lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile))
        lbl1.setScaledContents(True)
        lbl1.setStyleSheet("background: 'white';")
        lbl1.setGeometry(91, 180, 115, 104)

        image_path = os.getcwd() + "/mamaro/babybedPNG/weight0.png"
        image_profile = QtGui.QImage(image_path)  #QImage object

        lbl1 = QtWidgets.QLabel('weighticon', self)
        lbl1.setObjectName('weighticon')
        lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile))
        lbl1.setScaledContents(True)
        lbl1.setStyleSheet("background: 'white';")
        lbl1.setGeometry(91, 480, 115, 104)

        image_path = os.getcwd() + "/mamaro/babybedPNG/temp0.png"
        image_profile = QtGui.QImage(image_path)  #QImage object

        lbl1 = QtWidgets.QLabel('tempicon', self)
        lbl1.setObjectName('tempicon')
        lbl1.setPixmap(QtGui.QPixmap.fromImage(image_profile))
        lbl1.setScaledContents(True)
        lbl1.setStyleSheet("background: 'white';")
        lbl1.setGeometry(91, 780, 115, 104)
        # lbl1.resize(lbl1.sizeHint());

        #create text
        lbl1 = None

        lbl1 = QtWidgets.QLabel('heighttext', self)
        lbl1.setObjectName('heighttext')
        lbl1.setText("")
        lbl1.setFont(QtGui.QFont("ms gothic", 28))
        lbl1.setStyleSheet("color:#9EA2A2;")
        #lbl1.setAlignment(QtCore.Qt.AlignTop)
        lbl1.setAlignment(QtCore.Qt.AlignCenter)
        lbl1.setGeometry(91, 314, 115, 46)

        lbl1 = QtWidgets.QLabel('weighttext', self)
        lbl1.setObjectName('weighttext')
        lbl1.setText("")
        lbl1.setFont(QtGui.QFont("ms gothic", 28))
        lbl1.setStyleSheet("color:#9EA2A2;")
        #lbl1.setAlignment(QtCore.Qt.AlignTop)
        lbl1.setAlignment(QtCore.Qt.AlignCenter)
        lbl1.setGeometry(91, 614, 115, 52)

        lbl1 = QtWidgets.QLabel('temptext', self)
        lbl1.setObjectName('temptext')
        lbl1.setText("")
        lbl1.setFont(QtGui.QFont("ms gothic", 28))
        lbl1.setStyleSheet("color:#9EA2A2;")
        #lbl1.setAlignment(QtCore.Qt.AlignTop)
        lbl1.setAlignment(QtCore.Qt.AlignCenter)
        lbl1.setGeometry(91, 914, 115, 46)

        lbl1 = QtWidgets.QLabel('contentcover', self)
        lbl1.setObjectName('contentcover')
        lbl1.setText("")
        lbl1.setCursor(Qt.PointingHandCursor)
        lbl1.setGeometry(0, 0, 297, 1080)

        lbl1.mousePressEvent = self.contentclick

        # In this widget, the video will be drawn
        if sys.platform == "darwin":  # for MacOS
            from PyQt5.QtWidgets import QMacCocoaViewContainer
            videoframe = QMacCocoaViewContainer(0)
        else:
            videoframe = QtWidgets.QFrame(self)
        self.palette = videoframe.palette()
        self.palette.setColor(QPalette.Window, QColor(0, 0, 0))
        videoframe.setObjectName('videoview')
        videoframe.setPalette(self.palette)
        videoframe.setAutoFillBackground(True)
        videoframe.mousePressEvent = self.contentclick
        videoframe.setGeometry(QtCore.QRect(298, 0, 1622, 1080))

        global connection, roomid, readcheck, playlist, sorted_x, totalfile, oneloopindex, totalindexx, checkonetime, strings2, cou
        self.OpenFile(strings2[cou])
        insertdata(sorted_x[cou].DBindex, sorted_x[cou].playindex, totalindexx)
        cou += 1
        totalindexx += 1
        print(self.mediaplayer.get_state())