Ejemplo n.º 1
0
    def insert_child(self, keybind):
        """insert_child

        :param keybind:
        """
        (model, it) = self.view.get_selection().get_selected()
        parent = model.get_value(it, 5)
        self._insert_keybind(keybind, parent)

        accel_key, accel_mods = key_openbox2gtk(keybind.key)
        show_chroot = len(keybind.children) > 0 or not len(keybind.actions)
#         newit =
        self.model.append(it, (
            accel_key, accel_mods, keybind.key,
            keybind.chroot, show_chroot, keybind,
            self.get_action_desc(keybind)))

#         if newit:
#             for c in keybind.children:
#                 self.apply_keybind(c, newit)
#             self.view.get_selection().select_iter(newit)
        # it means that we have inserted first child here, change status
        if len(parent.children) == 1:
            self.actionlist.set_actions(None)

        p = model.get_path(it)
        self.changed_items_paths.append(p)
        if p in self.deleted_items_paths: self.deleted_items_paths.remove(p)
Ejemplo n.º 2
0
    def insert_child(self, keybind):
        """insert_child

        :param keybind:
        """
        (model, it) = self.view.get_selection().get_selected()
        parent = model.get_value(it, 5)
        self._insert_keybind(keybind, parent)

        accel_key, accel_mods = key_openbox2gtk(keybind.key)
        show_chroot = len(keybind.children) > 0 or not len(keybind.actions)
#         newit =
        self.model.append(it, (
            accel_key, accel_mods, keybind.key,
            keybind.chroot, show_chroot, keybind,
            self.get_action_desc(keybind)))

#         if newit:
#             for c in keybind.children:
#                 self.apply_keybind(c, newit)
#             self.view.get_selection().select_iter(newit)
        # it means that we have inserted first child here, change status
        if len(parent.children) == 1:
            self.actionlist.set_actions(None)

        p = model.get_path(it)
        self.changed_items_paths.append(p)
        if p in self.deleted_items_paths: self.deleted_items_paths.remove(p)
Ejemplo n.º 3
0
 def apply_cqk_initial_value(self):
     """apply_cqk_initial_value"""
     cqk_accel_key, cqk_accel_mods = key_openbox2gtk(
         self.keyboard.chain_quit_key)
     if cqk_accel_mods == 0:
         self.keyboard.chain_quit_key = ""
     self.cqk_model.append((
         cqk_accel_key, cqk_accel_mods,
         self.keyboard.chain_quit_key))
Ejemplo n.º 4
0
 def apply_cqk_initial_value(self):
     """apply_cqk_initial_value"""
     cqk_accel_key, cqk_accel_mods = key_openbox2gtk(
         self.keyboard.chain_quit_key)
     if cqk_accel_mods == 0:
         self.keyboard.chain_quit_key = ""
     self.cqk_model.append((
         cqk_accel_key, cqk_accel_mods,
         self.keyboard.chain_quit_key))
Ejemplo n.º 5
0
    def cqk_key_edited(self, cell, path, text):
        """cqk_key_edited

        :param cell:
        :param path:
        :param text:
        """
        self.cqk_model[path][0], self.cqk_model[path][1] \
            = key_openbox2gtk(text)
        self.cqk_model[path][2] = text
        self.keyboard.chain_quit_key = text
        self.view.grab_focus()
Ejemplo n.º 6
0
    def cqk_key_edited(self, cell, path, text):
        """cqk_key_edited

        :param cell:
        :param path:
        :param text:
        """
        self.cqk_model[path][0], self.cqk_model[path][1] \
            = key_openbox2gtk(text)
        self.cqk_model[path][2] = text
        self.keyboard.chain_quit_key = text
        self.view.grab_focus()
Ejemplo n.º 7
0
    def key_edited(self, cell, path, text):
        """key_edited

        :param cell:
        :param path:
        :param text:
        """
        self.model[path][0], self.model[path][1] = key_openbox2gtk(text)
        self.model[path][2] = text
        self.model[path][5].key = text

        p = self.model.get_path(self.model.get_iter_from_string(path))
        self.changed_items_paths.append(p)
        if p in self.deleted_items_paths: self.deleted_items_paths.remove(p)
Ejemplo n.º 8
0
    def key_edited(self, cell, path, text):
        """key_edited

        :param cell:
        :param path:
        :param text:
        """
        self.model[path][0], self.model[path][1] = key_openbox2gtk(text)
        self.model[path][2] = text
        self.model[path][5].key = text

        p = self.model.get_path(self.model.get_iter_from_string(path))
        self.changed_items_paths.append(p)
        if p in self.deleted_items_paths: self.deleted_items_paths.remove(p)
Ejemplo n.º 9
0
    def apply_keybind(self, kb, parent=None):
        """apply_keybind

        :param kb:
        :param parent:
        """
        accel_key, accel_mods = key_openbox2gtk(kb.key)
        chroot = kb.chroot
        show_chroot = len(kb.children) > 0 or not len(kb.actions)

        n = self.model.append(parent, (
            accel_key, accel_mods, kb.key,
            chroot, show_chroot, kb,
            self.get_action_desc(kb)))

        for c in kb.children:
            self.apply_keybind(c, n)
Ejemplo n.º 10
0
    def apply_keybind(self, kb, parent=None):
        """apply_keybind

        :param kb:
        :param parent:
        """
        accel_key, accel_mods = key_openbox2gtk(kb.key)
        chroot = kb.chroot
        show_chroot = len(kb.children) > 0 or not len(kb.actions)

        n = self.model.append(parent, (
            accel_key, accel_mods, kb.key,
            chroot, show_chroot, kb,
            self.get_action_desc(kb)))

        for c in kb.children:
            self.apply_keybind(c, n)
Ejemplo n.º 11
0
    def insert_sibling(self, keybind):
        """insert_sibling

        :param keybind:
        """
        (model, it) = self.view.get_selection().get_selected()

        accel_key, accel_mods = key_openbox2gtk(keybind.key)
        show_chroot = len(keybind.children) > 0 or not len(keybind.actions)

        if it:
            parent_it = model.iter_parent(it)
            parent = None
            if parent_it:
                parent = model.get_value(parent_it, 5)
            after = model.get_value(it, 5)

            self._insert_keybind(keybind, parent, after)
            newit = self.model.insert_after(
                parent_it, it, (
                    accel_key, accel_mods, keybind.key,
                    keybind.chroot, show_chroot,
                    keybind,
                    self.get_action_desc(keybind)))
        else:
            self._insert_keybind(keybind)
            newit = self.model.append(None, (
                accel_key, accel_mods, keybind.key,
                keybind.chroot, show_chroot,
                keybind,
                self.get_action_desc(keybind)))

        if newit:
            for c in keybind.children:
                self.apply_keybind(c, newit)
            self.view.get_selection().select_iter(newit)
            it=newit

        p = model.get_path(it)
        self.changed_items_paths.append(p)
        if p in self.deleted_items_paths: self.deleted_items_paths.remove(p)
Ejemplo n.º 12
0
    def insert_sibling(self, keybind):
        """insert_sibling

        :param keybind:
        """
        (model, it) = self.view.get_selection().get_selected()

        accel_key, accel_mods = key_openbox2gtk(keybind.key)
        show_chroot = len(keybind.children) > 0 or not len(keybind.actions)

        if it:
            parent_it = model.iter_parent(it)
            parent = None
            if parent_it:
                parent = model.get_value(parent_it, 5)
            after = model.get_value(it, 5)

            self._insert_keybind(keybind, parent, after)
            newit = self.model.insert_after(
                parent_it, it, (
                    accel_key, accel_mods, keybind.key,
                    keybind.chroot, show_chroot,
                    keybind,
                    self.get_action_desc(keybind)))
        else:
            self._insert_keybind(keybind)
            newit = self.model.append(None, (
                accel_key, accel_mods, keybind.key,
                keybind.chroot, show_chroot,
                keybind,
                self.get_action_desc(keybind)))

        if newit:
            for c in keybind.children:
                self.apply_keybind(c, newit)
            self.view.get_selection().select_iter(newit)
            it=newit

        p = model.get_path(it)
        self.changed_items_paths.append(p)
        if p in self.deleted_items_paths: self.deleted_items_paths.remove(p)