mirror of
https://github.com/ModOrganizer2/modorganizer-preview_dds.git
synced 2026-07-27 14:06:05 -07:00
Fix pylupdate parsing
This commit is contained in:
+12
-12
@@ -34,7 +34,7 @@ class DDSFile:
|
||||
with Path(self.fileName).open('rb') as file:
|
||||
magicNumber = file.read(4)
|
||||
if magicNumber != DDSDefinitions.DDS_MAGIC_NUMBER:
|
||||
qCritical(self.__tr("Magic number mismatch."))
|
||||
qCritical(self.tr("Magic number mismatch."))
|
||||
raise DDSReadException()
|
||||
|
||||
self.header.fromStream(file)
|
||||
@@ -88,7 +88,7 @@ class DDSFile:
|
||||
# Pixel Format says the FourCC
|
||||
elif self.header.ddspf.dwFlags & DDSDefinitions.DDS_PIXELFORMAT.Flags.DDPF_FOURCC:
|
||||
fourCC = self.header.ddspf.dwFourCC
|
||||
format = self.__tr("{0} (equivalent to {1})").format(fourCC.decode('ascii'),
|
||||
format = self.tr("{0} (equivalent to {1})").format(fourCC.decode('ascii'),
|
||||
DDSDefinitions.fourCCToDXGI(fourCC).name.replace(
|
||||
"DXGI_FORMAT_", ""))
|
||||
# We've got bitmasks for the colour channels
|
||||
@@ -96,26 +96,26 @@ class DDSFile:
|
||||
# This could be prettier if there was logic to detect that certain common bitmasks represented things more easily represented, like RGBA8
|
||||
if self.header.ddspf.dwFlags & (
|
||||
DDSDefinitions.DDS_PIXELFORMAT.Flags.DDPF_RGB | DDSDefinitions.DDS_PIXELFORMAT.Flags.DDPF_YUV):
|
||||
format += self.__tr("Red bitmask {0}, Green bitmask {1}, Blue bitmask {2}").format(
|
||||
format += self.tr("Red bitmask {0}, Green bitmask {1}, Blue bitmask {2}").format(
|
||||
self.header.ddspf.dwRBitMask.hex().upper(), self.header.ddspf.dwGBitMask.hex().upper(),
|
||||
self.header.ddspf.dwBBitMask.hex().upper())
|
||||
if self.header.ddspf.dwFlags & DDSDefinitions.DDS_PIXELFORMAT.Flags.DDPF_LUMINANCE:
|
||||
if format != "":
|
||||
format += ", "
|
||||
format += self.__tr("Luminance bitmask {0}").format(self.header.ddspf.dwRBitMask.hex().upper())
|
||||
format += self.tr("Luminance bitmask {0}").format(self.header.ddspf.dwRBitMask.hex().upper())
|
||||
if self.header.ddspf.dwFlags & (
|
||||
DDSDefinitions.DDS_PIXELFORMAT.Flags.DDPF_ALPHA | DDSDefinitions.DDS_PIXELFORMAT.Flags.DDPF_ALPHAPIXELS):
|
||||
if format != "":
|
||||
format += ", "
|
||||
format += self.__tr("Alpha bitmask {0}").format(self.header.ddspf.dwABitMask.hex().upper())
|
||||
format += self.tr("Alpha bitmask {0}").format(self.header.ddspf.dwABitMask.hex().upper())
|
||||
|
||||
size = self.__tr("{0}×{1}").format(self.header.dwWidth, self.header.dwHeight)
|
||||
size = self.tr("{0}×{1}").format(self.header.dwWidth, self.header.dwHeight)
|
||||
|
||||
dimensions = self.__tr("Cubemap") if self.isCubemap else self.__tr("2D")
|
||||
dimensions = self.tr("Cubemap") if self.isCubemap else self.tr("2D")
|
||||
|
||||
mipmaps = self.__tr("Mipmapped") if self.mipLevels() != 1 else self.__tr("No mipmaps")
|
||||
mipmaps = self.tr("Mipmapped") if self.mipLevels() != 1 else self.tr("No mipmaps")
|
||||
|
||||
return self.__tr("{0}, {1} {2}, {3}").format(format, size, dimensions, mipmaps)
|
||||
return self.tr("{0}, {1} {2}, {3}").format(format, size, dimensions, mipmaps)
|
||||
|
||||
def mipLevels(self):
|
||||
if self.header.dwFlags & DDSDefinitions.DDS_HEADER.Flags.DDSD_MIPMAPCOUNT:
|
||||
@@ -137,13 +137,13 @@ class DDSFile:
|
||||
compatible = True
|
||||
break
|
||||
if not compatible:
|
||||
qCritical(self.__tr("OpenGL driver incompatible with texture format."))
|
||||
qCritical(self.tr("OpenGL driver incompatible with texture format."))
|
||||
return None
|
||||
|
||||
if self.header.dwCaps2 & DDSDefinitions.DDS_HEADER.Caps2.DDSCAPS2_CUBEMAP:
|
||||
texture = QOpenGLTexture(QOpenGLTexture.Target.TargetCubeMap)
|
||||
if self.header.dwWidth != self.header.dwHeight:
|
||||
qCritical(self.__tr("Cubemap faces must be square"))
|
||||
qCritical(self.tr("Cubemap faces must be square"))
|
||||
return None
|
||||
else:
|
||||
# Assume GL_TEXTURE_2D for now
|
||||
@@ -202,5 +202,5 @@ class DDSFile:
|
||||
|
||||
return texture
|
||||
|
||||
def __tr(self, str):
|
||||
def tr(self, str):
|
||||
return QCoreApplication.translate("DDSFile", str)
|
||||
+10
-10
@@ -186,7 +186,7 @@ class DDSWidget(QOpenGLWidget):
|
||||
if self.logger:
|
||||
self.logger.initialize()
|
||||
self.logger.messageLogged.connect(
|
||||
lambda message: qDebug(self.__tr("OpenGL debug message: {0}").fomat(message.message())))
|
||||
lambda message: qDebug(self.tr("OpenGL debug message: {0}").fomat(message.message())))
|
||||
self.logger.startLogging()
|
||||
|
||||
gl = QOpenGLVersionFunctionsFactory.get(glVersionProfile)
|
||||
@@ -300,7 +300,7 @@ class DDSWidget(QOpenGLWidget):
|
||||
def getBackgroundColour(self):
|
||||
return self.backgroundColour
|
||||
|
||||
def __tr(self, str):
|
||||
def tr(self, str):
|
||||
return QCoreApplication.translate("DDSWidget", str)
|
||||
|
||||
|
||||
@@ -321,18 +321,18 @@ class DDSPreview(mobase.IPluginPreview):
|
||||
return "AnyOldName3"
|
||||
|
||||
def description(self):
|
||||
return self.__tr("Lets you preview DDS files by actually uploading them to the GPU.")
|
||||
return self.tr("Lets you preview DDS files by actually uploading them to the GPU.")
|
||||
|
||||
def version(self):
|
||||
return mobase.VersionInfo(1, 0, 0, 0)
|
||||
|
||||
def settings(self):
|
||||
return [mobase.PluginSetting("log gl errors", self.__tr(
|
||||
return [mobase.PluginSetting("log gl errors", self.tr(
|
||||
"If enabled, log OpenGL errors and debug messages. May decrease performance."), False),
|
||||
mobase.PluginSetting("background r", self.__tr("Red channel of background colour"), 0),
|
||||
mobase.PluginSetting("background g", self.__tr("Green channel of background colour"), 0),
|
||||
mobase.PluginSetting("background b", self.__tr("Blue channel of background colour"), 0),
|
||||
mobase.PluginSetting("background a", self.__tr("Alpha channel of background colour"), 0)]
|
||||
mobase.PluginSetting("background r", self.tr("Red channel of background colour"), 0),
|
||||
mobase.PluginSetting("background g", self.tr("Green channel of background colour"), 0),
|
||||
mobase.PluginSetting("background b", self.tr("Blue channel of background colour"), 0),
|
||||
mobase.PluginSetting("background a", self.tr("Alpha channel of background colour"), 0)]
|
||||
|
||||
def supportedExtensions(self):
|
||||
return ["dds"]
|
||||
@@ -356,7 +356,7 @@ class DDSPreview(mobase.IPluginPreview):
|
||||
widget.setLayout(layout)
|
||||
return widget
|
||||
|
||||
def __tr(self, str):
|
||||
def tr(self, str):
|
||||
return QCoreApplication.translate("DDSPreview", str)
|
||||
|
||||
def __makeLabel(self, ddsFile):
|
||||
@@ -366,7 +366,7 @@ class DDSPreview(mobase.IPluginPreview):
|
||||
return label
|
||||
|
||||
def __makeColourButton(self, ddsWidget):
|
||||
button = QPushButton(self.__tr("Pick background colour"))
|
||||
button = QPushButton(self.tr("Pick background colour"))
|
||||
savedColour = QColor(self.__organizer.pluginSetting(self.name(), "background r"),
|
||||
self.__organizer.pluginSetting(self.name(), "background g"),
|
||||
self.__organizer.pluginSetting(self.name(), "background b"),
|
||||
|
||||
+49
-82
@@ -1,117 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS><TS version="2.0">
|
||||
<context>
|
||||
<name>DDSFile</name>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="32"/>
|
||||
<source>Magic number mismatch.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0">
|
||||
<context><name>DDSFile</name><message>
|
||||
<location filename="DDS\DDSFile.py" line="37" /><location filename="DDS\DDSFile.py" line="37" /><source>Magic number mismatch.</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="85"/>
|
||||
<source>{0} (equivalent to {1})</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="91" /><location filename="DDS\DDSFile.py" line="91" /><source>{0} (equivalent to {1})</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="90"/>
|
||||
<source>Red bitmask {0}, Green bitmask {1}, Blue bitmask {2}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="99" /><location filename="DDS\DDSFile.py" line="99" /><source>Red bitmask {0}, Green bitmask {1}, Blue bitmask {2}</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="94"/>
|
||||
<source>Luminance bitmask {0}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="105" /><location filename="DDS\DDSFile.py" line="105" /><source>Luminance bitmask {0}</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="98"/>
|
||||
<source>Alpha bitmask {0}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="110" /><location filename="DDS\DDSFile.py" line="110" /><source>Alpha bitmask {0}</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message><location filename="DDS\DDSFile.py" line="112" /><location filename="DDS\DDSFile.py" line="112" /><source>{0}×{1}</source><translation type="unfinished" /></message><message>
|
||||
<location filename="DDS\DDSFile.py" line="114" /><location filename="DDS\DDSFile.py" line="114" /><source>Cubemap</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="100"/>
|
||||
<source>{0}×{1}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="114" /><location filename="DDS\DDSFile.py" line="114" /><source>2D</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="102"/>
|
||||
<source>Cubemap</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="116" /><location filename="DDS\DDSFile.py" line="116" /><source>Mipmapped</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="102"/>
|
||||
<source>2D</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="116" /><location filename="DDS\DDSFile.py" line="116" /><source>No mipmaps</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="104"/>
|
||||
<source>Mipmapped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="118" /><location filename="DDS\DDSFile.py" line="118" /><source>{0}, {1} {2}, {3}</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="104"/>
|
||||
<source>No mipmaps</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="140" /><location filename="DDS\DDSFile.py" line="140" /><source>OpenGL driver incompatible with texture format.</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="106"/>
|
||||
<source>{0}, {1} {2}, {3}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDS\DDSFile.py" line="146" /><location filename="DDS\DDSFile.py" line="146" /><source>Cubemap faces must be square</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
</context><context><name>DDSPreview</name><message>
|
||||
<location filename="DDSPreview.py" line="324" /><source>Lets you preview DDS files by actually uploading them to the GPU.</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="128"/>
|
||||
<source>OpenGL driver incompatible with texture format.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDSPreview.py" line="330" /><source>If enabled, log OpenGL errors and debug messages. May decrease performance.</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDS/DDSFile.py" line="134"/>
|
||||
<source>Cubemap faces must be square</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DDSPreview</name>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="321"/>
|
||||
<source>Lets you preview DDS files by actually uploading them to the GPU.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDSPreview.py" line="332" /><source>Red channel of background colour</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="327"/>
|
||||
<source>If enabled, log OpenGL errors and debug messages. May decrease performance.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDSPreview.py" line="333" /><source>Green channel of background colour</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="328"/>
|
||||
<source>Red channel of background colour</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDSPreview.py" line="334" /><source>Blue channel of background colour</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="329"/>
|
||||
<source>Green channel of background colour</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDSPreview.py" line="335" /><source>Alpha channel of background colour</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="330"/>
|
||||
<source>Blue channel of background colour</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="DDSPreview.py" line="369" /><source>Pick background colour</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="331"/>
|
||||
<source>Alpha channel of background colour</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</context><context><name>DDSWidget</name><message>
|
||||
<location filename="DDSPreview.py" line="189" /><source>OpenGL debug message: {0}</source>
|
||||
<translation type="unfinished" />
|
||||
</message>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="365"/>
|
||||
<source>Pick background colour</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DDSWidget</name>
|
||||
<message>
|
||||
<location filename="DDSPreview.py" line="186"/>
|
||||
<source>OpenGL debug message: {0}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
</context></TS>
|
||||
|
||||
Reference in New Issue
Block a user