コード例 #1
0
ファイル: qt.py プロジェクト: japareaggae/smtracker
    def export_html(self):
        """Saves an HTML report using QFileDialog to set a location."""
        filetuple = QFileDialog.getSaveFileName(self, "Save HTML report as",
                                                None, "HTML file (*.html)")

        if filetuple[0]:
            if filetuple[0].endswith(".html"):
                filename = filetuple[0]
            else:
                filename = filetuple[0] + ".html"

            html.save(self.stats, self.mode, self.difficulties, self.theme,
                      filename)
コード例 #2
0
ファイル: smtracker.py プロジェクト: japareaggae/smtracker
def main():
    """Runs smtracker."""
    parser = get_argparser()
    args = parser.parse_args()
    statsxml = args.file
    gamemode = args.mode
    output_type = args.output
    theme = args.theme
    dest = args.dest

    # Parse the statsxml file and return a tree for the outputs
    if statsxml is not None:
        stats = etree.parse(statsxml).getroot()

        # Check if this is a valid Stats.xml file before doing anything
        if stats.find("SongScores") is None:
            print("Error: The specified file is not a valid StepMania Stats.xml file")
            exit(1)

    else:
        stats = None

    # Remove ignored difficulties from difficulties array
    if args.ignore:
        for diff in args.ignore:
            try:
                DIFFICULTIES.remove(diff)
            except ValueError:
                print("Warning: {} is not a valid difficulty".format(args.ignore))


    if output_type == "plain":
        plain.report(stats, gamemode, DIFFICULTIES, theme)
    elif output_type == "qt":
        qt.run(stats, gamemode, DIFFICULTIES, theme)
    elif output_type == "html":
        html.save(stats, gamemode, DIFFICULTIES, theme, dest)