~saurabhanandiit/gtg/exportFixed

« back to all changes in this revision

Viewing changes to gtg

  • Committer: Izidor Matušov
  • Date: 2012-02-29 10:06:41 UTC
  • mfrom: (1098 gtg)
  • mto: This revision was merged to the branch mainline in revision 1103.
  • Revision ID: izidor.matusov@gmail.com-20120229100641-q1uns4yqz1fem2z4
Merged with the current trunk & solved problems with offset

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import sys
31
31
from optparse import OptionParser
32
32
 
 
33
required_liblarch_api="1.0"
 
34
 
33
35
 
34
36
def X_is_running():
35
37
    from gtk.gdk import Screen
39
41
    except RuntimeError:
40
42
        pass
41
43
    return False
 
44
    
 
45
def import_liblarch():
 
46
    """ Check if liblarch is installed and is compatible
 
47
 
 
48
    If not, provide information how to obtain the newest version """
 
49
 
 
50
    git_cmd= "git clone git://github.com/ploum/liblarch.git  ../liblarch"
 
51
    try:
 
52
        import liblarch
 
53
        toreturn = True
 
54
    except:
 
55
        sys.path.append("../liblarch/")
 
56
        try:
 
57
            import liblarch
 
58
            toreturn = True
 
59
        except:
 
60
                print "GTG requires liblarch but liblarch is not installed."
 
61
                print "To install liblarch, run the following command in the current folder:"
 
62
                print "\n"
 
63
                print "   %s" %git_cmd
 
64
                print "\n"
 
65
                print "More informations about liblarch: https://live.gnome.org/liblarch/"
 
66
                toreturn = False
 
67
 
 
68
    if toreturn and not liblarch.is_compatible(required_liblarch_api):
 
69
        print "Your liblarch copy has its API at version %s" %liblarch.api
 
70
        print "but your GTG copy need liblarch API version %s" %required_liblarch_api
 
71
        print ""
 
72
        print "You may fix that by downloading the last version of liblarch with:"
 
73
        print "   %s"%git_cmd
 
74
        toreturn = False
 
75
 
 
76
    return toreturn
42
77
 
43
78
 
44
79
try:
64
99
        print "Could not open X display"
65
100
        sys.exit(1)
66
101
 
67
 
    else:
 
102
    elif import_liblarch():
68
103
        import GTG.gtg
69
104
        sys.exit(GTG.gtg.main(options, args))
70
105