-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecryptorUI.py
More file actions
86 lines (68 loc) · 3.13 KB
/
DecryptorUI.py
File metadata and controls
86 lines (68 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import sys
import os
from random import randint
from PyQt5 import QtWidgets
from PyQt5 import uic
from FileExplorerUI import FileExplorer
from locksmith import LockSmith
class Decrpytor(QtWidgets.QMainWindow):
def __init__(self,uipath):
super(Decrpytor, self).__init__()
uic.loadUi(uipath, self)
# BUTTONS
self.infoFileButton = self.findChild(QtWidgets.QPushButton, 'infoFileButton') # Find the button
self.infoFileButton.clicked.connect(self.clickinfoFileButton) # Remember to pass the definition/method, not the return value!
self.rsaFileButton = self.findChild(QtWidgets.QPushButton, 'rsaFileButton')
self.rsaFileButton.clicked.connect(self.clickRSAFileButton)
self.savemylifeButton = self.findChild(QtWidgets.QPushButton, 'savemylifeButton')
self.savemylifeButton.clicked.connect(self.clickSavemylifeButton)
self.savemylifeButton.setEnabled(True)
# LABELS
self.infoFileLocationLabel = self.findChild(QtWidgets.QLabel, "infoFileLocationLabel")
self.flaginfo = False
self.rsaFileLocationLabel = self.findChild(QtWidgets.QLabel, "rsaFileLocationLabel")
self.flagrsa = False
# PROGRESS BAR
self.progressBar = self.findChild(QtWidgets.QProgressBar, "progressBar")
#self.progressBar.setValue(randint(0,100))
# LIST WIDGET
self.decryptedFilesListWidget = self.findChild(QtWidgets.QListWidget,"decryptedFilesList")
# SCROLL AREA
self.scrollBar = self.findChild(QtWidgets.QScrollArea,"fileListScroolArea")
self.show()
def openFileExplorer(self):
_selected_file = FileExplorer().initUI()
return _selected_file
def clickinfoFileButton(self):
_selected_file = self.openFileExplorer()
if _selected_file:
self.infoFileLocationLabel.setText(_selected_file)
self.flaginfo = True
self.enableSavemylifeButton()
def clickRSAFileButton(self):
_selected_file = self.openFileExplorer()
if _selected_file:
self.rsaFileLocationLabel.setText(_selected_file)
self.flagrsa = True
self.enableSavemylifeButton()
def enableSavemylifeButton(self):
if self.flaginfo and self.flagrsa:
self.savemylifeButton.setEnabled(True)
def clickSavemylifeButton(self):
my_locksmith = LockSmith(self.infoFileLocationLabel.text(),self.rsaFileLocationLabel.text())
file_count = my_locksmith.openthelock()
my_locksmith.startingRescueFiles(file_count, self.decryptedFilesListWidget, self.progressBar)
self.savemylifeButton.setEnabled(False)
def resourcePath(filename, folders = ""):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, folders, filename)
if __name__ == "__main__":
GUI_path = resourcePath("locksmith.ui")
app = QtWidgets.QApplication(sys.argv)
window = Decrpytor(GUI_path)
app.exec_()