Thanks
@wmayer
If there should be only one button checked at a time then you can use a
QButtonGroup
No, each icon can act individually.
If you need the status of other buttons for internal calculations then put the buttons into a data structure where you can easily access them.
Thank you so much. I implemented it as below:
Code: Select all
class OSAFEViewGroupCommand:
def __init__(self):
self.icon_status = {}
for command in self.GetCommands():
self.icon_status[command] = True
def GetCommands(self):
return (
"OSAFE_wireframe_views",
"OSAFE_view_basefoundation",
"OSAFE_view_columns",
"OSAFE_view_beams",
"OSAFE_view_slabs",
"OSAFE_view_foundations",
"OSAFE_view_design_layer_a",
"OSAFE_view_design_layer_b",
"OSAFE_view_punch",
"OSAFE_view_arch_wall",
) # a tuple of command names that you want to group
def Activated(self, index):
command = self.GetCommands()[index]
self.icon_status[command] = not self.icon_status[command]
wireframe = self.icon_status["OSAFE_wireframe_views"]
show_base_foundation = self.icon_status["OSAFE_view_basefoundation"]
show_column = self.icon_status["OSAFE_view_columns"]
show_beam = self.icon_status["OSAFE_view_beams"]
show_slab = self.icon_status["OSAFE_view_slabs"]
show_foundation = self.icon_status["OSAFE_view_foundations"]
show_design_layer_a = self.icon_status["OSAFE_view_design_layer_a"]
show_design_layer_b = self.icon_status["OSAFE_view_design_layer_b"]
show_punch = self.icon_status["OSAFE_view_punch"]
show_arch_wall = self.icon_status["OSAFE_view_arch_wall"]
I guess you have a Workbench class. Re-implement the Activated() and Deactivated() functions where you restore and save the current status of the buttons, e.g. in a suitable parameter group.
I will examine this if I understand you!