File: syncthing-gtk.py

package info (click to toggle)
syncthing-gtk 0.9.4.4%2Bds%2Bgit20201209%2Bc46fbd8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,260 kB
  • sloc: python: 7,592; sh: 259; xml: 115; makefile: 2
file content (41 lines) | stat: -rwxr-xr-x 1,377 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
#!/usr/bin/env python3
import os, sys, gi

if __name__ == "__main__":
	gi.require_version('Gtk', '3.0')
	gi.require_version('Rsvg', '2.0')
	
	from syncthing_gtk.tools import init_logging, init_locale, IS_WINDOWS
	init_logging()
	
	if IS_WINDOWS:
		from syncthing_gtk.windows import (
			enable_localization,
			fix_localized_system_error_messages,
			override_menu_borders
		)
		from syncthing_gtk.configuration import Configuration
		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("./glade", "./icons").run(sys.argv)