Exemplo n.º 1
0
 def rename_tag(self, widget, iter):
     from picty.uitools import completions
     
     old_key = self.model[iter][self.M_KEY]
     kw = self.mainframe.entry_dialog('Rename Tag', 'New Name:', completions.TagCompletion, old_key)
     
     if not kw or kw == old_key:
         return
     
     rename_response = dialogs.prompt_dialog("Rename Tag", 'Would you like to replace the tag "{}" with "{}" for all images in your collection'.format(old_key, kw))
     
     if rename_response == 2:
         return
     
     self.model[iter][self.M_KEY] = kw
     self.model[iter][self.M_DISP] = kw.replace('&', '&')
     
     try:
         self.user_tags[kw] = self.user_tags[old_key]
         del self.user_tags[old_key]
     except:
         pass
     
     if rename_response == 0:
         # todo: if this job is busy the request will fail so probably
         # shouldn't actually rename the tag unless the request succeeds
         self.worker.keyword_edit('"{}" "{}"'.format(old_key, kw), False, False, True, backend.EDIT_COLLECTION)
Exemplo n.º 2
0
    def rename_tag(self, widget, iter):
        from picty.uitools import completions

        old_key = self.model[iter][self.M_KEY]
        kw = self.mainframe.entry_dialog('Rename Tag', 'New Name:',
                                         completions.TagCompletion, old_key)

        if not kw or kw == old_key:
            return

        rename_response = dialogs.prompt_dialog(
            "Rename Tag",
            'Would you like to replace the tag "{}" with "{}" for all images in your collection'
            .format(old_key, kw))

        if rename_response == 2:
            return

        self.model[iter][self.M_KEY] = kw
        self.model[iter][self.M_DISP] = kw.replace('&', '&')

        try:
            self.user_tags[kw] = self.user_tags[old_key]
            del self.user_tags[old_key]
        except:
            pass

        if rename_response == 0:
            # todo: if this job is busy the request will fail so probably
            # shouldn't actually rename the tag unless the request succeeds
            self.worker.keyword_edit('"{}" "{}"'.format(old_key, kw), False,
                                     False, True, backend.EDIT_COLLECTION)
Exemplo n.º 3
0
    def login_dialog(self):
        self.flickr_client = flickrapi.FlickrAPI(self.api_key, self.api_secret)
        (self.token, self.frob) = self.flickr_client.get_token_part_one(perms="write")
        if not self.token:
            from picty.uitools import dialogs

            result = dialogs.prompt_dialog(
                "Allow Flickr Access",
                'picty has opened a Flickr application authentication page in your web browser. Please give picty access to your flickr account accepting the prompt in your web browser. Press "Done" when complete',
                buttons=("_Done",),
                default=0,
            )
Exemplo n.º 4
0
 def write_do_callback(self,widget):
     dest_path=self.filename_entry.get_text()
     path,name=os.path.split(dest_path)
     src_path=self.viewer.collection.get_path(self.item)
     if not name:
         return
     if not path:
         path=self.viewer.collection.get_path(self.item)
         dest_path=os.path.join(os.path.split(path)[0],name)
     if os.path.exists(dest_path):
         if dialogs.prompt_dialog("File Exists","Do you want to overwrite\n"+dest_path+"?",("_Cancel","_Overwrite"),1)==0:
             return
     self.worker.queue_job_instance(ImageWriteJob(self.worker,self.viewer.collection,None,self,self.item,src_path,dest_path))
Exemplo n.º 5
0
 def remove_tag(self, widget, iter):
     k = self.model[iter][self.M_KEY]
     rename_response = dialogs.prompt_dialog(
         "Delete Tag", 'Would you like to remove the tag "%s" from all images in your collection?' % (k,)
     )
     if rename_response == 2:
         return
     self.model.remove(iter)
     if k in self.user_tags:
         del self.user_tags[k]
     if rename_response == 0:
         self.worker.keyword_edit(
             '"%s"' % (k,), False, True, False, backend.EDIT_COLLECTION
         )  ##todo: if this job is busy the request will fail so probably shouldn't actually rename the tag unless the request succeeds
Exemplo n.º 6
0
 def remove_tag(self, widget, iter):
     k = self.model[iter][self.M_KEY]
     rename_response = dialogs.prompt_dialog(
         "Delete Tag",
         'Would you like to remove the tag "%s" from all images in your collection?'
         % (k, ))
     if rename_response == 2:
         return
     self.model.remove(iter)
     if k in self.user_tags:
         del self.user_tags[k]
     if rename_response == 0:
         self.worker.keyword_edit(
             '"%s"' % (k, ), False, True, False, backend.EDIT_COLLECTION
         )  ##todo: if this job is busy the request will fail so probably shouldn't actually rename the tag unless the request succeeds
Exemplo n.º 7
0
 def write_do_callback(self, widget):
     dest_path = self.filename_entry.get_text()
     path, name = os.path.split(dest_path)
     src_path = self.viewer.collection.get_path(self.item)
     if not name:
         return
     if not path:
         path = self.viewer.collection.get_path(self.item)
         dest_path = os.path.join(os.path.split(path)[0], name)
     if os.path.exists(dest_path):
         if dialogs.prompt_dialog(
                 "File Exists",
                 "Do you want to overwrite\n" + dest_path + "?",
             ("_Cancel", "_Overwrite"), 1) == 0:
             return
     self.worker.queue_job_instance(
         ImageWriteJob(self.worker, self.viewer.collection, None, self,
                       self.item, src_path, dest_path))
Exemplo n.º 8
0
    def rename_tag(self, widget, iter):
        from picty.uitools import completions

        old_key = self.model[iter][self.M_KEY]
        k = self.mainframe.entry_dialog("Rename Tag", "New Name:", completions.TagCompletion, old_key)
        if not k or k == old_key:
            return
        rename_response = dialogs.prompt_dialog(
            "Rename Tag",
            'Would you like to replace the tag "%s" with "%s" for all images in your collection' % (old_key, k),
        )
        if rename_response == 2:
            return
        self.model[iter][self.M_KEY] = k
        self.model[iter][self.M_DISP] = k.replace("&", "&")
        try:
            self.user_tags[k] = self.user_tags[old_key]
            del self.user_tags[old_key]
        except:
            pass
        if rename_response == 0:
            self.worker.keyword_edit(
                '"%s" "%s"' % (old_key, k), False, False, True, backend.EDIT_COLLECTION
            )  ##todo: if this job is busy the request will fail so probably shouldn't actually rename the tag unless the request succeeds
Exemplo n.º 9
0
 def image_write_meta_failed(self):
     dialogs.prompt_dialog(
         "Metadata could not be written",
         "Warning: Could not write metadata to image image\n" + dest_path,
         ("_OK", ), 1)
Exemplo n.º 10
0
 def image_write_failed(self):
     dialogs.prompt_dialog("Save Failed",
                           "Could not save image\n" + dest_path, ("_OK", ),
                           1)
Exemplo n.º 11
0
 def image_write_meta_failed(self):
     dialogs.prompt_dialog("Metadata could not be written","Warning: Could not write metadata to image image\n"+dest_path,("_OK",),1)
Exemplo n.º 12
0
 def image_write_failed(self):
     dialogs.prompt_dialog("Save Failed","Could not save image\n"+dest_path,("_OK",),1)
Exemplo n.º 13
0
 def login_dialog(self):
     self.flickr_client = flickrapi.FlickrAPI(self.api_key, self.api_secret)
     (self.token, self.frob) = self.flickr_client.get_token_part_one(perms='write')
     if not self.token:
         from picty.uitools import dialogs
         result=dialogs.prompt_dialog('Allow Flickr Access','picty has opened a Flickr application authentication page in your web browser. Please give picty access to your flickr account accepting the prompt in your web browser. Press "Done" when complete',buttons=('_Done',),default=0)