Exemple #1
0
    def thread_do(self):
        gd_client = picasa_login()
        if not gd_client:
            return
        progress_dialog = ProgressDialogController(
            _("Uploading Pictures"), _("Uploading pictures to Picasa Web Album"), max_value=self._files_albums_count
        )
        progress_dialog.show()
        try:
            upass = __kupfer_settings__["userpass"]
            progress = 0
            for files, album_id, album_name in self._files_to_upload:
                # create album
                if album_id is None:
                    progress_dialog.update(progress, _("Creating album:"), album_name)
                    album = gd_client.InsertAlbum(title=album_name, summary=_("Album created by Kupfer"))
                    album_id = album.gphoto_id.text
                    progress += 1
                    # send files
                album_url = ALBUM_URL % (upass.username, album_id)
                for filename in files:
                    pretty.print_debug(__name__, "upload: sending", filename)
                    progress_dialog.update(progress, _("File:"), utils.get_display_path_for_bytestring(filename))
                    if progress_dialog.aborted:
                        pretty.print_debug(__name__, "upload: abort")
                        break
                        # send file
                    gd_client.InsertPhotoSimple(album_url, os.path.basename(filename), "", filename)
                    pretty.print_debug(__name__, "upload: file sended", filename)
                    progress += 1

        except (gdata.service.Error, gdata.photos.service.GooglePhotosException), err:
            pretty.print_error(__name__, "upload error", err)
Exemple #2
0
	def get_description(self):
		# Use Application's description, else use executable
		# for "file-based" applications we show the path
		app_desc = tounicode(self.object.get_description())
		ret = tounicode(app_desc if app_desc else self.object.get_executable())
		if self.init_path:
			app_path = utils.get_display_path_for_bytestring(self.init_path)
			return u"(%s) %s" % (app_path, ret)
		return ret
Exemple #3
0
 def get_description(self):
     # Use Application's description, else use executable
     # for "file-based" applications we show the path
     app_desc = tounicode(self.object.get_description())
     ret = tounicode(app_desc if app_desc else self.object.get_executable())
     if self.init_path:
         app_path = utils.get_display_path_for_bytestring(self.init_path)
         return u"(%s) %s" % (app_path, ret)
     return ret
Exemple #4
0
	def add_directory_model(self, d, store=False):
		have = list(os.path.normpath(row[0]) for row in self.dir_store)
		if d in have:
			self.output_debug("Ignoring duplicate directory: ", d)
			return
		else:
			have.append(d)

		d = os.path.expanduser(d)
		dispname = utils.get_display_path_for_bytestring(d)
		gicon = icons.get_gicon_for_file(d)
		self.dir_store.append((d, gicon, dispname))

		if store:
			setctl = settings.GetSettingsController()
			setctl.set_directories(have)
Exemple #5
0
    def add_directory_model(self, d, store=False):
        have = list(os.path.normpath(row[0]) for row in self.dir_store)
        if d in have:
            self.output_debug("Ignoring duplicate directory: ", d)
            return
        else:
            have.append(d)

        d = os.path.expanduser(d)
        dispname = utils.get_display_path_for_bytestring(d)
        gicon = icons.get_gicon_for_file(d)
        self.dir_store.append((d, gicon, dispname))

        if store:
            setctl = settings.GetSettingsController()
            setctl.set_directories(have)
Exemple #6
0
 def activate(self, obj, ctx):
     ## If the same file @obj is already open,
     ## then close its window.
     if obj.object in self.open_windows:
         open_window = self.open_windows.pop(obj.object)
         open_window.destroy()
         return
     image_widget = gtk.Image()
     h = gtk.gdk.screen_height()
     w = gtk.gdk.screen_width()
     image_widget.set_from_pixbuf(load_image_max_size(obj.object, w, h))
     image_widget.show()
     window = gtk.Window()
     window.set_title(utils.get_display_path_for_bytestring(obj.object))
     window.set_position(gtk.WIN_POS_CENTER)
     window.add(image_widget)
     ctx.environment.present_window(window)
     window.connect("key-press-event", self.window_key_press, obj.object)
     window.connect("delete-event", self.window_deleted, obj.object)
     self.open_windows[obj.object] = window
Exemple #7
0
	def activate(self, obj, ctx):
		## If the same file @obj is already open,
		## then close its window.
		if obj.object in self.open_windows:
			open_window = self.open_windows.pop(obj.object)
			open_window.destroy()
			return
		image_widget = gtk.Image()
		h = gtk.gdk.screen_height()
		w = gtk.gdk.screen_width()
		image_widget.set_from_pixbuf(load_image_max_size(obj.object, w, h))
		image_widget.show()
		window = gtk.Window() 
		window.set_title(utils.get_display_path_for_bytestring(obj.object))
		window.set_position(gtk.WIN_POS_CENTER)
		window.add(image_widget)
		ctx.environment.present_window(window)
		window.connect("key-press-event", self.window_key_press, obj.object)
		window.connect("delete-event", self.window_deleted, obj.object)
		self.open_windows[obj.object] = window
Exemple #8
0
	def thread_do(self):
		gd_client = picasa_login()
		if not gd_client:
			return
		progress_dialog = ProgressDialogController(
				_("Uploading Pictures"),
				_("Uploading pictures to Picasa Web Album"),
				max_value=self._files_albums_count)
		progress_dialog.show()
		try:
			upass = __kupfer_settings__['userpass']
			progress = 0
			for files, album_id, album_name in self._files_to_upload:
				# create album
				if album_id is None:
					progress_dialog.update(progress, _("Creating album:"),
							album_name)
					album = gd_client.InsertAlbum(title=album_name,
							summary=_('Album created by Kupfer'))
					album_id = album.gphoto_id.text
					progress += 1
				# send files
				album_url = ALBUM_URL % (upass.username, album_id)
				for filename in files:
					pretty.print_debug(__name__, 'upload: sending', filename)
					progress_dialog.update(progress, _('File:'),
							utils.get_display_path_for_bytestring(filename))
					if progress_dialog.aborted:
						pretty.print_debug(__name__, 'upload: abort')
						break
					# send file
					gd_client.InsertPhotoSimple(album_url,
							os.path.basename(filename), '', filename)
					pretty.print_debug(__name__, 'upload: file sended', filename)
					progress += 1

		except (gdata.service.Error, gdata.photos.service.GooglePhotosException), \
				err:
			pretty.print_error(__name__, 'upload error', err)
Exemple #9
0
	def get_description(self):
		return utils.get_display_path_for_bytestring(self.canonical_path())
Exemple #10
0
	def get_description(self):
		orig_path = self.get_orig_path()
		return utils.get_display_path_for_bytestring(orig_path) if orig_path \
				else None
Exemple #11
0
 def get_description(self):
     return _("Volume mounted at %s") % \
             utils.get_display_path_for_bytestring(self.object)
Exemple #12
0
 def get_description(self):
     return utils.get_display_path_for_bytestring(self.canonical_path())
Exemple #13
0
 def get_description(self):
     dispname = utils.get_display_path_for_bytestring(self.object)
     return _("TrueCrypt volume: %(file)s") % dict(file=dispname)
Exemple #14
0
 def get_description(self):
     dispname = utils.get_display_path_for_bytestring(self.object)
     return _("TrueCrypt volume: %(file)s") % dict(file=dispname)