Skip to content

Commit

Permalink
Indicate if model:tag has been downloaded already
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffser committed Dec 26, 2024
1 parent 8532c67 commit 19b32a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/alpaca.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<file alias="icons/scalable/status/sprout-symbolic.svg">icons/sprout-symbolic.svg</file>
<file alias="icons/scalable/status/weight-symbolic.svg">icons/weight-symbolic.svg</file>
<file alias="icons/scalable/status/tree-circle-symbolic.svg">icons/tree-circle-symbolic.svg</file>
<file alias="icons/scalable/status/check-plain-symbolic.svg">icons/check-plain-symbolic.svg</file>

<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
Expand Down
21 changes: 11 additions & 10 deletions src/custom_widgets/model_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,16 +600,17 @@ def show_pull_menu(self):
window.model_tag_flow_box.append(category_pill('language:' + _('Others...'), True))

for tag_data in tags:
if f"{self.get_name()}:{tag_data[0]}" not in window.model_manager.get_model_list():
tag_row = Adw.ActionRow(
title = tag_data[0],
subtitle = tag_data[1],
name = f"{self.get_name()}:{tag_data[0]}"
)
download_icon = Gtk.Image.new_from_icon_name("folder-download-symbolic")
tag_row.add_suffix(download_icon)
download_icon.update_property([4], [_("Download {}:{}").format(self.get_name(), tag_data[0])])
tag_row = Adw.ActionRow(
title = tag_data[0],
subtitle = tag_data[1],
name = f"{self.get_name()}:{tag_data[0]}",
sensitive = f"{self.get_name()}:{tag_data[0]}" not in window.model_manager.get_model_list()
)
download_icon = Gtk.Image.new_from_icon_name("folder-download-symbolic" if f"{self.get_name()}:{tag_data[0]}" not in window.model_manager.get_model_list() else "check-plain-symbolic")
tag_row.add_suffix(download_icon)
download_icon.update_property([4], [_("Download {}:{}").format(self.get_name(), tag_data[0])])

if f"{self.get_name()}:{tag_data[0]}" not in window.model_manager.get_model_list():
gesture_click = Gtk.GestureClick.new()
gesture_click.connect("pressed", lambda *_, name=f"{self.get_name()}:{tag_data[0]}" : self.pull_model(name))

Expand All @@ -619,7 +620,7 @@ def show_pull_menu(self):
tag_row.add_controller(gesture_click)
tag_row.add_controller(event_controller_key)

window.model_tag_list_box.append(tag_row)
window.model_tag_list_box.append(tag_row)

class available_model_list(Gtk.ListBox):
__gtype_name__ = 'AlpacaAvailableModelList'
Expand Down
2 changes: 2 additions & 0 deletions src/icons/check-plain-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 19b32a9

Please sign in to comment.