Пример #1
0
    def main(self):
        # Check Versions
        self.logger.info("Running Python "+sys.version)
        if (3,2) > sys.version_info:
            QtGui.QMessageBox.critical(None,"Unsupported Python Version","Your Python Version is not supported: {0}\r\nThis Application may or may not work.\r\nYou are advised to upgrade to Python 3.2+".format(sys.version),"Dismiss")
        self.logger.info("Running libyo "+libyo.LIBYO_VERSION)
        self.logger.info("Running libvlc %s"%libvlc.libvlc_get_version())

        # Setup UI
        self.logger.debug("Loading Interface")
        self.main_window = QtGui.QMainWindow()
        self.main_window.ui = Ui_MainWindow()
        self.main_window.ui.setupUi(self.main_window)
        self.main_window.setWindowTitle(self.window_title_1)
        self.main_window.ui.frame_video.setAttribute(QtCore.Qt.WA_NativeWindow)
        self.video_frame = self.main_window.ui.frame_video
        self.video_frame.installEventFilter(self)

        # Setup Signals and Player Instance
        self.logger.debug("Setting up libvlc")
        self.setupPlayer()
        self.connectPlayer()
        self.setupSignals()
        self.setupTimer()

        # Enter Main Loop
        self.logger.debug("Entering Main Loop")
        self.main_window.show()
        self.exec_()

        # Cleanup
        self.logger.debug("Cleaning Up")
        self.cleanUp()
        self.logger.debug("Terminating")
Пример #2
0
    def setupUi(self):
        tr = QtCore.QCoreApplication.instance().translate

        self.setObjectName("AboutDialog")
        self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        self.setWindowTitle(tr("AboutDialog", "About VLYC"))
        self.resize(500, 400)

        self.root_layout = QtGui.QVBoxLayout(self)
        self.root_layout.setObjectName("root_layout")

        import libyo
        from vlc.libvlc import libvlc_get_version
        from platform import (platform, architecture, machine,
                              python_version, python_implementation)
        self.about_text = QtGui.QTextEdit(self)
        self.about_text.setObjectName("about_text")
        self.about_text.setReadOnly(True)
        self.about_text.setHtml(tr("AboutDialog",
"""<b>VideoLan YouTube Client</b> <i>{vlyc_version}</i><br>
<br>
This Program is not affilited with or approved by the VideoLan Organization.
The Program name is based soely on the fact that it uses the VLC library.<br>
<hr>
<table><tbody>
<tr><td colspan=2><b>Library Versions</b></td></tr>
<tr><td>Platform</td><td>{platform} ({arch})</td></tr>
<tr><td>Python</td><td>{python_version} {python_implementation}{frozen}</td></tr>
<tr><td>libvlc</td><td>{libvlc_version}</td></tr>
<tr><td>libyo</td><td>{libyo_version}</td></tr>
<tr><td>Qt</td><td>{qt_version}</td></tr>
<tr><td>PyQt4</td><td>{pyqt4_version}</td></tr>
</tbody></table>
<hr>
<table><tbody>
<tr><td colspan=2><b>Copyright</b></td></tr>
<tr><td>VLYC</td><td>&copy; 2012 Orochimarufan</td></tr>
<tr><td>UI design & code</td><td>&copy; the VideoLan Team and Orochimarufan</td></tr>
<tr><td>libvlc</td><td>&copy; <a href="http://www.videolan.org">the VideoLan Team and VLC contributors</a></td></tr>
<tr><td>libyo</td><td>&copy; Orochimarufan</td></tr>
<tr><td>Qt</td><td>&copy; <a href="http://qt.nokia.com">Nokia and/or it's subsidiaries</a></td></tr>
<tr><td>PyQt4</td><td>&copy; <a href="http://riverbankcomputing.co.uk/">Riverbank Computing Limited</a></td></tr>
</tbody></table>
<hr>
<b>License</b><br>
<br>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or <-- Qt is GPLv3, others are GPLv2, use GPLv3 -->
(at your option) any later version.<br>
<br>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.<br>
<br>
You should have received a copy of the GNU General Public License
along with this program.  If not, see &lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.<br>
""").format(python_version=python_version(),
            python_implementation=python_implementation(),
            frozen=" (frozen binary distribution)" if (hasattr(sys, "frozen")) else "",
            vlyc_version=QtCore.QCoreApplication.instance().applicationVersion(),
            libvlc_version=str(libvlc_get_version(), "latin-1"),
            libyo_version=libyo.version,
            qt_version=QtCore.qVersion(),
            pyqt4_version=QtCore.PYQT_VERSION_STR,
            platform=platform(),
            arch="%s on %s" % (architecture()[0], machine())))
        self.about_text.setFocusPolicy(QtCore.Qt.NoFocus)
        self.root_layout.addWidget(self.about_text)

        self.button_box = QtGui.QHBoxLayout()
        self.button_box.setObjectName("button_box")
        self.root_layout.addLayout(self.button_box)

        self.about_qt_button = QtGui.QPushButton(self)
        self.about_qt_button.setObjectName("about_qt_button")
        self.about_qt_button.setText(tr("AboutDialog", "About Qt"))
        self.about_qt_button.clicked.connect(QtGui.QApplication.instance().aboutQt)
        self.button_box.addWidget(self.about_qt_button)

        self.button_box.addStretch()

        self.close_button = QtGui.QPushButton(self)
        self.close_button.setObjectName("close_button")
        self.close_button.setText(tr("AboutDialog", "Ok"))
        self.close_button.clicked.connect(self.close)
        self.button_box.addWidget(self.close_button)

        self.close_button.setFocus(True)