def on_selection_changed(self, item_selection): """选中listView中行时,选中相应warper曲线。""" # 获取UI中选中的warper selected_warpers = self.list_UI_selected_warper() # 选中warper,设置开关防止陷入刷新死循环 selected_warpers = [safe_to_string(i.toString()) for i in selected_warpers] select(selected_warpers)
def on_remove_button_clicked(self): """删除选中的warper""" # 获取选中warper selected_warpers = self.list_UI_selected_warper() selected_warpers = [safe_to_string(i.toString()) for i in selected_warpers] # 删除 delete(selected_warpers) # 刷新界面 self.warper_model.update_warpers()
def on_connect_button_clicked(self): """建立选中控制器的已Key属性与选中warper之间连接""" # 获取选中的控制器 ctrls = [i for i in selected(dagObjects=True) if i in selected()] # 获取选中warpers selected_warpers = self.list_UI_selected_warper() selected_warpers = [safe_to_string(i.toString()) for i in selected_warpers] # 连接属性 for warper in selected_warpers: time_warper.connect_warper(warper, ctrls)
def on_disconn_button_clicked(self): """打断选中控制器与选中warper之间连接""" # 获取选中的控制器 ctrls = [i for i in selected(dagObjects=True) if i in selected()] # 获取选中warpers selected_warpers = self.list_UI_selected_warper() selected_warpers = [safe_to_string(i.toString()) for i in selected_warpers] # 连接属性 for warper in selected_warpers: if not ctrls: time_warper.breakdown_all(warper) else: time_warper.disconnect_warper(warper, ctrls)
def on_brk_link_button_clicked(self): """打断选中的已Key属性与warper之间连接""" # 获取选中属性 selected_attrs = [] selected_objs = [i for i in selected( dagObjects=True) if i in selected()] selected_channels = get_selected_channels() for obj in selected_objs: selected_attrs.extend(["{obj}.{attr}".format( obj=obj, attr=i) for i in selected_channels]) # 获取选中warpers selected_warpers = self.list_UI_selected_warper() selected_warpers = [safe_to_string(i.toString()) for i in selected_warpers] # 打断连接 if selected_attrs and selected_warpers: for warper in selected_warpers: time_warper.disconnect_warper(warper, selected_attrs)