@@ -644,26 +644,34 @@ def autoAxis(self, _:bool = False) -> None:
644644 self .xlimitEdit_min .repaint ()
645645 self .xlimitEdit .repaint ()
646646
647- endedittime_str = str (self .xlimitEdit .text ())
648- if endedittime_str is not None and endedittime_str != '' :
649- endeditime = stringtoseconds (endedittime_str )
650- if self .aw .qmc .endofx != endeditime :
651- self .aw .qmc .endofx = endeditime
652- self .aw .qmc .locktimex_end = endeditime
647+ try :
648+ endedittime_str = str (self .xlimitEdit .text ())
649+ if endedittime_str is not None and endedittime_str != '' :
650+ endeditime = stringtoseconds (endedittime_str )
651+ if self .aw .qmc .endofx != endeditime :
652+ self .aw .qmc .endofx = endeditime
653+ self .aw .qmc .locktimex_end = endeditime
654+ changed = True
655+ except Exception : # pylint: disable=broad-except
656+ pass # stringtoseconds raises exception on malformed input
657+
658+ try :
659+ startedittime_str = str (self .xlimitEdit_min .text ())
660+ if startedittime_str is not None and startedittime_str != '' :
661+ starteditime = stringtoseconds (startedittime_str )
662+ if starteditime >= 0 and self .aw .qmc .timeindex [0 ] != - 1 :
663+ self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]] + starteditime
664+ elif starteditime >= 0 and self .aw .qmc .timeindex [0 ] == - 1 :
665+ self .aw .qmc .startofx = starteditime
666+ elif starteditime < 0 and self .aw .qmc .timeindex [0 ] != - 1 :
667+ self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]]- abs (starteditime )
668+ else :
669+ self .aw .qmc .startofx = starteditime
670+ self .aw .qmc .locktimex_start = starteditime
653671 changed = True
654- startedittime_str = str (self .xlimitEdit_min .text ())
655- if startedittime_str is not None and startedittime_str != '' :
656- starteditime = stringtoseconds (startedittime_str )
657- if starteditime >= 0 and self .aw .qmc .timeindex [0 ] != - 1 :
658- self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]] + starteditime
659- elif starteditime >= 0 and self .aw .qmc .timeindex [0 ] == - 1 :
660- self .aw .qmc .startofx = starteditime
661- elif starteditime < 0 and self .aw .qmc .timeindex [0 ] != - 1 :
662- self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]]- abs (starteditime )
663- else :
664- self .aw .qmc .startofx = starteditime
665- self .aw .qmc .locktimex_start = starteditime
666- changed = True
672+ except Exception : # pylint: disable=broad-except
673+ pass # stringtoseconds raises exception on malformed input
674+
667675 if changed :
668676 self .aw .qmc .redraw (recomputeAllDeltas = False )
669677
@@ -833,25 +841,33 @@ def updatewindow(self) -> None:
833841
834842 endedittime_str = str (self .xlimitEdit .text ())
835843 if endedittime_str is not None and endedittime_str != '' :
836- endeditime = stringtoseconds (endedittime_str )
837- self .aw .qmc .endofx = endeditime
838- self .aw .qmc .locktimex_end = endeditime
844+ try :
845+ endeditime = stringtoseconds (endedittime_str )
846+ self .aw .qmc .endofx = endeditime
847+ self .aw .qmc .locktimex_end = endeditime
848+ except Exception : # pylint: disable=broad-except
849+ self .aw .qmc .endofx = self .aw .qmc .endofx_default
850+ self .aw .qmc .locktimex_end = self .aw .qmc .endofx_default
839851 else :
840852 self .aw .qmc .endofx = self .aw .qmc .endofx_default
841853 self .aw .qmc .locktimex_end = self .aw .qmc .endofx_default
842854
843855 startedittime_str = str (self .xlimitEdit_min .text ())
844856 if startedittime_str is not None and startedittime_str != '' :
845- starteditime = stringtoseconds (startedittime_str )
846- if starteditime >= 0 and self .aw .qmc .timeindex [0 ] != - 1 :
847- self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]] + starteditime
848- elif starteditime >= 0 and self .aw .qmc .timeindex [0 ] == - 1 :
849- self .aw .qmc .startofx = starteditime
850- elif starteditime < 0 and self .aw .qmc .timeindex [0 ] != - 1 :
851- self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]]- abs (starteditime )
852- else :
853- self .aw .qmc .startofx = starteditime
854- self .aw .qmc .locktimex_start = starteditime
857+ try :
858+ starteditime = stringtoseconds (startedittime_str )
859+ if starteditime >= 0 and self .aw .qmc .timeindex [0 ] != - 1 :
860+ self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]] + starteditime
861+ elif starteditime >= 0 and self .aw .qmc .timeindex [0 ] == - 1 :
862+ self .aw .qmc .startofx = starteditime
863+ elif starteditime < 0 and self .aw .qmc .timeindex [0 ] != - 1 :
864+ self .aw .qmc .startofx = self .aw .qmc .timex [self .aw .qmc .timeindex [0 ]]- abs (starteditime )
865+ else :
866+ self .aw .qmc .startofx = starteditime
867+ self .aw .qmc .locktimex_start = starteditime
868+ except Exception : # pylint: disable=broad-except
869+ self .aw .qmc .startofx = self .aw .qmc .startofx_default
870+ self .aw .qmc .locktimex_start = self .aw .qmc .startofx_default
855871 else :
856872 self .aw .qmc .startofx = self .aw .qmc .startofx_default
857873 self .aw .qmc .locktimex_start = self .aw .qmc .startofx_default
@@ -865,13 +881,19 @@ def updatewindow(self) -> None:
865881 except Exception : # pylint: disable=broad-except
866882 pass
867883
868- resettime = stringtoseconds (str (self .resetEdit .text ()))
869- if resettime > 0 :
870- self .aw .qmc .resetmaxtime = resettime
884+ try :
885+ resettime = stringtoseconds (str (self .resetEdit .text ()))
886+ if resettime > 0 :
887+ self .aw .qmc .resetmaxtime = resettime
888+ except Exception : # pylint: disable=broad-except
889+ pass
871890
872- chargetime = stringtoseconds (str (self .chargeminEdit .text ()))
873- if chargetime <= 0 :
874- self .aw .qmc .chargemintime = chargetime
891+ try :
892+ chargetime = stringtoseconds (str (self .chargeminEdit .text ()))
893+ if chargetime <= 0 :
894+ self .aw .qmc .chargemintime = chargetime
895+ except Exception : # pylint: disable=broad-except
896+ pass
875897
876898 self .aw .qmc .fixmaxtime = not self .fixmaxtimeFlag .isChecked ()
877899 self .aw .qmc .locktimex = self .locktimexFlag .isChecked ()
0 commit comments