switch to PyQt API ver 2

This commit is contained in:
gen2brain 2013-04-06 11:15:07 +02:00
parent 05e5b1f426
commit 365268c52d
14 changed files with 114 additions and 238 deletions

View file

@ -15,16 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import ctypes as C
try:
from m64py.core.defs import *
from m64py.utils import log
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.utils import log
SECTIONS_FUNC = C.CFUNCTYPE(None, C.c_void_p, C.c_char_p)
PARAMETERS_FUNC = C.CFUNCTYPE(None, C.c_void_p, C.c_char_p, C.c_int)

View file

@ -14,22 +14,13 @@
# 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 ctypes as C
from PyQt4.QtCore import SIGNAL
from PyQt4.QtOpenGL import QGLFormat
from SDL import *
try:
from m64py.core.defs import *
from m64py.utils import log
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.utils import log
try:
if not SDL_WasInit(SDL_INIT_VIDEO):
@ -158,41 +149,6 @@ class Video():
self.widget.swapBuffers()
return M64ERR_SUCCESS
m64p_error = C.c_int
m64p_GLattr = C.c_int
class m64p_2d_size(C.Structure):
_fields_ = [
('uiWidth', C.c_uint),
('uiHeight', C.c_uint)
]
FuncInit =C.CFUNCTYPE(m64p_error)
FuncQuit = C.CFUNCTYPE(m64p_error)
FuncListModes = C.CFUNCTYPE(m64p_error, C.POINTER(m64p_2d_size), C.POINTER(C.c_int))
FuncSetMode = C.CFUNCTYPE(m64p_error, C.c_int, C.c_int, C.c_int, C.c_int)
FuncGLGetProc = C.CFUNCTYPE(C.c_void_p, C.c_char_p)
FuncGLSetAttr = C.CFUNCTYPE(m64p_error, m64p_GLattr, C.c_int)
FuncGLGetAttr = C.CFUNCTYPE(m64p_error, m64p_GLattr, C.POINTER(C.c_int))
FuncGLSwapBuf = C.CFUNCTYPE(m64p_error)
FuncSetCaption = C.CFUNCTYPE(m64p_error, C.c_char_p)
FuncToggleFS= C.CFUNCTYPE(m64p_error)
class m64p_video_extension_functions(C.Structure):
_fields_ = [
('Functions', C.c_uint),
('VidExtFuncInit', FuncInit),
('VidExtFuncQuit', FuncQuit),
('VidExtFuncListModes', FuncListModes),
('VidExtFuncSetMode', FuncSetMode),
('VidExtFuncGLGetProc', FuncGLGetProc),
('VidExtFuncGLSetAttr', FuncGLSetAttr),
('VidExtFuncGLGetAttr', FuncGLGetAttr),
('VidExtFuncGLSwapBuf', FuncGLSwapBuf),
('VidExtFuncSetCaption', FuncSetCaption),
('VidExtFuncToggleFS', FuncToggleFS),
]
video = Video()
vidext = m64p_video_extension_functions()
vidext.Functions = 10

View file

@ -16,21 +16,15 @@
import os
import re
import sys
from collections import defaultdict
from PyQt4.QtGui import *
from PyQt4.QtCore import *
try:
from m64py.core.defs import *
from m64py.utils import sl, log
from m64py.ui.cheat_ui import Ui_CheatDialog
from m64py.ui.choices_ui import Ui_ChoicesDialog
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.utils import sl, log
from m64py.ui.cheat_ui import Ui_CheatDialog
from m64py.ui.choices_ui import Ui_ChoicesDialog
class Cheat(QDialog, Ui_CheatDialog):
"""Cheats dialog"""
@ -93,7 +87,7 @@ class Cheat(QDialog, Ui_CheatDialog):
"""Sets description"""
items = self.treeWidget.selectedItems()
for item in items:
data = item.data(0, Qt.UserRole).toPyObject()
data = item.data(0, Qt.UserRole)
if data:
for cheat in data:
cd, address, value, choices = cheat
@ -102,7 +96,7 @@ class Cheat(QDialog, Ui_CheatDialog):
def on_item_clicked(self, item, column):
"""Sets description"""
data = item.data(column, Qt.UserRole).toPyObject()
data = item.data(column, Qt.UserRole)
if data:
for cheat in data:
cd, address, value, choices = cheat
@ -122,14 +116,14 @@ class Cheat(QDialog, Ui_CheatDialog):
def activate_cheat(self, item, column):
"""Activates selected cheat"""
state = item.checkState(column)
name = str(item.text(column))
name = item.text(column)
parent = item.parent()
if parent:
name = "%s\\%s" % (parent.text(column), name)
parent = parent.parent()
if parent:
name = "%s\\%s" % (parent.text(column), name)
data = item.data(column, Qt.UserRole).toPyObject()
data = item.data(column, Qt.UserRole)
if state == Qt.Checked:
codes_type = m64p_cheat_code * len(data)
codes = codes_type()
@ -140,12 +134,12 @@ class Cheat(QDialog, Ui_CheatDialog):
rval = choices.exec_()
if rval == QDialog.Accepted:
curr_item = choices.listWidget.currentItem()
value = curr_item.data(Qt.UserRole).toPyObject()
value = curr_item.data(Qt.UserRole)
else:
#item.setCheckState(0, Qt.Unchecked)
return
codes[num].address = int(str(address), 16)
codes[num].value = int(str(value), 16)
codes[num].address = int(address, 16)
codes[num].value = int(value, 16)
self.parent.worker.add_cheat(name, codes)
else:
self.parent.worker.cheat_enabled(name, False)

View file

@ -14,23 +14,12 @@
# 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 sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtOpenGL import *
#from OpenGL.GL import glViewport,glMatrixMode,glLoadIdentity,GL_PROJECTION
#from OpenGL.error import GLError
try:
from m64py.core.defs import *
#from m64py.utils import log
from m64py.frontend.keymap import SDL_KEYMAP
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.frontend.keymap import SDL_KEYMAP
class GLWidget(QGLWidget):
@ -58,14 +47,6 @@ class GLWidget(QGLWidget):
def paintEvent(self, event):
pass
#def resizeGL(self, width, height):
#try:
#glViewport(0, 0, width, height)
#glMatrixMode(GL_PROJECTION)
#glLoadIdentity()
#except GLError, err:
#log.warn(str(err))
def keyPressEvent(self, event):
if self.worker.state == M64EMU_RUNNING:
key = event.key()

View file

@ -14,22 +14,16 @@
# 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 re
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
try:
from m64py.core.defs import *
from m64py.frontend.joystick import Joystick
from m64py.frontend.keymap import SDL_KEYMAP, QT_MODIFIERS, QT_KEYSTRING
from m64py.ui.input_ui import Ui_InputDialog
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.utils import format_tooltip
from m64py.frontend.joystick import Joystick
from m64py.frontend.keymap import SDL_KEYMAP, QT_MODIFIERS, QT_KEYSTRING
from m64py.ui.input_ui import Ui_InputDialog
KEY_RE = re.compile("([a-z]+)\((.*)\)")
AXIS_RE = re.compile("([a-z]+)\((.*?),(.*?)\)")
@ -88,19 +82,17 @@ class Input(QDialog, Ui_InputDialog):
self.save_opts()
self.save_keys()
self.config.save_file()
def on_device_changed(self, index):
self.device = self.comboDevice.itemData(
self.comboDevice.currentIndex()).toInt()[0]
self.device = self.comboDevice.itemData(self.comboDevice.currentIndex())
self.is_joystick = bool(self.device >= 0)
def on_controller_changed(self, index):
self.save_config()
self.controller = self.comboController.itemData(
index).toInt()[0]
self.controller = self.comboController.itemData(index)
self.set_section("Input-SDL-Control%d" % self.controller)
self.config.open_section(self.section)
self.is_joystick = bool(self.config.get_parameter("device") >= 0)
if not self.config.parameters[self.section]:
self.set_default()
@ -171,8 +163,8 @@ class Input(QDialog, Ui_InputDialog):
spin1, spin2 = widget
spin1.setValue(int(paramX))
spin2.setValue(int(paramY))
spin1.setToolTip(tooltip)
spin2.setToolTip(tooltip)
spin1.setToolTip(format_tooltip(tooltip))
spin2.setToolTip(format_tooltip(tooltip))
else:
widget.setText(param)
if key not in ["AnalogDeadzone", "AnalogPeak"] and tooltip:
@ -186,8 +178,7 @@ class Input(QDialog, Ui_InputDialog):
widget.isChecked())
elif ptype == M64TYPE_INT:
self.config.set_parameter(key,
widget.itemData(
widget.currentIndex()).toInt()[0])
widget.itemData(widget.currentIndex()))
elif ptype == M64TYPE_STRING:
if key in ["AnalogDeadzone", "AnalogPeak"]:
spin1, spin2 = widget

View file

@ -17,24 +17,11 @@
# 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
from PyQt4.QtCore import QObject, pyqtSignal, QTime, QTimer, SIGNAL
try:
from SDL import *
except ImportError, err:
sys.stderr.write("Error: Can't import SDL module%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from SDL import *
try:
from m64py.utils import log
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.utils import log
JOYSTICK_DEADZONE = 0
JOYSTICK_SENSITIVITY = 0

View file

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from PyQt4.QtCore import Qt
from SDL.constants import *
SDL_KEYMAP = {

View file

@ -20,33 +20,29 @@ import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
try:
from m64py.core.defs import *
from m64py.frontend.dialogs import *
from m64py.archive import EXT_FILTER
from m64py.ui.mainwindow_ui import Ui_MainWindow
from m64py.frontend.worker import Worker
from m64py.frontend.rominfo import RomInfo
from m64py.frontend.romlist import ROMList
from m64py.frontend.recentfiles import RecentFiles
from m64py.frontend.glwidget import GLWidget
from m64py.frontend.cheat import Cheat
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.frontend.dialogs import *
from m64py.archive import EXT_FILTER
from m64py.ui.mainwindow_ui import Ui_MainWindow
from m64py.frontend.worker import Worker
from m64py.frontend.rominfo import RomInfo
from m64py.frontend.romlist import ROMList
from m64py.frontend.recentfiles import RecentFiles
from m64py.frontend.glwidget import GLWidget
from m64py.frontend.cheat import Cheat
class MainWindow(QMainWindow, Ui_MainWindow):
"""Frontend main window"""
rom_opened = pyqtSignal()
rom_closed = pyqtSignal()
file_open = pyqtSignal(str)
file_open = pyqtSignal(str, str)
file_opening = pyqtSignal(str)
set_caption = pyqtSignal(str)
state_changed = pyqtSignal(tuple)
save_image = pyqtSignal(bool)
info_dialog = pyqtSignal(str)
archive_dialog = pyqtSignal(list)
def __init__(self, optparse):
"""Constructor"""
@ -92,8 +88,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def showEvent(self, event):
if not self.widgets_height:
width, height = self.settings.qset.value(
"size", SIZE_1X).toPyObject()
width, height = self.settings.qset.value("size", SIZE_1X)
menubar_height = self.menubar.size().height()
statusbar_height = self.statusbar.size().height()
self.widgets_height = menubar_height + statusbar_height
@ -148,7 +143,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.on_rom_opened)
self.connect(self, SIGNAL("rom_closed()"),
self.on_rom_closed)
self.connect(self, SIGNAL("file_open(PyQt_PyObject)"),
self.connect(self, SIGNAL("file_open(PyQt_PyObject, PyQt_PyObject)"),
self.file_open)
self.connect(self, SIGNAL("file_opening(PyQt_PyObject)"),
self.on_file_opening)
@ -160,6 +155,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.on_save_image)
self.connect(self, SIGNAL("info_dialog(PyQt_PyObject)"),
self.on_info_dialog)
self.connect(self, SIGNAL("archive_dialog(PyQt_PyObject)"),
self.on_archive_dialog)
def create_widgets(self):
"""Creates central widgets."""
@ -202,8 +199,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
action.setToolTip("%sx%s" % (width, height))
action.setActionGroup(group )
size = self.settings.qset.value(
"size", SIZE_1X).toPyObject()
size = self.settings.qset.value("size", SIZE_1X)
if size in self.sizes.keys():
self.sizes[size].setChecked(True)
@ -213,15 +209,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.connect(action, SIGNAL("triggered()"),
lambda w=w,h=h:self.resize(w, h))
def file_open(self, filepath=None):
def file_open(self, filepath=None, filename=None):
"""Opens ROM file."""
if not filepath:
action = self.sender()
filepath = str(action.data().toString())
self.worker.core_state_query()
filepath = action.data()
self.worker.core_state_query(M64CORE_EMU_STATE)
if self.worker.state in [M64EMU_RUNNING, M64EMU_PAUSED]:
self.worker.stop()
self.worker.set_filepath(filepath)
self.worker.set_filepath(filepath, filename)
self.worker.start()
self.raise_()
@ -248,6 +244,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.settings.raise_()
InfoDialog(self.settings, info)
def on_archive_dialog(self, files):
"""Shows archive dialog."""
archive = ArchiveDialog(self, files)
rval = archive.exec_()
if rval == QDialog.Accepted:
curr_item = archive.listWidget.currentItem()
fname = curr_item.data(Qt.UserRole)
self.worker.filename = fname
def on_state_changed(self, states):
"""Toggles actions state."""
load,pause,action,cheats = states
@ -280,10 +285,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
QTimer.singleShot(2000, self.worker.toggle_actions)
def on_rom_closed(self):
if self.worker.is_firstrun:
self.worker.m64p.config.save_file()
self.settings.set_config()
self.settings.save_config()
if self.worker.use_vidext and self.isFullScreen():
self.glwidget.emit(SIGNAL("toggle_fs()"))
self.stack.setCurrentWidget(self.view)
@ -299,12 +300,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""Shows ROM file dialog."""
dialog = QFileDialog()
dialog.setFileMode(QFileDialog.ExistingFile)
last_dir = self.settings.qset.value("last_dir").toString()
last_dir = self.settings.qset.value("last_dir")
filepath = dialog.getOpenFileName(
self, "Load ROM Image", last_dir,
"Nintendo64 ROM (%s);;All files (*)" % EXT_FILTER)
if filepath:
self.emit(SIGNAL("file_open(PyQt_PyObject)"), str(filepath))
self.emit(SIGNAL("file_open(PyQt_PyObject, PyQt_PyObject)"), filepath, None)
last_dir = QFileInfo(filepath).path()
self.settings.qset.setValue("last_dir", last_dir)

View file

@ -14,20 +14,12 @@
# 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
from PyQt4.QtGui import *
from PyQt4.QtCore import *
try:
from m64py.core.defs import *
from m64py.utils import format_label, format_options
from m64py.ui.plugin_ui import Ui_PluginDialog
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.utils import format_label, format_options
from m64py.ui.plugin_ui import Ui_PluginDialog
class Plugin(QDialog, Ui_PluginDialog):
"""Plugin settings dialog"""
@ -103,8 +95,7 @@ class Plugin(QDialog, Ui_PluginDialog):
opts[key] = (idx, value)
data = (idx, key, value)
widget.addItem(value)
widget.setItemData(
idx, QVariant(data))
widget.setItemData(idx, data)
self.gridLayout.addWidget(
QLabel(format_label(param_name)), row2, 3)
self.gridLayout.addWidget(widget, row2, 4)
@ -121,13 +112,11 @@ class Plugin(QDialog, Ui_PluginDialog):
for param_name, item in self.widgets.items():
widget, widget_class, opts = item
if widget_class == QLineEdit:
widget.setText(
str(self.config.get_parameter(param_name)))
widget.setText(str(self.config.get_parameter(param_name)))
elif widget_class == QSpinBox:
param = self.config.get_parameter(param_name)
if param is not None:
widget.setValue(
int(self.config.get_parameter(param_name)))
widget.setValue(int(self.config.get_parameter(param_name)))
elif widget_class == QComboBox:
key = self.config.get_parameter(param_name)
try:
@ -136,8 +125,7 @@ class Plugin(QDialog, Ui_PluginDialog):
idx = 0
widget.setCurrentIndex(int(idx))
elif widget_class == QCheckBox:
widget.setChecked(
bool(self.config.get_parameter(param_name)))
widget.setChecked(bool(self.config.get_parameter(param_name)))
def save_items(self):
for param_name, item in self.widgets.items():
@ -147,8 +135,7 @@ class Plugin(QDialog, Ui_PluginDialog):
elif widget_class == QSpinBox:
param_value = int(widget.value())
elif widget_class == QComboBox:
data = widget.itemData(
widget.currentIndex()).toPyObject()
data = widget.itemData(widget.currentIndex())
idx, key, value = data
param_value = key
elif widget_class == QCheckBox:

View file

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from PyQt4.QtGui import QAction, QIcon, QPixmap
from PyQt4.QtCore import QFileInfo, QVariant, SIGNAL
from PyQt4.QtCore import QFileInfo, SIGNAL
class RecentFiles():
"""Keeps track of last opened files."""
@ -52,13 +52,12 @@ class RecentFiles():
def update(self):
"""Updates list of recent files."""
self.recent_files = self.parent.settings.qset.value(
"recent_files").toStringList()
num_files = min(self.recent_files.count(), self.max_recent)
self.recent_files = self.parent.settings.qset.value("recent_files", [])
num_files = min(len(self.recent_files), self.max_recent)
for i in range(num_files):
text = QFileInfo(self.recent_files[i]).fileName()
self.recent_actions[i].setText(text)
self.recent_actions[i].setData(QVariant(self.recent_files[i]))
self.recent_actions[i].setData(self.recent_files[i])
self.recent_actions[i].setVisible(True)
self.recent_actions[i].setToolTip(QFileInfo(
self.recent_files[i]).filePath())
@ -68,12 +67,13 @@ class RecentFiles():
def add(self, filepath):
"""Adds file to recent files list."""
self.recent_files.removeAll(filepath)
self.recent_files.prepend(filepath)
while self.recent_files.count() > 5:
self.recent_files.removeAt(self.recent_files.count() - 1)
if filepath in self.recent_files:
self.recent_files.remove(filepath)
self.recent_files.insert(0, filepath)
while len(self.recent_files) > 5:
self.recent_files.pop(len(self.recent_files) - 1)
self.parent.settings.qset.setValue(
"recent_files", QVariant(self.recent_files))
"recent_files", self.recent_files)
self.update()
def clear(self):

View file

@ -15,16 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
from PyQt4.QtGui import QMessageBox
try:
from m64py.utils import sl
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.utils import sl
class RomInfo():
"""ROM information dialog"""

View file

@ -15,23 +15,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
try:
from m64py.core.defs import *
from m64py.loader import find_library
from m64py.core.vidext import MODES
from m64py.platform import DLL_FILTER
from m64py.frontend.plugin import Plugin
from m64py.frontend.input import Input
from m64py.ui.settings_ui import Ui_Settings
except ImportError, err:
sys.stderr.write("Error: Can't import m64py modules%s%s%s" % (
os.linesep, str(err), os.linesep))
sys.exit(1)
from m64py.core.defs import *
from m64py.loader import find_library
from m64py.core.vidext import MODES
from m64py.platform import DLL_FILTER
from m64py.frontend.plugin import Plugin
from m64py.frontend.input import Input
from m64py.ui.settings_ui import Ui_Settings
class Settings(QDialog, Ui_Settings):
"""Settings dialog"""
@ -124,18 +118,18 @@ class Settings(QDialog, Ui_Settings):
if directory:
dialog.setFileMode(QFileDialog.Directory)
path = dialog.getExistingDirectory(
self, groupbox.title(), QString(), QFileDialog.ShowDirsOnly)
self, groupbox.title(), "", QFileDialog.ShowDirsOnly)
else:
dialog.setFileMode(QFileDialog.ExistingFile)
path = dialog.getOpenFileName(
self, groupbox.title(), QString(),
self, groupbox.title(), "",
"%s (*%s);;All files (*)" % (groupbox.title(), DLL_FILTER))
if not path: return
widget.setText(str(path))
widget.setText(path)
if widget == self.pathLibrary:
if not self.m64p_handle:
self.parent.worker.core_load(str(path))
self.parent.worker.core_load(path)
if self.parent.worker.m64p.get_handle():
self.m64p = self.parent.worker.m64p
self.m64p_handle = self.m64p.get_handle()
@ -143,7 +137,7 @@ class Settings(QDialog, Ui_Settings):
self.set_core()
self.set_video()
self.set_default_general()
size = self.qset.value("size", SIZE_1X).toPyObject()
size = self.qset.value("size", SIZE_1X)
self.parent.window_size_triggered(size)
self.qset.setValue("firstrun", False)
@ -153,13 +147,13 @@ class Settings(QDialog, Ui_Settings):
elif widget == self.pathPlugins:
if self.m64p_handle:
self.m64p.plugins_unload()
self.parent.worker.plugin_load_try(str(path))
self.parent.worker.plugin_load_try(path)
self.set_plugins()
def get_section(self, combo):
plugin = str(combo.currentText())
plugin = combo.currentText()
index = combo.findText(plugin)
desc = str(combo.itemData(index).toString())
desc = combo.itemData(index)
name = os.path.splitext(plugin)[0][12:]
section = "-".join([n.capitalize() for n in name.split("-")])
return (section, desc)
@ -194,14 +188,13 @@ class Settings(QDialog, Ui_Settings):
self.m64p.config.list_parameters()
def set_paths(self):
path_library = self.qset.value("Paths/Library",
find_library(CORE_NAME)).toString()
path_library = self.qset.value("Paths/Library", find_library(CORE_NAME))
path_data = self.qset.value("Paths/Data",
self.m64p.config.get_path("SharedData")).toString()
path_roms = self.qset.value("Paths/ROM").toString()
self.m64p.config.get_path("SharedData"))
path_roms = self.qset.value("Paths/ROM")
try:
path_plugins = self.qset.value("Paths/Plugins", os.path.realpath(
os.path.dirname(self.m64p.plugin_files[0]))).toString()
os.path.dirname(self.m64p.plugin_files[0])))
except IndexError:
path_plugins = ""
@ -217,8 +210,7 @@ class Settings(QDialog, Ui_Settings):
self.comboResolution.addItem(
"%sx%s" % (width, height), (width, height))
self.comboResolution.setCurrentIndex(0)
self.comboResolution.setEnabled(
not self.parent.worker.use_vidext)
self.comboResolution.setEnabled(not self.parent.worker.use_vidext)
self.m64p.config.open_section("Video-General")
width = self.m64p.config.get_parameter("ScreenWidth")
@ -233,8 +225,7 @@ class Settings(QDialog, Ui_Settings):
if tooltip:
self.checkFullscreen.setToolTip(tooltip)
enable_vidext = self.qset.value(
"enable_vidext", True).toBool()
enable_vidext = bool(self.qset.value("enable_vidext", 1))
self.checkEnableVidExt.setChecked(enable_vidext)
def set_core(self):
@ -268,7 +259,7 @@ class Settings(QDialog, Ui_Settings):
combo.setItemData(index, plugin_desc)
combo.setItemData(index, plugin_desc, Qt.ToolTipRole)
current = self.qset.value("Plugins/%s" %
PLUGIN_NAME[plugin_type]).toString()
PLUGIN_NAME[plugin_type])
index = combo.findText(current)
if index == -1: index = 0
combo.setCurrentIndex(index)
@ -287,13 +278,12 @@ class Settings(QDialog, Ui_Settings):
def save_video(self):
self.m64p.config.open_section("Video-General")
if not self.parent.worker.use_vidext:
width, height = str(self.comboResolution.currentText()).split("x")
width, height = self.comboResolution.currentText().split("x")
self.m64p.config.set_parameter("ScreenWidth", int(width))
self.m64p.config.set_parameter("ScreenHeight", int(height))
self.m64p.config.set_parameter("Fullscreen",
self.checkFullscreen.isChecked())
self.qset.setValue("enable_vidext",
self.checkEnableVidExt.isChecked())
self.qset.setValue("enable_vidext", int(self.checkEnableVidExt.isChecked()))
def save_core(self):
self.m64p.config.open_section("Core")
@ -307,7 +297,7 @@ class Settings(QDialog, Ui_Settings):
self.m64p.config.set_parameter("DisableExtraMem",
self.checkDisableExtraMem.isChecked())
self.m64p.config.set_parameter("SharedDataPath",
str(self.pathData.text()))
self.pathData.text())
def save_plugins(self):
for plugin_type in self.combomap:

View file

@ -181,8 +181,9 @@ class PosixLibraryLoader(LibraryLoader):
try: directories.extend([dir.strip() for dir in open('/etc/ld.so.conf')])
except IOError: pass
directories.extend(['/lib', '/usr/lib', '/lib64', '/usr/lib64',
'/usr/games/lib', '/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu'])
directories.extend(['/lib', '/usr/lib', '/lib64',
'/usr/lib64', '/usr/games/lib', '/usr/games/lib64',
'/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu'])
cache = {}
lib_re = re.compile(r'lib(.*)\.s[ol]')

View file

@ -24,6 +24,7 @@ if sys.platform.startswith("linux"):
SEARCH_DIRS = [
"/usr/local/lib/mupen64plus",
"/usr/lib/mupen64plus",
"/usr/games/lib64/mupen64plus",
"/usr/games/lib/mupen64plus",
"/usr/lib/x86_64-linux-gnu/mupen64plus",
"/usr/lib/i386-linux-gnu/mupen64plus",
@ -34,6 +35,7 @@ elif sys.platform == "darwin":
DLL_FILTER = ".dylib"
DEFAULT_DYNLIB = "libmupen64plus.dylib"
SEARCH_DIRS = [
os.path.join(".", "M64Py", "Contents", "MacOS"),
"/usr/local/lib/mupen64plus",
"/usr/lib/mupen64plus",
"."
@ -42,7 +44,4 @@ elif sys.platform == "win32":
DLL_EXT = ".dll"
DLL_FILTER = ".dll"
DEFAULT_DYNLIB = "mupen64plus.dll"
SEARCH_DIRS = [
os.path.join(".", "M64Py", "Contents", "MacOS"),
"."
]
SEARCH_DIRS = ["."]