def tryShowBody(self): try: b=O.bodies[self.bodyId] self.serEd=SerializableEditor(b,showType=True,parent=self,path='O.bodies[%d]'%self.bodyId) except IndexError: self.serEd=QFrame(self) self.bodyId=-1 self.scroll.setWidget(self.serEd)
def refresh(self): self.periCheckBox.setChecked(O.periodic) editor = self.scroll.widget() if not O.periodic and editor: self.scroll.takeWidget() if (O.periodic and not editor) or (editor and editor.ser != O.cell): self.scroll.setWidget( SerializableEditor(O.cell, parent=self, showType=True, path='O.cell'))
def setupInteraction(self): try: intr=O.interactions[self.ids[0],self.ids[1]] self.serEd=SerializableEditor(intr,showType=True,parent=self.scroll,path='O.interactions[%d,%d]'%(self.ids[0],self.ids[1])) self.scroll.setWidget(self.serEd) self.gotoId1Button.setText('#'+makeBodyLabel(O.bodies[self.ids[0]])) self.gotoId2Button.setText('#'+makeBodyLabel(O.bodies[self.ids[1]])) self.setWindowTitle('Interaction #%d + #%d'%(self.ids[0],self.ids[1])) except IndexError: if self.ids: # reset view (there was an interaction) self.ids=None self.serEd=QFrame(self.scroll); self.scroll.setWidget(self.serEd) self.setWindowTitle('No interaction') self.gotoId1Button.setText(u'#…'); self.gotoId2Button.setText(u'#…');