home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / xulrunner / python / frontend.py < prev    next >
Encoding:
Python Source  |  2007-11-12  |  2.5 KB  |  62 lines

  1. # Miro - an RSS based video player application
  2. # Copyright (C) 2005-2007 Participatory Culture Foundation
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  17.  
  18. # Almost everything is split out into files under frontend-implementation.
  19. # Note: these can't be in just any order; there is some subtlety in the
  20. # initialization order, so take care.
  21.  
  22. from frontend_implementation.HTMLDisplay import HTMLDisplay, getDTVAPIURL, getDTVAPICookie
  23. from frontend_implementation.Application import Application
  24. from frontend_implementation.UIBackendDelegate import UIBackendDelegate
  25. from frontend_implementation.MainFrame import MainFrame
  26. from frontend_implementation.VideoDisplay import VideoDisplay, PlaybackController
  27. import frontend_implementation.startup as startup
  28.  
  29. # FIXME: I threw this here so distutils would find it --NN
  30. import migrateappname
  31.  
  32. # these get set in components.pybridge.onStartup
  33. jsBridge = None
  34. vlcRenderer = None
  35.  
  36. currentVideoPath = None # gets changed in MainFrame.onSelectedTabChange()
  37.  
  38. def quit(emergencyExit=False):
  39.     jsBridge.closeWindow()
  40.  
  41. # Python's sys.exit isn't sufficient in a Windows application. It's not
  42. # clear why.
  43. # NEEDS: this is probably *not* what we want to do under XUL.
  44. from ctypes.wintypes import windll
  45. def exit(returnCode):
  46.     windll.kernel32.ExitProcess(returnCode)
  47.  
  48. def inMainThread(function, args=None, kwargs=None):
  49.     # TODO: IMPLEMENT THIS CORRECTLY (Currently calling on the same thread)
  50.     if args is None:
  51.         args = ()
  52.     if kwargs is None:
  53.         kwargs = {}
  54.     return function(*args, **kwargs)
  55.     
  56. # NEEDS: preferences
  57. #        config.set(prefs.RUN_DTV_AT_STARTUP, <bool>)
  58. #        config.set(prefs.CHECK_CHANNELS_EVERY_X_MN, minutes)
  59. #        config.set(prefs.LIMIT_UPSTREAM, <bool>)
  60. #        config.set(prefs.UPSTREAM_LIMIT_IN_KBS, <real>)
  61. #        config.set(prefs.PRESERVE_X_GB_FREE, <real>)
  62.