UI Tweaks (more :3)

This commit is contained in:
jeffser 2024-06-30 13:28:08 -06:00
parent dcc8ffb5b7
commit 04fb59ef5c
2 changed files with 31 additions and 16 deletions

View File

@ -104,6 +104,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
file_preview_open_button = Gtk.Template.Child() file_preview_open_button = Gtk.Template.Child()
secondary_menu_button = Gtk.Template.Child() secondary_menu_button = Gtk.Template.Child()
model_searchbar = Gtk.Template.Child() model_searchbar = Gtk.Template.Child()
model_link_button = Gtk.Template.Child()
manage_models_dialog = Gtk.Template.Child() manage_models_dialog = Gtk.Template.Child()
pulling_model_list_box = Gtk.Template.Child() pulling_model_list_box = Gtk.Template.Child()
@ -382,7 +383,6 @@ class AlpacaWindow(Adw.ApplicationWindow):
self.model_searchbar.set_search_mode(button.get_active()) self.model_searchbar.set_search_mode(button.get_active())
self.pulling_model_list_box.set_visible(not button.get_active() and len(self.pulling_models) > 0) self.pulling_model_list_box.set_visible(not button.get_active() and len(self.pulling_models) > 0)
self.local_model_list_box.set_visible(not button.get_active()) self.local_model_list_box.set_visible(not button.get_active())
print(button.get_active())
@Gtk.Template.Callback() @Gtk.Template.Callback()
def model_search_changed(self, entry): def model_search_changed(self, entry):
@ -915,6 +915,8 @@ Generate a title following these rules:
def list_available_model_tags(self, model_name): def list_available_model_tags(self, model_name):
self.navigation_view_manage_models.push_by_tag('model_tags_page') self.navigation_view_manage_models.push_by_tag('model_tags_page')
self.navigation_view_manage_models.find_page('model_tags_page').set_title(model_name.capitalize()) self.navigation_view_manage_models.find_page('model_tags_page').set_title(model_name.capitalize())
self.model_link_button.set_name(self.available_models[model_name]['url'])
self.model_link_button.set_tooltip_text(self.available_models[model_name]['url'])
self.available_model_list_box.unselect_all() self.available_model_list_box.unselect_all()
self.model_tag_list_box.connect('row_selected', lambda list_box, row: self.confirm_pull_model(row.get_name()) if row else None) self.model_tag_list_box.connect('row_selected', lambda list_box, row: self.confirm_pull_model(row.get_name()) if row else None)
self.model_tag_list_box.remove_all() self.model_tag_list_box.remove_all()
@ -935,14 +937,19 @@ Generate a title following these rules:
for name, model_info in self.available_models.items(): for name, model_info in self.available_models.items():
model = Adw.ActionRow( model = Adw.ActionRow(
title = "<b>{}</b> <small>by {}</small>".format(name.capitalize(), model_info['author']), title = "<b>{}</b> <small>by {}</small>".format(name.capitalize(), model_info['author']),
subtitle = "<a href='{}'>{}</a>".format(model_info["url"], _("Website")), subtitle = model_info["description"],
#("<b>Image recognition capable</b>\n" if model_info["image"] else "") + #("<b>Image recognition capable</b>\n" if model_info["image"] else "") +
#title = f"<b>{name.capitalize()}</b> <small>by {model_info['author']}</small>", #title = f"<b>{name.capitalize()}</b> <small>by {model_info['author']}</small>",
#subtitle = f"<small>" + (_("(Image recognition capable)\n") if model_info["image"] else "") + f"{model_info['description']}</small>", #subtitle = f"<small>" + (_("(Image recognition capable)\n") if model_info["image"] else "") + f"{model_info['description']}</small>",
name = name name = name
) )
if model_info["image"]: model.add_suffix(Gtk.Image.new_from_icon_name("image-x-generic-symbolic")) if model_info["image"]:
model.add_suffix(Gtk.Image.new_from_icon_name("go-next")) image_icon = Gtk.Image.new_from_icon_name("image-x-generic-symbolic")
image_icon.set_margin_start(5)
model.add_suffix(image_icon)
next_icon = Gtk.Image.new_from_icon_name("go-next")
next_icon.set_margin_start(5)
model.add_suffix(next_icon)
self.available_model_list_box.append(model) self.available_model_list_box.append(model)
def save_history(self): def save_history(self):
@ -1280,7 +1287,6 @@ Generate a title following these rules:
lab = Gtk.Label( lab = Gtk.Label(
label="funny" label="funny"
) )
print(type(button.get_label()))
button.set_label(lab) button.set_label(lab)
self.attachments[name] = {"path": file_path, "type": file_type, "content": content, "button": button} self.attachments[name] = {"path": file_path, "type": file_type, "content": content, "button": button}
button.connect("clicked", lambda button: dialogs.remove_attached_file(self, button)) button.connect("clicked", lambda button: dialogs.remove_attached_file(self, button))

View File

@ -594,6 +594,7 @@
<property name="title" translatable="yes">Manage Models</property> <property name="title" translatable="yes">Manage Models</property>
<property name="child"> <property name="child">
<object class="AdwToolbarView"> <object class="AdwToolbarView">
<property name="height-request">140</property>
<child type="top"> <child type="top">
<object class="AdwHeaderBar"> <object class="AdwHeaderBar">
<child type="start"> <child type="start">
@ -615,6 +616,7 @@
</child> </child>
<child type="top"> <child type="top">
<object class="GtkSearchBar" id="model_searchbar"> <object class="GtkSearchBar" id="model_searchbar">
<property name="key-capture-widget">AlpacaWindow</property>
<child> <child>
<object class="GtkSearchEntry" id="searchentry"> <object class="GtkSearchEntry" id="searchentry">
<signal name="search-changed" handler="model_search_changed"/> <signal name="search-changed" handler="model_search_changed"/>
@ -676,7 +678,14 @@
<property name="child"> <property name="child">
<object class="AdwToolbarView"> <object class="AdwToolbarView">
<child type="top"> <child type="top">
<object class="AdwHeaderBar"/> <object class="AdwHeaderBar">
<child type="start">
<object class="GtkButton" id="model_link_button">
<signal name="clicked" handler="link_button_handler"/>
<property name="icon-name">globe-symbolic</property>
</object>
</child>
</object>
</child> </child>
<property name="content"> <property name="content">
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
@ -937,7 +946,7 @@
<menu id="primary_menu"> <menu id="primary_menu">
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">Import chat</attribute> <attribute name="label" translatable="yes">Import Chat</attribute>
<attribute name="action">app.import_chat</attribute> <attribute name="action">app.import_chat</attribute>
</item> </item>
</section> </section>
@ -947,7 +956,7 @@
<attribute name="action">app.preferences</attribute> <attribute name="action">app.preferences</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">Keyboard shortcuts</attribute> <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute> <attribute name="action">win.show-help-overlay</attribute>
</item> </item>
<item> <item>
@ -958,30 +967,30 @@
</menu> </menu>
<menu id="secondary_menu"> <menu id="secondary_menu">
<item> <item>
<attribute name="label" translatable="yes">Rename chat</attribute> <attribute name="label" translatable="yes">Rename Chat</attribute>
<attribute name="action">app.rename_current_chat</attribute> <attribute name="action">app.rename_current_chat</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">Export chat</attribute> <attribute name="label" translatable="yes">Export Chat</attribute>
<attribute name="action">app.export_current_chat</attribute> <attribute name="action">app.export_current_chat</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">Clear chat</attribute> <attribute name="label" translatable="yes">Clear Chat</attribute>
<attribute name="action">app.clear</attribute> <attribute name="action">app.clear</attribute>
</item> </item>
</menu> </menu>
<menu id="chat_right_click_menu"> <menu id="chat_right_click_menu">
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">Delete chat</attribute> <attribute name="label" translatable="yes">Delete Chat</attribute>
<attribute name="action">app.delete_chat</attribute> <attribute name="action">app.delete_chat</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">Rename chat</attribute> <attribute name="label" translatable="yes">Rename Chat</attribute>
<attribute name="action">app.rename_chat</attribute> <attribute name="action">app.rename_chat</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">Export chat</attribute> <attribute name="label" translatable="yes">Export Chat</attribute>
<attribute name="action">app.export_chat</attribute> <attribute name="action">app.export_chat</attribute>
</item> </item>
</section> </section>
@ -989,11 +998,11 @@
<menu id="create_model_menu"> <menu id="create_model_menu">
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">From existing model</attribute> <attribute name="label" translatable="yes">From Existing Model</attribute>
<attribute name="action">app.create_model_from_existing</attribute> <attribute name="action">app.create_model_from_existing</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">From GGUF file (Experimental)</attribute> <attribute name="label" translatable="yes">From GGUF File (Experimental)</attribute>
<attribute name="action">app.create_model_from_file</attribute> <attribute name="action">app.create_model_from_file</attribute>
</item> </item>
</section> </section>