How to use eldonationtracker - 10 common examples

To help you get started, we’ve selected a few eldonationtracker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github djotaku / ELDonationTracker / eldonationtracker / call_tracker.py View on Github external
def set_font_color(self, font_color):
        self.ui.Donation_label.setTextColor(font_color)

    def set_background_color(self, color):
        self.ui.graphicsView.setBackgroundBrush(color)


def main(participant_conf):
    """Launch the window."""
    window = MyForm(participant_conf)
    window.exec()

if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = MyForm()
    w.show()
    sys.exit(app.exec_())
github djotaku / ELDonationTracker / eldonationtracker / participant.py View on Github external
def _get_participant_info(self):
        """Get JSON data for participant information.

        :returns: JSON data for self.total_raised, self.number_of_donations, and self.goal.
        """
        participant_json = extralife_io.get_json(self.participant_url)
        if not participant_json:
            print("[bold red]Couldn't access participant JSON.[/bold red]")
            return self.total_raised, self.number_of_donations, self.goal
        else:
            return participant_json['sumDonations'], participant_json['numDonations'],\
                   participant_json['fundraisingGoal']
github djotaku / ELDonationTracker / eldonationtracker / participant.py View on Github external
self.output_donation_data()
            self.update_donor_data()
            self.output_donor_data()
        # TEAM BLOCK ############################################
        if self.team_id:
            self.my_team.team_run()
        ##########################################################
        self.first_run = False
        print(time.strftime("%H:%M:%S"))

    def __str__(self):
        return f"A participant with Extra Life ID {self.extralife_id}. Team info: {self.my_team}"


if __name__ == "__main__":  # pragma: no cover
    participant_conf = extralife_io.ParticipantConf()
    p = Participant(participant_conf)
    while True:
        p.run()
        time.sleep(15)
github djotaku / ELDonationTracker / eldonationtracker / participant.py View on Github external
def _format_donor_information_for_output(self) -> None:
        """Format the donor attributes for the output files."""
        self.donor_formatted_output['TopDonorNameAmnt'] = extralife_io.single_format(self.top_donor, False,
                                                                                     self.currency_symbol)
github djotaku / ELDonationTracker / eldonationtracker / call_settings.py View on Github external
def _validate_id(self, id_type: str):
        print("[bold blue]Validating URL[/bold blue]")
        if id_type == "participant":
            url = f"{base_api_url}/participants/{self.ui.lineEditParticipantID.text()}"
            valid_url = extralife_io.validate_url(url)
            if valid_url:
                message_box = QMessageBox.information(self, "Participant ID Validation",
                                                      f"Able to reach {url}. Participant ID is valid.")
            else:
                message_box = QMessageBox.warning(self, "Participant ID Validation",
                                                  f"Could not reach {url}. Participant ID may be invalid.")
        elif id_type == "team":
            url = f"{base_api_url}/teams/{self.ui.lineEditTeamID.text()}"
            valid_url = extralife_io.validate_url(url)
            if valid_url:
                message_box = QMessageBox.information(self, "Team ID Validation",
                                                      f"Able to reach {url}. Team ID is valid.")
            else:
                message_box = QMessageBox.warning(self, "Team ID Validation",
                                                  f"Could not reach {url}. Team ID may be invalid.")
github djotaku / ELDonationTracker / eldonationtracker / gui.py View on Github external
def __init__(self):
        """Setup the GUI.

        Set up QTimers:
         1) to allow the text on the GUI to update without blocking the user from interacting with the GUI.
         2) to run the participant.py updates

        Then we instantiate the other windows:
        tracker and settings

        Finally, connect the buttons.
        """
        super(self.__class__, self).__init__()

        self.participant_conf = extralife_io.ParticipantConf()

        # deal with version mismatch
        self.version_mismatch = self.participant_conf.get_version_mismatch()
        self.version_check()

        self.setupUi(self)

        # timer to update the main text
        self.timer = QtCore.QTimer(self)
        self.timer.setSingleShot(False)
        self.timer.setInterval(15000)  # milliseconds
        self.timer.timeout.connect(self.get_some_text)
        self.timer.start()

        # setup the participant
        self.my_participant = participant.Participant(self.participant_conf)
github djotaku / ELDonationTracker / eldonationtracker / participant.py View on Github external
def write_text_files(self, dictionary: dict) -> None:  # pragma: no cover
        """Write OBS/XSplit display info to text files.

        It uses the helper function extralife_IO.write_text_files to handle the task.

        :param dictionary: Dictionary containing values to write to text files\
        . The key will become the filename. The value will be written to the\
        file.
        :type dictionary: dict
        """
        extralife_io.write_text_files(dictionary, self.text_folder)
github djotaku / ELDonationTracker / eldonationtracker / team.py View on Github external
def get_team_json(self):
        """Get team info from JSON api."""
        self.team_json = extralife_IO.get_JSON(self.team_url)
        if self.team_json == 0:
            print("Could not get team JSON")
        else:
            self.team_goal = self.team_json["fundraisingGoal"]
            self.team_captain = self.team_json["captainDisplayName"]
            self.total_raised = self.team_json["sumDonations"]
            self.num_donations = self.team_json["numDonations"]
            # dictionary
            self.team_info["Team_goal"] = f"{self.currency_symbol}{self.team_goal:,.2f}"
            self.team_info["Team_captain"] = f"{self.team_captain}"
            self.team_info["Team_totalRaised"] = f"{self.currency_symbol}{self.total_raised:,.2f}"
            self.team_info["Team_numDonations"] = f"{self.num_donations}"
github djotaku / ELDonationTracker / eldonationtracker / team.py View on Github external
def get_participants(self):
        """Get team participant info from API."""
        self.participant_list = []
        self.team_participant_json = extralife_IO.get_JSON(self.team_participant_url)
        if self.team_participant_json == 0:
            print("couldn't get to URL")
        elif len(self.team_participant_json) == 0:
            print("No team participants!")
        else:
            self.participant_list = [TeamParticipant(self.team_participant_json[participant]) for participant in range(0, len(self.team_participant_json))]
github djotaku / ELDonationTracker / eldonationtracker / team.py View on Github external
def get_top_5_participants(self):
        """Get team participants."""
        self.top5_team_participant_json = extralife_IO.get_JSON(self.team_participant_url, True)
        if self.top5_team_participant_json == 0:
            print("Couldn't get top 5 team participants")
        elif len(self.top5_team_participant_json) == 0:
            print("No team participants!")
        else:
            self.top_5_participant_list = [TeamParticipant(self.top5_team_participant_json[participant]) for participant in range(0, len(self.top5_team_participant_json))]