def __init__(self): wx.Frame.__init__(self, None, -1, _('Past Chat Browser'), name = 'Past Chat Browser') self.SetFrameIcon(skin.get('appdefaults.taskbaricon')) sz = self.Sizer = wx.BoxSizer(VERTICAL) self.pastbrowser = PastBrowserPanel(self) sz.Add(self.pastbrowser, 1, EXPAND) persist_window_pos(self, defaultPos = wx.Point(150, 150), defaultSize = wx.Size(700, 500)) snap_pref(self)
def __init__(self, prefs, defaults, parent=None, id=-1, title="Advanced Preferences", name = 'Advanced Preferences'): wx.Frame.__init__(self, parent, id, title, style = wx.DEFAULT_FRAME_STYLE & ~(wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX)) self.prefs_viewer = PrefsViewer(self, prefs, defaults) from gui.toolbox import persist_window_pos, snap_pref persist_window_pos(self, unique_id = 'PrefsFrame', defaultPos = wx.Point(100, 100), defaultSize = wx.Size(600, 500), position_only = True) snap_pref(self)
def __init__(self, connection): wx.Frame.__init__(self, None, -1, 'XML Console for %s' % connection.username, name = 'XML Console') self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.panel = XMLConsole(self, connection) self.Bind(wx.EVT_CLOSE, self.panel.on_close) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.panel, 1, wx.EXPAND | wx.ALL) persist_window_pos(self, nostack = True) snap_pref(self)
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) # Set the frame icon with traceguard: from gui import skin self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon')) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) # Do snapping if set in the preferences from gui.toolbox import snap_pref, loadWindowPos snap_pref(self) defaultRect = get_default_blist_rect() loadWindowPos(self, defaultPos=defaultRect.Position, defaultSize=defaultRect.Size) # frame doesn't hide when mouse is over the infobox from gui.native.docking import Docker #@UnresolvedImport docker = self.docker = Docker(self) panel = self.buddyListPanel = BuddyListPanel(self) docker.ShouldShowInTaskbar = lambda: pref( 'buddylist.show_in_taskbar', default=True, type=bool) docker.ShouldAlwaysStayOnTop = self.SetAlwaysOnTop docker.LinkedWindows += [panel.infobox] docker.OnHide += panel.infobox.Hide self.userSizeForMaximize = None self.inMaximize = False Bind = self.Bind Bind(wx.EVT_SET_FOCUS, lambda e: panel.buddylist.SetFocus()) Bind(wx.EVT_CLOSE, self.on_close) def on_show(e): # hiding the buddylist triggers paging out RAM e.Skip() if not e.GetShow(): memory_event() Bind(wx.EVT_SHOW, on_show) if config.platform == 'win': Bind(wx.EVT_ICONIZE, self.on_iconize) if config.platform == 'mac': Bind(wx.EVT_MAXIMIZE, self.on_maximize) Bind(wx.EVT_SIZE, self.on_size)
def __init__(self, parent, initial_tab=default_selected_tab): wx.Frame.__init__(self, parent, title=_('Digsby Preferences'), size=self.default_size, style=prefs_dialog_style, name='Preferences Window') self.loaded_panels = {} self.SetMinSize(self.default_size) metrics.event('Prefs Dialog Opened') self.create_gui() self.bind_events() self.layout_gui() self.exithooks = Delegate() with traceguard: from gui import skin self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon')) if not wxMac: self.BackgroundColour = wx.WHITE self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.Bind(wx.EVT_PAINT, self.OnPaint) # Fake a first selection self.tabs.SetSelection(initial_tab) self.on_tab_selected(initial_tab) self.tabnames = names = [ module_name for module_name, nice_name in tabnames ] self.Bind(wx.EVT_CLOSE, self.on_close) self._loaded = 0 # Obey the windows.sticky prreference snap_pref(self) profile.prefs.add_observer(self.incoming_network_prefs) from gui.uberwidgets.keycatcher import KeyCatcher k = self._keycatcher = KeyCatcher(self) k.OnDown('ctrl+w', self.Close) k.OnDown('escape', self.Close)
def __init__(self, parent, xferlist): wx.Frame.__init__(self, parent, title = _('File Transfers'), name = 'File Transfers') self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon')) with traceguard: from gui.toolbox import snap_pref snap_pref(self) s = self.Sizer = wx.BoxSizer(wx.VERTICAL) ftp = FileTransferPanel(self, xferlist) s.Add(ftp, 1, wx.EXPAND) persist_window_pos(self, defaultPos = wx.Point(200, 200), defaultSize = wx.Size(450, 300)) self.Bind(wx.EVT_CLOSE, self.__OnClose)
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) # Set the frame icon with traceguard: from gui import skin self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon')) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) # Do snapping if set in the preferences from gui.toolbox import snap_pref, loadWindowPos snap_pref(self) defaultRect = get_default_blist_rect() loadWindowPos(self, defaultPos = defaultRect.Position, defaultSize = defaultRect.Size) # frame doesn't hide when mouse is over the infobox from gui.native.docking import Docker #@UnresolvedImport docker = self.docker = Docker(self) panel = self.buddyListPanel = BuddyListPanel(self) docker.ShouldShowInTaskbar = lambda: pref('buddylist.show_in_taskbar', default=True, type=bool) docker.ShouldAlwaysStayOnTop = self.SetAlwaysOnTop docker.LinkedWindows += [panel.infobox] docker.OnHide += panel.infobox.Hide self.userSizeForMaximize = None self.inMaximize = False Bind = self.Bind Bind(wx.EVT_SET_FOCUS, lambda e: panel.buddylist.SetFocus()) Bind(wx.EVT_CLOSE, self.on_close) def on_show(e): # hiding the buddylist triggers paging out RAM e.Skip() if not e.GetShow(): memory_event() Bind(wx.EVT_SHOW, on_show) if config.platform == 'win': Bind(wx.EVT_ICONIZE, self.on_iconize) if config.platform == 'mac': Bind(wx.EVT_MAXIMIZE, self.on_maximize) Bind(wx.EVT_SIZE, self.on_size)
def __init__(self, connection): wx.Frame.__init__(self, None, -1, 'XML Console for %s' % connection.username, name='XML Console') self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.panel = XMLConsole(self, connection) self.Bind(wx.EVT_CLOSE, self.panel.on_close) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.panel, 1, wx.EXPAND | wx.ALL) persist_window_pos(self, nostack=True) snap_pref(self)
def __init__(self, parent, initial_tab = default_selected_tab): wx.Frame.__init__(self, parent, title = _('Digsby Preferences'), size = self.default_size, style = prefs_dialog_style, name = 'Preferences Window') self.loaded_panels = {} self.SetMinSize(self.default_size) metrics.event('Prefs Dialog Opened') self.create_gui() self.bind_events() self.layout_gui() self.exithooks = Delegate() with traceguard: from gui import skin self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon')) if not wxMac: self.BackgroundColour = wx.WHITE self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.Bind(wx.EVT_PAINT, self.OnPaint) # Fake a first selection self.tabs.SetSelection(initial_tab) self.on_tab_selected(initial_tab) self.tabnames = names = [module_name for module_name, nice_name in tabnames] self.Bind(wx.EVT_CLOSE, self.on_close) self._loaded = 0 # Obey the windows.sticky prreference snap_pref(self) profile.prefs.add_observer(self.incoming_network_prefs) from gui.uberwidgets.keycatcher import KeyCatcher k = self._keycatcher = KeyCatcher(self) k.OnDown('ctrl+w', self.Close) k.OnDown('escape', self.Close)
def __init__(self, parent, xferlist): wx.Frame.__init__(self, parent, title=_('File Transfers'), name='File Transfers') self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon')) with traceguard: from gui.toolbox import snap_pref snap_pref(self) s = self.Sizer = wx.BoxSizer(wx.VERTICAL) ftp = FileTransferPanel(self, xferlist) s.Add(ftp, 1, wx.EXPAND) persist_window_pos(self, defaultPos=wx.Point(200, 200), defaultSize=wx.Size(450, 300)) self.Bind(wx.EVT_CLOSE, self.__OnClose)
def __init__(self, parent): wx.Frame.__init__(self, parent, title = _('Javascript Console'), name = 'JavaScript Console') with traceguard: from gui.toolbox import persist_window_pos, snap_pref persist_window_pos(self, defaultPos = wx.Point(50, 50), defaultSize = wx.Size(400, 300), nostack = True) snap_pref(self) from gui import skin self.SetFrameIcon(skin.get('AppDefaults.TaskbarIcon').Inverted) # don't allow menu events, etc, to go up to the IM window which # is our parent. self.SetExtraStyle(wx.WS_EX_BLOCK_EVENTS) self.construct() self.Bind(wx.EVT_TOOL, self.on_clear, id = ID_CLEAR) self.Bind(wx.EVT_CLOSE, self.close)
def __init__(self, prefs, defaults, parent=None, id=-1, title="Advanced Preferences", name='Advanced Preferences'): wx.Frame.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE & ~(wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX)) self.prefs_viewer = PrefsViewer(self, prefs, defaults) from gui.toolbox import persist_window_pos, snap_pref persist_window_pos(self, unique_id='PrefsFrame', defaultPos=wx.Point(100, 100), defaultSize=wx.Size(600, 500), position_only=True) snap_pref(self)
def __init__(self, title, widget_id, on_close = None): self.widget_url = video_frame_url % dict(widget_id = widget_id) reload_plugins() BrowserFrame.__init__(self, None, name = 'Video Chat Window', title = title, url = self.widget_url, style = video_frame_style, external_links=False) self.on_close = on_close self.SetFrameIcon(skin.get('AppDefaults.TaskBarIcon')) self.Bind(wx.webview.EVT_WEBVIEW_BEFORE_LOAD, self.__onbeforeload) persist_window_pos(self, position_only = True) snap_pref(self) self.SetClientSize(video_frame_size) log.debug('opening video embed url: %s' % self.widget_url) if on_close is not None: self.Bind(wx.EVT_CLOSE, self.OnClose)
def __init__(self, title, widget_id, on_close=None): self.widget_url = video_frame_url % dict(widget_id=widget_id) reload_plugins() BrowserFrame.__init__(self, None, name='Video Chat Window', title=title, url=self.widget_url, style=video_frame_style, external_links=False) self.on_close = on_close self.SetFrameIcon(skin.get('AppDefaults.TaskBarIcon')) self.Bind(wx.webview.EVT_WEBVIEW_BEFORE_LOAD, self.__onbeforeload) persist_window_pos(self, position_only=True) snap_pref(self) self.SetClientSize(video_frame_size) log.debug('opening video embed url: %s' % self.widget_url) if on_close is not None: self.Bind(wx.EVT_CLOSE, self.OnClose)
def __init__(self, pos = None, size = None, startMinimized = False, posId = ''): if pref('imwin.ads', type = bool, default = False): defaultSize = wx.Size(490, 470) else: defaultSize = wx.Size(470, 390) wininfo, placement = preLoadWindowPos(ImFrame.WindowName, uniqueId = posId, defaultPos = wx.Point(200, 200), defaultSize = defaultSize) wininfo['style'] |= wx.DEFAULT_FRAME_STYLE setPos = pos is not None setSize = size is not None if setPos or setSize: wininfo['style'] &= ~wx.MAXIMIZE if startMinimized: wininfo['style'] |= wx.ICONIZE self._starting_minimized = True # see comment in imhub.py's frame_show function wininfo['style'] |= wx.FULL_REPAINT_ON_RESIZE wx.Frame.__init__(self, parent = None, name = ImFrame.WindowName, **wininfo) self.on_engaged_start = Delegate() self.on_engaged_end = Delegate() self.on_sent_message = Delegate() # FIXME: Currently the IM window appearance is set by a load-time switch, as I want to first test # to ensure altering appearance.skin for Mac doesn't have other side-effects. if config.nativeIMWindow: import gui.imwin.imwin_native self.notebookPanel = gui.imwin.imwin_native.NativeNotebookPanel(self, -1) self.eventHandler = gui.imwin.imwin_native.NativeIMFrameEventHandler(self) else: preview = None if config.platform == 'win': preview = ImTabController self.notebookPanel = SkinnedNotebookPanel(self, -1, preview=preview) self.eventHandler = SkinnedIMFrameEventHandler(self) from gui.imwin.imwin_ads import construct_ad_panel ad_panel = construct_ad_panel(self, self.notebookPanel, self.notebookPanel.notebook.did_add) self.notebook.winman = TabWindowManager(lambda pos, size=None: ImFrame(pos = pos, size=size)) if placement is not None and not (setPos or setSize): with traceguard: from gui.toolbox import SetWindowPlacement SetWindowPlacement(self, placement) if setPos: self.Position = pos if setSize: self.Size = size if not config.nativeIMWindow: self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.posId = posId self.EnsureInScreen() if pos is not None: wx.CallAfter(self.EnsureNotStacked) # obey always on top and snapping prefs profile.prefs.link(IMWIN_ALWAYS_ON_TOP_PREF, self.on_always_on_top, callnow=not startMinimized) snap_pref(self) self.iconizecallbacks = set() Bind = self.Bind Bind(wx.EVT_ICONIZE, self.OnIconize) memory_event() def gainfocus(e): if e.Active: self._startengage() else: self._endengage() e.Skip() Bind(wx.EVT_ACTIVATE, gainfocus) self.register_hooks()
def __init__(self, pos=None, size=None, startMinimized=False, posId=''): if pref('imwin.ads', type=bool, default=False): defaultSize = wx.Size(490, 470) else: defaultSize = wx.Size(470, 390) wininfo, placement = preLoadWindowPos(ImFrame.WindowName, uniqueId=posId, defaultPos=wx.Point(200, 200), defaultSize=defaultSize) wininfo['style'] |= wx.DEFAULT_FRAME_STYLE setPos = pos is not None setSize = size is not None if setPos or setSize: wininfo['style'] &= ~wx.MAXIMIZE if startMinimized: wininfo['style'] |= wx.ICONIZE self._starting_minimized = True # see comment in imhub.py's frame_show function wininfo['style'] |= wx.FULL_REPAINT_ON_RESIZE wx.Frame.__init__(self, parent=None, name=ImFrame.WindowName, **wininfo) self.on_engaged_start = Delegate() self.on_engaged_end = Delegate() self.on_sent_message = Delegate() # FIXME: Currently the IM window appearance is set by a load-time switch, as I want to first test # to ensure altering appearance.skin for Mac doesn't have other side-effects. if config.nativeIMWindow: import gui.imwin.imwin_native self.notebookPanel = gui.imwin.imwin_native.NativeNotebookPanel( self, -1) self.eventHandler = gui.imwin.imwin_native.NativeIMFrameEventHandler( self) else: preview = None if config.platform == 'win': preview = ImTabController self.notebookPanel = SkinnedNotebookPanel(self, -1, preview=preview) self.eventHandler = SkinnedIMFrameEventHandler(self) from gui.imwin.imwin_ads import construct_ad_panel ad_panel = construct_ad_panel(self, self.notebookPanel, self.notebookPanel.notebook.did_add) self.notebook.winman = TabWindowManager( lambda pos, size=None: ImFrame(pos=pos, size=size)) if placement is not None and not (setPos or setSize): with traceguard: from gui.toolbox import SetWindowPlacement SetWindowPlacement(self, placement) if setPos: self.Position = pos if setSize: self.Size = size if not config.nativeIMWindow: self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.posId = posId self.EnsureInScreen() if pos is not None: wx.CallAfter(self.EnsureNotStacked) # obey always on top and snapping prefs profile.prefs.link(IMWIN_ALWAYS_ON_TOP_PREF, self.on_always_on_top, callnow=not startMinimized) snap_pref(self) self.iconizecallbacks = set() Bind = self.Bind Bind(wx.EVT_ICONIZE, self.OnIconize) memory_event() def gainfocus(e): if e.Active: self._startengage() else: self._endengage() e.Skip() Bind(wx.EVT_ACTIVATE, gainfocus) self.register_hooks()