Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Dec 19, 2024
1 parent 1a7eb49 commit 98640fd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions spine_items/tool/widgets/tool_specification_editor_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,11 @@ def _set_program_file_dirty(self, index, dirty):
file_path = index.data(Qt.ItemDataRole.UserRole)
# Main program file items have their full path as UserRole data, additional
# program file items have only their file name as UserRole data
if self.has_root_directory() and os.path.exists(file_path) and os.path.samefile(self._current_main_program_file(), file_path):
if (
self.has_root_directory()
and os.path.exists(file_path)
and os.path.samefile(self._current_main_program_file(), file_path)
):
name = os.path.relpath(file_path, self.item.root_dir)

Check warning on line 478 in spine_items/tool/widgets/tool_specification_editor_window.py

View check run for this annotation

Codecov / codecov/patch

spine_items/tool/widgets/tool_specification_editor_window.py#L478

Added line #L478 was not covered by tests
else:
name = os.path.basename(file_path)
Expand Down Expand Up @@ -895,8 +899,8 @@ def _load_programfile_in_editor(self, index):
document = self._programfile_documents[file_path] = QTextDocument(self)
document.setPlainText(text)
document.setModified(False)
slot = self._programfile_set_dirty_slots[file_path] = (
lambda dirty, ind=index: self._set_program_file_dirty(ind, dirty)
slot = self._programfile_set_dirty_slots[file_path] = lambda dirty, ind=index: self._set_program_file_dirty(
ind, dirty
)
document.modificationChanged.connect(slot)
document.modificationChanged.connect(self._update_window_modified)
Expand All @@ -919,9 +923,7 @@ def _start_dir(self):
def browse_main_program_file(self, _=False):
"""Opens a file dialog where user can select the path of the main program file."""
# noinspection PyCallByClass, PyTypeChecker, PyArgumentList
answer = QFileDialog.getOpenFileName(
self, "Select existing main program file", self._start_dir(), "*.*"
)
answer = QFileDialog.getOpenFileName(self, "Select existing main program file", self._start_dir(), "*.*")
file_path = answer[0]
existing_file_paths = [
os.path.join(self.includes_main_path, i)
Expand Down

0 comments on commit 98640fd

Please sign in to comment.