Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix adding new executables to bottle and updating launch options #2909

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

pgasior
Copy link
Contributor

@pgasior pgasior commented May 27, 2023

Description

LaunchOptionsDialog was handling program configuration incorrectly in some cases:

  • When editing Launch options immediately after creating new entry. It tried to read properties that didn't exist from program dict
Traceback (most recent call last):
  File "/home/piotrek/dev/Bottles/bottles/frontend/widgets/program.py", line 134, in show_launch_options_view
    dialog = LaunchOptionsDialog(self, self.config, self.program)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/piotrek/dev/Bottles/bottles/frontend/windows/launchoptions.py", line 118, in __init__
    self.action_cwd.set_subtitle(program["folder"])
                                 ~~~~~~~^^^^^^^^^^
KeyError: 'folder'
  • When saving configuration, signal handler was converting dict to str
  File "/home/piotrek/dev/Bottles/bottles/frontend/widgets/program.py", line 202, in update_programs
    self.view_bottle.update_programs(config=self.config)
  File "/home/piotrek/dev/Bottles/bottles/frontend/views/bottle_details.py", line 287, in update_programs
    raise TypeError("config param need BottleConfig type, but it was %s" % type(config))
TypeError: config param need BottleConfig type, but it was <class 'str'>
  File "/home/piotrek/dev/Bottles/bottles/frontend/widgets/program.py", line 286, in browse_program_folder
    custom_path=self.program["folder"]
                ~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'folder'

Fixes #2897, #2609 probably #2885 and #2908

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.

  • Add new program to bottle and open Change Launch Options window
  • Open Change Launch Options for existing entry, save and open again
  • Add new program to bottle and use Browse path

@TheEvilSkeleton TheEvilSkeleton added this to the 52.0 milestone Jun 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

Pylint result on modfied files:
************* Module bottles.frontend.windows.launchoptions
bottles/frontend/windows/launchoptions.py:24:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/windows/launchoptions.py:26:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/windows/launchoptions.py:18:0: E0611: No name 'Adw' in module 'gi.repository' (no-name-in-module)
bottles/frontend/windows/launchoptions.py:165:31: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/windows/launchoptions.py:174:4: R1711: Useless return at end of function or method (useless-return)
bottles/frontend/windows/launchoptions.py:25:0: R0903: Too few public methods (1/2) (too-few-public-methods)
bottles/frontend/windows/launchoptions.py:21:0: C0411: standard import "from gettext import gettext as _" should be placed before "from gi.repository import Gtk, GLib, GObject, Adw" (wrong-import-order)
************* Module bottles.frontend.views.bottle_details
bottles/frontend/views/bottle_details.py:50:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:52:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:115:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:117:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:118:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:345:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:347:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:502:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/views/bottle_details.py:24:0: E0611: No name 'Adw' in module 'gi.repository' (no-name-in-module)
bottles/frontend/views/bottle_details.py:154:12: W0105: String statement has no effect (pointless-string-statement)
bottles/frontend/views/bottle_details.py:171:56: C0103: Argument name "x" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:171:59: C0103: Argument name "y" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:171:4: R0913: Too many arguments (6/5) (too-many-arguments)
bottles/frontend/views/bottle_details.py:184:25: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:184:28: C0103: Argument name "b" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:184:25: W0613: Unused argument 'a' (unused-argument)
bottles/frontend/views/bottle_details.py:184:28: W0613: Unused argument 'b' (unused-argument)
bottles/frontend/views/bottle_details.py:171:22: W0613: Unused argument 'drop_target' (unused-argument)
bottles/frontend/views/bottle_details.py:171:56: W0613: Unused argument 'x' (unused-argument)
bottles/frontend/views/bottle_details.py:171:59: W0613: Unused argument 'y' (unused-argument)
bottles/frontend/views/bottle_details.py:171:62: W0613: Unused argument 'user_data' (unused-argument)
bottles/frontend/views/bottle_details.py:193:36: C0103: Argument name "x" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:193:39: C0103: Argument name "y" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:193:23: W0613: Unused argument 'drop_target' (unused-argument)
bottles/frontend/views/bottle_details.py:193:36: W0613: Unused argument 'x' (unused-argument)
bottles/frontend/views/bottle_details.py:193:39: W0613: Unused argument 'y' (unused-argument)
bottles/frontend/views/bottle_details.py:197:23: W0613: Unused argument 'drop_target' (unused-argument)
bottles/frontend/views/bottle_details.py:237:18: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:340:31: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:351:30: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:358:12: C0103: Variable name "r" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:362:41: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:393:29: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:393:32: C0103: Argument name "b" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/views/bottle_details.py:393:29: W0613: Unused argument 'a' (unused-argument)
bottles/frontend/views/bottle_details.py:393:32: W0613: Unused argument 'b' (unused-argument)
bottles/frontend/views/bottle_details.py:370:29: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:370:37: W0613: Unused argument 'args' (unused-argument)
bottles/frontend/views/bottle_details.py:439:27: W0613: Unused argument 'error' (unused-argument)
bottles/frontend/views/bottle_details.py:423:23: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:471:26: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:487:31: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:517:37: W0613: Unused argument 'response_id' (unused-argument)
bottles/frontend/views/bottle_details.py:535:4: W0105: String statement has no effect (pointless-string-statement)
bottles/frontend/views/bottle_details.py:540:26: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:544:24: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:548:25: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:551:27: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:555:22: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:560:18: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:564:30: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:568:31: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:572:30: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:576:26: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/views/bottle_details.py:582:18: W0613: Unused argument 'result' (unused-argument)
bottles/frontend/views/bottle_details.py:582:31: W0613: Unused argument 'error' (unused-argument)
bottles/frontend/views/bottle_details.py:608:17: R1719: The if expression can be replaced with 'not test' (simplifiable-if-expression)
bottles/frontend/views/bottle_details.py:610:12: C0103: Variable name "w" doesn't conform to snake_case naming style (invalid-name)

@mirkobrombin
Copy link
Member

Thanks for your contribution!

@mirkobrombin mirkobrombin merged commit 8c3eeda into bottlesdevs:main Aug 1, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Regression: can't launch shortcut after "Change Launch Options"
3 participants