mirror of
https://github.com/mupen64plus/mupen64plus-ui-python.git
synced 2025-04-02 10:51:53 -04:00
Remove aspect option, which and titles/snapshots bindings
This commit is contained in:
parent
f235b519e9
commit
6e3b052ba1
10 changed files with 50 additions and 173 deletions
|
@ -23,15 +23,13 @@ import tempfile
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
from m64py.utils import which
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import rarfile
|
import rarfile
|
||||||
HAS_RAR = True
|
HAS_RAR = True
|
||||||
RAR_CMD = None
|
RAR_CMD = None
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_RAR = False
|
HAS_RAR = False
|
||||||
RAR_CMD = which("rar") or which("unrar")
|
RAR_CMD = shutil.which("rar") or shutil.which("unrar")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from py7zlib import Archive7z
|
from py7zlib import Archive7z
|
||||||
|
@ -39,7 +37,7 @@ try:
|
||||||
LZMA_CMD = None
|
LZMA_CMD = None
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_7Z = False
|
HAS_7Z = False
|
||||||
LZMA_CMD = which("7z")
|
LZMA_CMD = shutil.which("7z")
|
||||||
|
|
||||||
ZIP, GZIP, BZIP, RAR, LZMA, ROM = range(6)
|
ZIP, GZIP, BZIP, RAR, LZMA, ROM = range(6)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
from PyQt6.QtWidgets import QApplication
|
from PyQt6.QtWidgets import QApplication
|
||||||
from PyQt6.QtGui import QSurfaceFormat, QGuiApplication
|
from PyQt6.QtGui import QSurface, QSurfaceFormat, QGuiApplication
|
||||||
|
|
||||||
from sdl2 import SDL_WasInit, SDL_InitSubSystem, SDL_QuitSubSystem, SDL_INIT_VIDEO
|
from sdl2 import SDL_WasInit, SDL_InitSubSystem, SDL_QuitSubSystem, SDL_INIT_VIDEO
|
||||||
from sdl2 import SDL_GetNumDisplayModes, SDL_DisplayMode, SDL_GetDisplayMode
|
from sdl2 import SDL_GetNumDisplayModes, SDL_DisplayMode, SDL_GetDisplayMode
|
||||||
|
@ -73,6 +73,8 @@ class Video:
|
||||||
if QGuiApplication.platformName() != "wayland":
|
if QGuiApplication.platformName() != "wayland":
|
||||||
self.glcontext.setFormat(self.glformat)
|
self.glcontext.setFormat(self.glformat)
|
||||||
|
|
||||||
|
self.widget.setSurfaceType(QSurface.SurfaceType.OpenGLSurface)
|
||||||
|
|
||||||
return M64ERR_SUCCESS
|
return M64ERR_SUCCESS
|
||||||
|
|
||||||
def init_with_render_mode(self, mode):
|
def init_with_render_mode(self, mode):
|
||||||
|
@ -87,6 +89,8 @@ class Video:
|
||||||
self.glcontext.moveToThread(QApplication.instance().thread())
|
self.glcontext.moveToThread(QApplication.instance().thread())
|
||||||
self.glcontext = None
|
self.glcontext = None
|
||||||
|
|
||||||
|
self.widget.destroy()
|
||||||
|
|
||||||
return M64ERR_SUCCESS
|
return M64ERR_SUCCESS
|
||||||
|
|
||||||
def list_modes(self, size_array, num_sizes):
|
def list_modes(self, size_array, num_sizes):
|
||||||
|
|
|
@ -20,19 +20,12 @@ from PyQt6.QtGui import QWindow, QOpenGLContext, QSurface
|
||||||
class GLWidget(QWindow):
|
class GLWidget(QWindow):
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
self.parent = parent
|
|
||||||
QWindow.__init__(self, None)
|
QWindow.__init__(self, None)
|
||||||
|
self.parent = parent
|
||||||
self.setSurfaceType(QSurface.SurfaceType.OpenGLSurface)
|
|
||||||
self.ctx = QOpenGLContext()
|
self.ctx = QOpenGLContext()
|
||||||
|
|
||||||
def context(self):
|
def context(self):
|
||||||
return self.ctx
|
return self.ctx
|
||||||
|
|
||||||
def resizeEvent(self, event):
|
|
||||||
size = event.size()
|
|
||||||
width, height = int(size.width() * self.devicePixelRatio()), int(size.height() * self.devicePixelRatio())
|
|
||||||
self.resize(width, height)
|
|
||||||
|
|
||||||
def mouseDoubleClickEvent(self, event):
|
def mouseDoubleClickEvent(self, event):
|
||||||
self.parent.toggle_fs.emit()
|
self.parent.toggle_fs.emit()
|
||||||
|
|
|
@ -48,7 +48,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
file_opening = pyqtSignal(str)
|
file_opening = pyqtSignal(str)
|
||||||
set_caption = pyqtSignal(str)
|
set_caption = pyqtSignal(str)
|
||||||
state_changed = pyqtSignal(tuple)
|
state_changed = pyqtSignal(tuple)
|
||||||
save_image = pyqtSignal(bool)
|
|
||||||
info_dialog = pyqtSignal(str)
|
info_dialog = pyqtSignal(str)
|
||||||
archive_dialog = pyqtSignal(list)
|
archive_dialog = pyqtSignal(list)
|
||||||
vidext_init = pyqtSignal(QOpenGLContext)
|
vidext_init = pyqtSignal(QOpenGLContext)
|
||||||
|
@ -70,8 +69,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.statusbar_label.setIndent(2)
|
self.statusbar_label.setIndent(2)
|
||||||
self.statusbar_label.setSizePolicy(QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Fixed)
|
self.statusbar_label.setSizePolicy(QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Fixed)
|
||||||
self.statusbar.addPermanentWidget(self.statusbar_label, 1)
|
self.statusbar.addPermanentWidget(self.statusbar_label, 1)
|
||||||
self.update_status(self.tr(
|
self.update_status(self.tr("M64Py version %s." % FRONTEND_VERSION))
|
||||||
"Welcome to M64Py version %s." % FRONTEND_VERSION))
|
|
||||||
|
|
||||||
self.sizes = {
|
self.sizes = {
|
||||||
SIZE_1X: self.action1X,
|
SIZE_1X: self.action1X,
|
||||||
|
@ -107,16 +105,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.windowState() == Qt.WindowState.WindowMaximized):
|
self.windowState() == Qt.WindowState.WindowMaximized):
|
||||||
self.maximized = True
|
self.maximized = True
|
||||||
|
|
||||||
def resizeEvent(self, event):
|
|
||||||
event.ignore()
|
|
||||||
size = event.size()
|
|
||||||
if self.widgets_height:
|
|
||||||
width, height = size.width(), size.height()
|
|
||||||
self.window_size_triggered((width, height))
|
|
||||||
else:
|
|
||||||
width, height = size.width(), size.height()
|
|
||||||
self.resize(width, height)
|
|
||||||
|
|
||||||
def showEvent(self, event):
|
def showEvent(self, event):
|
||||||
if not self.widgets_height:
|
if not self.widgets_height:
|
||||||
width, height = self.settings.get_size_safe()
|
width, height = self.settings.get_size_safe()
|
||||||
|
@ -136,49 +124,44 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
if modifiers & Qt.KeyboardModifier.AltModifier and (key == Qt.Key.Key_Enter or key == Qt.Key.Key_Return):
|
if modifiers & Qt.KeyboardModifier.AltModifier and (key == Qt.Key.Key_Enter or key == Qt.Key.Key_Return):
|
||||||
self.toggle_fs.emit()
|
self.toggle_fs.emit()
|
||||||
elif key == Qt.Key.Key_F3:
|
|
||||||
self.worker.save_title()
|
|
||||||
elif key == Qt.Key.Key_F4:
|
|
||||||
self.worker.save_snapshot()
|
|
||||||
else:
|
else:
|
||||||
try:
|
if key in QT2SDL2:
|
||||||
sdl_key = QT2SDL2[key]
|
self.worker.send_sdl_keydown(QT2SDL2[key])
|
||||||
self.worker.send_sdl_keydown(sdl_key)
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def keyReleaseEvent(self, event):
|
def keyReleaseEvent(self, event):
|
||||||
if self.worker.state != M64EMU_RUNNING:
|
if self.worker.state != M64EMU_RUNNING:
|
||||||
return
|
return
|
||||||
|
|
||||||
key = event.key()
|
key = event.key()
|
||||||
try:
|
if key in QT2SDL2:
|
||||||
sdl_key = QT2SDL2[key]
|
self.worker.send_sdl_keyup(QT2SDL2[key])
|
||||||
self.worker.send_sdl_keyup(sdl_key)
|
|
||||||
except KeyError:
|
def resizeEvent(self, event):
|
||||||
pass
|
event.ignore()
|
||||||
|
size = event.size()
|
||||||
|
if self.widgets_height:
|
||||||
|
width, height = size.width(), size.height()
|
||||||
|
self.window_size_triggered((width, height))
|
||||||
|
else:
|
||||||
|
width, height = size.width(), size.height()
|
||||||
|
self.resize(width, height)
|
||||||
|
|
||||||
def window_size_triggered(self, size):
|
def window_size_triggered(self, size):
|
||||||
window_width, window_height = size
|
width, height = size
|
||||||
if self.vidext and self.worker.core.get_handle():
|
if self.vidext and self.worker.core.get_handle():
|
||||||
game_height = window_height - self.widgets_height
|
|
||||||
game_width = window_width
|
|
||||||
|
|
||||||
if not sys.platform == "win32":
|
|
||||||
if bool(self.settings.get_int_safe("keep_aspect", 1)):
|
|
||||||
game_width = int((4 / 3) * window_height)
|
|
||||||
|
|
||||||
self.worker.core.config.open_section("Video-General")
|
self.worker.core.config.open_section("Video-General")
|
||||||
self.worker.core.config.set_parameter("ScreenWidth", game_width)
|
self.worker.core.config.set_parameter("ScreenWidth", width)
|
||||||
self.worker.core.config.set_parameter("ScreenHeight", game_height)
|
self.worker.core.config.set_parameter("ScreenHeight", height - self.widgets_height)
|
||||||
|
|
||||||
video_size = (game_width << 16) + game_height
|
video_size = ((int(width * self.devicePixelRatio()) << 16) +
|
||||||
|
(int(height * self.devicePixelRatio()) - self.widgets_height))
|
||||||
if self.worker.state in (M64EMU_RUNNING, M64EMU_PAUSED):
|
if self.worker.state in (M64EMU_RUNNING, M64EMU_PAUSED):
|
||||||
self.worker.core_state_set(M64CORE_VIDEO_SIZE, video_size)
|
self.worker.core_state_set(M64CORE_VIDEO_SIZE, video_size)
|
||||||
|
|
||||||
self.set_sizes((window_width, window_height - self.widgets_height))
|
self.set_sizes((width, height - self.widgets_height))
|
||||||
self.settings.qset.setValue("size", (window_width, window_height - self.widgets_height))
|
self.settings.qset.setValue("size", (width, height - self.widgets_height))
|
||||||
self.resize(window_width, window_height)
|
|
||||||
|
self.resize(width, height)
|
||||||
|
|
||||||
def set_sizes(self, size):
|
def set_sizes(self, size):
|
||||||
"""Sets 'Window Size' radio buttons on resize event."""
|
"""Sets 'Window Size' radio buttons on resize event."""
|
||||||
|
@ -189,21 +172,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
for action in self.sizes.values():
|
for action in self.sizes.values():
|
||||||
action.setChecked(False)
|
action.setChecked(False)
|
||||||
|
|
||||||
def keep_aspect(self, size):
|
|
||||||
"""Keeps 4:3 aspect ratio."""
|
|
||||||
width, height = size
|
|
||||||
if self.maximized:
|
|
||||||
return width, height
|
|
||||||
fixed_ratio = 1.3333333333333333
|
|
||||||
current_ratio = float(width)/float(height)
|
|
||||||
if fixed_ratio > current_ratio:
|
|
||||||
w = int(width)
|
|
||||||
h = int(width/fixed_ratio)
|
|
||||||
else:
|
|
||||||
h = int(height)
|
|
||||||
w = int(height*fixed_ratio)
|
|
||||||
return w, h
|
|
||||||
|
|
||||||
def center_widget(self):
|
def center_widget(self):
|
||||||
"""Centers widget on desktop."""
|
"""Centers widget on desktop."""
|
||||||
size = self.size()
|
size = self.size()
|
||||||
|
@ -221,7 +189,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.file_opening.connect(self.on_file_opening)
|
self.file_opening.connect(self.on_file_opening)
|
||||||
self.set_caption.connect(self.on_set_caption)
|
self.set_caption.connect(self.on_set_caption)
|
||||||
self.state_changed.connect(self.on_state_changed)
|
self.state_changed.connect(self.on_state_changed)
|
||||||
self.save_image.connect(self.on_save_image)
|
|
||||||
self.info_dialog.connect(self.on_info_dialog)
|
self.info_dialog.connect(self.on_info_dialog)
|
||||||
self.archive_dialog.connect(self.on_archive_dialog)
|
self.archive_dialog.connect(self.on_archive_dialog)
|
||||||
self.toggle_fs.connect(self.on_toggle_fs)
|
self.toggle_fs.connect(self.on_toggle_fs)
|
||||||
|
@ -316,10 +283,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.update_status("Loading %s..." % (
|
self.update_status("Loading %s..." % (
|
||||||
os.path.basename(filepath)))
|
os.path.basename(filepath)))
|
||||||
|
|
||||||
def on_save_image(self, title):
|
|
||||||
"""Saves snapshot or title image."""
|
|
||||||
self.worker.save_image(title)
|
|
||||||
|
|
||||||
def on_info_dialog(self, info):
|
def on_info_dialog(self, info):
|
||||||
"""Shows info dialog."""
|
"""Shows info dialog."""
|
||||||
self.settings.show_page(0)
|
self.settings.show_page(0)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
from PyQt6.QtCore import Qt, QSettings
|
from PyQt6.QtCore import Qt, QSettings
|
||||||
from PyQt6.QtWidgets import QDialog, QFileDialog, QRadioButton, QVBoxLayout
|
from PyQt6.QtWidgets import QDialog, QFileDialog, QRadioButton, QVBoxLayout
|
||||||
|
@ -250,13 +249,6 @@ class Settings(QDialog, Ui_Settings):
|
||||||
self.checkVsync.setToolTip(
|
self.checkVsync.setToolTip(
|
||||||
self.get_parameter_help_safe("VerticalSync"))
|
self.get_parameter_help_safe("VerticalSync"))
|
||||||
|
|
||||||
if sys.platform == "win32":
|
|
||||||
self.checkKeepAspect.setChecked(False)
|
|
||||||
self.checkKeepAspect.setEnabled(False)
|
|
||||||
else:
|
|
||||||
keep_aspect = bool(self.get_int_safe("keep_aspect", 1))
|
|
||||||
self.checkKeepAspect.setChecked(keep_aspect)
|
|
||||||
|
|
||||||
disable_screensaver = bool(self.get_int_safe("disable_screensaver", 1))
|
disable_screensaver = bool(self.get_int_safe("disable_screensaver", 1))
|
||||||
self.checkDisableScreenSaver.setChecked(disable_screensaver)
|
self.checkDisableScreenSaver.setChecked(disable_screensaver)
|
||||||
|
|
||||||
|
@ -340,7 +332,7 @@ class Settings(QDialog, Ui_Settings):
|
||||||
self.core.config.set_parameter("ScreenHeight", int(height))
|
self.core.config.set_parameter("ScreenHeight", int(height))
|
||||||
self.core.config.set_parameter("Fullscreen", self.checkFullscreen.isChecked())
|
self.core.config.set_parameter("Fullscreen", self.checkFullscreen.isChecked())
|
||||||
self.core.config.set_parameter("VerticalSync", self.checkVsync.isChecked())
|
self.core.config.set_parameter("VerticalSync", self.checkVsync.isChecked())
|
||||||
self.qset.setValue("keep_aspect", int(self.checkKeepAspect.isChecked()))
|
|
||||||
self.qset.setValue("disable_screensaver", int(self.checkDisableScreenSaver.isChecked()))
|
self.qset.setValue("disable_screensaver", int(self.checkDisableScreenSaver.isChecked()))
|
||||||
self.qset.setValue("enable_vidext", int(self.checkEnableVidExt.isChecked()))
|
self.qset.setValue("enable_vidext", int(self.checkEnableVidExt.isChecked()))
|
||||||
|
|
||||||
|
|
|
@ -205,53 +205,6 @@ class Worker(QThread):
|
||||||
"""Saves screenshot."""
|
"""Saves screenshot."""
|
||||||
self.core.take_next_screenshot()
|
self.core.take_next_screenshot()
|
||||||
|
|
||||||
def get_screenshot(self, path):
|
|
||||||
"""Gets last saved screenshot."""
|
|
||||||
name = self.core.rom_header.Name.decode()
|
|
||||||
rom_name = name.replace(' ', '_').lower()
|
|
||||||
screenshots = []
|
|
||||||
for filename in os.listdir(path):
|
|
||||||
if filename.startswith(rom_name):
|
|
||||||
screenshots.append(os.path.join(
|
|
||||||
path, filename))
|
|
||||||
if screenshots:
|
|
||||||
return sorted(screenshots)[-1]
|
|
||||||
return None
|
|
||||||
|
|
||||||
def save_image(self, title=True):
|
|
||||||
"""Saves snapshot or title image."""
|
|
||||||
data_path = self.core.config.get_path("UserData")
|
|
||||||
capture = "title" if title else "snapshot"
|
|
||||||
dst_path = os.path.join(data_path, capture)
|
|
||||||
if not os.path.isdir(dst_path):
|
|
||||||
os.makedirs(dst_path)
|
|
||||||
screenshot = self.get_screenshot(
|
|
||||||
os.path.join(data_path, "screenshot"))
|
|
||||||
if screenshot:
|
|
||||||
image_name = "%X%X.png" % (
|
|
||||||
sl(self.core.rom_header.CRC1), sl(self.core.rom_header.CRC2))
|
|
||||||
try:
|
|
||||||
shutil.copyfile(screenshot, os.path.join(dst_path, image_name))
|
|
||||||
log.info("Captured %s" % capture)
|
|
||||||
except IOError:
|
|
||||||
log.exception("couldn't save image %s" % image_name)
|
|
||||||
|
|
||||||
def save_title(self):
|
|
||||||
"""Saves title."""
|
|
||||||
self.save_screenshot()
|
|
||||||
QTimer.singleShot(1500, self.save_title_image)
|
|
||||||
|
|
||||||
def save_snapshot(self):
|
|
||||||
"""Saves snapshot."""
|
|
||||||
self.save_screenshot()
|
|
||||||
QTimer.singleShot(1500, self.save_snapshot_image)
|
|
||||||
|
|
||||||
def save_title_image(self):
|
|
||||||
self.parent.save_image.emit(True)
|
|
||||||
|
|
||||||
def save_snapshot_image(self):
|
|
||||||
self.parent.save_image.emit(False)
|
|
||||||
|
|
||||||
def state_load(self, state_path=None):
|
def state_load(self, state_path=None):
|
||||||
"""Loads state."""
|
"""Loads state."""
|
||||||
self.core.state_load(state_path)
|
self.core.state_load(state_path)
|
||||||
|
|
|
@ -587,8 +587,8 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.py" line="60"/>
|
<location filename="mainwindow.py" line="60"/>
|
||||||
<source>Welcome to M64Py version %s.</source>
|
<source>M64Py version %s.</source>
|
||||||
<translation type="unfinished">Willkommen zu M64py version %s.</translation>
|
<translation type="unfinished">M64py version %s.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.py" line="323"/>
|
<location filename="mainwindow.py" line="323"/>
|
||||||
|
|
|
@ -586,7 +586,7 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.py" line="60"/>
|
<location filename="mainwindow.py" line="60"/>
|
||||||
<source>Welcome to M64Py version %s.</source>
|
<source>M64Py version %s.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -426,26 +426,6 @@ QGroupBox::title {
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkOSD">
|
|
||||||
<property name="text">
|
|
||||||
<string>On Screen Display</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkDisableScreenSaver">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Disables ScreenSaver when emulator is running</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Disable ScreenSaver</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="checkEnableVidExt">
|
<widget class="QCheckBox" name="checkEnableVidExt">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -459,13 +439,23 @@ QGroupBox::title {
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="checkKeepAspect">
|
<widget class="QCheckBox" name="checkDisableScreenSaver">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Maintain aspect-ratio on resizing</string>
|
<string>Disables ScreenSaver when emulator is running</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Keep Aspect Ratio</string>
|
<string>Disable ScreenSaver</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkOSD">
|
||||||
|
<property name="text">
|
||||||
|
<string>On Screen Display</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -13,25 +13,9 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def which(prog):
|
|
||||||
def is_exe(fp):
|
|
||||||
return os.path.exists(fp) and os.access(fp, os.X_OK)
|
|
||||||
fpath, fname = os.path.split(prog)
|
|
||||||
if fpath:
|
|
||||||
if is_exe(prog):
|
|
||||||
return prog
|
|
||||||
else:
|
|
||||||
for path in os.environ["PATH"].split(os.pathsep):
|
|
||||||
filename = os.path.join(path, prog)
|
|
||||||
if is_exe(filename):
|
|
||||||
return filename
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def version_split(ver):
|
def version_split(ver):
|
||||||
return "%d.%d.%d" % (
|
return "%d.%d.%d" % (
|
||||||
((ver >> 16) & 0xffff),
|
((ver >> 16) & 0xffff),
|
||||||
|
|
Loading…
Add table
Reference in a new issue