diff --git a/src/simudator/gui/breakpoint_window.py b/src/simudator/gui/breakpoint_window.py index bf713be52d56593502b42f2706a231868a7b6737..82530cf9cf06fb9584aed20272876ab39b616e6f 100644 --- a/src/simudator/gui/breakpoint_window.py +++ b/src/simudator/gui/breakpoint_window.py @@ -69,7 +69,7 @@ class BreakpointWindow(QWidget): """ Removes all list items from the breakpoint list. """ - for row in range(self.breakpoint_list.count()): + for _ in range(self.breakpoint_list.count()): self.breakpoint_list.takeItem(0) def toggleEnabledClicked(self) -> None: diff --git a/src/simudator/gui/cpu_graphics_scene.py b/src/simudator/gui/cpu_graphics_scene.py index 925ad9846014c8538a422eacd43c298bf9f19933..b4b726b18ec8ae0bf3e2c1b29a8d17aee0e37dfb 100644 --- a/src/simudator/gui/cpu_graphics_scene.py +++ b/src/simudator/gui/cpu_graphics_scene.py @@ -37,6 +37,11 @@ class CpuGraphicsScene(QGraphicsScene): self.placeModuleGraphicsItemDefault(graphics_item) def placeModuleGraphicsItemDefault(self, graphics_item: ModuleGraphicsItem) -> None: + """ + Places a module graphics items at a position where the x value + is equal to the y value. Used to place all graphics items in a + diagonal. + """ placement = len(self.module_graphics_items)*self.MODULE_SPACEING graphics_item.setPos(placement, placement) self.addItem(graphics_item) @@ -46,6 +51,9 @@ class CpuGraphicsScene(QGraphicsScene): pos_x: int, pos_y: int ) -> None: + """ + Changes the postions of an existing modules graphics item. + """ graphics_item.setPos(pos_x*self.MODULE_SPACEING, pos_y*self.MODULE_SPACEING) @@ -101,6 +109,9 @@ class CpuGraphicsScene(QGraphicsScene): super().mousePressEvent(event) def load_layout_from_file(self, file_path: str) -> None: + """ + Loads a layout for a processor from a saved filed. + """ file = open(file_path) graphics_item_name = None diff --git a/src/simudator/gui/gui.py b/src/simudator/gui/gui.py index 112d349e299c0dd1143d1bef30c49358b466b5fe..54c220dfc035f7d7ecce84cc854cbe3e9a73228d 100644 --- a/src/simudator/gui/gui.py +++ b/src/simudator/gui/gui.py @@ -370,6 +370,10 @@ class GUI(QMainWindow): """ @pyqtSlot(str, str, str) def editModuleState(self, module_name, state, value) -> None: + """ + Tries to change the value of module to value given by user + through the dialog opened by editModuleStateDialog. + """ try: parsed_value = ast.literal_eval(value) except SyntaxError as e: @@ -383,6 +387,10 @@ class GUI(QMainWindow): @pyqtSlot(str, str, str) def editMemoryContent(self, module_name: str, adress: str, value: str) -> None: + """ + Tries to change the value at adress to value given by user + through the dialog opened by editModuleStateDialog. + """ try: parsed_adress = int(adress, 16) parsed_value = ast.literal_eval(value) @@ -402,6 +410,10 @@ class GUI(QMainWindow): @pyqtSlot(str, str, str) def addStateBreakpoint(self, module_name: str, state: str, value: str) -> None: + """ + Tries to add a breakpoint to the module through the dialog + opened by stateBreakpointDialog. + """ try: parsed_value = ast.literal_eval(value) self.cpu.add_state_breakpoint(module_name, state, parsed_value) @@ -411,6 +423,10 @@ class GUI(QMainWindow): @pyqtSlot(str, str) def addLambdaBreakpoint(self, lambda_name, kwargs_str) -> None: + """ + Tries to add a breakpoint to the module through the dialog + opened by lambdaBreakpointDialog. + """ try: lambda_kwargs = {} for kwarg in kwargs_str.split(' '): @@ -423,6 +439,10 @@ class GUI(QMainWindow): @pyqtSlot(str, str, str) def addMemoryBreakpoint(self, module_name: str, adress: str, value: str) -> None: + """ + Tries to add a breakpoint to the module through the dialog + opened by memoryBreakpointDialog. + """ try: parsed_adress = int(adress, 16) parsed_value = ast.literal_eval(value) @@ -600,8 +620,8 @@ class GUI(QMainWindow): def saveLayoutToolBarButtonClick(self) -> None: """ - Saves the layout of all the modules in a human readable - (and editable) format. + Saves the layout of all the modules in a (somewhat) + human readable format. Erases the previous content of the file before saving the data. """