File: syncthing-gtk.py

package info (click to toggle)
syncthing-gtk 0.9.4.4%2Bds%2Bgit20221205%2B12a9702d29ab-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,888 kB
  • sloc: python: 8,077; sh: 259; xml: 134; makefile: 6
file content (46 lines) | stat: -rwxr-xr-x 1,572 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python3
import os
import sys

import gi


if __name__ == "__main__":
    gi.require_version('Gtk', '3.0')
    gi.require_version('Gdk', '3.0')
    gi.require_version('Rsvg', '2.0')

    from syncthing_gtk.tools import IS_WINDOWS, init_locale, init_logging
    init_logging()

    if IS_WINDOWS:
        from syncthing_gtk.configuration import Configuration
        from syncthing_gtk.windows import enable_localization, fix_localized_system_error_messages, override_menu_borders
        config = Configuration()
        if config["force_dark_theme"]:
            os.environ["GTK_THEME"] = "Adwaita:dark"
        if config["language"] not in ("", "None", None):
            os.environ["LANGUAGE"] = config["language"]

        enable_localization()

    init_locale("locale/")

    if IS_WINDOWS:
        from syncthing_gtk.windows import enable_localization
        fix_localized_system_error_messages()
        override_menu_borders()
        from gi.repository import Gtk
        Gtk.IconTheme.get_default().prepend_search_path(
            os.path.abspath(os.path.join(os.getcwd(), "icons", "32x32", "apps")))
        Gtk.IconTheme.get_default().prepend_search_path(
            os.path.abspath(os.path.join(os.getcwd(), "icons")))

    from gi.repository import Gtk
    Gtk.IconTheme.get_default().prepend_search_path(
        os.path.join(os.getcwd(), "icons"))
    Gtk.IconTheme.get_default().prepend_search_path(
        os.path.join(os.getcwd(), "icons/32x32/status"))

    from syncthing_gtk.app import App
    App("./ui", "./icons").run(sys.argv)