-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lint] Fix ruff lint gettext and type comparison
The gettext strings cannot be formatted until after the function return from gettext. Refs: https://docs.astral.sh/ruff/rules/f-string-in-get-text-func-call/ Refs: https://docs.astral.sh/ruff/rules/printf-in-get-text-func-call/
- Loading branch information
Showing
10 changed files
with
37 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,20 +226,20 @@ def load_languages(self): | |
self.language_checkbox = self.builder.get_object('checkbutton_language') | ||
lang_model = self.language_combo.get_model() | ||
langs = get_languages() | ||
index = -1 | ||
for i, l in enumerate(langs): | ||
lang_code, name = l | ||
lang_idx = -1 | ||
for idx, lang in enumerate(langs): | ||
lang_code, name = lang | ||
lang_model.append([lang_code, name]) | ||
if self.gtkui_config['language'] == lang_code: | ||
index = i | ||
lang_idx = idx | ||
|
||
if self.gtkui_config['language'] is None: | ||
self.language_checkbox.set_active(True) | ||
self.language_combo.set_visible(False) | ||
else: | ||
self.language_combo.set_visible(True) | ||
if index != -1: | ||
self.language_combo.set_active(index) | ||
if lang_idx != -1: | ||
self.language_combo.set_active(lang_idx) | ||
|
||
def __del__(self): | ||
del self.gtkui_config | ||
|
@@ -647,15 +647,15 @@ def set_config(self, hide=False): | |
'chk_move_completed' | ||
).get_active() | ||
|
||
new_core_config[ | ||
'download_location' | ||
] = self.download_location_path_chooser.get_text() | ||
new_core_config[ | ||
'move_completed_path' | ||
] = self.move_completed_path_chooser.get_text() | ||
new_core_config[ | ||
'torrentfiles_location' | ||
] = self.copy_torrent_files_path_chooser.get_text() | ||
new_core_config['download_location'] = ( | ||
self.download_location_path_chooser.get_text() | ||
) | ||
new_core_config['move_completed_path'] = ( | ||
self.move_completed_path_chooser.get_text() | ||
) | ||
new_core_config['torrentfiles_location'] = ( | ||
self.copy_torrent_files_path_chooser.get_text() | ||
) | ||
new_core_config['prioritize_first_last_pieces'] = self.builder.get_object( | ||
'chk_prioritize_first_last_pieces' | ||
).get_active() | ||
|
@@ -956,7 +956,7 @@ def on_response(response): | |
mode = _('Thinclient') if was_standalone else _('Standalone') | ||
dialog = YesNoDialog( | ||
_('Switching Deluge Client Mode...'), | ||
_('Do you want to restart to use %s mode?' % mode), | ||
_('Do you want to restart to use %s mode?') % mode, | ||
) | ||
dialog.run().addCallback(on_response) | ||
|
||
|
@@ -1381,7 +1381,9 @@ async def on_accounts_add_clicked(self, widget): | |
except Exception as ex: | ||
return ErrorDialog( | ||
_('Error Adding Account'), | ||
_(f'An error occurred while adding account: {account}'), | ||
_('An error occurred while adding account: {account}').format( | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cas--
Author
Member
|
||
account=account | ||
), | ||
parent=self.pref_dialog, | ||
details=ex, | ||
).run() | ||
|
@@ -1434,8 +1436,8 @@ def on_accounts_delete_clicked(self, widget): | |
header = _('Remove Account') | ||
text = _( | ||
'Are you sure you want to remove the account with the ' | ||
'username "%(username)s"?' % {'username': username} | ||
) | ||
'username "%(username)s"?' | ||
) % {'username': username} | ||
dialog = YesNoDialog(header, text, parent=self.pref_dialog) | ||
|
||
def dialog_finished(response_id): | ||
|
@cas-- ,
: {account}
should be outside of_(...)
or be: %s
?