File: __init__.py.in.in

package info (click to toggle)
idjc 0.8.17-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 9,628 kB
  • sloc: python: 20,415; ansic: 15,941; sh: 4,869; makefile: 189; sed: 16
file content (124 lines) | stat: -rw-r--r-- 4,087 bytes parent folder | download
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
"""Main IDJC python package initialiser.

Generated from file __init__.py.in.in -- edit the original.
"""

#   Copyright (C) 2011, 2012 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 pygtk
pygtk.require("2.0")
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(object):
    """Namespace class of variables which cannot be altered.

    These are set by the build process.
    """

    __metaclass__ = FixedAttributes

    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@
    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(object):
    """Values which cannot be changed once they have been read."""
      
    __metaclass__ = PolicedAttributes

    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"
    default_icon = FGlobs.pkgdatadir / "icon.png"
    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_effects = 24
    num_panpresets = 3
    theme = "lighttheme"
    themedir = FGlobs.lightthemedir


def main():
    """Package execution entry point."""

    from .prelims import ProfileManager  # pylint: disable=W0404
    ProfileManager()

    from . import maingui  # pylint: disable=W0404
    return maingui.main()