Пример #1
0
 def setUp(self):
     set_app_context(ApplicationContext())
     self.osu_path = asset_path_builder(Path("mock_osu_folder"))
     self.beatmap_folder = self.osu_path / Path("Songs/1")
     self.beatmap = Beatmap("Artist", "Title", "Creator", "Diff", "audio.mp3", "1")
     beep = self.beatmap_folder / Path("beep.mp3")
     shutil.copy(beep, self.beatmap_folder / Path("audio.mp3"))
Пример #2
0
def main():
    appctxt = ApplicationContext()
    set_app_context(appctxt)

    osu_path = get_osu_path()
    osu_db_file_path = osu_path is not None and (osu_path /
                                                 Path("osu!.db")) or None

    if osu_path is None or \
        not osu_db_file_path.exists():
        QtWidgets.QMessageBox.warning(
            None, "NC2DT", ("Couldn't find your osu! installation.\n"
                            "Please select the folder where it's installed."))
        new_path = QtWidgets.QFileDialog.getExistingDirectory(
            None, "Please select your osu! installation")
        if new_path == "":
            QtWidgets.QMessageBox.critical(None, "NC2DT",
                                           "No folder was selected, exiting.")
            sys.exit(1)

        set_osu_path(new_path)
        osu_db_file_path = Path(new_path) / Path("osu!.db")

    try:
        osu_db = OsuDB(osu_db_file_path)
    except FileNotFoundError:
        QtWidgets.QMessageBox.critical(None, "NC2DT",
                                       "Couldn't open osu!.db. Exiting.")
        sys.exit(1)

    main_window = MainWindow(osu_db)
    main_window.show()
    sys.exit(appctxt.app.exec())
Пример #3
0
 def tearDown(self):
     set_app_context(None)
     for f in self.beatmap_folder.glob("*"):
         if f.name != "beep.mp3":
             os.remove(str(f))
Пример #4
0
 def tearDown(self):
     set_app_context(None)
Пример #5
0
 def setUp(self):
     set_app_context(ApplicationContext())