@@ -896,7 +896,6 @@ def signalsHandlerAns(self, bot, chat_id, strung):
896896 self .signals_range [chat_id ] = []
897897 self .menuHandler (bot , chat_id )
898898 else :
899- a = strung .split ('.' )
900899 units = self .logger .database .getUniqueUnits ()
901900 multiSelectorList = []
902901 for unit in units :
@@ -911,7 +910,7 @@ def signalsHandlerAns(self, bot, chat_id, strung):
911910 # pass
912911 plot_signals .append (sig )
913912 else :
914- names = sig . split ( '.' )
913+ names = self . str2signal ( sig )
915914 sigID = self .logger .database .getSignalID (names [0 ], names [1 ])
916915 if sigID != - 1 :
917916 plot_signals .append (sig )
@@ -966,7 +965,7 @@ def signalsHandlerAns(self, bot, chat_id, strung):
966965 xmin , xmax = self .signals_range [chat_id ]
967966 for sigName in self .signals_selected [chat_id ]:
968967 if sigName != 'Events' :
969- sigID = self .logger .database .getSignalID (* sigName . split ( '.' ))
968+ sigID = self .logger .database .getSignalID (* self . str2signal ( sigName ))
970969 if sigID != - 1 :
971970 self .logger .database .removeSignal (sigID , xmin , xmax , True )
972971 self .signals_selected [chat_id ] = []
@@ -976,7 +975,7 @@ def signalsHandlerAns(self, bot, chat_id, strung):
976975 xmin , xmax = self .signals_range [chat_id ]
977976 for sigName in self .signals_selected [chat_id ]:
978977 if sigName != 'Events' :
979- sigID = self .logger .database .getSignalID (* sigName . split ( '.' ))
978+ sigID = self .logger .database .getSignalID (* self . str2signal ( sigName ))
980979 if sigID != - 1 :
981980 self .logger .database .removeEvents (sigID , xmin , xmax , True )
982981 self .send_message (chat_id = chat_id ,
@@ -1004,7 +1003,7 @@ def signalsHandlerAns(self, bot, chat_id, strung):
10041003 self .send_message (chat_id = chat_id ,
10051004 text = translate ('RTOC' , 'I\' m collecting the data now...' ))
10061005 sigIDs = [self .logger .database .getSignalID (
1007- * i . split ( '.' )) for i in self .signals_selected [chat_id ]]
1006+ * self . str2signal ( i )) for i in self .signals_selected [chat_id ]]
10081007 xmin , xmax = self .signals_range [chat_id ]
10091008 dir = self .logger .config ['global' ]['documentfolder' ]
10101009 self .logger .database .signalsToCSV (
@@ -1056,11 +1055,20 @@ def signalsDeviceSubHandlerAns(self, bot, chat_id, strung):
10561055 device = self .telegram_clients [str (chat_id )]['menu' ].split (':' )[0 ]
10571056 self .signalsDeviceSubHandler (bot , chat_id , device )
10581057
1058+ def str2signal (self , strung ):
1059+ a = strung .split ('.' )
1060+ if len (a )> 2 :
1061+ # b=['.'.join(a[:-1]),a[-1]]
1062+ b = [a [0 ],'.' .join (a [1 :])]
1063+ return b
1064+ elif len (a ) == 2 :
1065+ return a
1066+
10591067 def selectSignal (self , bot , chat_id , strung ):
10601068 a = strung .split ('.' )
10611069 if len (a )> 2 :
10621070 self .send_message (chat_id , translate ('RTOC' , 'Please rename this signal. Signals should not contain "." and ":".' ))
1063- b = ['.' .join (a [:- 2 ]),a [- 1 ]]
1071+ b = ['.' .join (a [:- 1 ]),a [- 1 ]]
10641072 self .selectSignal2 (bot , chat_id , strung , b )
10651073 b = [a [0 ],'.' .join (a [1 :])]
10661074 self .selectSignal2 (bot , chat_id , strung , b )
@@ -1069,10 +1077,11 @@ def selectSignal(self, bot, chat_id, strung):
10691077
10701078
10711079 def selectSignal2 (self , bot , chat_id , strung , a ):
1072- a = strung .split ('.' )
10731080 if len (a ) == 2 :
10741081 if strung not in self .signals_selected [chat_id ]:
10751082 sigID = self .logger .database .getSignalID (a [0 ], a [1 ])
1083+ if sigID == - 1 :
1084+ return
10761085 xmin , xmax , sigLen = self .logger .database .getSignalInfo (sigID )
10771086 if xmin != None :
10781087 self .signals_selected [chat_id ].append (strung )
@@ -1754,7 +1763,8 @@ def sendSignalPlot(self, bot, chat_id, signalnames, xmin_plot, xmax_plot):
17541763 maxLen = 0
17551764
17561765 for idx , signalname in enumerate (signalnames ):
1757- a = signalname .split ('.' )
1766+ # a = signalname.split('.')
1767+ a = self .str2signal (signalname )
17581768 signal = self .logger .database .getSignal_byName (
17591769 a [0 ], a [1 ], xmin = xmin_plot , xmax = xmax_plot , database = True , maxN = 1000 )
17601770 # bot.send_chat_action(chat_id=chat_id,
0 commit comments