Skip to content

Commit

Permalink
Fixes #227 Remove QMessageBox static function keywords.
Browse files Browse the repository at this point in the history
Although the .pyi does record the keywords, there is an exception when they are used.
  • Loading branch information
markfinal committed Jan 7, 2025
1 parent aa3630b commit 7130a21
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 80 deletions.
4 changes: 2 additions & 2 deletions src/cruiz/commands/conaninvocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def _critical_failure(self, message: str) -> None:
None, # type: ignore[arg-type]
"System failure",
message,
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
sys.exit(1)

Expand Down
8 changes: 4 additions & 4 deletions src/cruiz/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"Conan unavailable",
"Unable to locate the conan Python package in the current environment.\n"
"Use pip install conan[==version].",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
sys.exit(-1)

Expand Down Expand Up @@ -72,8 +72,8 @@ def _are_resources_out_of_date() -> bool:
None, # type: ignore[arg-type]
"Resources",
"Resources are out of date.\n" "Please build with python3 setup.py build",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
sys.exit(-1)

Expand Down
8 changes: 4 additions & 4 deletions src/cruiz/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ def load_recipe(
"Recipe does not exist",
f"The recipe at {str(recipe_path)} no longer exists. \
Remove from the recent list?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if result == QtWidgets.QMessageBox.StandardButton.Yes:
# TODO: this is not ideal, as it's not atomic
Expand Down Expand Up @@ -665,8 +665,8 @@ def _icon_license(self) -> None:
self,
"Failed file copy",
f"Unable to copy the {license_file} to a temporary location for viewing", # noqa: E501
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
QtGui.QDesktopServices.openUrl(
Expand Down
16 changes: 8 additions & 8 deletions src/cruiz/manage_local_cache/managelocalcachesdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ def reject(self) -> None:
self,
"Local cache modifications",
"Do you want to lose unsaved changes to the local cache?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
== QtWidgets.QMessageBox.StandardButton.No
):
Expand Down Expand Up @@ -611,9 +611,9 @@ def _operations_remove_all_packages(self) -> None:
self,
"Package deletion",
"Are you sure you want to delete all packages from this local cache?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if result == QtWidgets.QMessageBox.StandardButton.Yes:
RemoveAllPackagesDialog(self._context, self).exec_()
Expand Down Expand Up @@ -647,9 +647,9 @@ def _operations_delete_cache(self) -> None:
self,
"Local cache deletion",
f"Are you sure you want to delete the local cache {cache_name}?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if result == QtWidgets.QMessageBox.StandardButton.No:
return
Expand All @@ -675,9 +675,9 @@ def _operations_delete_cache(self) -> None:
if short_home_dir
else f"Please confirm deletion of the directory {conan_home_dir}?"
),
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if result == QtWidgets.QMessageBox.StandardButton.No:
return
Expand Down
4 changes: 2 additions & 2 deletions src/cruiz/manage_local_cache/widgets/installconfigdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def _install_complete(self, result: typing.Any, exception: typing.Any) -> None:
self,
"Local cache config install failure",
str(exception),
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
with RecentConanConfigSettingsReader() as settings:
Expand Down
32 changes: 16 additions & 16 deletions src/cruiz/manage_local_cache/widgets/movelocalcachedialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def accept(self) -> None:
"Conan local cache home directory",
f"The selected home directory '{new_home_dir}' is unchanged. "
"Please choose another.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
qdir = QtCore.QDir(new_home_dir)
Expand All @@ -113,8 +113,8 @@ def accept(self) -> None:
"Conan local cache home directory",
f"The selected home directory '{new_home_dir}' already exists. "
"Please choose another.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
if not qdir.isEmpty():
Expand All @@ -123,8 +123,8 @@ def accept(self) -> None:
"Conan local cache home directory",
f"The selected home directory '{new_home_dir}' is not empty. "
"Please choose another.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
if short_home_dir:
Expand All @@ -135,8 +135,8 @@ def accept(self) -> None:
"Conan local cache short home directory",
f"The selected short home directory '{new_short_home_dir}' "
"is unchanged. Please choose another.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
qdir = QtCore.QDir(new_short_home_dir)
Expand All @@ -146,8 +146,8 @@ def accept(self) -> None:
"Conan local cache short home directory",
f"The selected short home directory '{new_short_home_dir}' already"
" exists. Please choose another.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
if not qdir.isEmpty():
Expand All @@ -156,8 +156,8 @@ def accept(self) -> None:
"Conan local cache short home directory",
f"The selected short home directory '{new_short_home_dir}' is "
"not empty. Please choose another.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
else:
Expand Down Expand Up @@ -191,8 +191,8 @@ def _move(
self,
"Conan move local cache",
f"Failed to move the local cache home dir because: {exception}.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
# roll back previous steps
settings.home_dir = old_home_dir # type: ignore
Expand All @@ -209,8 +209,8 @@ def _move(
"Conan move local cache",
"Failed to move the local cache short home dir because: "
f"{exception}.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
# roll back previous steps
shutil.move(new_home_dir, str(old_conan_dir))
Expand Down
4 changes: 2 additions & 2 deletions src/cruiz/manage_local_cache/widgets/newlocalcachewizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def _perform_new_cache_config_install_complete(
self,
"New local cache configuration install failure",
str(exception),
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)

@property
Expand Down
4 changes: 2 additions & 2 deletions src/cruiz/manage_local_cache/widgets/progressdialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def _done(self, result: typing.Any, exception: typing.Any) -> None:
self,
f"{self._title} failed",
str(exception),
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
self.reset()
Expand Down
16 changes: 8 additions & 8 deletions src/cruiz/recipe/recipewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ def closeEvent(self, event: QtGui.QCloseEvent) -> None:
self,
"Recipe cannot be closed",
"Commands are still running. Cannot close recipe.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
event.ignore()
return
Expand Down Expand Up @@ -964,9 +964,9 @@ def _local_workflow_on_delete_common_subdir(self) -> None:
self,
"Delete directory",
f"Delete the directory '{resolved_working_dir}'?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if result == QtWidgets.QMessageBox.StandardButton.No:
return
Expand All @@ -990,9 +990,9 @@ def _local_workflow_on_delete_command_folder(self, property_name: str) -> None:
self,
"Delete directory",
f"Delete the directory '{command_dir}'?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if result == QtWidgets.QMessageBox.StandardButton.No:
return
Expand Down Expand Up @@ -1344,8 +1344,8 @@ def _open_package_directory(self) -> None:
self,
"No such package directory",
f"Package directory '{directory}' does not exist",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)

def _copy_package_directory(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/cruiz/recipe/toolbars/buildfeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def reject(self) -> None:
self,
"Unsaved compiler cache arguments",
"Modifications are unsaved. Do you want to discard them?",
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
if response == QtWidgets.QMessageBox.StandardButton.No:
return
Expand Down
4 changes: 2 additions & 2 deletions src/cruiz/remote_browser/pages/packagebinarypage.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ def _on_prev_dclicked(self, index: QtCore.QModelIndex) -> None:
self,
"Cannot view file contents",
f"Unable to interpret file {path} in archive {container} " "as text",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)

def on_cancel(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/cruiz/remote_browser/remotebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def closeEvent(self, event: QtGui.QCloseEvent) -> None:
self,
"Remote browser cannot be closed",
"Commands are still running. Cannot close remote browser.",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
event.ignore()
return
Expand Down
16 changes: 8 additions & 8 deletions src/cruiz/revealonfilesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def _use_xdg_open(file_info: QtCore.QFileInfo) -> None:
None, # type: ignore[arg-type]
"Cannot reveal path",
"Unable to find the path to xdg-open",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
script_args = [file_info.canonicalFilePath()]
Expand All @@ -61,8 +61,8 @@ def reveal_on_filesystem(path: pathlib.Path) -> None:
None, # type: ignore[arg-type]
"Cannot reveal path",
f"Path '{path}' does not exist",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
file_info = QtCore.QFileInfo(path)
Expand All @@ -86,8 +86,8 @@ def open_terminal_at(path: str) -> None:
None, # type: ignore[arg-type]
"Cannot open terminal at path",
f"Path '{path}' does not exist",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
return
if platform.system() == "Darwin":
Expand Down Expand Up @@ -116,8 +116,8 @@ def open_terminal_at(path: str) -> None:
None, # type: ignore[arg-type]
"Cannot open terminal at path",
"Unable to detect window manager",
button0=QtWidgets.QMessageBox.StandardButton.Ok,
button1=QtWidgets.QMessageBox.StandardButton.NoButton,
QtWidgets.QMessageBox.StandardButton.Ok,
QtWidgets.QMessageBox.StandardButton.NoButton,
)
else:
raise RuntimeError(f"Unrecognised platform {platform.system()}")
16 changes: 8 additions & 8 deletions src/cruiz/settings/managers/cleansettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def sanitise_settings(widget: QtWidgets.QWidget) -> bool:
widget,
"Inconsistent recipe settings",
message,
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.Yes,
)
if response == QtWidgets.QMessageBox.StandardButton.Yes:
for uuid in incomplete_uuids:
Expand All @@ -78,9 +78,9 @@ def sanitise_settings(widget: QtWidgets.QWidget) -> bool:
widget,
"Inconsistent recipe settings",
message,
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.Yes,
)
if response == QtWidgets.QMessageBox.StandardButton.Yes:
for uuid, _ in recipe_no_longer_exists_uuid.items():
Expand All @@ -96,9 +96,9 @@ def sanitise_settings(widget: QtWidgets.QWidget) -> bool:
widget,
"Inconsistent recipe settings",
message,
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.Yes,
)
if response == QtWidgets.QMessageBox.StandardButton.Yes:
for uuid in recent_recipe_only:
Expand All @@ -114,9 +114,9 @@ def sanitise_settings(widget: QtWidgets.QWidget) -> bool:
widget,
"Inconsistent recipe settings",
message,
button0=QtWidgets.QMessageBox.StandardButton.Yes
QtWidgets.QMessageBox.StandardButton.Yes
| QtWidgets.QMessageBox.StandardButton.No,
button1=QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.Yes,
)
if response == QtWidgets.QMessageBox.StandardButton.Yes:
for uuid in all_uuids:
Expand Down
Loading

0 comments on commit 7130a21

Please sign in to comment.