3 ##############################################################################
5 # Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
9 # WARNING: This program as such is intended to be used by professional
10 # programmers who take the whole responsability of assessing all potential
11 # consequences resulting from its eventual inadequacies and bugs
12 # End users who are looking for a ready-to-use solution with commercial
13 # garantees and support are strongly adviced to contract a Free Software
16 # This program is Free Software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License
18 # as published by the Free Software Foundation; either version 2
19 # of the License, or (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 ##############################################################################
33 Tiny ERP is an ERP+CRM program for small and medium businesses.
35 The whole source code is distributed under the terms of the
38 (c) 2003-TODAY, Fabien Pinckaers - Tiny sprl
42 __author__
= release
.author
43 __version__
= release
.version
46 __builtin__
.__dict
__['tinyerp_version'] = __version__
51 from distutils
.sysconfig
import get_python_lib
52 terp_path
= os
.path
.join(get_python_lib(), 'tinyerp-client')
53 sys
.path
.append(terp_path
)
56 sys
.path
.insert(0, os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\bin'))
57 sys
.path
.insert(0, os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\lib'))
58 os
.environ
['PATH'] = os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\lib') + ";" + os
.environ
['PATH']
59 os
.environ
['PATH'] = os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\bin') + ";" + os
.environ
['PATH']
66 import locale
, gettext
73 sys
.path
.insert(0, os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0])))
74 os
.environ
['PATH'] = os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0])) + ";" + os
.environ
['PATH']
81 translate
.setlang(options
.options
['client.lang'])
83 for logger
in options
.options
['logging.logger'].split(','):
85 loglevel
= {'DEBUG':logging
.DEBUG
, 'INFO':logging
.INFO
, 'WARNING':logging
.WARNING
, 'ERROR':logging
.ERROR
, 'CRITICAL':logging
.CRITICAL
}
86 log
= logging
.getLogger(logger
)
87 log
.setLevel(loglevel
[options
.options
['logging.level'].upper()])
88 if options
.options
['logging.verbose']:
89 logging
.getLogger().setLevel(logging
.INFO
)
91 logging
.getLogger().setLevel(logging
.ERROR
)
97 items
= [('terp-flag', '_Translation', gtk
.gdk
.CONTROL_MASK
, ord('t'), '')]
100 factory
= gtk
.IconFactory ()
101 factory
.add_default ()
103 pix_file
= os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'icons')
104 if not os
.path
.isdir(pix_file
):
105 pix_file
= os
.path
.join(options
.options
['path.pixmaps'],'icons')
107 for fname
in os
.listdir(pix_file
):
108 ffname
= os
.path
.join(pix_file
,fname
)
109 if not os
.path
.isfile(ffname
):
111 iname
= os
.path
.splitext(fname
)[0]
113 pixbuf
= gtk
.gdk
.pixbuf_new_from_file(ffname
)
118 icon_set
= gtk
.IconSet (pixbuf
)
119 factory
.add('terp-'+iname
, icon_set
)
124 win
= modules
.gui
.main
.terp_main()
125 if not common
.terp_survey():
126 if options
.options
.rcexist
:
127 if options
.options
['tip.autostart']:
128 common
.tipoftheday(win
.window
)
132 except KeyboardInterrupt, e
:
133 log
= logging
.getLogger('common')
134 log
.info(_('Closing Tiny ERP, KeyboardInterrupt'))