1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
"""Main IDJC python package initialiser.
Generated from file __init__.py.in.in -- edit the original.
"""
# Copyright (C) 2011-2024 Stephen Fairchild (s-fairchild@users.sourceforge.net)
# 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 2 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 in the file entitled COPYING.
# If not, see <http://www.gnu.org/licenses/>.
import os
import gettext
import ctypes
import sys
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("GLib", "2.0")
gi.require_version("GObject", "2.0")
gi.require_version("Gdk", "3.0")
gi.require_version("GdkPixbuf", "2.0")
from gi.repository import GLib
from .utils import FixedAttributes
from .utils import PolicedAttributes
from .utils import PathStr
def lib_probe(at_runtime, names, extension):
if at_runtime:
for name in names.split():
name += extension
try:
ctypes.CDLL(name)
except Exception:
continue
else:
return True, name
else:
return False, ""
else:
return True, ""
class FGlobs(metaclass=FixedAttributes):
"""Namespace class of variables which cannot be altered.
These are set by the build process.
"""
datarootdir = PathStr("""@datarootdir@""")
libdir = PathStr("""@libdir@""")
pkglibdir = PathStr("""${pkglibdir}""")
pkgdatadir = PathStr("""${pkgdatadir}""")
darkthemedir = pkgdatadir / "darktheme"
lightthemedir = pkgdatadir / "lighttheme"
localedir = PathStr("""@localedir@""")
bindir = PathStr("""@bindir@""")
avenabled = (0, 1)[@HAVE_AVFORMAT@ and @HAVE_AVCODEC@ and @HAVE_AVUTIL@]
flacenabled = @HAVE_FLAC@
oggflacenabled = @HAVE_OGGFLAC@
opusenabled = @HAVE_OPUS@
speexenabled = @HAVE_SPEEX@
twolameenabled = @HAVE_TWOLAME@
reallibshoutidjc = @REAL_LIBSHOUTIDJC@
shouttlsenabled = @HAVE_SHOUT_TLS@
have_libmp3lame, libmp3lame_filename = lib_probe(@DYN_LAME@,
"libmp3lame liblame", """@DYLIB_EXT@""")
have_libmpg123, libmpg123_filename = lib_probe(@DYN_MPG123@,
"libmpg123", """@DYLIB_EXT@""")
package_name = """@PACKAGE_NAME@"""
package_version = """@PACKAGE_VERSION@"""
backend = PathStr("""${pkglibdir}""") / ("idjc" + """@DYLIB_EXT@""")
_ = gettext.translation(FGlobs.package_name, FGlobs.localedir,
fallback=True).gettext
class PGlobs(metaclass = PolicedAttributes):
"""Values which cannot be changed once they have been read."""
config_dir = PathStr(GLib.get_user_config_dir()) / FGlobs.package_name
#config_dir = PathStr(os.path.expanduser("~")) / ("." + FGlobs.package_name)
profile_dir = config_dir / "profiles"
dbus_bus_basename = "net.sf." + FGlobs.package_name
dbus_objects_basename = "/net/sf/" + FGlobs.package_name
app_shortform = "IDJC"
app_longform = "Internet DJ Console"
jack_prefix = "idjc"
default_icon = FGlobs.pkgdatadir / "icon.svg"
autoload_profile_pathname = config_dir / "autoload-profile"
copyright = _("Copyright 2005-%s Stephen Fairchild and others."
) % """@COPYRIGHT_YEAR@"""
license = _("Released under the GNU General Public License V2.0+.")
num_micpairs = 2
num_streamers = 6
num_encoders = 6
num_recorders = 2
num_mini_players = 36
num_panpresets = 3
theme = "lighttheme"
themedir = FGlobs.lightthemedir
def main():
"""Package execution entry point."""
from .prelims import ProfileManager
pm = ProfileManager()
print(FGlobs.package_name, FGlobs.package_version)
print(sys.implementation.name, sys.version)
if pm.testing:
from .testing import main
else:
from .maingui import main
return main()
|