2 # -*- encoding: utf-8 -*-
4 ##############################################################################
6 # Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
10 # WARNING: This program as such is intended to be used by professional
11 # programmers who take the whole responsability of assessing all potential
12 # consequences resulting from its eventual inadequacies and bugs
13 # End users who are looking for a ready-to-use solution with commercial
14 # garantees and support are strongly adviced to contract a Free Software
17 # This program is Free Software; you can redistribute it and/or
18 # modify it under the terms of the GNU General Public License
19 # as published by the Free Software Foundation; either version 2
20 # of the License, or (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write to the Free Software
29 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 ##############################################################################
34 Tiny ERP is an ERP+CRM program for small and medium businesses.
36 The whole source code is distributed under the terms of the
39 (c) 2003-TODAY, Fabien Pinckaers - Tiny sprl
43 __author__
= release
.author
44 __version__
= release
.version
47 __builtin__
.__dict
__['tinyerp_version'] = __version__
52 from distutils
.sysconfig
import get_python_lib
53 terp_path
= os
.path
.join(get_python_lib(), 'tinyerp-client')
54 sys
.path
.append(terp_path
)
57 sys
.path
.insert(0, os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\bin'))
58 sys
.path
.insert(0, os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\lib'))
59 os
.environ
['PATH'] = os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\lib') + ";" + os
.environ
['PATH']
60 os
.environ
['PATH'] = os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'GTK\\bin') + ";" + os
.environ
['PATH']
67 import locale
, gettext
74 sys
.path
.insert(0, os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0])))
75 os
.environ
['PATH'] = os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0])) + ";" + os
.environ
['PATH']
82 # On first run, client won't have a language option,
83 # so try with the LANG environ, or fallback to english
84 client_lang
= options
.options
['client.lang']
85 if client_lang
is False:
86 client_lang
= os
.environ
.get('LANG', '')
88 translate
.setlang(client_lang
)
90 for logger
in options
.options
['logging.logger'].split(','):
92 loglevel
= {'DEBUG':logging
.DEBUG
, 'INFO':logging
.INFO
, 'WARNING':logging
.WARNING
, 'ERROR':logging
.ERROR
, 'CRITICAL':logging
.CRITICAL
}
93 log
= logging
.getLogger(logger
)
94 log
.setLevel(loglevel
[options
.options
['logging.level'].upper()])
95 if options
.options
['logging.verbose']:
96 logging
.getLogger().setLevel(logging
.INFO
)
98 logging
.getLogger().setLevel(logging
.ERROR
)
104 items
= [('terp-flag', '_Translation', gtk
.gdk
.CONTROL_MASK
, ord('t'), '')]
105 gtk
.stock_add (items
)
107 factory
= gtk
.IconFactory ()
108 factory
.add_default ()
110 pix_file
= os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'icons')
111 if not os
.path
.isdir(pix_file
):
112 pix_file
= os
.path
.join(options
.options
['path.pixmaps'],'icons')
114 for fname
in os
.listdir(pix_file
):
115 ffname
= os
.path
.join(pix_file
,fname
)
116 if not os
.path
.isfile(ffname
):
118 iname
= os
.path
.splitext(fname
)[0]
120 pixbuf
= gtk
.gdk
.pixbuf_new_from_file(ffname
)
125 icon_set
= gtk
.IconSet (pixbuf
)
126 factory
.add('terp-'+iname
, icon_set
)
131 win
= modules
.gui
.main
.terp_main()
132 if not common
.terp_survey():
133 if options
.options
.rcexist
:
134 if options
.options
['tip.autostart']:
135 common
.tipoftheday(win
.window
)
139 except KeyboardInterrupt, e
:
140 log
= logging
.getLogger('common')
141 log
.info(_('Closing Tiny ERP, KeyboardInterrupt'))
144 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: