Skip to content

Commit 19b32a9

Browse files
committed
Indicate if model:tag has been downloaded already
1 parent 8532c67 commit 19b32a9

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/alpaca.gresource.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<file alias="icons/scalable/status/sprout-symbolic.svg">icons/sprout-symbolic.svg</file>
4747
<file alias="icons/scalable/status/weight-symbolic.svg">icons/weight-symbolic.svg</file>
4848
<file alias="icons/scalable/status/tree-circle-symbolic.svg">icons/tree-circle-symbolic.svg</file>
49+
<file alias="icons/scalable/status/check-plain-symbolic.svg">icons/check-plain-symbolic.svg</file>
4950

5051
<file preprocess="xml-stripblanks">window.ui</file>
5152
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>

src/custom_widgets/model_widget.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -600,16 +600,17 @@ def show_pull_menu(self):
600600
window.model_tag_flow_box.append(category_pill('language:' + _('Others...'), True))
601601

602602
for tag_data in tags:
603-
if f"{self.get_name()}:{tag_data[0]}" not in window.model_manager.get_model_list():
604-
tag_row = Adw.ActionRow(
605-
title = tag_data[0],
606-
subtitle = tag_data[1],
607-
name = f"{self.get_name()}:{tag_data[0]}"
608-
)
609-
download_icon = Gtk.Image.new_from_icon_name("folder-download-symbolic")
610-
tag_row.add_suffix(download_icon)
611-
download_icon.update_property([4], [_("Download {}:{}").format(self.get_name(), tag_data[0])])
603+
tag_row = Adw.ActionRow(
604+
title = tag_data[0],
605+
subtitle = tag_data[1],
606+
name = f"{self.get_name()}:{tag_data[0]}",
607+
sensitive = f"{self.get_name()}:{tag_data[0]}" not in window.model_manager.get_model_list()
608+
)
609+
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")
610+
tag_row.add_suffix(download_icon)
611+
download_icon.update_property([4], [_("Download {}:{}").format(self.get_name(), tag_data[0])])
612612

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

@@ -619,7 +620,7 @@ def show_pull_menu(self):
619620
tag_row.add_controller(gesture_click)
620621
tag_row.add_controller(event_controller_key)
621622

622-
window.model_tag_list_box.append(tag_row)
623+
window.model_tag_list_box.append(tag_row)
623624

624625
class available_model_list(Gtk.ListBox):
625626
__gtype_name__ = 'AlpacaAvailableModelList'

src/icons/check-plain-symbolic.svg

Lines changed: 2 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)