Example #1
0
 def remove_channel(self, items):
     for item in items:
         removed_item = self.channelListWidget.takeItem(
             self.channelListWidget.row(item))
         self.configuration.value["watched_channels"].remove(
             removed_item.text())
         self.configuration.flush_config_to_file()
         self.append_log(
             log.format_info(removed_item.text() + " channel removed"))
         # Reset watchdog patterns?
         self.eveloghandler_worker.set_patterns()
Example #2
0
 def add_channel(self):
     is_dupe = False
     if self.lineEditChannelAdd.text() != "":
         for i in range(self.channelListWidget.count()):
             if self.channelListWidget.item(
                     i).text() == self.lineEditChannelAdd.text():
                 is_dupe = True
         if not is_dupe:
             self.configuration.value["watched_channels"].append(
                 self.lineEditChannelAdd.text())
             self.channelListWidget.addItem(self.lineEditChannelAdd.text())
             self.configuration.flush_config_to_file()
             self.append_log(
                 log.format_info(self.lineEditChannelAdd.text() +
                                 " channel added"))
         self.lineEditChannelAdd.clear()
         # Reset watchdog patterns?
         self.eveloghandler_worker.set_patterns()
Example #3
0
    def choose_alarm_location(self):
        self.alarm_location = QFileDialog.getOpenFileName(
            self,
            "Choose sound file",
            "intelpy/resources",
            "Sounds (*.mp3 *.wav)",
            options=QFileDialog.DontUseNativeDialog)

        if self.alarm_location[0]:
            this_alarm_location = QDir.toNativeSeparators(
                self.alarm_location[0])
            self.lineEdit_alarm.setText(this_alarm_location)
            self.configuration.value["alarm_sound"] = this_alarm_location
            self.configuration.flush_config_to_file()
            self.append_log(
                log.format_info("Alarm set to: " +
                                self.configuration.value["alarm_sound"]))
            if self.configuration.value["debug"] and self.logger:
                self.logger.write_log("Alarm set to: " +
                                      self.configuration.value["alarm_sound"])
Example #4
0
    def choose_log_location(self):
        self.log_location = QFileDialog.getExistingDirectory(
            self,
            "Choose Eve Log Files Directory",
            str(Path.home()),
            options=QFileDialog.DontUseNativeDialog | QFileDialog.ShowDirsOnly)

        if len(self.log_location) > 0:
            self.log_location = QDir.toNativeSeparators(self.log_location)
            self.lineEditEve_Log_Location.setText(self.log_location)
            self.configuration.value["eve_log_location"] = self.log_location
            self.configuration.flush_config_to_file()
            self.append_log(
                log.format_info("Log directory set to: " +
                                self.configuration.value["eve_log_location"]))
            self.restart_watchdog()
            if self.configuration.value["debug"] and self.logger:
                self.logger.write_log(
                    "Log directory set to: " +
                    self.configuration.value["eve_log_location"])
Example #5
0
    def message_ready_process(self, message_list):
        #here we can check alerts, update UI etc
        # message_list =  dts, nick, message
        this_message = message_list[2]
        this_message = this_message.upper()

        # check for clear
        if self.configuration.value["filter_clear"]:
            if "CLEAR" in this_message or "CLR" in this_message:
                if self.configuration.value["display_clear"]:
                    self.append_log(
                        log.format_info("Clear message received: " +
                                        message_list[2]))
                return

        if self.configuration.value["filter_status"]:
            if "STATUS" in this_message:
                self.append_log(
                    log.format_info("Status? message received: " +
                                    message_list[2]))
                return

        # check if message contains a system within jump range
        for system in self.alert_system_names_readable:
            if system in this_message:
                # display alert msg
                self.append_log(
                    log.format_alert(
                        "Bad guy reported within " +
                        str(self.configuration.value["alert_jumps"]) +
                        " jumps!"))
                # check if details need to be printed
                if self.configuration.value["display_alerts"]:
                    self.append_log(
                        log.format_important(
                            "<font color=\"red\">Time: </font>" +
                            str(message_list[0])))
                    self.append_log(
                        log.format_important(
                            "<font color=\"red\">System: </font>" + system))
                    self.append_log(
                        log.format_important(
                            "<font color=\"red\">Reported by: </font>" +
                            message_list[1]))
                    self.append_log(
                        log.format_important(
                            "<font color=\"red\">Message: </font>" +
                            message_list[2]))

                # play alert (blocking on Linux so threading it)
                alert_worker = playalertworker.PlayAlert_worker(
                    self.configuration, self.logger)
                alert_worker.start()  # chucking away once done

                # get id codes
                system_id = self.eve_data.get_id_code(system)
                home_id = self.eve_data.get_id_code(
                    self.lineEditHome_System.text())
                short_path = self.eve_data.shortest_path_length(
                    home_id, system_id)
                # secs, reported system, jumps, msg
                self.alert_recent_add(0, system, str(short_path),
                                      message_list[2])

                if self.configuration.value["debug"] and self.logger:
                    self.logger.write_log(
                        "Alert sound + message was triggered")
                return

        # Display all?
        if self.configuration.value["display_all"]:
            self.append_log("<b> > </b> " +
                            log.format_info(str(message_list[0])))
            self.append_log(log.format_info(message_list[2]))
Example #6
0
    def checkbox_changed(self, state, which_button):
        alert_on = "set to <font color=\"green\">ON</font>"
        alert_off = "set to <font color=\"red\">OFF</font>"
        ignore_on = "set to <font color=\"red\">IGNORE</font>"
        ignore_off = "set to <font color=\"green\">NOT IGNORE</font>"

        if self.configuration.value["debug"] and self.logger:
            self.logger.write_log("Config checkbox was changed")

        if which_button == "dark_theme":
            if state.isChecked():
                self.set_config_state("dark_theme", 1)
                self.append_log(
                    log.format_info("Dark mode set to " + alert_on +
                                    ". Please restart IntelPy to enable."))
            else:
                self.set_config_state("dark_theme", 0)
                self.append_log(
                    log.format_info("Dark mode set to " + alert_off +
                                    ". Please restart IntelPy to disable."))
        if which_button == "display_alerts":
            if state.isChecked():
                self.set_config_state("display_alerts", 1)
                self.append_log(
                    log.format_info("Display alert details set to " +
                                    alert_on))
            else:
                self.set_config_state("display_alerts", 0)
                self.append_log(
                    log.format_info("Display alert details set to " +
                                    alert_off))
        if which_button == "display_clear":
            if state.isChecked():
                self.set_config_state("display_clear", 1)
                self.append_log(
                    log.format_info("Display clear set to " + alert_on))
            else:
                self.set_config_state("display_clear", 0)
                self.append_log(
                    log.format_info("Display clear set to " + alert_off))
        if which_button == "display_all":
            if state.isChecked():
                self.set_config_state("display_all", 1)
                self.append_log(
                    log.format_info("Display all set to " + alert_on))
            else:
                self.set_config_state("display_all", 0)
                self.append_log(
                    log.format_info("Display all set to " + alert_off))
        if which_button == "filter_clear":
            if state.isChecked():
                self.set_config_state("filter_clear", 1)
                self.append_log(
                    log.format_info("Clear messages set to " + ignore_on))
            else:
                self.set_config_state("filter_clear", 0)
                self.append_log(
                    log.format_info("Clear messages set to " + ignore_off))
        if which_button == "filter_status":
            if state.isChecked():
                self.set_config_state("filter_status", 1)
                self.append_log(
                    log.format_info("Status messages set to " + ignore_on))
            else:
                self.set_config_state("filter_status", 0)
                self.append_log(
                    log.format_info("Status messages set to " + ignore_off))