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

Make unspecified 'Arch' to be listed for 32-bit and 64-bit architecture #2684

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
- Changed the way the app read manifest dependency by adding 'for' a…
…ttribute on the steps action, for multi-architecture support

- Added 'show all dependencies' and 'show allowed dependency' on the dependency menu.
  • Loading branch information
Zylquinal committed Feb 18, 2023
commit 194bd0b3198d81130f5c2eb81d3ef7b8bf1484e4
5 changes: 4 additions & 1 deletion bottles/backend/managers/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,15 @@ def install(
_res = self.install(config, [_ext_dep, _dep])
if not _res.status:
return _res

for step in manifest.get("Steps"):
"""
Here we execute all steps in the manifest.
Steps are the actions performed to install the dependency.
"""
arch = step.get("for", "win64_win32")
if config.Arch not in arch:
continue

res = self.__perform_steps(config, step)
if not res.status:
GLib.idle_add(self.__operation_manager.remove_task, task_id)
Expand Down
8 changes: 8 additions & 0 deletions bottles/frontend/ui/details-dependencies.blp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ Popover pop_context {
tooltip-text: _("Read Documentation.");
text: _("Documentation");
}
.GtkModelButton btn_show_all {
tooltip-text: _("Show all dependencies.");
text: _("Show All Dependencies");
}
.GtkModelButton btn_show_allowed {
tooltip-text: _("Show allowed dependencies.");
text: _("Show Allowed Dependencies");
}
}
}

Expand Down
27 changes: 22 additions & 5 deletions bottles/frontend/views/bottle_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import time
from typing import Optional

Expand All @@ -35,6 +34,8 @@ class DependenciesView(Adw.Bin):
# region Widgets
list_dependencies = Gtk.Template.Child()
btn_report = Gtk.Template.Child()
btn_show_all = Gtk.Template.Child()
btn_show_allowed = Gtk.Template.Child()
btn_help = Gtk.Template.Child()
entry_search = Gtk.Template.Child()
actions = Gtk.Template.Child()
Expand All @@ -53,6 +54,7 @@ def __init__(self, details, config: BottleConfig, **kwargs):
self.manager = details.window.manager
self.config = config
self.queue = details.queue
self.show_all = False

self.ev_controller.connect("key-released", self.__search_dependencies)

Expand All @@ -61,12 +63,29 @@ def __init__(self, details, config: BottleConfig, **kwargs):

self.btn_report.connect("clicked", open_doc_url, "contribute/missing-dependencies")
self.btn_help.connect("clicked", open_doc_url, "bottles/dependencies")
self.btn_show_all.connect("clicked", self.__show_all_dependencies)
self.btn_show_allowed.connect("clicked", self.__show_allowed_dependencies)

if self.manager.utils_conn.status == False:
self.btn_show_all.set_visible(not self.show_all)
self.btn_show_allowed.set_visible(self.show_all)

if not self.manager.utils_conn.status:
self.stack.set_visible_child_name("page_offline")

self.spinner_loading.start()

def __show_all_dependencies(self, widget):
self.show_all = True
self.update(False, self.config)
self.btn_show_allowed.set_visible(self.show_all)
self.btn_show_all.set_visible(not self.show_all)

def __show_allowed_dependencies(self, widget):
self.show_all = False
self.update(False, self.config)
self.btn_show_all.set_visible(not self.show_all)
self.btn_show_allowed.set_visible(self.show_all)

def __search_dependencies(self, *_args):
"""
This function search in the list of dependencies the
Expand Down Expand Up @@ -129,11 +148,9 @@ def process_dependencies():
if dep[0] in self.config.Installed_Dependencies:
continue # Do not list already installed dependencies'

dependency_arch = dep[1].get("Arch")
if dependency_arch is not None and dependency_arch != self.config.get("Arch"):
if self.config.Arch not in dep[1].get("Arch", "win64_win32") and not self.show_all:
# NOTE: avoid listing dependencies not supported by the bottle arch
continue

GLib.idle_add(new_dependency, dep)

if len(self.config.Installed_Dependencies) > 0:
Expand Down
16 changes: 16 additions & 0 deletions po/bottles.pot
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,22 @@ msgstr ""
msgid "Report Missing Dependency"
msgstr ""

#: bottles/frontend/ui/details-dependencies.blp:85
msgid "Show all dependencies."
msgstr ""

#: bottles/frontend/ui/details-dependencies.blp:86
msgid "Show All Dependencies"
msgstr ""

#: bottles/frontend/ui/details-dependencies.blp:89
msgid "Show allowed dependencies."
msgstr ""

#: bottles/frontend/ui/details-dependencies.blp:90
msgid "Show Allowed Dependencies"
msgstr ""

#: bottles/frontend/ui/details-dependencies.blp:47
msgid "Read Documentation."
msgstr ""
Expand Down