예제 #1
0
파일: main.py 프로젝트: tek/chiasma-py
def window_state(ui_window: Ident, twindow: Window, layout: ViewTree) -> Do:
    window_id = yield TS.from_maybe(twindow.id, 'window_state: `{twindow}` has no id')
    native_window_e = yield TS.lift(window(window_id))
    native_window = yield TS.from_either(native_window_e)
    panes = yield TS.lift(window_panes(window_id))
    native_pane, tail = yield TS.from_maybe(panes.detach_head, 'no panes in window')
    reference_pane = yield pane_by_id(native_pane.id)
    state = (
        reference_pane
        .map(L(TrackedWindow)(native_window, ui_window, layout, native_pane, _)) |
        L(PristineWindow)(native_window, ui_window, layout, native_pane)
    )
    yield TS.pure(state)
예제 #2
0
파일: main.py 프로젝트: tek/chiasma-py
 def tracked_window(self, win: TrackedWindow) -> Do:
     ref = yield TS.from_either(find_pane(win.pane.ident)(win.layout))
     width, height = int(win.native_window.width), int(win.native_window.height)
     measure_tree = measure_view_tree(self.bindings)(win.layout, width, height)
     yield pack_tree(self.session, self.window, self.principal)(measure_tree, ref)
예제 #3
0
파일: main.py 프로젝트: tek/chiasma-py
 def layout_node(self, node: MeasuredLayoutNode) -> Do:
     layout_reference = yield reference_pane(node)
     reference = yield TS.from_either(layout_reference)
     yield resize_view_with(node.data, reference.ident, self.vertical)
예제 #4
0
def pane_id_fatal(pane: Pane) -> TS[D, str]:
    return TS.from_either(pane.id.to_either(lambda: f'pane has no id: {pane}'))