home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / gui / video / webvideo.pyo (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.9 KB  |  59 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from __future__ import with_statement
  5. import wx
  6. from gui import skin
  7. from gui.browser import BrowserFrame, reload_plugins
  8. from gui.toolbox import persist_window_pos, snap_pref
  9. from logging import getLogger
  10. log = getLogger('webvideo')
  11. video_frame_url = 'http://v.digsby.com/embed.php?id=%(widget_id)s'
  12. video_frame_style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.STAY_ON_TOP
  13. video_frame_size = (542, 264)
  14.  
  15. def confirm_invite(buddy_name):
  16.     return wx.YES == wx.MessageBox(_('%s has invited you to an audio/video chat.\n\nWould you like to join?') % buddy_name, _('Audio/Video Chat Invitation'), style = wx.YES_NO)
  17.  
  18.  
  19. class VideoChatWindow(BrowserFrame):
  20.     
  21.     def __init__(self, title, widget_id, on_close = None):
  22.         self.widget_url = video_frame_url % dict(widget_id = widget_id)
  23.         reload_plugins()
  24.         BrowserFrame.__init__(self, None, name = 'Video Chat Window', title = title, url = self.widget_url, style = video_frame_style, external_links = False)
  25.         self.on_close = on_close
  26.         self.SetFrameIcon(skin.get('AppDefaults.TaskBarIcon'))
  27.         self.Bind(wx.webview.EVT_WEBVIEW_BEFORE_LOAD, self._VideoChatWindow__onbeforeload)
  28.         persist_window_pos(self, position_only = True)
  29.         snap_pref(self)
  30.         self.SetClientSize(video_frame_size)
  31.         log.debug('opening video embed url: %s' % self.widget_url)
  32.         if on_close is not None:
  33.             self.Bind(wx.EVT_CLOSE, self.OnClose)
  34.         
  35.  
  36.     
  37.     def __onbeforeload(self, e):
  38.         if e.NavigationType == wx.webview.WEBVIEW_NAV_LINK_CLICKED:
  39.             url = e.URL
  40.             if not any((url.startswith('digsby:'), url.startswith('javascript:'))):
  41.                 if url == 'http://www.adobe.com/go/getflashplayer':
  42.                     url = 'http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe'
  43.                 
  44.                 wx.LaunchDefaultBrowser(url)
  45.                 e.Cancel()
  46.                 return None
  47.         
  48.         e.Skip()
  49.  
  50.     
  51.     def OnClose(self, e):
  52.         self.Hide()
  53.         e.Skip()
  54.         if self.on_close is not None:
  55.             self.on_close()
  56.         
  57.  
  58.  
  59.