Пример #1
0
def save_style_ballot_images(ballots: list, style_num):
    for ballot in ballots:
        utils.sts(f"Saving images for ballot {ballot.ballotdict['ballot_id']}",
                  3)

        DB.save_data_list(data_list=ballot.ballotimgdict['images'],
                          dirname='styles',
                          name=ballot.ballotdict['ballot_id'],
                          format='.png',
                          subdir=style_num)
    def save_ballot_images(self):
        """Method to save ballot as an image (JPG) file.
            This saves them by precinct rather than by style.
        """

        DB.save_data_list(data_list=self.ballotimgdict['images'],
                          dirname='styles',
                          name=self.ballotdict['ballot_id'],
                          format='.png',
                          subdir=self.ballotdict['precinct'])