Exemplo n.º 1
0
    def server_login(self):

        for thing in self.config.sections["interests"]["likes"]:
            if thing and isinstance(thing, str):
                self.queue.append(slskmessages.AddThingILike(thing))

        for thing in self.config.sections["interests"]["dislikes"]:
            if thing and isinstance(thing, str):
                self.queue.append(slskmessages.AddThingIHate(thing))
Exemplo n.º 2
0
    def on_add_thing_i_dislike(self, widget, *args):
        thing = widget.get_text()
        widget.set_text("")

        if thing and thing.lower() not in self.np.config.sections["interests"]["dislikes"]:
            thing = thing.lower()
            self.np.config.sections["interests"]["dislikes"].append(thing)
            self.dislikes[thing] = self.dislikes_model.append([thing])
            self.np.config.write_configuration()
            self.np.queue.put(slskmessages.AddThingIHate(thing))
Exemplo n.º 3
0
    def on_add_thing_i_dislike(self, widget, *args):

        thing = widget.get_text()
        widget.set_text("")

        if thing and thing.lower(
        ) not in config.sections["interests"]["dislikes"]:
            thing = thing.lower()
            config.sections["interests"]["dislikes"].append(thing)
            self.dislikes[thing] = self.dislikes_model.insert_with_valuesv(
                -1, self.dislikes_column_numbers, [thing])
            config.write_configuration()
            self.np.queue.append(slskmessages.AddThingIHate(thing))
Exemplo n.º 4
0
    def add_thing_i_hate(self, item):

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

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

        self.config.sections["interests"]["dislikes"].append(item)
        self.config.write_configuration()

        self.queue.append(slskmessages.AddThingIHate(item))
        return True
Exemplo n.º 5
0
    def on_dislike_recommendation(self, widget):
        thing = widget.get_parent().get_user()

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

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

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

            self.np.config.write_configuration()
            self.np.queue.put(slskmessages.RemoveThingIHate(thing))
Exemplo n.º 6
0
    def on_dislike_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"]["dislikes"]:
            config.sections["interests"]["dislikes"].append(thing)
            self.dislikes[thing] = self.dislikes_model.insert_with_valuesv(
                -1, self.dislikes_column_numbers, [thing])

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

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

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

        action.set_state(state)