Skip to content

Commit

Permalink
Channel Master: Select all hosts and select all host in current tab c…
Browse files Browse the repository at this point in the history
…ommands #74
  • Loading branch information
miquelcampos committed Jan 26, 2023
1 parent bf9378a commit b0e0b65
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions release/scripts/mgear/animbits/channel_master.py
Expand Up @@ -125,6 +125,21 @@ def create_actions(self):
)
self.use_only_local_data_action.setCheckable(True)

# Select actions
self.select_all_hosts_action = QtWidgets.QAction(
"Select All Ctl Hosts", self
)
self.select_all_hosts_action.setIcon(
pyqt.get_icon("mgear_mouse-pointer")
)

self.select_current_tab_all_hosts_action = QtWidgets.QAction(
"Select Current Tab All Ctl Hosts", self
)
self.select_current_tab_all_hosts_action.setIcon(
pyqt.get_icon("mgear_mouse-pointer")
)

# Display actions
self.display_fullname_action = QtWidgets.QAction(
"Channel Full Name", self
Expand Down Expand Up @@ -208,6 +223,10 @@ def create_widgets(self):
self.file_menu.addAction(self.use_node_namespace_action)
self.file_menu.addAction(self.use_only_local_data_action)

self.select_menu = self.menu_bar.addMenu("Select")
self.select_menu.addAction(self.select_all_hosts_action)
self.select_menu.addAction(self.select_current_tab_all_hosts_action)

self.display_menu = self.menu_bar.addMenu("Display")
self.display_menu.addAction(self.display_sync_graph_action)
self.display_menu.addAction(self.display_auto_sync_graph_action)
Expand Down Expand Up @@ -382,6 +401,13 @@ def create_connections(self):
self.use_only_local_data
)

# actions select
self.select_all_hosts_action.triggered.connect(self.select_all_hosts)

self.select_current_tab_all_hosts_action.triggered.connect(
self.select_current_table_all_hosts
)

# actions display
self.display_fullname_action.triggered.connect(
self.action_display_fullname
Expand Down Expand Up @@ -1098,6 +1124,65 @@ def remove_selected_channels(self):
else:
pm.displayWarning("Main Tab Can't be Edited!")

def get_table_all_hosts(self, table, *args):
"""Get the ctl host for a given table
Args:
table (obj): table
*args: Description
Returns:
TYPE: Description
"""
ctls = []
for i in range(table.rowCount()):
item = table.item(i, 0)
attr_config = item.data(QtCore.Qt.UserRole)
ctls.append(attr_config["ctl"])
return ctls

def get_all_hosts(self, *args):
"""Get all ctl host from all the table in channel master
Args:
*args: Description
Returns:
TYPE: Description
"""
all_ctls = []
for t in self.get_all_tables():
all_ctls += self.get_table_all_hosts(t)
return all_ctls

def get_current_table_all_hosts(self, *args):
"""Get current active table all ctl hosts
Args:
*args: Description
Returns:
TYPE: Description
"""
table = self.get_current_table()
return self.get_table_all_hosts(table)

def select_current_table_all_hosts(self, *args):
"""Select current active table all ctl hosts
Args:
*args: Description
"""
pm.select(self.get_current_table_all_hosts())

def select_all_hosts(self, *args):
"""Select all ctl host from all tabs in Channel Master
Args:
*args: Description
"""
pm.select(self.get_all_hosts())


def openChannelMaster(*args):
return pyqt.showDialog(ChannelMaster, dockable=True)
Expand Down

0 comments on commit b0e0b65

Please sign in to comment.