Skip to content

Commit 043aeb2

Browse files
committed
Fixe time_info display in dialog boxes
1 parent 5d93d5a commit 043aeb2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

nMOLDYN/GUI/AnalysisDialog.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ def body(self, master):
414414
tagName = 'frame_selection',\
415415
contents = timeInfo)
416416

417-
self.updateTimeInfo()
417+
self.updateTimeInfo(t)
418418

419-
self.widgets[widget].entry.variable.trace_variable('w', self.updateTimeInfo)
419+
self.widgets[widget].entry.variable.trace_variable('w', lambda: self.updateTimeInfo(t))
420420

421421
elif widget == 'timeunits':
422422
self.widgets[widget] = ComboRadiobutton(widgetsFrame,\
@@ -671,7 +671,7 @@ def widgetsState(self, widget, state = DISABLED):
671671
except:
672672
return
673673

674-
def updateTimeInfo(self, *dummy):
674+
def updateTimeInfo(self, trajectory):
675675
"""
676676
"""
677677

@@ -700,21 +700,16 @@ def updateTimeInfo(self, *dummy):
700700

701701
f -= 1
702702

703-
if hasattr(self.trajectory,'time'):
704-
t = self.trajectory.time[f:l:s]
703+
t = trajectory.time[f:l:s]
705704

706-
# Otherwise, sets |t| to virtual times.
707-
else:
708-
t = range(len(self.trajectory))[f:l:s]
709-
710705
if len(t) <= 1:
711706
dt = 1.0
712707
else:
713708
dt = t[1] - t[0]
714709

715-
updatedFirt, updatedLast, updatedStep = [round(v,3) for v in [t[0],t[-1],dt]]
710+
updatedFirst, updatedLast, updatedStep = [round(v,3) for v in [t[0],t[-1],dt]]
716711

717-
updatedTimeInfo += ' (%s ps to %s ps step %s ps)' % (updatedFirt, updatedLast, updatedStep)
712+
updatedTimeInfo += ' (%s ps to %s ps step %s ps)' % (updatedFirst, updatedLast, updatedStep)
718713

719714
self.widgets['timeinfo'].frameLabel.set(updatedTimeInfo)
720715

0 commit comments

Comments
 (0)