Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinsteen committed Aug 25, 2023
1 parent 48651f6 commit 4948a4a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
10 changes: 5 additions & 5 deletions bottles/frontend/views/bottle_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
from bottles.frontend.widgets.dependency import DependencyEntry


@Gtk.Template(resource_path='/com/usebottles/bottles/details-dependencies.ui')
@Gtk.Template(resource_path="/com/usebottles/bottles/details-dependencies.ui")
class DependenciesView(Adw.Bin):
__gtype_name__ = 'DetailsDependencies'
__gtype_name__ = "DetailsDependencies"
__registry = []

# region Widgets
Expand Down Expand Up @@ -89,7 +89,7 @@ def empty_list(self):
r.get_parent().remove(r)
self.__registry = []

def update(self, widget=False, config: Optional[BottleConfig] = None):
def update(self, _widget=False, config: Optional[BottleConfig] = None):
"""
This function update the dependencies list with the
supported by the manager.
Expand All @@ -99,7 +99,7 @@ def update(self, widget=False, config: Optional[BottleConfig] = None):
self.config = config

# Not sure if it's the best place to make this check
if self.manager.utils_conn.status == False:
if not self.manager.utils_conn.status:
return

self.stack.set_visible_child_name("page_loading")
Expand All @@ -115,7 +115,7 @@ def new_dependency(dependency, plain=False):
self.list_dependencies.append(entry)

@GtkUtils.run_in_main_loop
def callback(result, error=False):
def callback(_result, _error=False):
self.stack.set_visible_child_name("page_deps")

def process_dependencies():
Expand Down
25 changes: 13 additions & 12 deletions bottles/frontend/widgets/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
from bottles.frontend.windows.generic import SourceDialog


@Gtk.Template(resource_path='/com/usebottles/bottles/dependency-entry.ui')
@Gtk.Template(resource_path="/com/usebottles/bottles/dependency-entry.ui")
class DependencyEntry(Adw.ActionRow):
__gtype_name__ = 'DependencyEntry'
__gtype_name__ = "DependencyEntry"

# region Widgets
label_category = Gtk.Template.Child()
Expand All @@ -56,10 +56,10 @@ def __init__(self, window, config: BottleConfig, dependency, plain=False, **kwar
self.queue = window.page_details.queue

if plain:
'''
"""
If the dependency is plain, treat it as a placeholder, it
can be used to display "fake" elements on the list
'''
"""
self.set_title(dependency)
self.set_subtitle("")
self.btn_install.set_visible(False)
Expand Down Expand Up @@ -87,24 +87,24 @@ def __init__(self, window, config: BottleConfig, dependency, plain=False, **kwar
self.btn_license.connect("clicked", self.open_license)

if dependency[0] in self.config.Installed_Dependencies:
'''
"""
If the dependency is installed, hide the btn_install
button and show the btn_remove button
'''
"""
self.btn_install.set_visible(False)
self.btn_remove.set_visible(True)
self.btn_reinstall.set_visible(True)

if dependency[0] in self.config.Uninstallers.keys():
'''
"""
If the dependency has no uninstaller, disable the
btn_remove button
'''
"""
uninstaller = self.config.Uninstallers[dependency[0]]
if uninstaller in [False, "NO_UNINSTALLER"]:
self.btn_remove.set_sensitive(False)

def open_manifest(self, widget):
def open_manifest(self, _widget):
"""
This function pop up a dialog with the manifest
of the dependency
Expand All @@ -118,7 +118,7 @@ def open_manifest(self, widget):
)
).present()

def open_license(self, widget):
def open_license(self, _widget):
"""
This function pop up a dialog with the license
of the dependency
Expand All @@ -128,7 +128,7 @@ def open_license(self, widget):
)
webbrowser.open(manifest["License_url"])

def install_dependency(self, widget):
def install_dependency(self, _widget):
"""
This function install the dependency in the bottle, it
will also prevent user from installing other dependencies
Expand Down Expand Up @@ -179,7 +179,8 @@ def set_install_status(self, result: Result, error=None):
self.window.show_toast(_("\"{0}\" uninstalled").format(self.dependency[0]))
else:
self.window.show_toast(_("\"{0}\" installed").format(self.dependency[0]))
return self.set_installed(uninstaller, removed)
self.set_installed(uninstaller, removed)
return
self.set_err()

def set_err(self):
Expand Down

0 comments on commit 4948a4a

Please sign in to comment.