Skip to content

Commit 9abff17

Browse files
Clarify Merge Data Extra Data input labeling
1 parent f7cee7e commit 9abff17

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

Orange/widgets/data/owmergedata.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,26 @@ def matches(part, variables):
243243

244244
class OWMergeData(widget.OWWidget):
245245
name = "Merge Data"
246-
description = "Merge datasets based on the values of selected features."
246+
description = (
247+
"Merge two datasets by matching selected features. "
248+
"Connect the primary table to Data and the second table to "
249+
"Extra Data (second table)."
250+
)
247251
category = "Transform"
248252
icon = "icons/MergeData.svg"
249253
priority = 1110
250254
keywords = "merge data, join"
251255

252256
class Inputs:
253-
data = Input("Data", Orange.data.Table, default=True, replaces=["Data A"])
254-
extra_data = Input("Extra Data", Orange.data.Table, replaces=["Data B"])
257+
data = Input(
258+
"Data", Orange.data.Table, default=True,
259+
doc="Primary / left table. Rows you usually want to keep.",
260+
replaces=["Data A"])
261+
extra_data = Input(
262+
"Extra Data (second table)", Orange.data.Table,
263+
doc="Second / right table to merge from. "
264+
"Connect a different widget here - not the same link as Data.",
265+
replaces=["Extra Data", "Data B"])
255266

256267
class Outputs:
257268
data = Output("Data",
@@ -260,7 +271,7 @@ class Outputs:
260271
dynamic=False)
261272

262273
LeftJoin, InnerJoin, OuterJoin = range(3)
263-
OptionNames = ("Append columns from Extra data",
274+
OptionNames = ("Append columns from Extra Data",
264275
"Find matching pairs of rows",
265276
"Concatenate tables")
266277
OptionDescriptions = (
@@ -292,6 +303,12 @@ class Outputs:
292303
want_main_area = False
293304
resizing_enabled = False
294305

306+
class Information(widget.OWWidget.Information):
307+
need_both_tables = Msg(
308+
"Connect both inputs: Data (main table) and "
309+
"Extra Data (second table).\n"
310+
"Each must come from a different source.")
311+
295312
class Warning(widget.OWWidget.Warning):
296313
renamed_vars = Msg("Some variables have been renamed "
297314
"to avoid duplicates.\n{}")
@@ -332,6 +349,10 @@ def __init__(self):
332349
self.model = DomainModelWithTooltips(content)
333350
self.extra_model = DomainModelWithTooltips(content)
334351

352+
gui.label(
353+
self.controlArea, self,
354+
"Inputs: Data = main table · Extra Data = second table to merge")
355+
335356
grp = gui.radioButtons(
336357
self.controlArea, self, "merging", box="Merging",
337358
btnLabels=self.OptionNames, tooltips=self.OptionDescriptions,
@@ -397,6 +418,8 @@ def get_unique_str_metas_names(model_):
397418
@gui.deferred
398419
def commit(self):
399420
self.clear_messages()
421+
if bool(self.data) ^ bool(self.extra_data):
422+
self.Information.need_both_tables()
400423
merged = self.merge() if self.data and self.extra_data else None
401424
self.Outputs.data.send(merged)
402425

0 commit comments

Comments
 (0)