UI changes, added save_as

This commit is contained in:
itdominator 2022-02-04 18:14:11 -06:00
parent 67c13d264a
commit f77becc21c
2 changed files with 78 additions and 43 deletions

View File

@ -78,9 +78,14 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
save_load_dialog = self.builder.get_object("save_load_dialog") save_load_dialog = self.builder.get_object("save_load_dialog")
if action == "save_session": if action == "save_session":
self.window_controller.save_state()
return
elif action == "save_session_as":
save_load_dialog.set_action(Gtk.FileChooserAction.SAVE) save_load_dialog.set_action(Gtk.FileChooserAction.SAVE)
elif action == "load_session": elif action == "load_session":
save_load_dialog.set_action(Gtk.FileChooserAction.OPEN) save_load_dialog.set_action(Gtk.FileChooserAction.OPEN)
else:
raise Exception(f"Unknown action given: {action}")
save_load_dialog.set_current_folder(view.get_current_directory()) save_load_dialog.set_current_folder(view.get_current_directory())
save_load_dialog.set_current_name("session.json") save_load_dialog.set_current_name("session.json")
@ -154,7 +159,7 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
if action == "create": if action == "create":
self.create_files() self.create_files()
if action in ["save_session", "load_session"]: if action in ["save_session", "save_session_as", "load_session"]:
self.save_load_session(action) self.save_load_session(action)
self.ctrlDown = False self.ctrlDown = False

View File

@ -1139,6 +1139,11 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="stock">gtk-justify-center</property> <property name="stock">gtk-justify-center</property>
</object> </object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-save</property>
</object>
<object class="GtkTextBuffer" id="message_buffer"/> <object class="GtkTextBuffer" id="message_buffer"/>
<object class="GtkImage" id="open_with_img"> <object class="GtkImage" id="open_with_img">
<property name="visible">True</property> <property name="visible">True</property>
@ -1455,27 +1460,52 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
</object> </object>
</child> </child>
<child> <child>
<object class="GtkImageMenuItem"> <object class="GtkMenuItem">
<property name="label">Save Session</property>
<property name="name">save_session</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">New File/Folder...</property> <property name="label" translatable="yes">Session</property>
<property name="image">image1</property> <child type="submenu">
<property name="use-stock">False</property> <object class="GtkMenu">
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> <property name="visible">True</property>
</object> <property name="can-focus">False</property>
</child> <child>
<child> <object class="GtkImageMenuItem">
<object class="GtkImageMenuItem"> <property name="label">Save Session</property>
<property name="label">Load Session</property> <property name="name">save_session</property>
<property name="name">load_session</property> <property name="visible">True</property>
<property name="visible">True</property> <property name="can-focus">False</property>
<property name="can-focus">False</property> <property name="tooltip-text" translatable="yes">New File/Folder...</property>
<property name="tooltip-text" translatable="yes">New File/Folder...</property> <property name="image">image4</property>
<property name="image">image2</property> <property name="use-stock">False</property>
<property name="use-stock">False</property> <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> </object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">Save Session As</property>
<property name="name">save_session_as</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">New File/Folder...</property>
<property name="image">image1</property>
<property name="use-stock">False</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">Load Session</property>
<property name="name">load_session</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">New File/Folder...</property>
<property name="image">image2</property>
<property name="use-stock">False</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
</child>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
@ -2458,25 +2488,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="position">8</property> <property name="position">8</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton">
<property name="label">gtk-delete</property>
<property name="name">delete</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Delete...</property>
<property name="margin-top">20</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">9</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="restore_from_trash"> <object class="GtkButton" id="restore_from_trash">
<property name="label" translatable="yes">Restore From Trash</property> <property name="label" translatable="yes">Restore From Trash</property>
@ -2491,7 +2502,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">10</property> <property name="position">9</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2502,13 +2513,12 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Empty Trash...</property> <property name="tooltip-text" translatable="yes">Empty Trash...</property>
<property name="margin-bottom">20</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">11</property> <property name="position">10</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2519,6 +2529,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Move to Trash...</property> <property name="tooltip-text" translatable="yes">Move to Trash...</property>
<property name="margin-top">20</property>
<property name="image">trash_img</property> <property name="image">trash_img</property>
<property name="always-show-image">True</property> <property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
@ -2526,7 +2537,7 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">12</property> <property name="position">11</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2541,6 +2552,25 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="always-show-image">True</property> <property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/> <signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">12</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-delete</property>
<property name="name">delete</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Delete...</property>
<property name="margin-top">20</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>