Fixes to UI
This commit is contained in:
parent
898c64ce35
commit
5bf77d6b97
@ -99,10 +99,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
model_string_list = Gtk.Template.Child()
|
model_string_list = Gtk.Template.Child()
|
||||||
chat_right_click_menu = Gtk.Template.Child()
|
chat_right_click_menu = Gtk.Template.Child()
|
||||||
model_tag_list_box = Gtk.Template.Child()
|
model_tag_list_box = Gtk.Template.Child()
|
||||||
manage_models_carousel = Gtk.Template.Child()
|
navigation_view_manage_models = Gtk.Template.Child()
|
||||||
manage_models_title = Gtk.Template.Child()
|
|
||||||
create_model_button = Gtk.Template.Child()
|
|
||||||
manage_models_back_button = Gtk.Template.Child()
|
|
||||||
file_preview_open_button = Gtk.Template.Child()
|
file_preview_open_button = Gtk.Template.Child()
|
||||||
|
|
||||||
manage_models_dialog = Gtk.Template.Child()
|
manage_models_dialog = Gtk.Template.Child()
|
||||||
@ -237,10 +234,6 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
@Gtk.Template.Callback()
|
@Gtk.Template.Callback()
|
||||||
def manage_models_button_activate(self, button=None):
|
def manage_models_button_activate(self, button=None):
|
||||||
self.manage_models_carousel.scroll_to(self.manage_models_carousel.get_nth_page(0), True)
|
|
||||||
self.manage_models_title.set_title(_("Manage Models"))
|
|
||||||
self.create_model_button.set_visible(True)
|
|
||||||
self.manage_models_back_button.set_visible(False)
|
|
||||||
self.update_list_local_models()
|
self.update_list_local_models()
|
||||||
self.manage_models_dialog.present(self)
|
self.manage_models_dialog.present(self)
|
||||||
|
|
||||||
@ -866,18 +859,14 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
def confirm_pull_model(self, model_name):
|
def confirm_pull_model(self, model_name):
|
||||||
|
self.navigation_view_manage_models.pop()
|
||||||
self.model_tag_list_box.unselect_all()
|
self.model_tag_list_box.unselect_all()
|
||||||
self.manage_models_title.set_title(_("Manage Models"))
|
|
||||||
self.create_model_button.set_visible(True)
|
|
||||||
self.manage_models_back_button.set_visible(False)
|
|
||||||
self.manage_models_carousel.scroll_to(self.manage_models_carousel.get_nth_page(0), True)
|
|
||||||
self.pull_model(model_name)
|
self.pull_model(model_name)
|
||||||
|
|
||||||
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.find_page('model_tags_page').set_title(model_name.capitalize())
|
||||||
self.available_model_list_box.unselect_all()
|
self.available_model_list_box.unselect_all()
|
||||||
self.manage_models_title.set_title(model_name.capitalize())
|
|
||||||
self.create_model_button.set_visible(False)
|
|
||||||
self.manage_models_back_button.set_visible(True)
|
|
||||||
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()
|
||||||
tags = self.available_models[model_name]['tags']
|
tags = self.available_models[model_name]['tags']
|
||||||
@ -895,9 +884,8 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
tooltip_text = _("Pull '{} ({})'").format(model_name.capitalize(), tag_data[0])
|
tooltip_text = _("Pull '{} ({})'").format(model_name.capitalize(), tag_data[0])
|
||||||
)
|
)
|
||||||
pull_button.connect("clicked", lambda button, model_name=f"{model_name}:{tag_data[0]}" : self.confirm_pull_model(model_name))
|
pull_button.connect("clicked", lambda button, model_name=f"{model_name}:{tag_data[0]}" : self.confirm_pull_model(model_name))
|
||||||
tag_row.add_suffix(pull_button)
|
#tag_row.add_suffix(pull_button)
|
||||||
self.model_tag_list_box.append(tag_row)
|
self.model_tag_list_box.append(tag_row)
|
||||||
self.manage_models_carousel.scroll_to(self.manage_models_carousel.get_nth_page(1), True)
|
|
||||||
|
|
||||||
def update_list_available_models(self):
|
def update_list_available_models(self):
|
||||||
self.available_model_list_box.connect('row_selected', lambda list_box, row: self.list_available_model_tags(row.get_name()) if row else None)
|
self.available_model_list_box.connect('row_selected', lambda list_box, row: self.list_available_model_tags(row.get_name()) if row else None)
|
||||||
@ -923,7 +911,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
link_button.connect("clicked", lambda button=link_button, link=model_info["url"]: os.system(f'xdg-open "{link}"'))
|
link_button.connect("clicked", lambda button=link_button, link=model_info["url"]: os.system(f'xdg-open "{link}"'))
|
||||||
pull_button.connect("clicked", lambda button=pull_button, model_name=name: self.list_available_model_tags(model_name))
|
pull_button.connect("clicked", lambda button=pull_button, model_name=name: self.list_available_model_tags(model_name))
|
||||||
model.add_suffix(link_button)
|
model.add_suffix(link_button)
|
||||||
model.add_suffix(pull_button)
|
#model.add_suffix(pull_button)
|
||||||
self.available_model_list_box.append(model)
|
self.available_model_list_box.append(model)
|
||||||
|
|
||||||
def save_history(self):
|
def save_history(self):
|
||||||
|
152
src/window.ui
152
src/window.ui
@ -581,74 +581,87 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="AdwToastOverlay" id="manage_models_overlay">
|
<object class="AdwToastOverlay" id="manage_models_overlay">
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwToolbarView">
|
<object class="AdwNavigationView" id="navigation_view_manage_models">
|
||||||
<child type="top">
|
<child>
|
||||||
<object class="AdwHeaderBar">
|
<object class="AdwNavigationPage">
|
||||||
<child type="start">
|
<property name="title" translatable="yes">Manage Models</property>
|
||||||
<object class="GtkBox">
|
<property name="child">
|
||||||
<child>
|
<object class="AdwToolbarView">
|
||||||
<object class="GtkMenuButton" id="create_model_button">
|
<child type="top">
|
||||||
<property name="primary">True</property>
|
<object class="AdwHeaderBar">
|
||||||
<property name="icon-name">list-add-symbolic</property>
|
<child type="start">
|
||||||
<property name="tooltip-text" translatable="yes">Create Model</property>
|
<object class="GtkMenuButton" id="create_model_button">
|
||||||
<property name="menu-model">create_model_menu</property>
|
<property name="primary">True</property>
|
||||||
|
<property name="icon-name">list-add-symbolic</property>
|
||||||
|
<property name="tooltip-text" translatable="yes">Create Model</property>
|
||||||
|
<property name="menu-model">create_model_menu</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<property name="content">
|
||||||
<object class="GtkButton" id="manage_models_back_button">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="icon-name">step-back-symbolic</property>
|
<property name="hexpand">true</property>
|
||||||
<property name="tooltip-text" translatable="yes">Back</property>
|
<property name="vexpand">true</property>
|
||||||
<signal name="clicked" handler="manage_models_button_activate"/>
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-end">12</property>
|
||||||
|
<property name="margin-top">12</property>
|
||||||
|
<property name="margin-bottom">12</property>
|
||||||
|
<property name="orientation">1</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="pulling_model_list_box">
|
||||||
|
<property name="visible">false</property>
|
||||||
|
<property name="selection-mode">none</property>
|
||||||
|
<style>
|
||||||
|
<class name="boxed-list"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="local_model_list_box">
|
||||||
|
<property name="selection-mode">none</property>
|
||||||
|
<style>
|
||||||
|
<class name="boxed-list"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="available_model_list_box">
|
||||||
|
<property name="selection-mode">single</property>
|
||||||
|
<style>
|
||||||
|
<class name="boxed-list"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<property name="title-widget">
|
|
||||||
<object class="AdwWindowTitle" id="manage_models_title">
|
|
||||||
<property name="title" translatable="yes">Manage Models</property>
|
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class= "AdwCarousel" id="manage_models_carousel">
|
<object class="AdwNavigationPage">
|
||||||
<property name="halign">0</property>
|
<property name="title">MODEL</property>
|
||||||
<property name="valign">0</property>
|
<property name="tag">model_tags_page</property>
|
||||||
<property name="allow-long-swipes">false</property>
|
<property name="child">
|
||||||
<property name="allow-scroll-wheel">false</property>
|
<object class="AdwToolbarView">
|
||||||
<property name="allow-mouse-drag">false</property>
|
<child type="top">
|
||||||
<property name="spacing">12</property>
|
<object class="AdwHeaderBar"/>
|
||||||
<child>
|
</child>
|
||||||
<object class="GtkScrolledWindow">
|
<property name="content">
|
||||||
<property name="hexpand">true</property>
|
<object class="GtkScrolledWindow">
|
||||||
<property name="vexpand">true</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="margin-start">12</property>
|
|
||||||
<property name="margin-end">12</property>
|
|
||||||
<property name="margin-top">12</property>
|
|
||||||
<property name="margin-bottom">12</property>
|
|
||||||
<property name="orientation">1</property>
|
|
||||||
<property name="spacing">12</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="pulling_model_list_box">
|
<object class="GtkListBox" id="model_tag_list_box">
|
||||||
<property name="visible">false</property>
|
<property name="valign">1</property>
|
||||||
<property name="selection-mode">none</property>
|
<property name="margin-start">12</property>
|
||||||
<style>
|
<property name="margin-end">12</property>
|
||||||
<class name="boxed-list"/>
|
<property name="margin-top">12</property>
|
||||||
</style>
|
<property name="margin-bottom">12</property>
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkListBox" id="local_model_list_box">
|
|
||||||
<property name="selection-mode">none</property>
|
|
||||||
<style>
|
|
||||||
<class name="boxed-list"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkListBox" id="available_model_list_box">
|
|
||||||
<property name="selection-mode">single</property>
|
<property name="selection-mode">single</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="boxed-list"/>
|
<class name="boxed-list"/>
|
||||||
@ -656,26 +669,9 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
<child>
|
|
||||||
<object class="GtkScrolledWindow">
|
|
||||||
<child>
|
|
||||||
<object class="GtkListBox" id="model_tag_list_box">
|
|
||||||
<property name="valign">1</property>
|
|
||||||
<property name="margin-start">12</property>
|
|
||||||
<property name="margin-end">12</property>
|
|
||||||
<property name="margin-top">12</property>
|
|
||||||
<property name="margin-bottom">12</property>
|
|
||||||
<property name="selection-mode">single</property>
|
|
||||||
<style>
|
|
||||||
<class name="boxed-list"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user