16
16
17
17
# classes
18
18
class popup (QWidget ):
19
- def __init__ (self ) -> None :
19
+ def __init__ (self , popupText : str ) -> None :
20
20
# default
21
21
super ().__init__ ()
22
- self .setWindowTitle ("Files Renamer" ) ; self .setWindowIcon (QIcon ("assets/warning.png" ))
23
22
self .resize (160 , 80 ) ; self .setFixedSize (self .size ())
24
23
25
24
# main layout
26
25
self .mainLayout : QVBoxLayout = QVBoxLayout () ; self .setLayout (self .mainLayout )
27
26
28
27
# widgets
29
28
# --- warning message ---
30
- self .warning : QLabel = QLabel ("Something is wrong !" ) ; self .warning .setAlignment (Qt .AlignmentFlag .AlignCenter )
31
- self .mainLayout .addWidget (self .warning )
29
+ if (popupText == "warning" ):
30
+ self .setWindowTitle ("Warning" )
31
+ self .setWindowIcon (QIcon ("assets/warning.png" ))
32
+ self .pText : QLabel = QLabel ("Something is wrong!" )
33
+ else :
34
+ self .setWindowTitle ("Notice" )
35
+ self .setWindowIcon (QIcon ("assets/checkmark.png" ))
36
+ self .pText : QLabel = QLabel ("Done!" )
37
+
38
+ self .pText .setAlignment (Qt .AlignmentFlag .AlignCenter )
39
+ self .mainLayout .addWidget (self .pText )
32
40
33
41
# --- close button ---
34
42
self .closeButton : QPushButton = QPushButton ("Close" )
@@ -48,7 +56,6 @@ def __init__(self) -> None:
48
56
self .setWindowTitle ("Files Renamer" ) ; self .setWindowIcon (QIcon ("assets/icon.png" ))
49
57
self .resize (500 , 220 ) ; self .setFixedSize (self .size ())
50
58
self .fr : FileRenamer = FileRenamer ()
51
- self .popup : popup = popup ()
52
59
53
60
# main layout
54
61
self .topLayout : QVBoxLayout = QVBoxLayout ()
@@ -121,8 +128,9 @@ def rename(self) -> None:
121
128
122
129
if (selectedFolderCheck and startFileCheck and startNumberCheck and renameFormatCheck and fileExtCheck ):
123
130
self .fr .rename (folder , fileExt , startFile , int (startNb ), renameFrmt )
131
+ self .popUp : popup = popup ("done" ) ; self .popUp .show ()
124
132
else :
125
- self .popup .show ()
133
+ self .popUp : popup = popup ( "warning" ) ; self . popUp .show ()
126
134
127
135
# test
128
136
if __name__ == "__main__" :
0 commit comments