You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.6 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. #!/usr/bin/env python2
  2. # -*- coding: utf-8 -*-
  3. """Youtubedlg __init__ file.
  4. Responsible on how the package looks from the outside.
  5. Example:
  6. In order to load the GUI from a python script.
  7. import youtube_dl_gui
  8. youtube_dl_gui.main()
  9. """
  10. from __future__ import unicode_literals
  11. import sys
  12. import gettext
  13. try:
  14. import wx
  15. except ImportError as error:
  16. print error
  17. sys.exit(1)
  18. # For package use
  19. from .version import __version__
  20. from .info import (
  21. __author__,
  22. __appname__,
  23. __contact__,
  24. __license__,
  25. __projecturl__,
  26. __licensefull__,
  27. __description__,
  28. __descriptionfull__,
  29. )
  30. from .logmanager import LogManager
  31. from .optionsmanager import OptionsManager
  32. from .utils import (
  33. get_config_path,
  34. get_locale_file
  35. )
  36. # Set config path and create options and log managers
  37. config_path = get_config_path()
  38. opt_manager = OptionsManager(config_path)
  39. log_manager = None
  40. if opt_manager.options['enable_log']:
  41. log_manager = LogManager(config_path, opt_manager.options['log_time'])
  42. # Set gettext before MainFrame import
  43. # because the GUI strings are class level attributes
  44. locale_dir = get_locale_file()
  45. try:
  46. gettext.translation('youtube_dl_gui', locale_dir, [opt_manager.options['locale_name']]).install(unicode=True)
  47. except IOError:
  48. opt_manager.options['locale_name'] = 'en_US'
  49. gettext.install('youtube_dl_gui')
  50. from .mainframe import MainFrame
  51. def main():
  52. """The real main. Creates and calls the main app windows. """
  53. app = wx.App()
  54. frame = MainFrame(opt_manager, log_manager)
  55. frame.Show()
  56. app.MainLoop()