Ejemplo n.º 1
0
 def setup_widgets(self, app):
     # Load glade file
     self.builder = UIBuilder()
     self.builder.add_from_file(os.path.join(self.gladepath, "about.glade"))
     self.builder.connect_signals(self)
     self.dialog = self.builder.get_object("dialog")
     # Get app version
     app_ver = "unknown"
     try:
         if IS_WINDOWS:
             # pkg_resources will not work on cx_Frozen package
             from syncthing_gtk.tools import get_install_path
             vfile = file(os.path.join(get_install_path(), "__version__"),
                          "r")
             app_ver = vfile.read().strip(" \t\r\n")
         else:
             import pkg_resources, syncthing_gtk
             if syncthing_gtk.__file__.startswith(
                     pkg_resources.require("syncthing-gtk")[0].location):
                 app_ver = pkg_resources.require("syncthing-gtk")[0].version
     except:
         # pkg_resources is not available or __version__ file missing
         # There is no reason to crash on this.
         pass
     # Get daemon version
     try:
         daemon_ver = app.daemon.get_version()
         app_ver = "%s (Daemon %s)" % (app_ver, daemon_ver)
     except:
         # App is None or daemon version is not yet known
         pass
     # Display versions in UI
     self.builder.get_object("lblVersion").set_label(app_ver)
Ejemplo n.º 2
0
	def setup_widgets(self, app):
		self.builder = UIBuilder()
		# Fix icon path
		self.builder.replace_icon_path("icons/", self.iconpath)
		# Load glade file
		self.builder.add_from_file(os.path.join(self.gladepath, "about.glade"))
		self.builder.connect_signals(self)
		self.dialog = self.builder.get_object("dialog")
		# Get app version
		app_ver = "unknown"
		try:
			if IS_WINDOWS:
				# pkg_resources will not work on cx_Frozen package
				from syncthing_gtk.tools import get_install_path
				with open(os.path.join(get_install_path(), "__version__"), "r") as vfile:
					app_ver = vfile.read().strip(" \t\r\n")
			else:
				import pkg_resources, syncthing_gtk
				if syncthing_gtk.__file__.startswith(pkg_resources.require("syncthing-gtk")[0].location):
					app_ver = pkg_resources.require("syncthing-gtk")[0].version
		except:
			# pkg_resources is not available or __version__ file missing
			# There is no reason to crash on this.
			pass
		# Get daemon version
		try:
			daemon_ver = app.daemon.get_version()
			app_ver = "%s (Daemon %s)" % (app_ver, daemon_ver)
		except:
			# App is None or daemon version is not yet known
			pass
		# Display versions in UI
		self.builder.get_object("lblVersion").set_label(app_ver)
Ejemplo n.º 3
0
	def setup_widgets(self, app):
		# Load glade file
		self.builder = Gtk.Builder()
		self.builder.add_from_file(os.path.join(self.gladepath, "about.glade"))
		self.builder.connect_signals(self)
		self.dialog = self.builder.get_object("dialog")
		# Get app version
		app_ver = "unknown"
		try:
			if IS_WINDOWS:
				# pkg_resources will not work on cx_Frozen package
				from syncthing_gtk.tools import get_install_path
				vfile = file(os.path.join(get_install_path(), "__version__"), "r")
				app_ver = vfile.read().strip(" \t\r\n")
			else:
				import pkg_resources
				app_ver = pkg_resources.require("syncthing-gtk")[0].version
		except:
			# pkg_resources is not available or __version__ file missing
			# There is no reason to crash on this.
			pass
		# Get daemon version
		try:
			daemon_ver = app.get_daemon_version()
			app_ver = "%s (Daemon %s)" % (app_ver, daemon_ver)
		except:
			# App is None or daemon version is not yet known
			pass
		# Display versions in UI
		self.dialog.set_version(app_ver)
Ejemplo n.º 4
0
#!/c/Python27/python.exe
# Note: this one is used by Windows
import sys, os, gi, cairo, _winreg

if __name__ == "__main__":
    path = "."
    if not os.path.exists("./app.glade"):
        # Usually
        from syncthing_gtk.tools import get_install_path
        path = get_install_path()

    # Tell cx_Freeze that I really need this library
    gi.require_foreign('cairo')

    from syncthing_gtk.tools import init_logging
    init_logging()

    from syncthing_gtk import windows
    windows.fix_localized_system_error_messages()
    windows.dont_use_localization_in_gtk()
    windows.override_menu_borders()

    from syncthing_gtk import App
    App(path, os.path.join(path, "icons")).run(sys.argv)
#!/c/Python27/python.exe
# Note: this one is used by Windows
import sys, os, gi, cairo, _winreg

if __name__ == "__main__":
	path = "."
	if not os.path.exists("./app.glade"):
		# Usually
		from syncthing_gtk.tools import get_install_path
		path = get_install_path()
	
	# Tell cx_Freeze that I really need this library
	gi.require_foreign('cairo')
	
	from syncthing_gtk.tools import init_logging
	init_logging()
	
	from syncthing_gtk import windows
	windows.fix_localized_system_error_messages()
	windows.dont_use_localization_in_gtk()
	windows.override_menu_borders()
	
	from syncthing_gtk import App
	App(path, os.path.join(path, "icons")).run(sys.argv)