Made functions more readeable

This commit is contained in:
jeffser 2024-10-10 22:23:53 -06:00
parent 3156c70260
commit ef8ec59977
2 changed files with 28 additions and 4 deletions

View File

@ -179,7 +179,13 @@ class pulling_model(Gtk.ListBoxRow):
css_classes = ["error", "circular"],
tooltip_text = _("Stop Pulling '{}'").format(window.convert_model_name(model_name, 0))
)
stop_button.connect('clicked', lambda *i: dialog_widget.simple(_('Stop Download?'), _("Are you sure you want to stop pulling '{}'?").format(window.convert_model_name(self.get_name(), 0)), self.stop, _('Stop'), 'destructive'))
stop_button.connect('clicked', lambda *i: dialog_widget.simple(
_('Stop Download?'),
_("Are you sure you want to stop pulling '{}'?").format(window.convert_model_name(self.get_name(), 0)),
self.stop,
_('Stop'),
'destructive'
))
container_box = Gtk.Box(
hexpand=True,
@ -277,7 +283,13 @@ class local_model(Gtk.ListBoxRow):
tooltip_text = _("Remove '{}'").format(window.convert_model_name(model_name, 0))
)
delete_button.connect('clicked', lambda *i: dialog_widget.simple(_('Delete Model?'), _("Are you sure you want to delete '{}'?").format(model_title), lambda model_name=model_name: window.model_manager.remove_local_model(model_name), _('Delete'), 'destructive'))
delete_button.connect('clicked', lambda *i: dialog_widget.simple(
_('Delete Model?'),
_("Are you sure you want to delete '{}'?").format(model_title),
lambda model_name=model_name: window.model_manager.remove_local_model(model_name),
_('Delete'),
'destructive'
))
container_box = Gtk.Box(
hexpand=True,

View File

@ -774,11 +774,23 @@ Generate a title following these rules:
chat_name = chat_row.label.get_label()
action_name = action.get_name()
if action_name in ('delete_chat', 'delete_current_chat'):
dialog_widget.simple(_('Delete Chat?'), _("Are you sure you want to delete '{}'?").format(chat_name), lambda chat_name=chat_name, *_: self.chat_list_box.delete_chat(chat_name), _('Delete'), 'destructive')
dialog_widget.simple(
_('Delete Chat?'),
_("Are you sure you want to delete '{}'?").format(chat_name),
lambda chat_name=chat_name, *_: self.chat_list_box.delete_chat(chat_name),
_('Delete'),
'destructive'
)
elif action_name in ('duplicate_chat', 'duplicate_current_chat'):
self.chat_list_box.duplicate_chat(chat_name)
elif action_name in ('rename_chat', 'rename_current_chat'):
dialog_widget.simple_entry(_('Rename Chat?'), _("Renaming '{}'").format(chat_name), lambda new_chat_name, old_chat_name=chat_name, *_: self.chat_list_box.rename_chat(old_chat_name, new_chat_name), {'placeholder': _('Chat name')}, _('Rename'))
dialog_widget.simple_entry(
_('Rename Chat?'),
_("Renaming '{}'").format(chat_name),
lambda new_chat_name, old_chat_name=chat_name, *_: self.chat_list_box.rename_chat(old_chat_name, new_chat_name),
{'placeholder': _('Chat name')},
_('Rename')
)
elif action_name in ('export_chat', 'export_current_chat'):
self.chat_list_box.export_chat(chat_name)