--- a/mqtt/client.py Fri Sep 13 14:28:07 2024 +0200
+++ b/mqtt/client.py Tue Sep 17 11:17:24 2024 +0200
@@ -28,15 +28,24 @@
(_("MQTT Client"), "CreateMQTTClient_UI")]
self.Controler.GetCTRoot().logger.write(msg)
def CreateMQTTClient_UI(self, parent):
- return MQTTClientPanel(
+ self.MQTTClient_UI = MQTTClientPanel( self.Controler.GetModelData(),
+ return self.MQTTClient_UI + if(self.MQTTClient_UI): + self.MQTTClient_UI.RefreshView() + return ConfTreeNodeEditor.RefreshView(self) class MQTTClient(object):
XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
--- a/mqtt/mqtt_client_gen.py Fri Sep 13 14:28:07 2024 +0200
+++ b/mqtt/mqtt_client_gen.py Tue Sep 17 11:17:24 2024 +0200
@@ -152,14 +152,6 @@
self.Reset(len(self.data))
-class MQQTTypeChoiceRenderer(dv.DataViewChoiceRenderer):
- def __init__(self, types_getter):
- dv.DataViewChoiceRenderer.__init__(self, types_getter())
- self.types_getter = types_getter
- return self.types_getter()
class MQTTTopicListPanel(wx.Panel):
def __init__(self, parent, log, model, direction, types_getter):
@@ -177,19 +169,12 @@
self.dvc.AssociateModel(self.model)
- dsc = lstcoldsc[direction]
- for idx,(colname,width) in enumerate(zip(dsc.lstcolnames,dsc.lstcolwidths)):
- choice_DV_render = MQQTTypeChoiceRenderer(types_getter)
- choice_DV_col = dv.DataViewColumn(colname, choice_DV_render, idx, width=width)
- self.dvc.AppendColumn(choice_DV_col)
- self.dvc.AppendTextColumn(colname, idx, width=width, mode=dv.DATAVIEW_CELL_EDITABLE)
+ self.types_getter = types_getter + self.direction = direction + self.CreateDVCColumns() self.Sizer = wx.BoxSizer(wx.VERTICAL)
- self.direction = direction
titlestr = direction + " variables"
title = wx.StaticText(self, label = titlestr)
@@ -207,6 +192,20 @@
self.Sizer.Add(self.dvc, 1, wx.EXPAND)
+ def CreateDVCColumns(self): + dsc = lstcoldsc[self.direction] + for idx,(colname,width) in enumerate(zip(dsc.lstcolnames,dsc.lstcolwidths)): + choice_DV_render = dv.DataViewChoiceRenderer(self.types_getter()) + choice_DV_col = dv.DataViewColumn(colname, choice_DV_render, idx, width=width) + self.dvc.AppendColumn(choice_DV_col) + self.dvc.AppendTextColumn(colname, idx, width=width, mode=dv.DATAVIEW_CELL_EDITABLE) + def ResetDVCColumns(self): + self.dvc.ClearColumns() + self.CreateDVCColumns() items = self.dvc.GetSelections()
row = self.model.GetRow(items[0]) if items else 0
@@ -235,6 +234,10 @@
+ for direction in directions: + self.selected_lists[direction].ResetDVCColumns()