# Path: tilenol/xcb/core.py
# class Rectangle(namedtuple('_Rectangle', 'x y width height')):
#     __slots__ = ()
# 
# Path: tilenol/commands.py
# class CommandDispatcher(dict):
# 
#     def __init__(self):
#         self.events = Events()
# 
#     def __setitem__(self, name, value):
#         super().__setitem__(name, value)
#         ev = self.events.get(name)
#         if ev is not None:
#             ev.emit()
# 
#     def call(self, obj, meth, *args):
#         getattr(self[obj], 'cmd_' + meth)(*args)
# 
#     def callback(self, *args):
#         return partial(self.call, *args)
# 
# Path: tilenol/layout/base.py
# class Layout(metaclass=LayoutMeta):
# 
#     def __init__(self):
#         self.visible = False
#         self.relayout = Event('layout.relayout')
#         self.relayout.listen(self.check_relayout)
# 
#     def check_relayout(self):
#         if self.visible:
#             self.layout()
#             self.group.check_focus()
# 
#     @classmethod
#     def get_defined_classes(cls, base):
#         res = OrderedDict()
#         for k in cls.fields:
#             v = getattr(cls, k)
#             if isinstance(v, type) and issubclass(v, base):
#                 res[k] = v
#         return res
# 
#     def dirty(self):
#         self.relayout.emit()
# 
#     def all_visible_windows(self):
#         for i in getattr(self, 'visible_windows', ()):
#             yield i
#         sub = getattr(self, 'sublayouts', None)
#         if sub:
#             for s in sub():
#                 for i in s.visible_windows:
#                     yield i
# 
#     def hide(self):
#         self.visible = False
#         for i in self.all_visible_windows():
#             i.hide()
# 
#     def show(self):
#         self.visible = True
#         for i in self.all_visible_windows():
#             i.show()


from collections import OrderedDict
from math import floor
from functools import wraps
from zorro.di import has_dependencies, dependency, di
from tilenol.xcb import Rectangle
from tilenol.commands import CommandDispatcher
from . import Layout
            w.show()
            start = end


def stackcommand(fun):
    @wraps(fun)
    def wrapper(self, *args):
        try:
            win = self.commander['window']
        except KeyError:
            return
        stack = win.lprops.stack
        if stack is None:
            return
        return fun(self, self.stacks[stack], win, *args)
    return wrapper


@has_dependencies
class Split(Layout):
    """Split layout

    It's customized by subclassing, not by instantiating. Class definition
    should consist of at least one stack

    :var fixed: whether to skip empty stacks or reserve place for them
    """
    fixed = False
    vertical = True


# Path: tilenol/xcb/core.py
# class Rectangle(namedtuple('_Rectangle', 'x y width height')):
#     __slots__ = ()
# 
# Path: tilenol/commands.py
# class CommandDispatcher(dict):
# 
#     def __init__(self):
#         self.events = Events()
# 
#     def __setitem__(self, name, value):
#         super().__setitem__(name, value)
#         ev = self.events.get(name)
#         if ev is not None:
#             ev.emit()
# 
#     def call(self, obj, meth, *args):
#         getattr(self[obj], 'cmd_' + meth)(*args)
# 
#     def callback(self, *args):
#         return partial(self.call, *args)
# 
# Path: tilenol/layout/base.py
# class Layout(metaclass=LayoutMeta):
# 
#     def __init__(self):
#         self.visible = False
#         self.relayout = Event('layout.relayout')
#         self.relayout.listen(self.check_relayout)
# 
#     def check_relayout(self):
#         if self.visible:
#             self.layout()
#             self.group.check_focus()
# 
#     @classmethod
#     def get_defined_classes(cls, base):
#         res = OrderedDict()
#         for k in cls.fields:
#             v = getattr(cls, k)
#             if isinstance(v, type) and issubclass(v, base):
#                 res[k] = v
#         return res
# 
#     def dirty(self):
#         self.relayout.emit()
# 
#     def all_visible_windows(self):
#         for i in getattr(self, 'visible_windows', ()):
#             yield i
#         sub = getattr(self, 'sublayouts', None)
#         if sub:
#             for s in sub():
#                 for i in s.visible_windows:
#                     yield i
# 
#     def hide(self):
#         self.visible = False
#         for i in self.all_visible_windows():
#             i.hide()
# 
#     def show(self):
#         self.visible = True
#         for i in self.all_visible_windows():
#             i.show()


# Path: tilenol/layout/tile.py
from collections import OrderedDict
from math import floor
from functools import wraps
from zorro.di import has_dependencies, dependency, di
from tilenol.xcb import Rectangle
from tilenol.commands import CommandDispatcher
from . import Layout

            w.show()
            start = end


def stackcommand(fun):
    @wraps(fun)
    def wrapper(self, *args):
        try:
            win = self.commander['window']
        except KeyError:
            return
        stack = win.lprops.stack
        if stack is None:
            return
        return fun(self, self.stacks[stack], win, *args)
    return wrapper


@has_dependencies
class Split(Layout):
    """Split layout

    It's customized by subclassing, not by instantiating. Class definition
    should consist of at least one stack

    :var fixed: whether to skip empty stacks or reserve place for them
    """
    fixed = False
    vertical = True


    commander = dependency(CommandDispatcher, 'commander')