mirror of
https://github.com/mupen64plus/mupen64plus-ui-python.git
synced 2025-04-02 10:51:53 -04:00
Early this week, GitHub user xX-Yoshi-Xx informed me that there was an issue installing using my last commit. This was due to the script trying to import a module from `src/m64py` before it was added to the path. So I fixed that just by moving the import down a few lines. I also rewrote the README in reStructuredText, since this is the default Python markup format. I added some new content on using the `requirements.txt`` file to install the Python dependencies as well as a few other notes. I also did a few smaller things like making the Changelog file in all caps like the other files.
70 lines
2.2 KiB
Python
Executable file
70 lines
2.2 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Author: Milan Nikolic <gen2brain@gmail.com>
|
|
#
|
|
# 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
|
|
# (at your option) any later version.
|
|
#
|
|
# 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.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
import os
|
|
import sys
|
|
import signal
|
|
|
|
if os.path.isdir(os.path.join(".", "src")) and os.path.isfile(
|
|
os.path.join(".", "setup.py")):
|
|
sys.path.insert(0, os.path.realpath("src"))
|
|
|
|
try:
|
|
from PyQt5.QtWidgets import QApplication
|
|
from PyQt5.QtCore import Qt, QLocale, QTranslator
|
|
except ImportError as err:
|
|
sys.stderr.write("This application needs PyQt5 module%sError:%s%s" % (
|
|
os.linesep, str(err), os.linesep))
|
|
sys.exit(1)
|
|
|
|
try:
|
|
from m64py.core.defs import FRONTEND_VERSION, LOGO
|
|
except ImportError as err:
|
|
sys.stderr.write("Can't import m64py modules%sError:%s%s" % (
|
|
os.linesep, str(err), os.linesep))
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
QApplication.setAttribute(Qt.AA_X11InitThreads)
|
|
|
|
app = QApplication(sys.argv)
|
|
from m64py.opts import opts, args
|
|
|
|
locale = QLocale.system().name()
|
|
translator = QTranslator()
|
|
if translator.load(":i18n/m64py_" + locale, ":/"):
|
|
app.installTranslator(translator)
|
|
|
|
sys.stderr.write("%s\nM64Py - A frontend for Mupen64Plus version %s\n\n" % (
|
|
LOGO, FRONTEND_VERSION))
|
|
|
|
from m64py.frontend.mainwindow import MainWindow
|
|
window = MainWindow((opts, args))
|
|
window.show()
|
|
window.raise_()
|
|
|
|
try:
|
|
try:
|
|
signal.siginterrupt(signal.SIGCHLD, False)
|
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
|
except AttributeError:
|
|
pass
|
|
sys.exit(app.exec_())
|
|
except KeyboardInterrupt:
|
|
pass
|