Move set_active_window into base class

It was only used in a single sub-class anyway
This commit is contained in:
Kovid Goyal 2018-02-02 13:56:25 +05:30
parent 2ee9844c2b
commit cc9a19b303
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -44,6 +44,7 @@ class Layout:
name = None
needs_window_borders = True
only_active_window_visible = False
def __init__(self, os_window_id, opts, border_width, windows):
self.os_window_id = os_window_id
@ -94,7 +95,9 @@ def bottom_blank_rect(self, window):
self.blank_rects.append(Rect(window.geometry.left, window.geometry.bottom, window.geometry.right, central.bottom + 1))
def set_active_window(self, windows, active_window_idx):
pass
if self.only_active_window_visible:
for i, w in enumerate(windows):
w.set_visible_in_layout(i, i == active_window_idx)
def __call__(self, windows, active_window_idx):
global central, cell_width, cell_height
@ -149,10 +152,7 @@ class Stack(Layout):
name = 'stack'
needs_window_borders = False
def set_active_window(self, windows, active_window_idx):
for i, w in enumerate(windows):
w.set_visible_in_layout(i, i == active_window_idx)
only_active_window_visible = True
def do_layout(self, windows, active_window_idx):
self.blank_rects = []