# Path: guake/globals.py
# NAME = "guake"
# 
# Path: guake/globals.py
# def bindtextdomain(app_name, locale_dir=None):
#     """
#     Bind the domain represented by app_name to the locale directory locale_dir.
#     It has the effect of loading translations, enabling applications for different
#     languages.
# 
#     app_name:
#         a domain to look for translations, typically the name of an application.
# 
#     locale_dir:
#         a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
#         If omitted or None, then the current binding for app_name is used.
#     """
# 
#     # pylint: disable=import-outside-toplevel
#     import locale
# 
#     # pylint: enable=import-outside-toplevel
# 
#     log.info("Local binding for app '%s', local dir: %s", app_name, locale_dir)
# 
#     locale.bindtextdomain(app_name, locale_dir)
#     locale.textdomain(app_name)
# 
# Path: guake/support.py
# def print_support():
#     print("<details><summary>$ guake --support</summary>")
#     print()
#     get_version()
#     get_desktop_session()
#     get_display()
# 
# Path: guake/utils.py
# def restore_preferences(filename):
#     # XXX: Hardcode?
#     with open(filename, "rb") as f:
#         prefs = f.read()
#     with subprocess.Popen(["dconf", "load", "/apps/guake/"], stdin=subprocess.PIPE) as p:
#         p.communicate(input=prefs)
# 
# Path: guake/utils.py
# def save_preferences(filename):
#     # XXX: Hardcode?
#     prefs = subprocess.check_output(["dconf", "dump", "/apps/guake/"])
#     with open(filename, "wb") as f:
#         f.write(prefs)


import builtins
import logging
import os
import signal
import subprocess
import sys
import uuid
        import gi
    import dbus
        import gi
from locale import gettext
from optparse import OptionParser
from guake.globals import NAME
from guake.globals import bindtextdomain
from guake.support import print_support
from guake.utils import restore_preferences
from guake.utils import save_preferences
    from guake.paths import LOCALE_DIR
        from guake import gtk_version
        from guake import guake_version
        from guake import vte_version
        from guake import vte_runtime_version
    from guake.dbusiface import DBUS_NAME
    from guake.dbusiface import DBUS_PATH
    from guake.dbusiface import DbusManager
    from guake.guake_logging import setupLogging
        from guake.guake_app import Guake
        from gi.repository import Gtk
            "        gir1.2-vte-2.91 \\\n"
            "        gir1.2-wnck-3.0 \\\n"
            "        libkeybinder-3.0-0 \\\n"
            "        libutempter0 \\\n"
            "        python3 \\\n"
            "        python3-dbus \\\n"
            "        python3-gi \\\n"
            "        python3-pip"
        )
        sys.exit(1)

    options = parser.parse_args()[0]
    if options.version:

        print(f"Guake Terminal: {guake_version()}")
        print(f"VTE: {vte_version()}")
        print(f"VTE runtime: {vte_runtime_version()}")
        print(f"Gtk: {gtk_version()}")
        sys.exit(0)

    if options.save_preferences and options.restore_preferences:
        parser.error("options --save-preferences and --restore-preferences are mutually exclusive")
    if options.save_preferences:
        save_preferences(options.save_preferences)
        sys.exit(0)
    elif options.restore_preferences:
        restore_preferences(options.restore_preferences)
        sys.exit(0)

    if options.support:

# Path: guake/globals.py
# NAME = "guake"
# 
# Path: guake/globals.py
# def bindtextdomain(app_name, locale_dir=None):
#     """
#     Bind the domain represented by app_name to the locale directory locale_dir.
#     It has the effect of loading translations, enabling applications for different
#     languages.
# 
#     app_name:
#         a domain to look for translations, typically the name of an application.
# 
#     locale_dir:
#         a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
#         If omitted or None, then the current binding for app_name is used.
#     """
# 
#     # pylint: disable=import-outside-toplevel
#     import locale
# 
#     # pylint: enable=import-outside-toplevel
# 
#     log.info("Local binding for app '%s', local dir: %s", app_name, locale_dir)
# 
#     locale.bindtextdomain(app_name, locale_dir)
#     locale.textdomain(app_name)
# 
# Path: guake/support.py
# def print_support():
#     print("<details><summary>$ guake --support</summary>")
#     print()
#     get_version()
#     get_desktop_session()
#     get_display()
# 
# Path: guake/utils.py
# def restore_preferences(filename):
#     # XXX: Hardcode?
#     with open(filename, "rb") as f:
#         prefs = f.read()
#     with subprocess.Popen(["dconf", "load", "/apps/guake/"], stdin=subprocess.PIPE) as p:
#         p.communicate(input=prefs)
# 
# Path: guake/utils.py
# def save_preferences(filename):
#     # XXX: Hardcode?
#     prefs = subprocess.check_output(["dconf", "dump", "/apps/guake/"])
#     with open(filename, "wb") as f:
#         f.write(prefs)


# Path: guake/main.py
import builtins
import logging
import os
import signal
import subprocess
import sys
import uuid
        import gi
    import dbus
        import gi
from locale import gettext
from optparse import OptionParser
from guake.globals import NAME
from guake.globals import bindtextdomain
from guake.support import print_support
from guake.utils import restore_preferences
from guake.utils import save_preferences
    from guake.paths import LOCALE_DIR
        from guake import gtk_version
        from guake import guake_version
        from guake import vte_version
        from guake import vte_runtime_version
    from guake.dbusiface import DBUS_NAME
    from guake.dbusiface import DBUS_PATH
    from guake.dbusiface import DbusManager
    from guake.guake_logging import setupLogging
        from guake.guake_app import Guake
        from gi.repository import Gtk

            "        gir1.2-vte-2.91 \\\n"
            "        gir1.2-wnck-3.0 \\\n"
            "        libkeybinder-3.0-0 \\\n"
            "        libutempter0 \\\n"
            "        python3 \\\n"
            "        python3-dbus \\\n"
            "        python3-gi \\\n"
            "        python3-pip"
        )
        sys.exit(1)

    options = parser.parse_args()[0]
    if options.version:

        print(f"Guake Terminal: {guake_version()}")
        print(f"VTE: {vte_version()}")
        print(f"VTE runtime: {vte_runtime_version()}")
        print(f"Gtk: {gtk_version()}")
        sys.exit(0)

    if options.save_preferences and options.restore_preferences:
        parser.error("options --save-preferences and --restore-preferences are mutually exclusive")
    if options.save_preferences:
        save_preferences(options.save_preferences)
        sys.exit(0)
    elif options.restore_preferences:
        restore_preferences(options.restore_preferences)
        sys.exit(0)

    if options.support:

        print_support()