def iter(self, by=1): loaded = cmd.get_names('objects')[0] choices = self.choices() l = len(choices) next_file = 0 next_file_index = 0 for i in range(l): if objname(choices[i]) == loaded: next_file_index = (i + by) % l next_file = choices[(i + by) % l] break cmd.delete('all') if not os.path.exists(next_file): raise ValueError("Can not locate file: %s" % next) cmd.load(next_file) if self.auto_zoom: cmd.zoom() if self.onload_command: logging.debug("onload_command: %s", self.onload_command) cmd.do(self.onload_command) #cmd.replace_wizard('message',next_file) # to display current pdb index, start at 1 cmd.replace_wizard( 'message', next_file + ", %d/%d" % (next_file_index + 1, l)) # +1, so the cycler starts at 1
def iter(self, by=1): #enabled = cmd.get_names('objects',enabled_only=1)[0] choices = self.choices() l = len(choices) assert self.current_index < l next_object = (self.current_index + by) % l cmd.disable(objname(choices[self.current_index])) self.current_index = next_object cmd.enable(objname(choices[self.current_index])) if self.auto_zoom: cmd.zoom(objname(choices[self.current_index])) if self.onload_command: logging.debug("onload_command: %s", self.onload_command) cmd.do(self.onload_command) cmd.replace_wizard('message', choices[self.current_index])
def iter(self,by=1): loaded = cmd.get_names('objects')[0] choices = self.choices() l = len(choices) next_file = 0 for i in range(l): if objname(choices[i]) == loaded: next_file = choices[ (i+by) % l ] break cmd.delete('all') if not os.path.exists(next_file): raise ValueError("Can not locate file: %s" % next) cmd.load(next_file) if self.auto_zoom: cmd.zoom() if self.onload_command: logging.debug("onload_command: %s", self.onload_command) cmd.do(self.onload_command) cmd.replace_wizard('message',next_file)
def iter(self,by=1): #enabled = cmd.get_names('objects',enabled_only=1)[0] choices = self.choices() l = len(choices) assert self.current_index < l next_object = (self.current_index + by) % l cmd.disable(objname(choices[self.current_index])) self.current_index = next_object cmd.enable(objname(choices[self.current_index])) if self.auto_zoom: cmd.zoom(objname(choices[self.current_index])) if self.onload_command: logging.debug("onload_command: %s", self.onload_command) cmd.do(self.onload_command) cmd.replace_wizard('message',choices[self.current_index])