Ejemplo n.º 1
0
 def prepare(self):
     # Determine which Syncthing to use
     suffix, tag = StDownloader.determine_platform()
     # Report error on unsupported platforms
     if suffix is None or tag is None:
         pd = "%s %s %s" % (
             platform.uname()[0],
             platform.uname()[2],  # OS, version
             platform.uname()[4])  # architecture
         self.parent.error(
             self, _("Cannot download Syncthing daemon."),
             _("This platform (%s) is not supported") % (pd, ), False)
         return
     # Determine target file & directory
     self.target = os.path.join(
         os.path.expanduser(StDownloader.get_target_folder()),
         "syncthing%s" % (suffix, ))
     # Create downloader and connect events
     self.sd = StDownloader(self.target, tag)
     self.sd.connect("error", self.on_download_error)
     self.sd.connect("version", self.on_version)
     self.sd.connect("download-progress", self.on_progress)
     self.sd.connect("download-finished", self.on_extract_start)
     self.sd.connect("extraction-progress", self.on_progress)
     self.sd.connect("extraction-finished", self.on_extract_finished)
     # Start downloading
     self.sd.get_version()
Ejemplo n.º 2
0
 def prepare(self):
     default_path, default_binary = os.path.split(
         self.parent.config.get_default_value("syncthing_binary"))
     self.paths = []
     if default_path:
         self.paths += [default_path]
     self.paths += ["./"]
     self.paths += [os.path.expanduser("~/.local/bin")]
     self.paths += [self.parent.st_configdir]
     if is_portable():
         self.paths += [".\\data"]
     if StDownloader is None:
         self.binaries = ["syncthing"]
     else:
         suffix, trash = StDownloader.determine_platform()
         self.binaries = ["syncthing", "syncthing%s" % (suffix, )]
         if suffix == "x64":
             # Allow 32bit binary on 64bit
             self.binaries += ["syncthing.x86"]
         if default_binary not in self.binaries:
             self.binaries = [default_binary] + self.binaries
     if IS_WINDOWS:
         self.paths += [
             "c:/Program Files/syncthing",
             "c:/Program Files (x86)/syncthing", self.parent.st_configdir
         ]
         self.binaries = ("syncthing.exe", )
     if "PATH" in os.environ:
         self.paths += os.environ["PATH"].split(":")
     log.info("Searching for syncthing binary...")
     GLib.idle_add(self.search)
Ejemplo n.º 3
0
	def prepare(self):
		# Determine which Syncthing to use
		suffix, tag = StDownloader.determine_platform()
		# Report error on unsupported platforms
		if suffix is None or tag is None:
			pd = "%s %s %s" % (
				platform.uname()[0], platform.uname()[2],	# OS, version
				platform.uname()[4])						# architecture
			self.parent.error(self,
				_("Cannot download Syncthing daemon."),
				_("This platform (%s) is not supported") % (pd,),
				False)
			return
		# Determine target file & directory
		self.target = os.path.join(
			os.path.expanduser(StDownloader.get_target_folder()),
			"syncthing%s" % (suffix,)
			)
		# Create downloader and connect events
		self.sd = StDownloader(self.target, tag)
		self.sd.connect("error", self.on_download_error)
		self.sd.connect("version", self.on_version)
		self.sd.connect("download-progress", self.on_progress)
		self.sd.connect("download-finished", self.on_extract_start)
		self.sd.connect("extraction-progress", self.on_progress)
		self.sd.connect("extraction-finished", self.on_extract_finished)
		# Start downloading
		self.sd.get_version()
Ejemplo n.º 4
0
	def prepare(self):
		default_path, default_binary = os.path.split(
				self.parent.config.get_default_value("syncthing_binary"))
		self.paths = []
		if default_path:
			self.paths += [ default_path ]
		self.paths += [ "./" ]
		self.paths += [ os.path.expanduser("~/.local/bin") ]
		self.paths += [ self.parent.st_configdir ]
		if is_portable():
			self.paths += [ ".\\data" ]
		if StDownloader is None:
			self.binaries = ["syncthing"]
		else:
			suffix, trash = StDownloader.determine_platform()
			self.binaries = ["syncthing", "syncthing%s" % (suffix,)]
			if suffix == "x64":
				# Allow 32bit binary on 64bit
				self.binaries += ["syncthing.x86"]
			if default_binary not in self.binaries:
				self.binaries = [ default_binary ] + self.binaries
		if IS_WINDOWS:
			self.paths += [ "c:/Program Files/syncthing",
				"c:/Program Files (x86)/syncthing",
				self.parent.st_configdir
				]
			self.binaries = ("syncthing.exe",)
		if "PATH" in os.environ:
			self.paths += os.environ["PATH"].split(":")
		log.info("Searching for syncthing binary...")
		GLib.idle_add(self.search)
Ejemplo n.º 5
0
	def cb_btDownload_clicked(self, *a):
		"""
		Disable half of dialog and start downloading syncthing package
		"""
		# Determine which syncthing to use
		suffix, tag = StDownloader.determine_platform()
		# Report error on unsupported platforms
		if suffix is None or tag is None:
			# Disable download button
			self["btDownload"].set_sensitive(False)
			# Set message
			pd = "%s %s" % (
				platform.uname()[0],	# OS
				platform.uname()[4])	# architecture
			self["lblDownloadProgress"].set_markup("%s %s" % (
					_("Cannot download Syncthing daemon."),
					_("This platform (%s) is not supported") % (pd,),
				))
			return
		# Determine target file & directory
		self.target = os.path.join(
			os.path.expanduser(StDownloader.get_target_folder()),
			"syncthing%s" % (suffix,)
			)
		# Create downloader and connect events
		sd = StDownloader(self.target, tag)
		sd.connect("error", self.cb_download_error)
		sd.connect("version", self.cb_version)
		sd.connect("download-progress", self.cb_progress)
		sd.connect("download-finished", self.cb_extract_start)
		sd.connect("extraction-progress", self.cb_progress)
		sd.connect("extraction-finished", self.cb_extract_finished)
		# Display message and start downloading
		self["lblDownloadProgress"].set_markup(_("Downloading..."))
		self["btDownload"].set_visible(False)
		self["pbDownload"].set_visible(True)
		self["vsyncthing_binary"].set_sensitive(False)
		self["btBrowse"].set_sensitive(False)
		self["btSave"].set_sensitive(False)
		sd.get_version()
	def cb_btDownload_clicked(self, *a):
		"""
		Disable half of dialog and start downloading syncthing package
		"""
		# Determine which syncthing to use
		suffix, tag = StDownloader.determine_platform()
		# Report error on unsupported platforms
		if suffix is None or tag is None:
			# Disable download button
			self["btDownload"].set_sensitive(False)
			# Set message
			pd = "%s %s" % (
				platform.uname()[0],	# OS
				platform.uname()[4])	# architecture
			self["lblDownloadProgress"].set_markup("%s %s" % (
					_("Cannot download Syncthing daemon."),
					_("This platform (%s) is not supported") % (pd,),
				))
			return
		# Determine target file & directory
		self.target = os.path.join(
			os.path.expanduser(StDownloader.get_target_folder()),
			"syncthing%s" % (suffix,)
			)
		# Create downloader and connect events
		sd = StDownloader(self.target, tag)
		sd.connect("error", self.cb_download_error)
		sd.connect("version", self.cb_version)
		sd.connect("download-progress", self.cb_progress)
		sd.connect("download-finished", self.cb_extract_start)
		sd.connect("extraction-progress", self.cb_progress)
		sd.connect("extraction-finished", self.cb_extract_finished)
		# Display message and start downloading
		self["lblDownloadProgress"].set_markup(_("Downloading..."))
		self["btDownload"].set_visible(False)
		self["pbDownload"].set_visible(True)
		self["vsyncthing_binary"].set_sensitive(False)
		self["btBrowse"].set_sensitive(False)
		self["btSave"].set_sensitive(False)
		sd.get_version()