def __add_aggregation_controls(self): def new_inbox(): nonlocal row, col, inbox inbox = QWidget() layout = QGridLayout() inbox.setLayout(layout) layout.setContentsMargins(0, 0, 0, 0) box.layout().addWidget(inbox) row = col = 0 box = gui.vBox(self.controlArea, "Aggregations") row = col = 0 inbox = None new_inbox() self.aggregation_checkboxes = [] # for test purposes for agg in self.AGGREGATIONS: if agg is None: line = QFrame() line.setFrameShape(QFrame.HLine) line.setLineWidth(1) line.setFrameShadow(QFrame.Sunken) box.layout().addWidget(line) new_inbox() continue elif agg == 2: col += 1 row = 0 continue check_box = QCheckBox(str(agg), inbox) check_box.setChecked(agg in self.sel_agg_functions) check_box.clicked.connect( lambda *args, a=agg: self.__aggregation_cb_clicked(a, args[0])) inbox.layout().addWidget(check_box, row, col) self.aggregation_checkboxes.append(check_box) row += 1
def __add_aggregation_controls(self): box = gui.vBox(self.controlArea, "Aggregations") for agg in self.AGGREGATIONS: if agg is None: gui.separator(box, height=1) line = QFrame() line.setFrameShape(QFrame.HLine) line.setLineWidth(1) line.setFrameShadow(QFrame.Sunken) box.layout().addWidget(line) continue check_box = QCheckBox(str(agg), box) check_box.setChecked(agg in self.sel_agg_functions) check_box.clicked.connect( lambda *args, a=agg: self.__aggregation_cb_clicked(a, args[0])) box.layout().addWidget(check_box)
def __add_aggregation_controls(self): box = gui.vBox(self.controlArea, "聚合") chinese_aggs = [ "计数(Count)", "计数已定义项(Count_defined)", None, "总和(Sum)", "平均(Mean)", "样式(Mode)", "最小(Min)", "最大(Max)", "中位数(Median)", "变量(Var)", None, "大多数(Majority)" ] for agg, chinese_agg in zip(self.AGGREGATIONS, chinese_aggs): if agg is None: gui.separator(box, height=1) line = QFrame() line.setFrameShape(QFrame.HLine) line.setLineWidth(1) line.setFrameShadow(QFrame.Sunken) box.layout().addWidget(line) continue check_box = QCheckBox(str(chinese_agg), box) check_box.setChecked(agg in self.sel_agg_functions) check_box.clicked.connect( lambda *args, a=agg: self.__aggregation_cb_clicked(a, args[0])) box.layout().addWidget(check_box)