Skip to content

Commit

Permalink
Minor change for setting toolbars object name
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofpayne committed Jul 23, 2024
1 parent 1db6fdd commit 2762d6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion laserstudio/widgets/toolbars/laserdrivertoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, laser_studio: "LaserStudio", laser_num: int):
assert laser_num < len(laser_studio.instruments.lasers)
self.laser = laser_studio.instruments.lasers[laser_num]
assert isinstance(self.laser, LaserDriverInstrument)
super().__init__(f"Laser {laser_num} (Donjon Driver)", f"toolbar-laser-donjon-{laser_num}")
super().__init__(f"Laser {laser_num} (Donjon Driver)", "donjon", laser_num)
self.setAllowedAreas(
Qt.ToolBarArea.LeftToolBarArea | Qt.ToolBarArea.RightToolBarArea
)
Expand Down
8 changes: 4 additions & 4 deletions laserstudio/widgets/toolbars/lasertoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@


class LaserToolbar(QToolBar):
def __init__(self, title: str, object_name: str):
def __init__(self, title: str, laser_model: str, laser_num: int):
"""
:param title: Toolbar title, as displayed in the context menus.
:param object_name: Unique object name for Qt, used for settings save and restore.
:param laser_model: Equipment model, such as "pdm". Used for settings save and restore.
:param laser_num: Laser equipment index.
"""
super().__init__(title)
super().setObjectName(object_name) # For settings save and restore
super().setObjectName(f"toolbox-laser-{laser_model}-{laser_num}") # For settings save and restore
2 changes: 1 addition & 1 deletion laserstudio/widgets/toolbars/pdmtoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, laser_studio: "LaserStudio", laser_num: int):
assert laser_num < len(laser_studio.instruments.lasers)
self.laser = laser_studio.instruments.lasers[laser_num]
assert isinstance(self.laser, PDMInstrument)
super().__init__(f"Laser {laser_num} (PDM)", f"toolbar-laser-pdm-{laser_num}")
super().__init__(f"Laser {laser_num} (PDM)", "pdm", laser_num)
self.setAllowedAreas(
Qt.ToolBarArea.LeftToolBarArea | Qt.ToolBarArea.RightToolBarArea
)
Expand Down

0 comments on commit 2762d6b

Please sign in to comment.