diff --git a/CustomPP.py b/CustomPP.py index fe38b2b..a1fd075 100644 --- a/CustomPP.py +++ b/CustomPP.py @@ -7,6 +7,8 @@ from PyQt5.QtGui import QPixmap from osr2mp4.ImageProcess.Objects.Scores.PPCounter import PPCounter from osr2mp4.ImageProcess.Objects.Scores.HitresultCounter import HitresultCounter +from osr2mp4.ImageProcess.Objects.Scores.URCounter import URCounter +from osr2mp4.ImageProcess.Objects.Scores.StrainGraph import StrainGraph from osr2mp4.Utils.Resolution import get_screensize from osr2mp4.global_var import Settings from PyQt5.QtWidgets import QLabel, QMainWindow, QApplication @@ -43,12 +45,23 @@ def __init__(self, width, ppsettings): self.hitresultcounter = HitresultCounter(settings) self.hitresultcounter.set({100: 17, 50: 70, 0: 13}) + + settings.settings['Enable Strain Graph'] = True + self.urcounter = URCounter(settings) + self.urcounter.ur = 420.69 + + self.straingraph = StrainGraph(settings, 0, 1000) + self.straingraph.set_strain_graph(os.path.join(abspath, 'res/StrainExample.png')) self.settings = settings def draw(self): background = self.background.copy() - self.ppcounter.add_to_frame(background) - self.hitresultcounter.add_to_frame(background) + for drawable in [self.ppcounter, self.hitresultcounter, self.urcounter]: + drawable.add_to_frame(background) + + """ #IMNOTLIKEOTHERFUNCTIONS """ + self.straingraph.add_to_frame(background, 500) + background.save(self.outputpath) diff --git a/PPComponents/Menu.py b/PPComponents/Menu.py index 8707a01..72e04b7 100644 --- a/PPComponents/Menu.py +++ b/PPComponents/Menu.py @@ -31,10 +31,12 @@ def save(self): ppsettings = copy(current_ppsettings) ppsettings["Rgb"] = eval(str(ppsettings["Rgb"])) ppsettings["Hitresult Rgb"] = eval(str(ppsettings["Hitresult Rgb"])) - self.parent.ppsample.ppcounter.loadsettings(ppsettings) - self.parent.ppsample.ppcounter.loadimg() - self.parent.ppsample.hitresultcounter.loadsettings(ppsettings) - self.parent.ppsample.hitresultcounter.loadimg() + + for drawable in [self.parent.ppsample.ppcounter, self.parent.ppsample.hitresultcounter, self.parent.ppsample.urcounter, self.parent.ppsample.straingraph]: + drawable.loadsettings(ppsettings) + drawable.loadimg() + + self.parent.updatepp() except Exception as e: print(repr(e)) @@ -53,10 +55,11 @@ def reset(self): ppsettings = defaultppconfig for k in ppsettings.keys(): current_ppsettings[k] = ppsettings[k] - self.parent.ppsample.ppcounter.loadsettings(current_ppsettings) - self.parent.ppsample.ppcounter.loadimg() - self.parent.ppsample.hitresultcounter.loadsettings(current_ppsettings) - self.parent.ppsample.hitresultcounter.loadimg() + + for drawable in [self.parent.ppsample.ppcounter, self.parent.ppsample.hitresultcounter, self.parent.ppsample.urcounter, self.parent.ppsample.straingraph]: + drawable.loadsettings(ppsettings) + drawable.loadimg() + self.parent.pplayout.updatevalue() self.parent.updatepp() with open(pppath, 'w+') as f: diff --git a/helper/datahelper.py b/helper/datahelper.py index 86c2b35..a65fefe 100644 --- a/helper/datahelper.py +++ b/helper/datahelper.py @@ -86,6 +86,7 @@ def loadsettings(config, settings, ppsettings): else: config["Output path"] = os.path.dirname(outputpath) + # not sure why this is a thing but oka ppsettings["Rgb"] = eval(str(ppsettings["Rgb"])) ppsettings["Hitresult Rgb"] = eval(str(ppsettings["Hitresult Rgb"])) diff --git a/options_config.json b/options_config.json index f7ee7f7..2b94b68 100644 --- a/options_config.json +++ b/options_config.json @@ -10,7 +10,8 @@ "Height": {"type": "SmallTextBox", "Column": 1}, "FPS": {"type": "SmallTextBox", "Column": 1}, "Video codec": {"type": "SmallTextBox", "Column": 1}, - "Audio codec": {"type": "SmallTextBox"} + "Audio codec": {"type": "SmallTextBox"}, + "ffmpeg path": {"type": "PathBox", "filetype": "Folder"} }, "Visual options": { @@ -18,6 +19,7 @@ "In-game interface": {"type": "CheckBox"}, "Show scoreboard": {"type": "CheckBox"}, "Background dim": {"type": "Slider", "min": 0, "max": 100, "step": 1}, + "Background blur": {"type": "Slider", "min": 0, "max": 10, "step": 1}, "Always show key overlay": {"type": "CheckBox"}, "Automatic cursor size": {"type": "CheckBox"}, "Score meter size": {"type": "Slider", "min": 0.5, "max": 5, "step": 0.1}, @@ -43,6 +45,13 @@ "Slider quality": {"type": "SmallTextBox"} }, + "Experimental options": { + "Resample": {"type": "CheckBox"}, + "Blend frames": {"type": "SmallTextBox", "Column": 1}, + "Show background video": {"type": "CheckBox"}, + "Enable Strain Graph": {"type": "CheckBox"} + }, + "Advanced render options": { "Use FFmpeg video writer": {"type": "CheckBox"}, "FFmpeg codec": {"type": "AverageTextBox"}, diff --git a/ppoptions_config.json b/ppoptions_config.json index 4d6ad7e..4ec28bd 100644 --- a/ppoptions_config.json +++ b/ppoptions_config.json @@ -4,6 +4,7 @@ "y": {"type": "Small_Textbox"}, "Size": {"type": "Small_Textbox"}, "Rgb": {"type": "Big_Textbox"}, + "Origin": {"type": "Small_Textbox"}, "Alpha": {"type": "Small_Textbox"}, "Font": {"type": "Small_Textbox"}, "Background": {"type": "PathBox", "filetype": [".png", ".jpg", ".jpeg"]} @@ -13,9 +14,32 @@ "Hitresult y": {"type": "Small_Textbox"}, "Hitresult Size": {"type": "Small_Textbox"}, "Hitresult Rgb": {"type": "Big_Textbox"}, + "Hitresult Origin": {"type": "Small_Textbox"}, "Hitresult Alpha": {"type": "Small_Textbox"}, "Hitresult Font": {"type": "Small_Textbox"}, "Hitresult Background": {"type": "PathBox", "filetype": [".png", ".jpg", ".jpeg"]}, "Hitresult Gap": {"type": "Small_Textbox"} + }, + + "UnstableRate counter": { + "URCounter x": {"type": "Small_Textbox"}, + "URCounter y": {"type": "Small_Textbox"}, + "URCounter Size": {"type": "Small_Textbox"}, + "URCounter Rgb": {"type": "Big_Textbox"}, + "URCounter Origin": {"type": "Small_Textbox"}, + "URCounter Alpha": {"type": "Small_Textbox"}, + "URCounter Font": {"type": "Small_Textbox"}, + "URCounter Background": {"type": "PathBox", "filetype": [".png", ".jpg", ".jpeg"]} + }, + + "Strain Visualizer": { + "Strain x": {"type": "Small_Textbox"}, + "Strain y": {"type": "Small_Textbox"}, + "Strain Size": {"type": "Small_Textbox"}, + "Strain AspectRatio": {"type": "Small_Textbox"}, + "Strain Rgb": {"type": "Big_Textbox"}, + "Strain Smoothing": {"type": "Small_Textbox"}, + "Strain ProgressAlpha": {"type": "Small_Textbox"}, + "Strain GraphDensity": {"type": "Small_Textbox"} } } \ No newline at end of file diff --git a/updater.py b/updater.py index 2341edd..0bfa482 100755 --- a/updater.py +++ b/updater.py @@ -7,6 +7,8 @@ from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QLabel, QApplication, QSizePolicy, QDesktopWidget, QWidget +from abspath import abspath + class Window(QWidget): def __init__(self): super().__init__() @@ -25,8 +27,10 @@ def __init__(self): self.a = threading.Thread(target=self.install) self.osrLogoUpdater() + def osrLogoUpdater(self): - pixmap = QPixmap('res/OsrUpdater.png') + pixmap = QPixmap(os.path.join(abspath, 'res/OsrUpdater.png')) + self.setFixedSize(pixmap.width(), pixmap.height()) self.label.setPixmap(pixmap) self.setAttribute(PyQt5.QtCore.Qt.WA_TranslucentBackground) self.setWindowFlags(PyQt5.QtCore.Qt.FramelessWindowHint) @@ -42,6 +46,7 @@ def center(self): def install(self): for i in self.upgradelist: subprocess.call([sys.executable, "-m", "pip", "install", i, "--upgrade"]) + QApplication.quit()