Skip to content

Commit

Permalink
Fix typing issues (mypy 11).
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Jul 22, 2024
1 parent 95c469f commit 79c177a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nion/swift/DocumentController.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ def __adjust_redimension_data_menu(self, menu: UserInterface.Menu) -> None:
selected_display_panel = self.selected_display_panel
display_item = selected_display_panel.display_item if selected_display_panel else None
data_item = display_item.data_item if display_item else None
if data_item:
if display_item and data_item:

def describe_data_descriptor(data_descriptor: DataAndMetadata.DataDescriptor, data_shape: typing.Sequence[int]) -> str:
if data_descriptor.is_sequence:
Expand Down
6 changes: 3 additions & 3 deletions nion/swift/Inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ def move_layer_backward(display_layer: DisplayItem.DisplayLayer) -> None:
command.perform()
document_controller.push_undo_command(command)

def add_layer(display_layer: DisplayItem.DisplayLayer) -> None:
index = display_item.display_layers.index(display_layer) + 1
def add_layer(display_layer: typing.Optional[DisplayItem.DisplayLayer]) -> None:
index = display_item.display_layers.index(display_layer) + 1 if display_layer else 0
command = DisplayPanel.AddDisplayLayerCommand(document_controller.document_model, display_item, index)
command.perform()
document_controller.push_undo_command(command)
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def update_label_widget(self, display_layer: DisplayItem.DisplayLayer) -> None:
button_row = ui.create_row_widget()
button_row.add(add_layer_button_widget)
button_row.add_stretch()
add_layer_button_widget.on_clicked = functools.partial(add_layer, 0)
add_layer_button_widget.on_clicked = functools.partial(add_layer, None)
column.add(button_row)

def update_labels() -> None:
Expand Down

0 comments on commit 79c177a

Please sign in to comment.