Skip to content

Commit

Permalink
Edits
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofpayne committed Jul 24, 2024
1 parent 2762d6b commit 6d2b452
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
8 changes: 7 additions & 1 deletion laserstudio/widgets/toolbars/laserdrivertoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@

class LaserDriverToolbar(LaserToolbar):
def __init__(self, laser_studio: "LaserStudio", laser_num: int):
"""
:param laser_studio: Main windows of laserstudio. Can be used for interacting with
other elements of the UI.
:param laser_num: Laser equipment index.
"""
assert LaserDriverPanel is not None
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)", "donjon", laser_num)
super().__init__(f"Laser {laser_num} (Donjon Driver)", laser_studio, laser_num)
super().setObjectName(f"toolbox-laser-donjon-{laser_num}") # For settings save and restore
self.setAllowedAreas(
Qt.ToolBarArea.LeftToolBarArea | Qt.ToolBarArea.RightToolBarArea
)
Expand Down
11 changes: 8 additions & 3 deletions laserstudio/widgets/toolbars/lasertoolbar.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
from PyQt6.QtWidgets import QToolBar
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ...laserstudio import LaserStudio

class LaserToolbar(QToolBar):
def __init__(self, title: str, laser_model: str, laser_num: int):
def __init__(self, title: str, laser_studio: "LaserStudio", laser_num: int):
"""
:param laser_model: Equipment model, such as "pdm". Used for settings save and restore.
:param laser_studio: Main windows of laserstudio. Can be used for interacting with
other elements of the UI.
:param laser_num: Laser equipment index.
"""
super().__init__(title)
super().setObjectName(f"toolbox-laser-{laser_model}-{laser_num}") # For settings save and restore
self.laser_studio = laser_studio
super().setObjectName(f"toolbox-laser-{laser_num}") # For settings save and restore
8 changes: 7 additions & 1 deletion laserstudio/widgets/toolbars/pdmtoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@

class PDMToolbar(LaserToolbar):
def __init__(self, laser_studio: "LaserStudio", laser_num: int):
"""
:param laser_studio: Main windows of laserstudio. Can be used for interacting with
other elements of the UI.
:param laser_num: Laser equipment index.
"""
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)", "pdm", laser_num)
super().__init__(f"Laser {laser_num} (PDM)", laser_studio, laser_num)
super().setObjectName(f"toolbox-laser-pdm-{laser_num}") # For settings save and restore
self.setAllowedAreas(
Qt.ToolBarArea.LeftToolBarArea | Qt.ToolBarArea.RightToolBarArea
)
Expand Down

0 comments on commit 6d2b452

Please sign in to comment.