Added shortcut to import chat, moved option to primary menu and moved primary menu to sidebar

This commit is contained in:
jeffser 2024-06-23 20:17:45 -06:00
parent 39691cc83c
commit b8c420526c
2 changed files with 18 additions and 22 deletions

View File

@ -88,7 +88,6 @@ class AlpacaWindow(Adw.ApplicationWindow):
message_text_view = Gtk.Template.Child() message_text_view = Gtk.Template.Child()
send_button = Gtk.Template.Child() send_button = Gtk.Template.Child()
stop_button = Gtk.Template.Child() stop_button = Gtk.Template.Child()
chats_menu_button = Gtk.Template.Child()
attachment_container = Gtk.Template.Child() attachment_container = Gtk.Template.Child()
attachment_box = Gtk.Template.Child() attachment_box = Gtk.Template.Child()
file_filter_tar = Gtk.Template.Child() file_filter_tar = Gtk.Template.Child()
@ -753,7 +752,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
self.chats["chats"][self.chats["selected_chat"]]["messages"][id]['content'] += data['message']['content'] self.chats["chats"][self.chats["selected_chat"]]["messages"][id]['content'] += data['message']['content']
def toggle_ui_sensitive(self, status): def toggle_ui_sensitive(self, status):
for element in [self.chat_list_box, self.add_chat_button, self.chats_menu_button]: for element in [self.chat_list_box, self.add_chat_button]:
element.set_sensitive(status) element.set_sensitive(status)
def switch_send_stop_button(self): def switch_send_stop_button(self):
@ -1229,7 +1228,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
self.get_application().create_action('new_chat', lambda *_: self.new_chat(), ['<primary>n']) self.get_application().create_action('new_chat', lambda *_: self.new_chat(), ['<primary>n'])
self.get_application().create_action('clear', lambda *_: dialogs.clear_chat(self), ['<primary>e']) self.get_application().create_action('clear', lambda *_: dialogs.clear_chat(self), ['<primary>e'])
self.get_application().create_action('send', lambda *_: self.send_message(self), ['Return']) self.get_application().create_action('send', lambda *_: self.send_message(self), ['Return'])
self.get_application().create_action('import_chat', lambda *_: self.import_chat()) self.get_application().create_action('import_chat', lambda *_: self.import_chat(), ['<primary>i'])
self.get_application().create_action('create_model_from_existing', lambda *_: dialogs.create_model_from_existing(self)) self.get_application().create_action('create_model_from_existing', lambda *_: dialogs.create_model_from_existing(self))
self.get_application().create_action('create_model_from_file', lambda *_: dialogs.create_model_from_file(self)) self.get_application().create_action('create_model_from_file', lambda *_: dialogs.create_model_from_file(self))
self.get_application().create_action('delete_chat', self.chat_actions) self.get_application().create_action('delete_chat', self.chat_actions)

View File

@ -46,11 +46,11 @@
</object> </object>
</child> </child>
<child type="end"> <child type="end">
<object class="GtkMenuButton" id="chats_menu_button"> <object class="GtkMenuButton">
<property name="direction">1</property> <property name="primary">True</property>
<property name="halign">3</property> <property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">chats_menu</property> <property name="tooltip-text" translatable="yes">Menu</property>
<property name="icon-name">view-more-symbolic</property> <property name="menu-model">primary_menu</property>
</object> </object>
</child> </child>
</object> </object>
@ -114,12 +114,7 @@
</object> </object>
</property> </property>
<child type="end"> <child type="end">
<object class="GtkMenuButton">
<property name="primary">True</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="tooltip-text" translatable="yes">Menu</property>
<property name="menu-model">primary_menu</property>
</object>
</child> </child>
</object> </object>
</child> </child>
@ -856,6 +851,10 @@
</template> </template>
<menu id="primary_menu"> <menu id="primary_menu">
<section> <section>
<item>
<attribute name="label" translatable="yes">Import chat</attribute>
<attribute name="action">app.import_chat</attribute>
</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>
@ -874,14 +873,6 @@
</item> </item>
</section> </section>
</menu> </menu>
<menu id="chats_menu">
<section>
<item>
<attribute name="label" translatable="yes">Import chat</attribute>
<attribute name="action">app.import_chat</attribute>
</item>
</section>
</menu>
<menu id="right_click_menu"> <menu id="right_click_menu">
<section> <section>
<item> <item>
@ -953,6 +944,12 @@
<property name="title" translatable="yes">Close application</property> <property name="title" translatable="yes">Close application</property>
</object> </object>
</child> </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;ctrl&gt;I</property>
<property name="title" translatable="yes">Import chat</property>
</object>
</child>
<child> <child>
<object class="GtkShortcutsShortcut"> <object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;ctrl&gt;E</property> <property name="accelerator">&lt;ctrl&gt;E</property>