~zeitgeist/zeitgeist-explorer/git-import

« back to all changes in this revision

Viewing changes to zgexplorer/utils.py

  • Committer: Manish Sinha
  • Date: 2013-07-13 04:17:03 UTC
  • Revision ID: git-v1:db5ffbaf540bd08be62f68a801bcec60d7ca9057
The Event for the Datasource is shown

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
20
 
 
21
from gi.repository import Zeitgeist
 
22
 
21
23
def get_readable_ontology(item):
22
24
    inter = subject.get_property("interpretation").split("#")[-1]
23
25
    manifes = subject.get_property("manifestation").split("#")[-1]
25
27
 
26
28
def get_readable_appname(actor):
27
29
    return actor.replace("application://","").replace(".desktop","")
 
30
 
 
31
def get_event_from_list(ev_list):
 
32
    if ev_list is None or len(ev_list) == 0:
 
33
        event = Zeitgeist.Event()
 
34
        subject = Zeitgeist.Subject()
 
35
        event.add_subject(subject)
 
36
        return event
 
37
        
 
38
    ev = Zeitgeist.Event()
 
39
    if len(ev_list[0]) > 0 :
 
40
        ev.set_property("timestamp", ev_list[0][1])
 
41
        ev.set_property("interpretation", ev_list[0][2])
 
42
        ev.set_property("manifestation", ev_list[0][3])
 
43
        ev.set_property("actor", ev_list[0][4])
 
44
        ev.set_property("origin", ev_list[0][5])
 
45
    
 
46
    sub = Zeitgeist.Subject()
 
47
    #if len(ev_list[1]) > 0 :
 
48
    #    sub = Zeitgeist.Subject.full(ev_list[0][1])
 
49
    ev.add_subject(sub)
 
50
    
 
51
    return ev