From b0d9ac29e7708a02b984a2f6918bc169371fbbde Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Thu, 3 Aug 2023 23:41:52 +0200 Subject: [PATCH] Adjust variable, layout, icon and alignment Signed-off-by: TheJackiMonster --- manuskript/ui/views/charactersView.py | 34 ++--- ui/characters.glade | 206 ++++++++++++++------------ 2 files changed, 125 insertions(+), 115 deletions(-) diff --git a/manuskript/ui/views/charactersView.py b/manuskript/ui/views/charactersView.py index d1b8e3b..6b93e5a 100644 --- a/manuskript/ui/views/charactersView.py +++ b/manuskript/ui/views/charactersView.py @@ -339,24 +339,24 @@ class CharactersView: container.remove(d) clear_container( self.charecterDetailsMenuAppendBox) clear_container(self.charecterDetailsMenuTemplateBox) - for x in self.characterTemplates.templates: - button = Gtk.Button(label=x,) # TODO: turn into ModelButton - button.connect("clicked", self._appendTemplateClicked, x) + for template_name in self.characterTemplates.templates: + button = Gtk.Button(label=template_name) # TODO: turn into ModelButton + button.connect("clicked", self._appendTemplateClicked, template_name) self.charecterDetailsMenuAppendBox.add(button) # Now we do the buttons for charecterDetailsMenuTemplateBox box = Gtk.Box() - label = Gtk.Label(label=x) + label = Gtk.Label(label=template_name) overwrite_button = Gtk.Button() - overwrite_button.add(Gtk.Image(icon_name='system-restart-symbolic')) - overwrite_button.connect("clicked", self._updateTemplateClicked, x) + overwrite_button.add(Gtk.Image(icon_name='emblem-synchronizing-symbolic')) + overwrite_button.connect("clicked", self._updateTemplateClicked, template_name) overwrite_button.set_tooltip_markup ('Overwrite template with text of current file') # TODO: This might be an issue when it comes to translating delete_button = Gtk.Button() - delete_button.add(Gtk.Image(icon_name='app-remove-symbolic')) + delete_button.add(Gtk.Image(icon_name='list-remove-symbolic')) delete_button.set_tooltip_markup ('Delete') # TODO: This might be an issue when it comes to translating - delete_button.connect("clicked", self._deleteTemplateClicked, x) - box.pack_start(overwrite_button, False, False, 0) - box.pack_start(delete_button, False, False, 0) - box.pack_start(label, False, False, 0) + delete_button.connect("clicked", self._deleteTemplateClicked, template_name) + box.pack_end(delete_button, False, False, 0) + box.pack_end(overwrite_button, False, False, 0) + box.pack_start(label, True, False, 0) self.charecterDetailsMenuTemplateBox.add(box) self.charecterDetailsMenuAppendBox.show_all() @@ -365,19 +365,19 @@ class CharactersView: def _onCharecterDetailsMenuClicked(self, button: Gtk.MenuButton): self._updateCharecterDetailsMenu() - def _updateTemplateClicked(self, button: Gtk.ModelButton, template): + def _updateTemplateClicked(self, button: Gtk.ModelButton, template_name): if self.character is None: return - self.characterTemplates.templates[template] = self.character.details # TODO: Add A warning? Or should there be undo/ redo when revisions are written. + self.characterTemplates.templates[template_name] = self.character.details # TODO: Add A warning? Or should there be undo/ redo when revisions are written. - def _deleteTemplateClicked(self, button: Gtk.ModelButton, template): - del self.characterTemplates.templates[template] + def _deleteTemplateClicked(self, button: Gtk.ModelButton, template_name): + del self.characterTemplates.templates[template_name] self._updateCharecterDetailsMenu() - def _appendTemplateClicked(self, button: Gtk.ModelButton, template): + def _appendTemplateClicked(self, button: Gtk.ModelButton, template_name): if self.character is None: return - self.character.details.update(self.characterTemplates.templates[template]) + self.character.details.update(self.characterTemplates.templates[template_name]) # We have to reload the character self.loadCharacterData(self.character) diff --git a/ui/characters.glade b/ui/characters.glade index a6cefe0..1b0333a 100644 --- a/ui/characters.glade +++ b/ui/characters.glade @@ -87,100 +87,9 @@ along with Manuskript. If not, see . - 200 + 350 + 250 False - - - True - False - vertical - - - True - True - True - Set info to template - main - True - - - False - True - 0 - - - - - True - True - True - in - - - True - False - - - True - False - none - False - - - - - - - True - True - 1 - - - - - True - False - - - True - True - new_template_entry_buffer - Enter a unique name - GTK_INPUT_HINT_NO_EMOJI | GTK_INPUT_HINT_NONE - - - False - True - 0 - - - - - New template - True - True - True - Adds a new template with the content of the current charecter's details. - - - False - True - 2 - - - - - False - True - 2 - - - - - edit_template - 1 - - True @@ -220,12 +129,8 @@ along with Manuskript. If not, see . main - 2 - - - True @@ -251,6 +156,7 @@ along with Manuskript. If not, see . True True True + 4 in @@ -276,7 +182,111 @@ along with Manuskript. If not, see . append_template - 4 + 1 + + + + + True + False + vertical + + + True + True + True + Set info to template + main + True + + + False + True + 0 + + + + + True + True + True + 4 + in + + + True + False + + + True + False + none + False + + + + + + + True + True + 1 + + + + + True + False + 4 + 4 + 4 + 4 + + + True + True + new_template_entry_buffer + Enter a unique name + GTK_INPUT_HINT_NO_EMOJI | GTK_INPUT_HINT_NONE + + + True + True + 0 + + + + + True + True + True + Adds a new template with the content of the current charecter's details. + + + True + False + list-add-symbolic + + + + + False + True + end + 2 + + + + + False + True + 2 + + + + + edit_template + 2