# HG changeset patch # User Edouard Tisserant # Date 1630309163 -7200 # Node ID 95fe62bfe9204eb2ede59bea45d8e0d605db959f # Parent 8b45d8494fae3895fb794906e7ab4d73d20a9723 Copy description when DnD variables from Globals in resources and configuration variable panels to POUs. Also prevent making exception in case some other DropSource wouldn't provide description. diff -r 8b45d8494fae -r 95fe62bfe920 controls/VariablePanel.py --- a/controls/VariablePanel.py Fri Aug 27 11:31:32 2021 +0200 +++ b/controls/VariablePanel.py Mon Aug 30 09:39:23 2021 +0200 @@ -956,7 +956,8 @@ var_name = self.Table.GetValueByName(row, "Name") var_class = self.Table.GetValueByName(row, "Class") var_type = self.Table.GetValueByName(row, "Type") - data = wx.TextDataObject(str((var_name, var_class, var_type, self.TagName))) + var_doc = self.Table.GetValueByName(row, "Documentation") + data = wx.TextDataObject(str((var_name, var_class, var_type, self.TagName, var_doc))) dragSource = wx.DropSource(self.VariablesGrid) dragSource.SetData(data) dragSource.DoDragDrop() diff -r 8b45d8494fae -r 95fe62bfe920 editors/Viewer.py --- a/editors/Viewer.py Fri Aug 27 11:31:32 2021 +0200 +++ b/editors/Viewer.py Mon Aug 30 09:39:23 2021 +0200 @@ -389,8 +389,8 @@ elif var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]: message = _("\"%s\" pou already exists!") % var_name elif not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]: - print(values) - self.ParentWindow.Controler.AddEditedElementPouExternalVar(tagname, values[2], var_name, description=values[4]) + kwargs = dict(description=values[4]) if len(values)>4 else {} + self.ParentWindow.Controler.AddEditedElementPouExternalVar(tagname, values[2], var_name, **kwargs) self.ParentWindow.RefreshVariablePanel() self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel() self.ParentWindow.AddVariableBlock(x, y, scaling, INPUT, var_name, values[2])