~fabrixxm/Collector

28987f9c5388cae92a20151838feaa9bb994c824 — fabrixxm 1 year, 8 months ago 2c8e6aa
Add shortcut for create new collection
3 files changed, 11 insertions(+), 5 deletions(-)

M TODO.txt
M src/shortcuts.ui
M src/window.py
M TODO.txt => TODO.txt +1 -1
@@ 21,7 21,7 @@ x Split open/recent window and collection window,
  allow more than one collection to be open at time
x search action (primary f) to focus searchentry
x close entry action (primary w) to get back to list page
- new collection action (primary n)
x new collection action (primary n)
- add a Gtk.EntryCompletion to the Gtk.SearchEntry to autocomplete field names
x add collection action "open in terminal"
- when saving an entry, there should be an option to copy files "linked" in a File field into the repo

M src/shortcuts.ui => src/shortcuts.ui +3 -3
@@ 10,15 10,15 @@
        <child>
          <object class="GtkShortcutsGroup">
            <property name="visible">True</property>
            <property name="title" translatable="yes">Collections</property>
            <property name="title" translatable="yes">Recent collections</property>

            <!--<child>
            <child>
              <object class="GtkShortcutsShortcut">
                <property name="visible">True</property>
                <property name="accelerator">&lt;primary&gt;N</property>
                <property name="title" translatable="yes">Create new collection</property>
              </object>
            </child>-->
            </child>
            <child>
              <object class="GtkShortcutsShortcut">
                <property name="visible">True</property>

M src/window.py => src/window.py +7 -1
@@ 70,18 70,22 @@ class OpenWindow(Gtk.ApplicationWindow):

        action = Gio.SimpleAction.new("back", None)
        action.connect("activate", self.on_back)
        action.props.enabled = True
        action.props.enabled = False
        self.add_action(action)

        action = Gio.SimpleAction.new("createcollection", None)
        action.connect("activate", self.on_create_collection)
        action.props.enabled = True
        self.add_action(action)

        action = Gio.SimpleAction.new("clonecollection", None)
        action.connect("activate", self.on_clone_collection)
        action.props.enabled = False
        self.add_action(action)

        application.set_accels_for_action("win.back", ["Escape",])
        application.set_accels_for_action("win.createcollection", ["<Primary>n",])

        self.stack = Gtk.Stack(transition_type=Gtk.StackTransitionType.CROSSFADE)
        self.stack.connect("notify::visible-child", self.on_page_changed)



@@ 120,9 124,11 @@ class OpenWindow(Gtk.ApplicationWindow):

    def on_back(self, action, params):
        self.stack.set_visible_child_name("recent")
        self.lookup_action("back").props.enabled = False

    def on_create_collection(self, action, params):
        self.stack.set_visible_child_name("create")
        self.lookup_action("back").props.enabled = True

    def on_clone_collection(self, action, params):
        ...