~gtg-user/gtg/file-attach

« back to all changes in this revision

Viewing changes to GTG/gtk/editor/taskview.py

  • Committer: Luca Invernizzi
  • Date: 2010-07-06 18:26:42 UTC
  • Revision ID: invernizzi.l@gmail.com-20100706182642-zhz4ap36gkbo8fmy
started looking at the code

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from gtk import gdk
35
35
import gobject
36
36
import pango
37
 
 
 
37
import os.path
38
38
import gnomevfs
39
39
import gnome.ui
40
40
 
821
821
        end_i = self.write_subtask(buff,line_nbr,anchor,level=level)
822
822
        return end_i
823
823
    
824
 
    def short_filename(self,fileuri):
825
 
        return fileuri.split('/')[-1]
826
 
 
827
824
    def filename_icon(self,fileuri):
828
825
        icon_theme = gtk.icon_theme_get_default()
829
826
        thumbnail_factory = gnome.ui.ThumbnailFactory(gnome.ui.THUMBNAIL_SIZE_NORMAL)
859
856
            buff.move_mark(e,i_e)
860
857
            fileurl = buff.get_text(i_s,i_e)
861
858
        if len(fileurl)>0:
862
 
            short_filename = self.short_filename(fileurl)
 
859
            short_filename = os.path.basename(fileurl)
863
860
            tag = self.create_anchor_tag(buff,fileurl,text=short_filename,typ="file")
864
861
            self.__apply_tag_to_mark(s,e,tag)
865
862
        else:
878
875
            self.modified_sigid = False
879
876
            reconnect_modified = True
880
877
 
881
 
        short = self.short_filename(fileurl)
 
878
        short = os.path.basename(fileurl)
882
879
        start_m = buff.create_mark(fileurl,start_i,True)
883
880
        end_m = buff.create_mark('/%s'%fileurl,end_i,False)
884
881
        buff.delete(start_i,end_i)
887
884
        tag = self.insert_with_anchor(short,fileurl,start_i,'file')
888
885
        tag.set_data('is_file',True)
889
886
        tag.set_data('fileurl',fileurl)
 
887
        print "FILEURL", "|"+fileurl+"|"
 
888
        print "FILEURL", "|"+fileurl+"|"
 
889
        print "FILEURL", "|"+fileurl+"|"
890
890
        start_i = buff.get_iter_at_mark(start_m)
891
891
        buff.insert_pixbuf(start_i,self.filename_icon(fileurl))
892
892