Hi, I'd like to update my plugin when a new object is loaded in PyMOL, a watch process is created for this task:
def find_proteins():
"""
Find all proteins in pymol
Returns:
"""
proteins = []
for object_name in cmd.get_names_of_type('object:molecule'):
if cmd.count_atoms(f'model {object_name} and {prot_and_dna_sele}') > 0:
proteins.append(object_name)
return proteins
def watch(self):
while True:
proteins = find_proteins()
if proteins != self.proteins:
self.update()
self.proteins = proteins
time.sleep(0.3)
thread = Thread(target=watch, daemon=True)
thread.start()
When the watch process is running in background, my PyMOL window is not responsive, I have to click many times to get the button working. Do you have any suggestions? Thanks!
Hi, I'd like to update my plugin when a new object is loaded in PyMOL, a watch process is created for this task:
When the watch process is running in background, my PyMOL window is not responsive, I have to click many times to get the button working. Do you have any suggestions? Thanks!
Screenshot: