def __init__(self, gladepath="/usr/share/syncthing-gtk", iconpath="/usr/share/syncthing-gtk/icons", config=None): # Init Gtk.Assistant.__init__(self) if not config is None: self.config = config else: self.config = Configuration() self.gladepath = gladepath self.iconpath = iconpath self.syncthing_options = {} self.lines = [] # Daemon and wizard output, # maybe for error reports self.finished = False self.connect("prepare", self.prepare_page) # Find syncthing configuration directory self.st_configdir = os.path.join(get_config_dir(), "syncthing") self.st_configfile = os.path.join(get_config_dir(), "syncthing", "config.xml") # Window setup self.set_position(Gtk.WindowPosition.CENTER) self.set_size_request(720, -1) self.set_default_size(720, 300) self.set_deletable(True) if IS_WINDOWS: self.set_icon_list([ GdkPixbuf.Pixbuf.new_from_file( "icons/32x32/apps/syncthing-gtk.png") ]) else: self.set_icon_name("syncthing-gtk") self.set_title("%s %s" % (_("Syncthing-GTK"), _("First run wizard"))) # Add "Quit" button self.quit_button = Gtk.Button.new_from_stock("gtk-quit") self.add_action_widget(self.quit_button) self.quit_button.set_visible(True) self.quit_button.connect("clicked", lambda *a: self.emit("cancel")) # Pages self.add_page(IntroPage(self)) self.add_page(FindDaemonPage()) self.add_page(GenerateKeysPage()) self.add_page(HttpSettingsPage()) self.add_page(SaveSettingsPage()) self.add_page(LastPage())
if __name__ == "__main__": signal.signal(signal.SIGINT, sigint) 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(