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.

82 lines
1.7 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
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. gettext.install('youtube_dl_gui')
  31. from .formats import reload_strings
  32. from .logmanager import LogManager
  33. from .optionsmanager import OptionsManager
  34. from .utils import (
  35. get_config_path,
  36. get_locale_file
  37. )
  38. # Set config path and create options and log managers
  39. config_path = get_config_path()
  40. opt_manager = OptionsManager(config_path)
  41. log_manager = None
  42. if opt_manager.options['enable_log']:
  43. log_manager = LogManager(config_path, opt_manager.options['log_time'])
  44. # Set gettext before MainFrame import
  45. # because the GUI strings are class level attributes
  46. locale_dir = get_locale_file()
  47. try:
  48. gettext.translation('youtube_dl_gui', locale_dir, [opt_manager.options['locale_name']]).install(unicode=True)
  49. except IOError:
  50. opt_manager.options['locale_name'] = 'en_US'
  51. gettext.install('youtube_dl_gui')
  52. reload_strings()
  53. from .mainframe import MainFrame
  54. def main():
  55. """The real main. Creates and calls the main app windows. """
  56. app = wx.App()
  57. frame = MainFrame(opt_manager, log_manager)
  58. frame.Show()
  59. app.MainLoop()