Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class FieldTranslationText(aeidon.EnumerationItem):
is_position = False
is_text = True
label = _("Translation")
tooltip = _("Translation")
fields = aeidon.Enumeration()
fields.NUMBER = FieldNumber()
fields.START = FieldStart()
fields.END = FieldEnd()
fields.DURATION = FieldDuration()
fields.MAIN_TEXT = FieldMainText()
fields.TRAN_TEXT = FieldTranslationText()
class LengthUnitChar(aeidon.EnumerationItem):
label = _("characters")
class LengthUnitEm(aeidon.EnumerationItem):
label = _("ems")
length_units = aeidon.Enumeration()
length_units.CHAR = LengthUnitChar()
length_units.EM = LengthUnitEm()
class OrientationHorizontal(aeidon.EnumerationItem):
value = Gtk.Orientation.HORIZONTAL
class OrientationVertical(aeidon.EnumerationItem):
value = Gtk.Orientation.VERTICAL
"$VIDEOFILE",
":start-time=$SECONDS",
":sub-file=$SUBFILE",
":subsdec-encoding=UTF-8",))
executable = _get_vlc_executable()
found = shutil.which(_get_vlc_executable()) is not None
label = "VLC"
players = aeidon.Enumeration()
players.MPLAYER = PlayerMPlayer()
players.MPV = PlayerMPV()
players.VLC = PlayerVLC()
class RegisterDo(aeidon.EnumerationItem):
shift = 1
signal = "action-done"
class RegisterUndo(aeidon.EnumerationItem):
shift = -1
signal = "action-undone"
class RegisterRedo(aeidon.EnumerationItem):
shift = 1
signal = "action-redone"
registers = aeidon.Enumeration()
registers.DO = RegisterDo()
registers.UNDO = RegisterUndo()
registers.REDO = RegisterRedo()
has_header = True
identifier = r"^\{-?\d+\}\{-?\d+\}"
label = "MicroDVD"
mime_type = "text/x-microdvd"
mode = modes.FRAME
class FormatMPL2(aeidon.EnumerationItem):
container = None
extension = ".txt"
has_header = False
identifier = r"^\[-?\d+\]\[-?\d+\]"
label = "MPL2"
mime_type = "text/plain"
mode = modes.TIME
class FormatSubRip(aeidon.EnumerationItem):
container = "subrip"
extension = ".srt"
has_header = False
identifier = (r"^-?\d\d:\d\d:\d\d,\d\d\d -->"
r" -?\d\d:\d\d:\d\d,\d\d\d"
r"( X1:\d+ X2:\d+ Y1:\d+ Y2:\d+)?\s*$")
label = "SubRip"
mime_type = "application/x-subrip"
mode = modes.TIME
class FormatSubStationAlpha(aeidon.EnumerationItem):
container = "ssa"
extension = ".ssa"
has_header = True
identifier = r"^ScriptType:\s*[vV]4.00\s*$"
registers = aeidon.Enumeration()
registers.DO = RegisterDo()
registers.UNDO = RegisterUndo()
registers.REDO = RegisterRedo()
class FormatAdvSubStationAlpha(aeidon.EnumerationItem):
container = "ssa"
extension = ".ass"
has_header = True
identifier = r"^ScriptType:\s*[vV]4.00\+\s*$"
label = "Advanced Sub Station Alpha"
mime_type = "text/x-ssa"
mode = modes.TIME
class FormatLRC(aeidon.EnumerationItem):
container = None
extension = ".lrc"
has_header = True
identifier = r"^\[-?\d\d:\d\d\.\d\d\]"
label = "LRC"
mime_type = "text/plain"
mode = modes.TIME
class FormatMicroDVD(aeidon.EnumerationItem):
container = None
extension = ".sub"
has_header = True
identifier = r"^\{-?\d+\}\{-?\d+\}"
label = "MicroDVD"
mime_type = "text/x-microdvd"
mode = modes.FRAME
def encode(self, obj):
"""Return JSON string matching `obj`."""
if isinstance(obj, aeidon.EnumerationItem):
return str(obj)
if isinstance(obj, (list, tuple)) and obj:
if isinstance(obj[0], aeidon.EnumerationItem):
return "[{}]".format(", ".join(map(str, obj)))
return json.JSONEncoder.encode(self, obj)
def _on_columns_changed(self, *args):
"""Reset the columns enumeration to match new column layout."""
count_changed = (len(self.columns) != len(self.get_columns()))
self._reset_columns()
field_order = []
for column in self.get_columns():
attribute = column.gaupol_id.upper()
item = aeidon.EnumerationItem()
setattr(self.columns, attribute, item)
if hasattr(gaupol.fields, attribute):
field = getattr(gaupol.fields, attribute)
field_order.append(field)
if not count_changed:
gaupol.conf.editor.field_order = field_order
"-noautosub",
"-sub $SUBFILE",
"-utf8",
"$VIDEOFILE",))
if sys.platform != "win32":
# Required for mplayer to work if gaupol was started
# as a background process (&) from a terminal window.
# http://www.mplayerhq.hu/DOCS/HTML/en/faq.html#idm5930
command_utf_8 = "{} < /dev/null".format(command_utf_8)
executable = _get_mplayer_executable()
found = shutil.which(_get_mplayer_executable()) is not None
label = "MPlayer"
class PlayerMPV(aeidon.EnumerationItem):
command = " ".join((_get_mpv_executable(),
"--quiet",
"--osd-level=2",
"--hr-seek=yes",
"--start=$SECONDS",
"--sub-file=$SUBFILE",
"$VIDEOFILE",))
command_utf_8 = " ".join((_get_mpv_executable(),
"--quiet",
"--osd-level=2",
"--hr-seek=yes",
"--start=$SECONDS",
"--sub-file=$SUBFILE",
"--sub-codepage=utf-8",
"$VIDEOFILE",))
label = _("Subtitle position")
align_methods = aeidon.Enumeration()
align_methods.NUMBER = AlignMethodNumber()
align_methods.POSITION = AlignMethodPosition()
class DocumentMain(aeidon.EnumerationItem): pass
class DocumentTranslation(aeidon.EnumerationItem): pass
documents = aeidon.Enumeration()
documents.MAIN = DocumentMain()
documents.TRAN = DocumentTranslation()
class Framerate23976(aeidon.EnumerationItem):
label = _("23.976 fps")
value = 24 / 1.001
class Framerate24000(aeidon.EnumerationItem):
label = _("24.000 fps")
value = 24.0
class Framerate25000(aeidon.EnumerationItem):
label = _("25.000 fps")
value = 25.0
class Framerate29970(aeidon.EnumerationItem):
label = _("29.970 fps")
value = 30 / 1.001
framerates = aeidon.Enumeration()
def _add_framerates(self):
"""Add custom framerates and corresponding UI elements."""
self.framerates = []
menu = self.application.get_menubar_section(
"custom-framerates-placeholder")
for value in sorted(self.conf.framerates):
name = "FPS_{:.3f}".format(value).replace(".", "_")
if hasattr(aeidon.framerates, name): continue
setattr(aeidon.framerates, name, aeidon.EnumerationItem())
framerate = getattr(aeidon.framerates, name)
framerate.label = _("{:.3f} fps").format(value)
framerate.value = float(value)
self.framerates.append(framerate)
with aeidon.util.silent(AttributeError):
# Menubar not available when running unit tests.
action = "win.set-framerate::{}".format(name)
menu.append(framerate.label, action)
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
"""Enumerations for document types."""
import aeidon
__all__ = ("documents",)
class Main(aeidon.EnumerationItem):
pass
class Translation(aeidon.EnumerationItem):
pass
documents = aeidon.Enumeration()
documents.MAIN = Main()
documents.TRAN = Translation()