def saveWindowPos(win, uniqueId=""): ''' Saves a window's position to the config file. ''' cfg = local_settings() section = windowId(win.Name, uniqueId) if not cfg.has_section(section): cfg.add_section(section) if wxMSW: placement = GetWindowPlacement(win) # on win7, if a window is Aero Snapped, GetWindowPlacement will return # it's "unsnapped" size. we want to save the size of the window as it # is now, though--so grab the size from win.Rect and use that. if cgui.isWin7OrHigher() and not win.IsMaximized() and not win.IsIconized(): placement_set_size(placement, win.Rect.Size) cfg.set(section, 'placement', json.dumps(placement)) else: rect = GetNormalRect(win) sz, p = rect.GetSize(), rect.GetPosition() for k, v in [("x", p.x), ("y", p.y), ("w", sz.width), ("h", sz.height), ('maximized', win.IsMaximized())]: cfg.set(section, k, str(v)) cfg.save()
def register_hooks(self): if getattr(ImFrame, 'did_register_hooks', False): return ImFrame.did_register_hooks = True ImFrame.engage_is_idle = False def goidle(): ImFrame.engage_is_idle = True for win in all_imframes(): win._endengage() return True def unidle(): ImFrame.engage_is_idle = False for win in all_imframes(): if win.IsActive(): win._startengage() return True def idle_ms(ms_idle_time): if not ImFrame.engage_is_idle and ms_idle_time > IMWIN_STAT_IDLE_TIME: goidle() elif ImFrame.engage_is_idle and ms_idle_time < IMWIN_STAT_IDLE_TIME: unidle() return 15 * 1000 #request check in 15 second intervals hooks.register('digsby.app.idle', idle_ms) # win7 taskbar hook import cgui if config.platform == 'win' and cgui.isWin7OrHigher(): from gui.native.win.taskbar import set_overlay_icon, get_tab_notebook def icon_updated(imwin): get_tab_notebook(imwin.Top).InvalidateThumbnails(imwin) def later(): if wx.IsDestroyed(imwin): return set_overlay_icon(im_badge(), tlw=imwin.Top) wx.CallLater(300, later) hooks.register('digsby.overlay_icon_updated', icon_updated)
def SetFrameIcon(frame, bitmap): "Given any Bitmap/Image/PILImage, sets this frame's icon." small_w, small_h = GetMetric(wx.SYS_SMALLICON_X), GetMetric(wx.SYS_SMALLICON_Y) big_w, big_h = GetMetric(wx.SYS_ICON_X), GetMetric(wx.SYS_ICON_Y) if small_w == -1: small_w = 16 if small_h == -1: small_h = 16 if big_w == -1: big_w = 32 if big_h == -1: big_h = 32 if isinstance(bitmap, wx.IconBundle): bundle = bitmap elif isinstance(bitmap, list): bundle = wx.IconBundle() for b in bitmap: if isinstance(b, wx.Icon): bundle.AddIcon(b) else: bundle.AddIcon(IconFromBitmap(b.PIL.ResizedSmaller(big_w).ResizeCanvas(big_w, big_h).WXB)) else: small_bitmap = bitmap.PIL.ResizedSmaller(small_w).ResizeCanvas(small_w, small_h).WXB if cgui.isWin7OrHigher(): # On Windows 7, always use the Digsby icon for the 32x32 version. # this is so that our application icon in the taskbar always shows as the Digsby logo. global _win7bigicon if _win7bigicon is None: from gui import skin _win7bigicon = skin.get('AppDefaults.TaskBarIcon').PIL.ResizedSmaller(big_w).ResizeCanvas(big_w, big_h).WXB large_bitmap = _win7bigicon else: large_bitmap = bitmap.PIL.ResizedSmaller(big_w).ResizeCanvas(big_w, big_h).WXB bundle = wx.IconBundle() bundle.AddIcon(IconFromBitmap(large_bitmap)) bundle.AddIcon(IconFromBitmap(small_bitmap)) frame.SetIcons(bundle)
def _update_jumplist(): ''' updates the jumplist on a timer ''' if not cgui.isWin7OrHigher(): return def on_timer(): _set_jumplist_now() @wx.CallAfter def after(): try: t = buddylist_sorted.timer except AttributeError: t = buddylist_sorted.timer = wx.PyTimer(on_timer) on_timer() else: if not t.IsRunning(): t.StartOneShot(6000)
def register_hooks(self): if getattr(ImFrame, 'did_register_hooks', False): return ImFrame.did_register_hooks = True ImFrame.engage_is_idle = False def goidle(): ImFrame.engage_is_idle = True for win in all_imframes(): win._endengage() return True def unidle(): ImFrame.engage_is_idle = False for win in all_imframes(): if win.IsActive(): win._startengage() return True def idle_ms(ms_idle_time): if not ImFrame.engage_is_idle and ms_idle_time > IMWIN_STAT_IDLE_TIME: goidle() elif ImFrame.engage_is_idle and ms_idle_time < IMWIN_STAT_IDLE_TIME: unidle() return 15*1000 #request check in 15 second intervals hooks.register('digsby.app.idle', idle_ms) # win7 taskbar hook import cgui if config.platform == 'win' and cgui.isWin7OrHigher(): from gui.native.win.taskbar import set_overlay_icon, get_tab_notebook def icon_updated(imwin): get_tab_notebook(imwin.Top).InvalidateThumbnails(imwin) def later(): if wx.IsDestroyed(imwin): return set_overlay_icon(im_badge(), tlw=imwin.Top) wx.CallLater(300, later) hooks.register('digsby.overlay_icon_updated', icon_updated)