Exemplo n.º 1
0
    def on_remove_thing_i_like(self, widget):
        thing = self.til_popup_menu.get_user()

        if thing not in self.np.config.sections["interests"]["likes"]:
            return

        self.likes_model.remove(self.likes[thing])
        del self.likes[thing]
        self.np.config.sections["interests"]["likes"].remove(thing)

        self.np.config.write_configuration()
        self.np.queue.put(slskmessages.RemoveThingILike(thing))
Exemplo n.º 2
0
    def remove_thing_i_like(self, item):

        if not item and not isinstance(item, str):
            return False

        if item not in self.config.sections["interests"]["likes"]:
            return False

        self.config.sections["interests"]["likes"].remove(item)
        self.config.write_configuration()
        self.queue.append(slskmessages.RemoveThingILike(item))
        return True
Exemplo n.º 3
0
    def on_like_recommendation(self, widget):
        thing = widget.get_parent().get_user()

        if widget.get_active() and thing not in self.np.config.sections["interests"]["likes"]:
            self.np.config.sections["interests"]["likes"].append(thing)
            self.likes[thing] = self.likes_model.append([thing])

            self.np.config.write_configuration()
            self.np.queue.put(slskmessages.AddThingILike(thing))

        elif not widget.get_active() and thing in self.np.config.sections["interests"]["likes"]:
            self.likes_model.remove(self.likes[thing])
            del self.likes[thing]
            self.np.config.sections["interests"]["likes"].remove(thing)

            self.np.config.write_configuration()
            self.np.queue.put(slskmessages.RemoveThingILike(thing))
Exemplo n.º 4
0
    def on_like_recommendation(self, action, state, thing=None):

        if thing is None:
            thing = self.r_popup_menu.get_user()

        if state.get_boolean() and \
                thing and thing not in config.sections["interests"]["likes"]:
            config.sections["interests"]["likes"].append(thing)
            self.likes[thing] = self.likes_model.insert_with_valuesv(
                -1, self.likes_column_numbers, [thing])

            config.write_configuration()
            self.np.queue.append(slskmessages.AddThingILike(thing))

        elif not state and \
                thing and thing in config.sections["interests"]["likes"]:
            self.likes_model.remove(self.likes[thing])
            del self.likes[thing]
            config.sections["interests"]["likes"].remove(thing)

            config.write_configuration()
            self.np.queue.append(slskmessages.RemoveThingILike(thing))

        action.set_state(state)