def set_active_group(window, view, other_group): nag = window.active_group() if other_group: group = 0 if other_group == 'left' else 1 groups = window.num_groups() if groups == 1: width = calc_width(view) cols = [0.0, width, 1.0 ] if other_group == 'left' else [0.0, 1 - width, 1.0] window.set_layout({ "cols": cols, "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] }) elif view: group = get_group(groups, nag) window.set_view_index(view, group, 0) else: group = nag # when other_group is left, we need move all views to right except FB view if nag == 0 and other_group == 'left' and group == 0: for v in reversed(window.views_in_group(nag)[1:]): window.set_view_index(v, 1, 0) return (nag, group)
def _other_group(self, w, nag): ''' creates new group if need and return index of the group where files shall be opened ''' groups = w.num_groups() if groups == 1: width = calc_width(self.view) w.set_layout({"cols": [0.0, width, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]}) group = get_group(groups, nag) return group
def set_active_group(window, view, other_group): nag = window.active_group() if other_group: group = 0 if other_group == 'left' else 1 groups = window.num_groups() if groups == 1: width = calc_width(view) cols = [0.0, width, 1.0] if other_group == 'left' else [0.0, 1-width, 1.0] window.set_layout({"cols": cols, "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]}) elif view: group = get_group(groups, nag) window.set_view_index(view, group, 0) else: group = nag # when other_group is left, we need move all views to right except FB view if nag == 0 and other_group == 'left' and group == 0: for v in reversed(window.views_in_group(nag)[1:]): window.set_view_index(v, 1, 0) return (nag, group)