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.

79 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
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 os.path
  13. import gettext
  14. try:
  15. import wx
  16. except ImportError as error:
  17. print error
  18. sys.exit(1)
  19. # For package use
  20. from .version import __version__
  21. from .info import (
  22. __author__,
  23. __appname__,
  24. __contact__,
  25. __license__,
  26. __projecturl__,
  27. __licensefull__,
  28. __description__,
  29. __descriptionfull__,
  30. )
  31. from .logmanager import LogManager
  32. from .optionsmanager import OptionsManager
  33. from .utils import (
  34. get_config_path,
  35. get_locale_file
  36. )
  37. # Set config path and create options and log managers
  38. config_path = get_config_path()
  39. opt_manager = OptionsManager(config_path)
  40. log_manager = None
  41. if opt_manager.options['enable_log']:
  42. log_manager = LogManager(config_path, opt_manager.options['log_time'])
  43. # Set gettext before MainFrame import
  44. # because the GUI strings are class level attributes
  45. locale_dir = get_locale_file()
  46. try:
  47. gettext.translation('youtube_dl_gui', locale_dir, [opt_manager.options['locale_name']]).install(unicode=True)
  48. except IOError:
  49. opt_manager.options['locale_name'] = 'en_US'
  50. gettext.install('youtube_dl_gui')
  51. from .mainframe import MainFrame
  52. def main():
  53. """The real main. Creates and calls the main app windows. """
  54. app = wx.App()
  55. frame = MainFrame(opt_manager, log_manager)
  56. frame.Show()
  57. app.MainLoop()