forked from drf/amsn2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamsn2.py
52 lines (45 loc) · 1.67 KB
/
amsn2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import sys
import os
import optparse
sys.path.insert(0, "./pymsn")
from amsn2.core import aMSNCore
if __name__ == '__main__':
account = None
passwd = None
default_front_end = "console"
# Detect graphical toolkit available.
# Format - 'default_front_end : module name'
# cocoa > efl > qt4 > gtk > console
toolkits = {'cocoa' : '????',
'elf' : 'ecore',
'qt4' : 'PyQt4.QtGui',
'gtk' : 'gtk',
'console' : None}
for toolkit in toolkits:
try:
default_front_end = toolkit
module_name = toolkits[toolkit]
module = __import__(module_name)
vars()[module_name] = module
# Debug
# print 'Imported toolkit "%s" with module "%s"' % (toolkit, module)
break
except ImportError:
# Debug
# print 'Couldn\'t import %s - doesn\'t exist!' % module_name
pass
except TypeError:
pass
parser = optparse.OptionParser()
parser.add_option("-a", "--account", dest="account",
default=None, help="The account's username to use")
parser.add_option("-p", "--password", dest="password",
default=None, help="The account's password to use")
parser.add_option("-f", "--front-end", dest="front_end",
default=default_front_end, help="The frontend to use")
parser.add_option("-d", "--debug", action="store_true", dest="debug",
default=False, help="Show protocol debug")
(options, args) = parser.parse_args()
amsn = aMSNCore(options)
amsn.run()