From 029c70356fe2125a5c383285a3c53e1bf993f11f Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Tue, 14 Mar 2023 18:46:19 +0100 Subject: [PATCH] more ui updates --- bin/__pycache__/checks.cpython-310.pyc | Bin 1905 -> 1905 bytes bin/__pycache__/handler.cpython-310.pyc | Bin 5356 -> 5636 bytes bin/handler.py | 23 +++++----- fsrimagevideoupscaler.py | 55 ++++++++++++------------ 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/bin/__pycache__/checks.cpython-310.pyc b/bin/__pycache__/checks.cpython-310.pyc index 0308bc390e02ac58e0f23faee18fb7c5b67ee5f3..0c3be33e5770679c589907ec3856466a2f741eae 100644 GIT binary patch delta 19 Zcmey!_mPh)pO=@50SHRhZsba52LLt%1m^$% delta 19 Zcmey!_mPh)pO=@50SH$5Zsba52LLr(1iJtL diff --git a/bin/__pycache__/handler.cpython-310.pyc b/bin/__pycache__/handler.cpython-310.pyc index 1c3c5019b80b33c6087d96c5b704885adc440c7c..725b872850b7d8ce2b961ce825e38df160c0429a 100644 GIT binary patch delta 1318 zcmah}O>7%Q6rP#=@n#Y?cI+gM5Y^DMrB03Whp2=ELMlr5sSqN<<}@RRi8y|>f`xrk#<+StW)-?GrSh5oGBDzw5l?@hcKGLd@Xj#)Np4K$$+J%F?QaF@|R6;hfaMYil zC_p9OClKCfi^T0?unYwI9t4+_Kaumjzd2*T`T7`6?h#o2KiK$D924N{Tkth`kiZp-#}`883oitBD-yDBp9jhZ4}^lm925^w8*v*ZSx`6O#*-V$c_cwQV1SX zS|_1ll-jKXgG&0}s`3kGx_26+bd%^156%9-&nW4Dqry9zKv3GkL9pN!oSafl20rd< zA5Z=dk7}L`DLA2vJ1W0%vcu=}8o|p@lpl=l;(a-jd2a4k0}|eSb;(zE6mImv```x+ z<_Fxr?(_9poB8Vbh|3HrCqK*lfn9ksTY;+lmVIDXfFJ)Ze;NDErg-F@Gb!)nKF_g{ nLPP*54)3R`RUX!>RT<=;!4vXUe!h?g#6%8t@X=>bJZAg_gw$4d delta 963 zcmaJ;OK1~87@mK2XS3aAn^*Hv3bCm*X^S9&3R+N7^dPB7L~x}P>4Y>*P1@{wFf8&OhHsX~zGTgsX&MB7 z5A#9(=C(Otox_0>4)es?IKcurQ;W(|u@rf#mMTwXv7*w_+Qjk|eJ!2SHUK$AxWd(C z!qq0VdN>qFmUWK73M}0KLR>P32^Cs59pE&H+9YDrv>K6&ip;Jq!@7*-C|qmeX6`GX zRwZ+k>xT(NS6A61l`1!I6LaYVnM&Z7h8s2BiyL#&b%Alew6Vp55@4QS6LEYlZGxkF z|J+Pq0oT0i^;M`nyA2n>)mQOyL9wokF8%R@(DQT~Pk09|@*mf~b&n`!J;$t=SATA(v5sfX>%T-5o*nKsFPb{XiVd|%y73~&4 zOvLpJ92Lj)i!`iv*7Od8k~rJ<@pKH^N$^yY0&&8vq&Iob>%{mTFT@#Xjq*VcK_*=y z6=jv$Z;?%VY$Jr8F=T>w2_F)*zyMqqHv{qUJG=+cIHG$u*)@EJ=|pum&Qb2K&{d`W z*acLW|0>0YK>G49qK0=Xsn@0cJ>Tb{U5}TUakamup*2j!j6vzy$oMWZvOD|4Vldr1 zvQ_G+xEEXpOXNc1M;fMK7`Zd~{E5j4{A#35maAoZw#ZXg7VMcz^W|zO<;<4tlwF*0 z%C+kLPYRab7!*%JKjEEt6h4pTv&dJifUx~b{D{0V{GfvY{?B?+yzGBq4EPguifq;p T%h5v+70;pvlrX;Fw`k-yX2s~` diff --git a/bin/handler.py b/bin/handler.py index f4818a6..f350a5f 100644 --- a/bin/handler.py +++ b/bin/handler.py @@ -1,11 +1,11 @@ -########################################################### -# -# Handler for FSRImageVideoUpscalerFrontend -# -# This code is licensed under the GPL V3 License! -# Developed 2022 by Janis Hutz -# -########################################################### +""" +* FSRImageVideoUpscalerFrontend - handler.py +* +* Created by Janis Hutz 03/14/2023, Licensed under the GPL V3 License +* https://janishutz.com, development@janishutz.com +* +* +""" import os @@ -29,6 +29,8 @@ class Handler: def handler(self, fsrpath, filepath, quality_mode, quality_setting, output_path): # Function to be called when using this class as this function automatically determines if file is video or image + print( '\n\nFSRImageVideoUpscalerFrontend - V1.1.0\n\nCopyright 2023 FSRImageVideoUpscalerFrontend contributors\n\n\n\n' ); + if self.os_type == "linux": self.tmppath = config["PathSettings"]["tmpPathLinux"] elif self.os_type == "win32": @@ -55,6 +57,7 @@ class Handler: self.photo_scaling(fsrpath, filepath, quality_mode, quality_setting, output_path) else: print("not supported") + return False def photo_scaling(self, fsrpath, filepath, quality_mode, quality_setting, output_path): # DO NOT CALL THIS! Use Handler().handler() instead! @@ -194,13 +197,11 @@ class Handler: else: print("OS CURRENTLY UNSUPPORTED!") return False - print(self.command, "\n\n\nCOMMAND\n\n\n") os.system(self.command) - print("Finished upscaling this section.") time.sleep(3) # get Video's audio - print("Retrieving Video's audio to append") + print("Finished Upscaling individual images. \n\n\nRetrieving Video's audio to append") try: os.remove(f"{self.tmppath}audio.aac") os.remove(f"{output_path}") diff --git a/fsrimagevideoupscaler.py b/fsrimagevideoupscaler.py index dd1894b..b348dbc 100644 --- a/fsrimagevideoupscaler.py +++ b/fsrimagevideoupscaler.py @@ -18,6 +18,7 @@ checks = bin.checks.Checks() handler = bin.handler.Handler() from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QDialog, QFileDialog, QComboBox, QHBoxLayout, QVBoxLayout, QWidget +from PyQt5.QtCore import QUrl class HomeWindow(QMainWindow): @@ -27,18 +28,29 @@ class HomeWindow(QMainWindow): self.save_file = "" self.open_file = "" - box = QHBoxLayout(); + box = QVBoxLayout(); + actionsBox = QHBoxLayout(); + widget = QWidget(); + actionsWidget = QWidget(); self.button = QPushButton( 'Input file' ); self.button.clicked.connect( self.filechooser_clicked ); + self.button_out = QPushButton( 'Output file' ); + self.button_out.clicked.connect( self.opfilechooser_clicked ); + self.button_run = QPushButton( 'Upscale' ); + self.button_run.clicked.connect( self.info_button ); self.qualitySelector = QComboBox(); self.qualitySelector.addItems( ['2x', '1.7x', '1.5x', '1.3x', 'Custom (will respect value below)' ] ); + actionsBox.addWidget( self.button ); + actionsBox.addWidget( self.button_out ); + actionsBox.addWidget( self.button_run ); + actionsWidget.setLayout( actionsBox ); - box.addWidget( self.button ) box.addWidget( self.qualitySelector ); + box.addWidget( actionsWidget ); widget.setLayout( box ); self.setCentralWidget( widget ); @@ -53,46 +65,33 @@ class HomeWindow(QMainWindow): self.model = quality.get_model() self.output = self.model[self.tree_iter][0] - def filechooser_clicked(self, widget): + def filechooser_clicked( self ): self.open_file = QFileDialog.getOpenFileName( self, 'Open input file', '', 'Image & Video files (*.jpg *.png *.mp4 *.mkv *.jpeg)' ); - def opfilechooser_clicked(self, widget): + def opfilechooser_clicked( self ): self.path = ''; - if str(self.open_file)[len(self.open_file) - 4:] == '.mp4': + if str( self.open_file )[len(self.open_file) - 4:] == '.mp4': self.path = 'video.mp4'; - elif str(self.open_file)[len(self.open_file) - 4:] == '.mkv': + elif str( self.open_file )[len(self.open_file) - 4:] == '.mkv': self.path = 'video.mkv'; - elif str(self.open_file)[len(self.open_file) - 4:] == '.png': + elif str( self.open_file )[len(self.open_file) - 4:] == '.png': self.path = 'image.png'; - elif str(self.open_file)[len(self.open_file) - 4:] == '.jpg': + elif str( self.open_file )[len(self.open_file) - 4:] == '.jpg': self.path = 'image.jpg'; - elif str(self.open_file)[len(self.open_file) - 4:] == '.jpeg': + elif str( self.open_file )[len(self.open_file) - 4:] == '.jpeg': self.path = 'image.jpeg'; - self.open_file_out = QFileDialog( self, 'Select output file', '', 'Image & Video files (*.jpg *.png *.mp4 *.mkv *.jpeg)' ); - self.open_file_out.setAcceptMode( 'AcceptSave' ); - if self.os_type == 'linux': - self.open_file_out.setDirectoryUrl( '/home' ); - elif self.os_type == 'win32': - self.open_file_out.setDirectoryUrl( '%HOMEPATH%' ); - else: - pass; + self.open_file_out = QFileDialog.getOpenFileName( self, 'Select output file', '', 'Image & Video files (*.jpg *.png *.mp4 *.mkv *.jpeg)' ); def info_button(self): - self.info_dialog = Gtk.Dialog() - self.remove_event = Gtk.Button(label="Don't show again") - self.info_dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK) - self.info_dialog.set_default_size(150, 100) - self.box = self.info_dialog.get_content_area() - self.label = Gtk.Label(label=" Upscaling. This process will take long (if a Video). \n Duration depends on your Hardware and length and resolution of video \n You may see the output of the app, if you switch to the other window that is behind it. \n\n\n click \"ok\" to start upscaling") - self.box.pack_start(self.label, True, True, 0) - self.info_dialog.show_all() - self.info_response = self.info_dialog.run() - self.info_dialog.destroy() + self.fileMissingErrorDialog = QDialog( self ); + self.fileMissingErrorDialog.setWindowTitle( 'Upscaling! This process might take a LONG time!' ); + self.fileMissingErrorDialog.exec(); + self.start_clicked(); - def start_clicked(self, widget): + def start_clicked(self): self.respawn = True try: if self.scaler.is_alive():