Exemple #1
0
 def run(self):
     """Record opacity changes until stop signal received."""
     while self.keep_going:
         opacity = xutil.request_opacity(self.window).unpack()
         if opacity != self.opacity_events[-1]:
             self.opacity_events.append(opacity)
     self.done = True
Exemple #2
0
    def flash_window(self, window):
        """Briefly change the opacity of a Xorg window."""
        log('Flashing window %s', str(window))
        try:
            pre_flash_opacity = xutil.request_opacity(window).unpack()

            log('Current opacity = %s', str(pre_flash_opacity))
            log('Beginning flash animation...')
            flash_series = self.compute_flash_series(pre_flash_opacity)
            for opacity in flash_series:
                xutil.set_opacity(window, opacity)
                sleep(self.timechunk)
            log('Resetting opacity to default')
            if pre_flash_opacity:
                xutil.set_opacity(window, pre_flash_opacity)
            else:
                xutil.delete_opacity(window)
        except WindowError:
            log('Attempted to flash a nonexistant window %s, ignoring...',
                str(window))
        log('Unlocking window %s', window)
        self.locked_windows.discard(window)
Exemple #3
0
def test_get_set_opacity(window):
    assert not xutil.request_opacity(window).unpack()
    xutil.set_opacity(window, 0.5)
    assert xutil.request_opacity(window).unpack() == approx(0.5, 0.00001)
Exemple #4
0
def test_delete_opacity(window):
    xutil.set_opacity(window, 0.5)
    assert xutil.request_opacity(window).unpack()
    xutil.delete_opacity(window)
    assert not xutil.request_opacity(window).unpack()
Exemple #5
0
 def __init__(self, window):
     super(WindowWatcher, self).__init__()
     self.window = window
     self.opacity_events = [xutil.request_opacity(self.window).unpack()]
     self.keep_going = True
     self.done = False