Package Gnumed :: Package wxpython :: Module gnumed
[frames] | no frames]

Source Code for Module Gnumed.wxpython.gnumed

  1  #!/usr/bin/env python 
  2   
  3  __doc__ = """GNUmed client launcher. 
  4   
  5  This is the launcher for the GNUmed GUI client. It takes 
  6  care of all the pre- and post-GUI runtime environment setup. 
  7   
  8  --quiet 
  9   Be extra quiet and show only _real_ errors in the log. 
 10  --debug 
 11   Pre-set the [debug mode] checkbox in the login dialog to 
 12   increase verbosity in the log file. Useful for, well, debugging :-) 
 13  --slave 
 14   Pre-set the [enable remote control] checkbox in the login 
 15   dialog to enable the XML-RPC remote control feature. 
 16  --hipaa 
 17   Enable HIPAA functionality which has user impact. 
 18  --profile=<file> 
 19   Activate profiling and write profile data to <file>. 
 20  --text-domain=<text domain> 
 21   Set this to change the name of the language file to be loaded. 
 22   Note, this does not change the directory the file is searched in, 
 23   only the name of the file where messages are loaded from. The 
 24   standard textdomain is, of course, "gnumed.mo". 
 25  --log-file=<file> 
 26   Use this to change the name of the log file. 
 27   See gmLog2.py to find out where the standard log file would 
 28   end up. 
 29  --conf-file=<file> 
 30   Use configuration file <file> instead of searching for it in 
 31   standard locations. 
 32  --lang-gettext=<language> 
 33   Explicitly set the language to use in gettext translation. The very 
 34   same effect can be achieved by setting the environment variable $LANG 
 35   from a launcher script. 
 36  --override-schema-check 
 37   Continue loading the client even if the database schema version 
 38   and the client software version cannot be verified to be compatible. 
 39  --skip-update-check 
 40   Skip checking for client updates. This is useful during development 
 41   and when the update check URL is unavailable (down). 
 42  --local-import 
 43   Adjust the PYTHONPATH such that GNUmed can be run from a local source tree. 
 44  --version, -V 
 45   Show version information. 
 46  --help, -h, or -? 
 47   Show this help. 
 48  """ 
 49  #========================================================== 
 50  # $Source: /cvsroot/gnumed/gnumed/gnumed/client/wxpython/gnumed.py,v $ 
 51  # $Id: gnumed.py,v 1.168 2010/01/21 09:01:00 ncq Exp $ 
 52  __version__ = "$Revision: 1.168 $" 
 53  __author__  = "H. Herb <hherb@gnumed.net>, K. Hilbert <Karsten.Hilbert@gmx.net>, I. Haywood <i.haywood@ugrad.unimelb.edu.au>" 
 54  __license__ = "GPL (details at http://www.gnu.org)" 
 55   
 56  # standard library 
 57  import sys, os, os.path, signal, logging, platform 
 58   
 59   
 60  # do not run as module 
 61  if __name__ != "__main__": 
 62          print "GNUmed startup: This is not intended to be imported as a module !" 
 63          print "-----------------------------------------------------------------" 
 64          print __doc__ 
 65          sys.exit(1) 
 66   
 67   
 68  # do not run as root 
 69  if os.name in ['posix'] and os.geteuid() == 0: 
 70          print """ 
 71  GNUmed startup: GNUmed should not be run as root. 
 72  ------------------------------------------------- 
 73   
 74  Running GNUmed as <root> can potentially put all 
 75  your medical data at risk. It is strongly advised 
 76  against. Please run GNUmed as a non-root user. 
 77  """ 
 78          sys.exit(1) 
 79   
 80  #---------------------------------------------------------- 
 81  current_client_version = u'0.6.rc6' 
 82  #current_client_version = u'CVS HEAD' 
 83  current_client_branch = u'0.6' 
 84  #current_client_branch = u'CVS HEAD' 
 85   
 86  _log = None 
 87  _cfg = None 
 88  _old_sig_term = None 
 89  _known_short_options = u'h?V' 
 90  _known_long_options = [ 
 91          u'debug', 
 92          u'slave', 
 93          u'skip-update-check', 
 94          u'profile=', 
 95          u'text-domain=', 
 96          u'log-file=', 
 97          u'conf-file=', 
 98          u'lang-gettext=', 
 99          u'override-schema-check', 
100          u'local-import', 
101          u'help', 
102          u'version', 
103          u'hipaa' 
104  ] 
105   
106  import_error_sermon = """ 
107  GNUmed startup: Cannot load GNUmed Python modules ! 
108  --------------------------------------------------- 
109  CRITICAL ERROR: Program halted. 
110   
111  Please make sure you have: 
112   
113   1) the required third-party Python modules installed 
114   2) the GNUmed Python modules linked or installed into site-packages/ 
115      (if you do not run from a CVS tree the installer should have taken care of that) 
116   3) your PYTHONPATH environment variable set up correctly 
117   
118  sys.path is currently set to: 
119   
120   %s 
121   
122  If you are running from a copy of the CVS tree make sure you 
123  did run gnumed/check-prerequisites.sh with good results. 
124   
125  If you still encounter errors after checking the above 
126  requirements please ask on the mailing list. 
127  """ 
128   
129   
130  missing_cli_config_file = u""" 
131  GNUmed startup: Missing configuration file. 
132  ------------------------------------------- 
133   
134  You explicitly specified a configuration file 
135  on the command line: 
136   
137          --conf-file=%s 
138   
139  The file does not exist, however. 
140  """ 
141   
142   
143  no_config_files = u""" 
144  GNUmed startup: Missing configuration files. 
145  -------------------------------------------- 
146   
147  None of the below candidate configuration 
148  files could be found: 
149   
150   %s 
151   
152  Cannot run GNUmed without any of them. 
153  """ 
154  #========================================================== 
155  # convenience functions 
156  #========================================================== 
157 -def setup_python_path():
158 159 if not u'--local-import' in sys.argv: 160 return 161 162 print "GNUmed startup: Running from local source tree." 163 print "-----------------------------------------------" 164 165 local_python_base_dir = os.path.dirname ( 166 os.path.abspath(os.path.join(sys.argv[0], '..', '..')) 167 ) 168 169 # does the path exist at all, physically ? 170 # (*broken* links are reported as False) 171 link_name = os.path.join(local_python_base_dir, 'Gnumed') 172 if not os.path.exists(link_name): 173 real_dir = os.path.join(local_python_base_dir, 'client') 174 print "Creating module import symlink ..." 175 print ' real dir:', real_dir 176 print ' link:', link_name 177 os.symlink(real_dir, link_name) 178 179 print "Adjusting PYTHONPATH ..." 180 sys.path.insert(0, local_python_base_dir)
181 #==========================================================
182 -def setup_logging():
183 try: 184 from Gnumed.pycommon import gmLog2 as _gmLog2 185 except ImportError: 186 sys.exit(import_error_sermon % '\n '.join(sys.path)) 187 188 global gmLog2 189 gmLog2 = _gmLog2 190 191 global _log 192 _log = logging.getLogger('gm.launcher')
193 #==========================================================
194 -def setup_console_exception_handler():
195 from Gnumed.pycommon.gmTools import handle_uncaught_exception_console 196 197 sys.excepthook = handle_uncaught_exception_console
198 #==========================================================
199 -def setup_cli():
200 from Gnumed.pycommon import gmCfg2 201 202 global _cfg 203 _cfg = gmCfg2.gmCfgData() 204 _cfg.add_cli ( 205 short_options = _known_short_options, 206 long_options = _known_long_options 207 ) 208 209 val = _cfg.get(option = '--debug', source_order = [('cli', 'return')]) 210 if val is None: 211 val = False 212 _cfg.set_option ( 213 option = u'debug', 214 value = val 215 ) 216 217 val = _cfg.get(option = '--slave', source_order = [('cli', 'return')]) 218 if val is None: 219 val = False 220 _cfg.set_option ( 221 option = u'slave', 222 value = val 223 ) 224 225 val = _cfg.get(option = '--skip-update-check', source_order = [('cli', 'return')]) 226 if val is None: 227 val = False 228 _cfg.set_option ( 229 option = u'skip-update-check', 230 value = val 231 ) 232 233 val = _cfg.get(option = '--hipaa', source_order = [('cli', 'return')]) 234 if val is None: 235 val = False 236 _cfg.set_option ( 237 option = u'hipaa', 238 value = val 239 ) 240 241 val = _cfg.get(option = '--local-import', source_order = [('cli', 'return')]) 242 if val is None: 243 val = False 244 _cfg.set_option ( 245 option = u'local-import', 246 value = val 247 ) 248 249 _cfg.set_option ( 250 option = u'client_version', 251 value = current_client_version 252 ) 253 254 _cfg.set_option ( 255 option = u'client_branch', 256 value = current_client_branch 257 )
258 259 #==========================================================
260 -def handle_sig_term(signum, frame):
261 _log.critical('SIGTERM (SIG%s) received, shutting down ...' % signum) 262 gmLog2.flush() 263 print 'GNUmed: SIGTERM (SIG%s) received, shutting down ...' % signum 264 if frame is not None: 265 print '%s::%s@%s' % (frame.f_code.co_filename, frame.f_code.co_name, frame.f_lineno) 266 267 # FIXME: need to do something useful here 268 269 if _old_sig_term in [None, signal.SIG_IGN]: 270 sys.exit(signal.SIGTERM) 271 else: 272 _old_sig_term(signum, frame)
273 #----------------------------------------------------------
274 -def setup_signal_handlers():
275 global _old_sig_term 276 old_sig_term = signal.signal(signal.SIGTERM, handle_sig_term)
277 #==========================================================
278 -def setup_locale():
279 gmI18N.activate_locale() 280 281 td = _cfg.get(option = '--text-domain', source_order = [('cli', 'return')]) 282 l = _cfg.get(option = '--lang-gettext', source_order = [('cli', 'return')]) 283 gmI18N.install_domain(domain = td, language = l, prefer_local_catalog = _cfg.get(option = u'local-import')) 284 285 # make sure we re-get the default encoding 286 # in case it changed 287 gmLog2.set_string_encoding()
288 #==========================================================
289 -def handle_help_request():
290 src = [(u'cli', u'return')] 291 292 help_requested = ( 293 _cfg.get(option = u'--help', source_order = src) or 294 _cfg.get(option = u'-h', source_order = src) or 295 _cfg.get(option = u'-?', source_order = src) 296 ) 297 298 if help_requested: 299 print _( 300 'Help requested\n' 301 '--------------' 302 ) 303 print __doc__ 304 sys.exit(0)
305 #==========================================================
306 -def handle_version_request():
307 src = [(u'cli', u'return')] 308 309 version_requested = ( 310 _cfg.get(option = u'--version', source_order = src) or 311 _cfg.get(option = u'-V', source_order = src) 312 ) 313 314 if version_requested: 315 316 from Gnumed.pycommon.gmPG2 import map_client_branch2required_db_version, known_schema_hashes 317 318 print 'GNUmed version information' 319 print '--------------------------' 320 print 'client : %s on branch [%s]' % (current_client_version, current_client_branch) 321 print 'database : %s' % map_client_branch2required_db_version[current_client_branch] 322 print 'schema hash: %s' % known_schema_hashes[map_client_branch2required_db_version[current_client_branch]] 323 sys.exit(0)
324 325 #==========================================================
326 -def setup_paths_and_files():
327 """Create needed paths in user home directory.""" 328 329 gmTools.mkdir(os.path.expanduser(os.path.join('~', '.gnumed', 'scripts'))) 330 gmTools.mkdir(os.path.expanduser(os.path.join('~', '.gnumed', 'spellcheck'))) 331 gmTools.mkdir(os.path.expanduser(os.path.join('~', '.gnumed', 'tmp'))) 332 gmTools.mkdir(os.path.expanduser(os.path.join('~', 'gnumed', 'export', 'docs'))) 333 gmTools.mkdir(os.path.expanduser(os.path.join('~', 'gnumed', 'export', 'xDT'))) 334 gmTools.mkdir(os.path.expanduser(os.path.join('~', 'gnumed', 'export', 'EMR'))) 335 gmTools.mkdir(os.path.expanduser(os.path.join('~', 'gnumed', 'xDT'))) 336 gmTools.mkdir(os.path.expanduser(os.path.join('~', 'gnumed', 'logs'))) 337 338 paths = gmTools.gmPaths(app_name = u'gnumed') 339 340 open(os.path.expanduser(os.path.join('~', '.gnumed', 'gnumed.conf')), 'a+').close()
341 #==========================================================
342 -def setup_date_time():
343 gmDateTime.init()
344 #==========================================================
345 -def setup_cfg():
346 """Detect and setup access to GNUmed config file. 347 348 Parts of this will have limited value due to 349 wxPython not yet being available. 350 """ 351 352 enc = gmI18N.get_encoding() 353 paths = gmTools.gmPaths(app_name = u'gnumed') 354 355 candidates = [ 356 # the current working dir 357 [u'workbase', os.path.join(paths.working_dir, 'gnumed.conf')], 358 # /etc/gnumed/ 359 [u'system', os.path.join(paths.system_config_dir, 'gnumed-client.conf')], 360 # ~/.gnumed/ 361 [u'user', os.path.join(paths.user_config_dir, 'gnumed.conf')], 362 # CVS/tgz tree .../gnumed/client/ (IOW a local installation) 363 [u'local', os.path.join(paths.local_base_dir, 'gnumed.conf')] 364 ] 365 # --conf-file= 366 explicit_fname = _cfg.get(option = u'--conf-file', source_order = [(u'cli', u'return')]) 367 if explicit_fname is None: 368 candidates.append([u'explicit', None]) 369 else: 370 candidates.append([u'explicit', explicit_fname]) 371 372 for candidate in candidates: 373 _cfg.add_file_source ( 374 source = candidate[0], 375 file = candidate[1], 376 encoding = enc 377 ) 378 379 # --conf-file given but does not actually exist ? 380 if explicit_fname is not None: 381 if _cfg.source_files['explicit'] is None: 382 _log.error('--conf-file argument does not exist') 383 sys.exit(missing_config_file % fname) 384 385 # any config file found at all ? 386 found_any_file = False 387 for f in _cfg.source_files.values(): 388 if f is not None: 389 found_any_file = True 390 break 391 if not found_any_file: 392 _log.error('no config file found at all') 393 sys.exit(no_config_files % '\n '.join(candidates)) 394 395 # mime type handling sources 396 fname = u'mime_type2file_extension.conf' 397 _cfg.add_file_source ( 398 source = u'user-mime', 399 file = os.path.join(paths.user_config_dir, fname), 400 encoding = enc 401 ) 402 _cfg.add_file_source ( 403 source = u'system-mime', 404 file = os.path.join(paths.system_config_dir, fname), 405 encoding = enc 406 )
407 #==========================================================
408 -def setup_backend():
409 _log.info('client expects database version [%s]', gmPG2.map_client_branch2required_db_version[current_client_branch]) 410 411 # set up database connection timezone 412 timezone = _cfg.get ( 413 group = u'backend', 414 option = 'client timezone', 415 source_order = [ 416 ('explicit', 'return'), 417 ('workbase', 'return'), 418 ('local', 'return'), 419 ('user', 'return'), 420 ('system', 'return') 421 ] 422 ) 423 if timezone is not None: 424 gmPG2.set_default_client_timezone(timezone)
425 #==========================================================
426 -def shutdown_backend():
427 gmPG2.shutdown()
428 #==========================================================
429 -def shutdown_logging():
430 431 # if _cfg.get(option = u'debug'): 432 # import types 433 434 # def get_refcounts(): 435 # refcount = {} 436 # # collect all classes 437 # for module in sys.modules.values(): 438 # for sym in dir(module): 439 # obj = getattr(module, sym) 440 # if type(obj) is types.ClassType: 441 # refcount[obj] = sys.getrefcount(obj) 442 # # sort by refcount 443 # pairs = map(lambda x: (x[1],x[0]), refcount.items()) 444 # pairs.sort() 445 # pairs.reverse() 446 # return pairs 447 448 # rcfile = open('./gm-refcount.lst', 'wb') 449 # for refcount, class_ in get_refcounts(): 450 # if not class_.__name__.startswith('wx'): 451 # rcfile.write('%10d %s\n' % (refcount, class_.__name__)) 452 # rcfile.close() 453 454 # do not choke on Windows 455 logging.raiseExceptions = False
456 457 #========================================================== 458 # main - launch the GNUmed wxPython GUI client 459 #---------------------------------------------------------- 460 setup_python_path() 461 setup_logging() 462 463 _log.info('Starting up as main module (%s).', __version__) 464 _log.info('GNUmed client version [%s] on branch [%s]', current_client_version, current_client_branch) 465 _log.info('Platform: %s', platform.uname()) 466 _log.info('Python %s on %s (%s)', sys.version, sys.platform, os.name) 467 try: 468 import lsb_release 469 _log.info('%s' % lsb_release.get_distro_information()) 470 except ImportError: 471 pass 472 473 setup_console_exception_handler() 474 setup_cli() 475 setup_signal_handlers() 476 477 from Gnumed.pycommon import gmI18N, gmTools, gmDateTime, gmHooks 478 479 setup_locale() 480 handle_help_request() 481 handle_version_request() 482 setup_paths_and_files() 483 setup_date_time() 484 setup_cfg() 485 486 from Gnumed.pycommon import gmPG2 487 488 setup_backend() 489 490 491 gmHooks.run_hook_script(hook = u'startup-before-GUI') 492 493 from Gnumed.wxpython import gmGuiMain 494 profile_file = _cfg.get(option = u'--profile', source_order = [(u'cli', u'return')]) 495 if profile_file is not None: 496 _log.info('writing profiling data into %s', profile_file) 497 import profile 498 profile.run('gmGuiMain.main()', profile_file) 499 else: 500 gmGuiMain.main() 501 502 gmHooks.run_hook_script(hook = u'shutdown-post-GUI') 503 504 505 shutdown_backend() 506 _log.info('Normally shutting down as main module.') 507 shutdown_logging() 508 509 #========================================================== 510 # $Log: gnumed.py,v $ 511 # Revision 1.168 2010/01/21 09:01:00 ncq 512 # - bump version 513 # 514 # Revision 1.167 2010/01/15 13:33:07 ncq 515 # - bump version 516 # 517 # Revision 1.166 2010/01/09 19:34:54 ncq 518 # - bump version 519 # 520 # Revision 1.165 2010/01/01 21:23:15 ncq 521 # - improve checking of import link 522 # - better logging 523 # 524 # Revision 1.164 2009/12/26 11:54:06 ncq 525 # - bump version 526 # 527 # Revision 1.163 2009/12/21 15:13:16 ncq 528 # - fix typo 529 # - --skip-update-check 530 # 531 # Revision 1.162 2009/12/01 22:06:38 ncq 532 # - bump version 533 # 534 # Revision 1.161 2009/11/19 15:07:14 ncq 535 # - 0.6.rc1 536 # 537 # Revision 1.160 2009/09/13 18:45:43 ncq 538 # - pre-bump version 539 # 540 # Revision 1.159 2009/08/11 11:03:28 ncq 541 # - version fix 542 # 543 # Revision 1.158 2009/08/04 13:02:22 ncq 544 # - bump version 545 # 546 # Revision 1.157 2009/07/18 12:15:24 ncq 547 # - 0.5.rc4 548 # 549 # Revision 1.156 2009/07/09 16:48:07 ncq 550 # - bump version 551 # - properly lookup "local import" cli option 552 # 553 # Revision 1.155 2009/07/06 19:52:18 ncq 554 # - 0.5.rc3 555 # 556 # Revision 1.154 2009/06/22 12:39:36 ncq 557 # - bump version 558 # 559 # Revision 1.153 2009/04/03 09:52:28 ncq 560 # - log lsb_release if available 561 # 562 # Revision 1.152 2009/03/18 14:31:41 ncq 563 # - bump version 564 # - --local-import -> local-import -> prefer_local_catalog in install_domain 565 # 566 # Revision 1.151 2009/03/04 13:50:00 ncq 567 # - bump version 568 # 569 # Revision 1.150 2009/03/02 11:24:12 ncq 570 # - bump version 571 # 572 # Revision 1.149 2009/02/27 12:40:44 ncq 573 # - bump version 574 # 575 # Revision 1.148 2009/02/24 10:38:41 ncq 576 # - improve python path manipulation 577 # 578 # Revision 1.147 2009/02/17 12:01:43 ncq 579 # - bump version 580 # 581 # Revision 1.146 2008/12/17 21:59:46 ncq 582 # - support --hipaa 583 # 584 # Revision 1.145 2008/11/23 12:47:27 ncq 585 # - comment on lsb_release 586 # 587 # Revision 1.144 2008/10/22 12:23:13 ncq 588 # - initiate version handling 589 # - add -V/--version 590 # 591 # Revision 1.143 2008/08/31 14:52:58 ncq 592 # - improved error messages 593 # - streamline setup_cfg and properly handle no --conf-file 594 # - detect and signal "no conf file at all" 595 # 596 # Revision 1.142 2008/08/05 12:47:14 ncq 597 # - support --local-import 598 # - some cleanup 599 # 600 # Revision 1.141 2008/07/10 21:08:16 ncq 601 # - call path detection with app name 602 # 603 # Revision 1.140 2008/06/11 19:12:13 ncq 604 # - add a comment 605 # 606 # Revision 1.139 2008/05/29 13:32:22 ncq 607 # - signal handlers cleanup 608 # 609 # Revision 1.138 2008/04/13 14:40:17 ncq 610 # - no old style logging anymore 611 # 612 # Revision 1.137 2008/03/06 21:30:49 ncq 613 # - comment out legacy logging 614 # - shutdown_backend() 615 # - shutdown_logging() 616 # 617 # Revision 1.136 2008/03/06 18:29:30 ncq 618 # - standard lib logging only 619 # 620 # Revision 1.135 2008/02/25 17:43:40 ncq 621 # - try suppressing the Python-on-Windows logging bug 622 # 623 # Revision 1.134 2008/01/30 14:10:40 ncq 624 # - cleanup 625 # 626 # Revision 1.133 2008/01/14 20:45:45 ncq 627 # - use set_string_encoding() 628 # 629 # Revision 1.132 2008/01/05 22:32:33 ncq 630 # - setup_backend() 631 # 632 # Revision 1.131 2007/12/26 21:06:38 ncq 633 # - don't use gmTools too early 634 # 635 # Revision 1.130 2007/12/26 20:59:41 ncq 636 # - fix faulty parens 637 # 638 # Revision 1.129 2007/12/26 20:53:15 ncq 639 # - set_option does not take None, so use gmTools.coalesce() 640 # 641 # Revision 1.128 2007/12/26 20:18:44 ncq 642 # - add = to long options where needed 643 # 644 # Revision 1.127 2007/12/26 12:36:37 ncq 645 # - missing : 646 # - extra or 647 # 648 # Revision 1.126 2007/12/23 21:15:26 ncq 649 # - add setup_backend() 650 # 651 # Revision 1.125 2007/12/23 20:56:32 ncq 652 # - cleanup++ 653 # 654 # Revision 1.124 2007/12/12 16:26:10 ncq 655 # - a whole bunch of cleanup, particularly related to logging 656 # 657 # Revision 1.123 2007/10/21 20:21:17 ncq 658 # - no more mandatory global config file 659 # 660 # Revision 1.122 2007/09/04 23:30:42 ncq 661 # - explain --slave 662 # 663 # Revision 1.121 2007/08/07 21:42:40 ncq 664 # - cPaths -> gmPaths 665 # 666 # Revision 1.120 2007/07/22 09:28:13 ncq 667 # - tmp/ now in .gnumed/ 668 # 669 # Revision 1.119 2007/07/13 09:12:35 ncq 670 # - setup signal handler 671 # 672 # Revision 1.118 2007/05/21 14:49:42 ncq 673 # - create gnumed/export/EMR/ 674 # 675 # Revision 1.117 2007/05/08 16:07:00 ncq 676 # - console exception display handler factored out 677 # - cleanup 678 # 679 # Revision 1.116 2007/05/08 11:16:51 ncq 680 # - cleanup 681 # 682 # Revision 1.115 2007/05/07 12:34:41 ncq 683 # - better --debug docs 684 # - cleanup 685 # - always startup with --debug enabled 686 # 687 # Revision 1.114 2007/04/19 13:14:50 ncq 688 # - init paths 689 # 690 # Revision 1.113 2007/04/11 20:47:13 ncq 691 # - no more 'resource dir' and 'gnumed_dir' 692 # 693 # Revision 1.112 2007/03/27 10:29:49 ncq 694 # - better placement for default word list 695 # 696 # Revision 1.111 2007/03/26 14:45:36 ncq 697 # - cleanup 698 # - remove --talkback handling (it will be better supported next version) 699 # - create path gnumed/logs/ at startup 700 # 701 # Revision 1.110 2007/03/18 14:11:34 ncq 702 # - a bit of clenaup/refactoring 703 # - add hooks before/after GUI 704 # 705 # Revision 1.109 2007/03/08 11:54:18 ncq 706 # - no more ~/.gnumed/user-preferences.conf 707 # 708 # Revision 1.108 2007/02/22 17:38:09 ncq 709 # - add gnumed/export/xDT/ 710 # 711 # Revision 1.107 2007/01/30 17:50:14 ncq 712 # - improved doc string 713 # 714 # Revision 1.106 2007/01/30 17:41:03 ncq 715 # - setup needed pathes in home dir of user at startup 716 # 717 # Revision 1.105 2006/12/21 17:54:43 ncq 718 # - init date/time handling early on 719 # 720 # Revision 1.104 2006/11/15 00:40:35 ncq 721 # - if we encounter and unhandled exception we can just as well be verbose 722 # 723 # Revision 1.103 2006/09/01 14:47:22 ncq 724 # - no more --unicode-gettext handling 725 # 726 # Revision 1.102 2006/08/08 10:28:30 ncq 727 # - show sys.path when failing to import GNUmed modules 728 # 729 # Revision 1.101 2006/08/08 10:13:01 ncq 730 # - fix typo 731 # 732 # Revision 1.100 2006/08/01 18:49:06 ncq 733 # - improve wording on failure to load our own modules 734 # 735 # Revision 1.99 2006/07/24 19:28:01 ncq 736 # - fixed variable verwechsling 737 # 738 # Revision 1.98 2006/07/01 13:15:04 ncq 739 # - cleanup 740 # 741 # Revision 1.97 2006/07/01 11:33:52 ncq 742 # - --text-domain/--lang-gettext/--unicode-gettext CLI options 743 # must now be provided by gmI18N *importers* 744 # 745 # Revision 1.96 2006/06/26 21:38:09 ncq 746 # - cleanup 747 # 748 # Revision 1.95 2006/06/15 21:34:46 ncq 749 # - log unhandled exceptions, too 750 # 751 # Revision 1.94 2006/06/13 20:36:57 ncq 752 # - use gmI18N only, don't mess with locale ourselves 753 # 754 # Revision 1.93 2006/06/06 20:56:24 ncq 755 # - cleanup 756 # 757 # Revision 1.92 2006/05/24 09:56:02 ncq 758 # - cleanup 759 # - hook sys.excepthook 760 # 761 # Revision 1.91 2005/12/27 19:02:41 ncq 762 # - document --overide-schema-check 763 # 764 # Revision 1.90 2005/12/23 15:43:23 ncq 765 # - refuse to be run as root 766 # - exit with status 0 if imported as module 767 # 768 # Revision 1.89 2005/12/11 13:31:44 ncq 769 # - deal with people setting their locale to something they don't have installed 770 # 771 # Revision 1.88 2005/10/30 15:53:13 ncq 772 # - try to be more careful and more precise when setting up the locale 773 # 774 # Revision 1.87 2005/09/28 21:27:30 ncq 775 # - a lot of wx2.6-ification 776 # 777 # Revision 1.86 2005/09/28 15:57:48 ncq 778 # - a whole bunch of wx.Foo -> wx.Foo 779 # 780 # Revision 1.85 2005/08/18 18:57:58 ncq 781 # - document --lang-gettext 782 # 783 # Revision 1.84 2005/07/24 11:36:44 ncq 784 # - cleanup 785 # 786 # Revision 1.83 2005/07/23 14:41:13 shilbert 787 # - locale setup failed on MS Windows 788 # 789 # Revision 1.82 2005/07/17 17:22:04 ncq 790 # - handle path expansion/normalization more carefully to 791 # hopefully cope with MS Windows shortcomings 792 # - be slightly more informative on startup re paths 793 # 794 # Revision 1.81 2005/07/16 18:36:35 ncq 795 # - more careful error catching around locale access 796 # 797 # Revision 1.80 2005/07/04 11:27:57 ncq 798 # - GnuMed -> GNUmed 799 # 800 # Revision 1.79 2005/06/29 15:11:05 ncq 801 # - make startup messages a bit more consistent 802 # 803 # Revision 1.78 2005/06/23 15:00:53 ncq 804 # - log default string encoding 805 # 806 # Revision 1.77 2005/04/26 20:02:48 ncq 807 # - cleanup 808 # 809 # Revision 1.76 2005/04/25 17:32:58 ncq 810 # - entirely comment out setup_locale 811 # 812 # Revision 1.75 2005/04/24 14:06:38 ncq 813 # - commented out a few locale queries that seemed to crash Richard's system ... 814 # 815 # Revision 1.74 2005/04/11 18:02:34 ncq 816 # - initial code to handle signals 817 # 818 # Revision 1.73 2005/03/30 22:10:39 ncq 819 # - even more better logging ... 820 # 821 # Revision 1.72 2005/03/29 07:32:36 ncq 822 # - add --unicode-gettext 823 # - add setup_locale() 824 # 825 # Revision 1.71 2005/02/03 20:35:41 ncq 826 # - slightly silence the console 827 # 828 # Revision 1.70 2005/02/01 10:16:07 ihaywood 829 # refactoring of gmDemographicRecord and follow-on changes as discussed. 830 # 831 # gmTopPanel moves to gmHorstSpace 832 # gmRichardSpace added -- example code at present, haven't even run it myself 833 # (waiting on some icon .pngs from Richard) 834 # 835 # Revision 1.69 2004/09/13 09:31:10 ncq 836 # - --slave and --port now in config file, remove help 837 # 838 # Revision 1.68 2004/09/10 10:40:48 ncq 839 # - add --conf-file option to --help output 840 # 841 # Revision 1.67 2004/08/16 11:59:10 ncq 842 # - fix existence check for config file (eg. test for Null instance, not None) 843 # 844 # Revision 1.66 2004/07/17 11:36:35 ncq 845 # - comment out refcounting even on normal --debug runs 846 # 847 # Revision 1.65 2004/06/26 23:10:18 ncq 848 # - add object refcounting when --debug 849 # 850 # Revision 1.64 2004/06/25 12:31:36 ncq 851 # - add profiling support via --profile=<file> 852 # 853 # Revision 1.63 2004/06/25 08:04:07 ncq 854 # - missing ) found by epydoc 855 # 856 # Revision 1.62 2004/06/23 21:07:26 ncq 857 # - log Python version, platform type, os name at startup 858 # 859 # Revision 1.61 2004/05/11 08:10:27 ncq 860 # - try: except: the warnings.filterwarnings code as some Pythons don't seem to have it 861 # 862 # Revision 1.60 2004/03/25 11:02:37 ncq 863 # - cleanup 864 # 865 # Revision 1.59 2004/03/04 19:45:51 ncq 866 # - add get_resource_path() 867 # - reorder main() flow 868 # - switch to from Gnumed.* import * 869 # 870 # Revision 1.58 2004/02/25 09:46:22 ncq 871 # - import from pycommon now, not python-common 872 # 873 # Revision 1.57 2004/02/05 23:52:37 ncq 874 # - --slave/--port docstring 875 # 876 # Revision 1.56 2003/11/17 10:56:39 sjtan 877 # 878 # synced and commiting. 879 # 880 # Revision 1.1 2003/10/23 06:02:40 sjtan 881 # 882 # manual edit areas modelled after r.terry's specs. 883 # 884 # Revision 1.55 2003/06/19 15:29:20 ncq 885 # - spelling, cleanup 886 # 887 # Revision 1.54 2003/06/01 12:28:23 ncq 888 # - fatal now "verbose" in LogException, use it 889 # 890 # Revision 1.53 2003/06/01 01:47:33 sjtan 891 # 892 # starting allergy connections. 893 # 894 # Revision 1.52 2003/04/02 13:31:57 ncq 895 # - turn Mandrake Python 2.3 True/False DeprecationWarning exceptions back into simple Warnings 896 # 897 # Revision 1.51 2003/03/30 00:24:00 ncq 898 # - typos 899 # - (hopefully) less confusing printk()s at startup 900 # 901 # Revision 1.50 2003/02/08 00:37:49 ncq 902 # - cleanup, one more module dir 903 # 904 # Revision 1.49 2003/02/07 21:06:02 sjtan 905 # 906 # refactored edit_area_gen_handler to handler_generator and handler_gen_editarea. New handler for gmSelectPerson 907 # 908 # Revision 1.48 2003/02/03 14:29:08 ncq 909 # - finally fixed that annoying Pseudo error exception.SystemExit on login dialog cancellation 910 # 911 # Revision 1.47 2003/01/20 08:25:15 ncq 912 # - better error messages 913 # 914 # Revision 1.46 2003/01/19 13:16:46 ncq 915 # - better instructions on failing starts 916 # 917 # Revision 1.45 2003/01/14 19:36:39 ncq 918 # - better logging of fatal exceptions 919 # 920 # Revision 1.44 2002/11/06 11:52:43 ncq 921 # - correct misleading printk()s 922 # 923 # Revision 1.43 2002/11/04 15:38:59 ncq 924 # - use helper in gmCfg for config file creation 925 # 926 # Revision 1.42 2002/11/03 14:10:15 ncq 927 # - autocreate empty config file on failing to find one 928 # - might fail on Windows - untested so far 929 # 930 # Revision 1.41 2002/11/03 13:22:20 ncq 931 # - phase 1: raise log level of console logger to lPanic only 932 # - gives a lot less confusing output 933 # 934 # Revision 1.40 2002/09/08 23:31:09 ncq 935 # - really fail on failing to load a module 936 # 937 # @change log: 938 # 01.03.2002 hherb first draft, untested 939