Skip to content

Commit 378d631

Browse files
janezdPrimozGodec
authored andcommitted
Groupby: Rearrange columns
1 parent 7735e26 commit 378d631

File tree

2 files changed

+139
-74
lines changed

2 files changed

+139
-74
lines changed

Orange/widgets/data/owgroupby.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from contextlib import contextmanager
33
from dataclasses import dataclass
44
from functools import partial
5-
from math import ceil
65
from typing import Any, Dict, List, Optional, Set
76

87
import pandas as pd
@@ -359,13 +358,19 @@ def __init_main_area(self) -> None:
359358
# aggregations checkboxes
360359
grid_layout = QGridLayout()
361360
gui.widgetBox(self.mainArea, orientation=grid_layout, box="Aggregations")
362-
itm_col = ceil(len(AGGREGATIONS) / 3)
363361

364-
for i, agg in enumerate(AGGREGATIONS):
362+
col = 0
363+
row = 0
364+
break_rows = (5, 5, 99)
365+
for agg in AGGREGATIONS:
365366
self.agg_checkboxes[agg] = cb = CheckBox(agg, self)
366367
cb.setDisabled(True)
367368
cb.stateChanged.connect(partial(self.__aggregation_changed, agg))
368-
grid_layout.addWidget(cb, i % itm_col, i // itm_col)
369+
grid_layout.addWidget(cb, row, col)
370+
row += 1
371+
if row == break_rows[col]:
372+
row = 0
373+
col += 1
369374

370375
############
371376
# Callbacks

0 commit comments

Comments
 (0)