-
Notifications
You must be signed in to change notification settings - Fork 1
/
UI.py
224 lines (183 loc) · 8.59 KB
/
UI.py
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import sys
from PySide2.QtCore import Qt, Slot
from PySide2.QtGui import QPainter, QFontDatabase, QIcon, QPixmap, QImage, QFont
from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget, QGroupBox, QPlainTextEdit, QCheckBox, QToolBar, QAction)
from PySide2.QtCharts import QtCharts
from pyside_material import apply_stylesheet
import allfiles
# class WidgetMainMenu(QWidget):
class ShortcutBlock(QWidget):
def __init__(self):
QWidget.__init__(self)
self.setLayout()
class WidgetMainMenu(QWidget):
def __init__(self):
QWidget.__init__(self)
self.a = QFontDatabase()
print(self.a.families())
print(self.a.writingSystemSample(QFontDatabase.Arabic))
#focus qeuee
#Texts
#Margin
#child widget access
#Top Bar
#multiple windows handling (one open, main close all close,
#nice Layouts
#Rights
#emoji and other langs (encoding)
self.MainToolbar = QToolBar()
self.DonateButton = QPushButton()
self.DonateButton.setStatusTip("FUCKING")
# self.DonateButton.setBackgroundRole(QIcon(QPixmap(":/Bitcoin.png")))
self.DonateButton.setFont(QFont("Vazir"))
self.DonateButton.setMinimumSize(50,100)
self.DonateButton.setText("test")
self.MainToolbar.addWidget(self.DonateButton)
self.ActiveSessionShortCutGroup = QGroupBox()
# self.ActiveSessionShortCutGroup
self.ActiveSessionShortCutGroup.setTitle("Shortcuts")
self.ActiveSessionShortCutGroupVBox = QVBoxLayout()
self.ActiveSessionShortCutGroupVBox.setContentsMargins(15,15,15,15)
def ShortCutVBox(text):
ShortCutInputButton = QPushButton()
ShortCutResetButton = QPushButton("Reset")
ShortCutText = QLabel(text)
ShortCutResetButton.setMaximumWidth(100)
ShortCutButtonsHBox = QHBoxLayout()
ShortCutButtonsHBox.setContentsMargins(10,10,10,10)
ShortCutButtonsHBox.addWidget(ShortCutInputButton)
ShortCutButtonsHBox.addWidget(ShortCutResetButton)
ShortCutBlockVBox = QVBoxLayout()
ShortCutBlockVBox.addWidget(ShortCutText)
ShortCutBlockVBox.addLayout(ShortCutButtonsHBox)
return ShortCutBlockVBox
CipherShortCutBlockVBox=ShortCutVBox("Enter Ciphering ShortCut (Also Decode in Smart Mode)")
DecipherShortCutBlockVBox=ShortCutVBox("Enter Deciphering ShortCut (Also Code in Smart Mode - could be left empty)")
self.ActiveSessionShortCutGroupVBox.addLayout(CipherShortCutBlockVBox)
self.ActiveSessionShortCutGroupVBox.addLayout(DecipherShortCutBlockVBox)
self.ActiveSessionShortCutGroup.setLayout(self.ActiveSessionShortCutGroupVBox)
self.SettingsGroup = QGroupBox()
self.SettingsGroupVBox = QVBoxLayout()
self.OnOffDeamonBox = QCheckBox("Start This service and Open Angel Gates to your Privacy, KINDA! :)")
self.StartUpDeamonBox = QCheckBox("Start CryptoCut Deamon at the System Boot up")
self.EncryptNotifBox = QCheckBox("Show a Notification After (De/En)crpt of Texts And Show its Successful or Not")
self.VirtualKeyboardBox = QCheckBox("Open Virtual Keyboard for Keylogger Suspection Situations")
self.SaftyTweaksBox = QCheckBox("Our Small Tweaks would be Applied on Standard Methods to Make them even better")
self.SuperSafeModeBox = QCheckBox("Open a Box with Password Input Mode to write text in and Paste in last Focused Region")
self.RapidModeBox = QCheckBox("Paste Text Back in place and Delete the text")
self.TrayDeamonBox = QCheckBox("Show Application Icon in Tray for Ease of Access")
self.SmartModeBox = QCheckBox("Automatically Detect Its a Cipher or a Normal Text and Work with one Shortcut")
self.SettingsGroupVBox.addWidget(self.OnOffDeamonBox)
self.SettingsGroupVBox.addWidget(self.StartUpDeamonBox)
self.SettingsGroupVBox.addWidget(self.EncryptNotifBox)
self.SettingsGroupVBox.addWidget(self.VirtualKeyboardBox)
self.SettingsGroupVBox.addWidget(self.SaftyTweaksBox)
self.SettingsGroupVBox.addWidget(self.SuperSafeModeBox)
self.SettingsGroupVBox.addWidget(self.RapidModeBox)
self.SettingsGroupVBox.addWidget(self.TrayDeamonBox)
self.SettingsGroupVBox.addWidget(self.SmartModeBox)
self.SettingsGroup.setTitle("Settings")
self.SettingsGroup.setLayout(self.SettingsGroupVBox)
self.apply = QPushButton("Apply Setting")
self.reset = QPushButton("Reset to Default")
self.apply.setMinimumWidth(150)
self.reset.setMinimumWidth(150)
self.apply.setMinimumHeight(35)
self.reset.setMinimumHeight(35)
self.Container = QHBoxLayout()
self.Container.addWidget(self.apply)
self.Container.addWidget(self.reset)
self.Container.minimumHeightForWidth(20)
self.Main = QVBoxLayout()
self.Main.setMargin(10)
self.Main.addWidget(self.MainToolbar)
self.Main.addWidget(self.ActiveSessionShortCutGroup)
self.Main.addWidget(self.SettingsGroup)
self.TestPlainTextEdit = QPlainTextEdit("Test CryptoCut HERE")
self.TestPlainTextEdit.setMinimumHeight(200)
self.Main.addWidget(self.TestPlainTextEdit)
self.Main.addLayout(self.Container)
#self.table_view.setSizePolicy(size)
# Set the layout to the QWidget
self.setLayout(self.Main)
# Signals and Slots
# self.add.clicked.connect(self.add_element)
# self.quit.clicked.connect(self.quit_application)
# self.clear.clicked.connect(self.clear_table)
# self.description.textChanged[str].connect(self.check_disable)
# self.price.textChanged[str].connect(self.check_disable)
@Slot()
def add_element(self):
des = self.description.text()
price = self.price.text()
self.table.insertRow(self.items)
description_item = QTableWidgetItem(des)
price_item = QTableWidgetItem("{:.2f}".format(float(price)))
price_item.setTextAlignment(Qt.AlignRight)
self.table.setItem(self.items, 0, description_item)
self.table.setItem(self.items, 1, price_item)
self.description.setText("")
self.price.setText("")
self.items += 1
@Slot()
def check_disable(self, s):
if not self.description.text() or not self.price.text():
self.add.setEnabled(False)
else:
self.add.setEnabled(True)
@Slot()
def plot_data(self):
# Get table information
series = QtCharts.QPieSeries()
for i in range(self.table.rowCount()):
text = self.table.item(i, 0).text()
number = float(self.table.item(i, 1).text())
series.append(text, number)
chart = QtCharts.QChart()
chart.addSeries(series)
chart.legend().setAlignment(Qt.AlignLeft)
self.chart_view.setChart(chart)
@Slot()
def quit_application(self):
QApplication.quit()
def fill_table(self, data=None):
data = self._data if not data else data
for desc, price in data.items():
description_item = QTableWidgetItem(desc)
price_item = QTableWidgetItem("{:.2f}".format(price))
price_item.setTextAlignment(Qt.AlignRight)
self.table.insertRow(self.items)
self.table.setItem(self.items, 0, description_item)
self.table.setItem(self.items, 1, price_item)
self.items += 1
@Slot()
def clear_table(self):
self.table.setRowCount(0)
self.items = 0
class MainWindow(QMainWindow):
def __init__(self, widget):
QMainWindow.__init__(self)
self.setWindowTitle("CryptoCut - Home")
# Exit QAction
exit_action = QAction("Exit", self)
exit_action.setShortcut("Ctrl+Q")
exit_action.triggered.connect(self.exit_app)
self.setCentralWidget(widget)
appIcon = QIcon(QPixmap(":/Logo.ico"))
self.setWindowIcon(appIcon)
@Slot()
def exit_app(self, checked):
QApplication.quit()
if __name__ == "__main__":
# Qt Application
app = QApplication(sys.argv)
# QWidget
widgetmainmenu = WidgetMainMenu()
# QMainWindow using QWidget as central widget
mainwindow = MainWindow(widgetmainmenu)
mainwindow.show()
# apply_stylesheet(app, theme='dark_teal.xml')
# Execute application
sys.exit(app.exec_())