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.

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