Exemplo n.º 1
0
 def __init__(self, com):
     super(Feedback, self).__init__()
     self.ui = Ui_FeedbackDialog()
     self.ui.setupUi(self)
     self.ui.sendButton.clicked.connect(self.send_mail)
     self.com = com
     self.com.mBox.connect(m_box_exec_success)
     self.com.mBoxEr.connect(m_box_exec)
     self.setWindowIcon(QIcon(get_file('animes.png')))
Exemplo n.º 2
0
 def __init__(self, com):
     super(Feedback, self).__init__()
     self.ui = Ui_FeedbackDialog()
     self.ui.setupUi(self)
     self.ui.sendButton.clicked.connect(self.send_mail)
     self.com = com
     self.com.mBox.connect(m_box_exec_success)
     self.com.mBoxEr.connect(m_box_exec)
     self.setWindowIcon(QIcon(get_file('animes.png')))
Exemplo n.º 3
0
class Feedback(QDialog):
    """Send feedback"""

    def __init__(self, com):
        super(Feedback, self).__init__()
        self.ui = Ui_FeedbackDialog()
        self.ui.setupUi(self)
        self.ui.sendButton.clicked.connect(self.send_mail)
        self.com = com
        self.com.mBox.connect(m_box_exec_success)
        self.com.mBoxEr.connect(m_box_exec)
        self.setWindowIcon(QIcon(get_file('animes.png')))

    def send_mail(self):
        """Calls EmailSender to send the feedback"""
        mail = EmailSender(self.ui.nameEdit.text(), 'Semard',
                           self.ui.emailEdit.text(), self.ui.messageEdit.toPlainText(), self.com)
        mail.start()
        mail.join()
        self.close()


    class Player(QMainWindow):
        """A simple Media Player using VLC and Qt """
        def __init__(self, player, master=None):
            QMainWindow.__init__(self, master)
            self.setWindowTitle("Semard: Mini-Player")

            # creating a basic vlc instance
            #self.instance = vlc.Instance()
            # creating an empty vlc media player
            self.mediaplayer = player  # self.instance.media_player_new()
            self.setWindowIcon(QIcon(get_file('animes.png')))

            #self.ui = self.createUI()
            self.isPaused = False

        def toogleFullscreen(self):
            if self.isFullScreen():
                self.playbutton.show()
                self.reloadbutton.show()
                self.positionslider.show()
                self.volumeslider.show()
                self.menubar.show()
                self.vboxlayout.setContentsMargins(0, 0, 0, 0)
                self.showNormal()
            else:
                self.playbutton.hide()
                self.reloadbutton.hide()
                self.positionslider.hide()
                self.volumeslider.hide()
                self.menubar.hide()
                self.vboxlayout.setContentsMargins(0, 0, 0, 0)
                self.showFullScreen()

        def mouseDoubleClickEvent(self, event):
            # self.mediaplayer.toggle_fullscreen()
            self.toogleFullscreen()

        def setMedia(self, media):
            self.media = media

        def setPlayer(self, player):
            self.mediaplayer = player

        def closeEvent(self, event):
            event.ignore()
            self.exit_media()
            self.hide()

        def createUI(self):
            """Set up the user interface, signals & slots
            """
            self.widget = QtGui.QWidget(self)
            self.setCentralWidget(self.widget)

            # In this widget, the video will be drawn
            self.videoframe = QtGui.QFrame()
            self.palette = self.videoframe.palette()
            self.palette.setColor(QtGui.QPalette.Window,
                                  QtGui.QColor(0, 0, 0))
            self.videoframe.setPalette(self.palette)
            self.videoframe.setAutoFillBackground(True)

            self.positionslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
            self.positionslider.setToolTip("Position")
            self.positionslider.setMaximum(1000)
            self.connect(self.positionslider,
                         QtCore.SIGNAL("sliderMoved(int)"), self.setPosition)

            self.hbuttonbox = QtGui.QHBoxLayout()
            self.playbutton = QtGui.QPushButton("Play")
            self.hbuttonbox.addWidget(self.playbutton)
            self.connect(self.playbutton, QtCore.SIGNAL("clicked()"),
                         self.PlayPause)

            self.reloadbutton = QtGui.QPushButton("Reload")
            self.hbuttonbox.addWidget(self.reloadbutton)
            self.connect(self.reloadbutton, QtCore.SIGNAL("clicked()"),
                         self.Reload)
            self.reloadbutton.setEnabled(False)
            self.reloadbutton.hide()

            self.hbuttonbox.addStretch(1)
            self.volumeslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
            self.volumeslider.setMaximum(100)
            self.volumeslider.setValue(self.mediaplayer.audio_get_volume())
            self.volumeslider.setToolTip("Volume")
            self.hbuttonbox.addWidget(self.volumeslider)
            self.connect(self.volumeslider,
                         QtCore.SIGNAL("valueChanged(int)"),
                         self.setVolume)

            self.vboxlayout = QtGui.QVBoxLayout()
            self.vboxlayout.addWidget(self.videoframe)
            self.vboxlayout.addWidget(self.positionslider)
            self.vboxlayout.addLayout(self.hbuttonbox)

            self.widget.setLayout(self.vboxlayout)

            #open = QtGui.QAction("&Open", self)
            #self.connect(open, QtCore.SIGNAL("triggered()"), self.OpenFile)
            ext = QtGui.QAction("&Exit", self)
            self.connect(ext, QtCore.SIGNAL("triggered()"), self.exit_media)
            self.menubar = self.menuBar()
            filemenu = self.menubar.addMenu("&File")
            # filemenu.addAction(open)
            filemenu.addSeparator()
            filemenu.addAction(ext)

            self.timer = QtCore.QTimer(self)
            self.timer.setInterval(200)
            self.connect(self.timer, QtCore.SIGNAL("timeout()"),
                         self.updateUI)

        def Reload(self):
            self.mediaplayer.release()
            self.mediaplayer.set_media(self.media)
            self.media.parse()
            self.mediaplayer.play()

        def exit_media(self):
            self.mediaplayer.stop()
            self.close()

        def PlayPause(self):
            """Toggle play/pause status
            """
            if self.mediaplayer.is_playing():
                self.mediaplayer.pause()
                self.playbutton.setText("Play")
                self.isPaused = True
            else:
                if self.mediaplayer.play() == -1:
                    # self.OpenFile()
                    return
                self.mediaplayer.play()
                self.playbutton.setText("Pause")
                self.timer.start()
                self.isPaused = False

        def Stop(self):
            """Stop player
            """
            self.mediaplayer.stop()
            self.playbutton.setText("Play")

        def OpenFile(self, filename=None):
            """Open a media file in a MediaPlayer
            """
            if filename is None:
                filename = QFileDialog.getOpenFileName(
                    self, "Open File", os.path.expanduser("~"))
            if not filename:
                return

            # create the media
            self.mediaplayer = self.instance.media_player_new()
            # put the media in the media player
            self.mediaplayer.set_media(self.media)
            # parse the metadata of the file
            self.media.parse()
            # set the title of the track as window title
            self.setWindowTitle(self.media.get_meta(0))

            # the media player has to be 'connected' to the QFrame
            # (otherwise a video would be displayed in it's own window)
            # this is platform specific!
            # you have to give the id of the QFrame (or similar object) to
            # vlc, different platforms have different functions for this
            if sys.platform == "linux2":  # for Linux using the X Server
                self.mediaplayer.set_xwindow(self.videoframe.winId())
            elif sys.platform == "win32":  # for Windows
                self.mediaplayer.set_hwnd(self.videoframe.winId())
            elif sys.platform == "darwin":  # for MacOS
                self.mediaplayer.set_agl(self.videoframe.windId())
            self.PlayPause()

        def setVolume(self, Volume):
            """Set the volume
            """
            self.mediaplayer.audio_set_volume(Volume)

        def setPosition(self, position):
            """Set the position
            """
            # setting the position to where the slider was dragged
            self.mediaplayer.set_position(position / 1000.0)
            # the vlc MediaPlayer needs a float value between 0 and 1, Qt
            # uses integer variables, so you need a factor; the higher the
            # factor, the more precise are the results
            # (1000 should be enough)

        def updateUI(self):
            """updates the user interface"""
            # setting the slider to the desired position
            self.positionslider.setValue(self.mediaplayer.get_position() * 1000)

            if not self.mediaplayer.is_playing():
                # no need to call this function if nothing is played
                self.timer.stop()
                if not self.isPaused:
                    # after the video finished, the play button stills shows
                    # "Pause", not the desired behavior of a media player
                    # this will fix it
                    self.Stop()
Exemplo n.º 4
0
class Feedback(QDialog):
    """Send feedback"""
    def __init__(self, com):
        super(Feedback, self).__init__()
        self.ui = Ui_FeedbackDialog()
        self.ui.setupUi(self)
        self.ui.sendButton.clicked.connect(self.send_mail)
        self.com = com
        self.com.mBox.connect(m_box_exec_success)
        self.com.mBoxEr.connect(m_box_exec)
        self.setWindowIcon(QIcon(get_file('animes.png')))

    def send_mail(self):
        """Calls EmailSender to send the feedback"""
        mail = EmailSender(self.ui.nameEdit.text(), 'Semard',
                           self.ui.emailEdit.text(),
                           self.ui.messageEdit.toPlainText(), self.com)
        mail.start()
        mail.join()
        self.close()

    class Player(QMainWindow):
        """A simple Media Player using VLC and Qt """
        def __init__(self, player, master=None):
            QMainWindow.__init__(self, master)
            self.setWindowTitle("Semard: Mini-Player")

            # creating a basic vlc instance
            #self.instance = vlc.Instance()
            # creating an empty vlc media player
            self.mediaplayer = player  # self.instance.media_player_new()
            self.setWindowIcon(QIcon(get_file('animes.png')))

            #self.ui = self.createUI()
            self.isPaused = False

        def toogleFullscreen(self):
            if self.isFullScreen():
                self.playbutton.show()
                self.reloadbutton.show()
                self.positionslider.show()
                self.volumeslider.show()
                self.menubar.show()
                self.vboxlayout.setContentsMargins(0, 0, 0, 0)
                self.showNormal()
            else:
                self.playbutton.hide()
                self.reloadbutton.hide()
                self.positionslider.hide()
                self.volumeslider.hide()
                self.menubar.hide()
                self.vboxlayout.setContentsMargins(0, 0, 0, 0)
                self.showFullScreen()

        def mouseDoubleClickEvent(self, event):
            # self.mediaplayer.toggle_fullscreen()
            self.toogleFullscreen()

        def setMedia(self, media):
            self.media = media

        def setPlayer(self, player):
            self.mediaplayer = player

        def closeEvent(self, event):
            event.ignore()
            self.exit_media()
            self.hide()

        def createUI(self):
            """Set up the user interface, signals & slots
            """
            self.widget = QtGui.QWidget(self)
            self.setCentralWidget(self.widget)

            # In this widget, the video will be drawn
            self.videoframe = QtGui.QFrame()
            self.palette = self.videoframe.palette()
            self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))
            self.videoframe.setPalette(self.palette)
            self.videoframe.setAutoFillBackground(True)

            self.positionslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
            self.positionslider.setToolTip("Position")
            self.positionslider.setMaximum(1000)
            self.connect(self.positionslider,
                         QtCore.SIGNAL("sliderMoved(int)"), self.setPosition)

            self.hbuttonbox = QtGui.QHBoxLayout()
            self.playbutton = QtGui.QPushButton("Play")
            self.hbuttonbox.addWidget(self.playbutton)
            self.connect(self.playbutton, QtCore.SIGNAL("clicked()"),
                         self.PlayPause)

            self.reloadbutton = QtGui.QPushButton("Reload")
            self.hbuttonbox.addWidget(self.reloadbutton)
            self.connect(self.reloadbutton, QtCore.SIGNAL("clicked()"),
                         self.Reload)
            self.reloadbutton.setEnabled(False)
            self.reloadbutton.hide()

            self.hbuttonbox.addStretch(1)
            self.volumeslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
            self.volumeslider.setMaximum(100)
            self.volumeslider.setValue(self.mediaplayer.audio_get_volume())
            self.volumeslider.setToolTip("Volume")
            self.hbuttonbox.addWidget(self.volumeslider)
            self.connect(self.volumeslider, QtCore.SIGNAL("valueChanged(int)"),
                         self.setVolume)

            self.vboxlayout = QtGui.QVBoxLayout()
            self.vboxlayout.addWidget(self.videoframe)
            self.vboxlayout.addWidget(self.positionslider)
            self.vboxlayout.addLayout(self.hbuttonbox)

            self.widget.setLayout(self.vboxlayout)

            #open = QtGui.QAction("&Open", self)
            #self.connect(open, QtCore.SIGNAL("triggered()"), self.OpenFile)
            ext = QtGui.QAction("&Exit", self)
            self.connect(ext, QtCore.SIGNAL("triggered()"), self.exit_media)
            self.menubar = self.menuBar()
            filemenu = self.menubar.addMenu("&File")
            # filemenu.addAction(open)
            filemenu.addSeparator()
            filemenu.addAction(ext)

            self.timer = QtCore.QTimer(self)
            self.timer.setInterval(200)
            self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.updateUI)

        def Reload(self):
            self.mediaplayer.release()
            self.mediaplayer.set_media(self.media)
            self.media.parse()
            self.mediaplayer.play()

        def exit_media(self):
            self.mediaplayer.stop()
            self.close()

        def PlayPause(self):
            """Toggle play/pause status
            """
            if self.mediaplayer.is_playing():
                self.mediaplayer.pause()
                self.playbutton.setText("Play")
                self.isPaused = True
            else:
                if self.mediaplayer.play() == -1:
                    # self.OpenFile()
                    return
                self.mediaplayer.play()
                self.playbutton.setText("Pause")
                self.timer.start()
                self.isPaused = False

        def Stop(self):
            """Stop player
            """
            self.mediaplayer.stop()
            self.playbutton.setText("Play")

        def OpenFile(self, filename=None):
            """Open a media file in a MediaPlayer
            """
            if filename is None:
                filename = QFileDialog.getOpenFileName(self, "Open File",
                                                       os.path.expanduser("~"))
            if not filename:
                return

            # create the media
            self.mediaplayer = self.instance.media_player_new()
            # put the media in the media player
            self.mediaplayer.set_media(self.media)
            # parse the metadata of the file
            self.media.parse()
            # set the title of the track as window title
            self.setWindowTitle(self.media.get_meta(0))

            # the media player has to be 'connected' to the QFrame
            # (otherwise a video would be displayed in it's own window)
            # this is platform specific!
            # you have to give the id of the QFrame (or similar object) to
            # vlc, different platforms have different functions for this
            if sys.platform == "linux2":  # for Linux using the X Server
                self.mediaplayer.set_xwindow(self.videoframe.winId())
            elif sys.platform == "win32":  # for Windows
                self.mediaplayer.set_hwnd(self.videoframe.winId())
            elif sys.platform == "darwin":  # for MacOS
                self.mediaplayer.set_agl(self.videoframe.windId())
            self.PlayPause()

        def setVolume(self, Volume):
            """Set the volume
            """
            self.mediaplayer.audio_set_volume(Volume)

        def setPosition(self, position):
            """Set the position
            """
            # setting the position to where the slider was dragged
            self.mediaplayer.set_position(position / 1000.0)
            # the vlc MediaPlayer needs a float value between 0 and 1, Qt
            # uses integer variables, so you need a factor; the higher the
            # factor, the more precise are the results
            # (1000 should be enough)

        def updateUI(self):
            """updates the user interface"""
            # setting the slider to the desired position
            self.positionslider.setValue(self.mediaplayer.get_position() *
                                         1000)

            if not self.mediaplayer.is_playing():
                # no need to call this function if nothing is played
                self.timer.stop()
                if not self.isPaused:
                    # after the video finished, the play button stills shows
                    # "Pause", not the desired behavior of a media player
                    # this will fix it
                    self.Stop()