-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotePad.py
265 lines (256 loc) · 14.7 KB
/
NotePad.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# Form implementation generated from reading ui file 'NotepadApp.ui'
#
# Created by: PyQt6 UI code generator 6.4.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(700, 500)
self.centralwidget = QtWidgets.QWidget(parent=MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
self.horizontalLayout.setObjectName("horizontalLayout")
self.textEdit = QtWidgets.QTextEdit(parent=self.centralwidget)
self.textEdit.setObjectName("textEdit")
self.horizontalLayout.addWidget(self.textEdit)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(parent=MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 700, 22))
self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(parent=self.menubar)
self.menuFile.setObjectName("menuFile")
self.menuEdit = QtWidgets.QMenu(parent=self.menubar)
self.menuEdit.setObjectName("menuEdit")
self.menuAbout = QtWidgets.QMenu(parent=self.menubar)
self.menuAbout.setObjectName("menuAbout")
self.menuFormat = QtWidgets.QMenu(parent=self.menubar)
self.menuFormat.setObjectName("menuFormat")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(parent=MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.toolBar = QtWidgets.QToolBar(parent=MainWindow)
self.toolBar.setObjectName("toolBar")
MainWindow.addToolBar(QtCore.Qt.ToolBarArea.TopToolBarArea, self.toolBar)
self.actionNew = QtGui.QAction(parent=MainWindow)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("images/new.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionNew.setIcon(icon)
self.actionNew.setObjectName("actionNew")
self.actionOpen = QtGui.QAction(parent=MainWindow)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("images/open.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionOpen.setIcon(icon1)
self.actionOpen.setObjectName("actionOpen")
self.actionSave = QtGui.QAction(parent=MainWindow)
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap("images/save.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionSave.setIcon(icon2)
self.actionSave.setObjectName("actionSave")
# self.actionPrint = QtGui.QAction(parent=MainWindow)
# self.actionPrint.setObjectName("actionPrint")
# self.actionPrint_Preview = QtGui.QAction(parent=MainWindow)
# self.actionPrint_Preview.setObjectName("actionPrint_Preview")
# self.actionQuit = QtGui.QAction(parent=MainWindow)
# self.actionQuit.setObjectName("actionQuit")
self.actionPrint = QtGui.QAction(parent=MainWindow)
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap("images/print.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionPrint.setIcon(icon3)
self.actionPrint.setObjectName("actionPrint")
self.actionPrint_Preview = QtGui.QAction(parent=MainWindow)
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap("images/printprev.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionPrint_Preview.setIcon(icon4)
self.actionPrint_Preview.setObjectName("actionPrint_Preview")
self.actionExport_PDF = QtGui.QAction(parent=MainWindow)
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap("images/pdf.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionExport_PDF.setIcon(icon5)
self.actionExport_PDF.setObjectName("actionExport_PDF")
self.actionQuit = QtGui.QAction(parent=MainWindow)
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap("images/exit.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionQuit.setIcon(icon6)
self.actionQuit.setObjectName("actionQuit")
self.actionUndo = QtGui.QAction(parent=MainWindow)
icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap("images/undo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionUndo.setIcon(icon7)
self.actionUndo.setObjectName("actionUndo")
self.actionRedo = QtGui.QAction(parent=MainWindow)
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap("images/redo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionRedo.setIcon(icon8)
self.actionRedo.setObjectName("actionRedo")
self.actionCut = QtGui.QAction(parent=MainWindow)
icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap("images/cut.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionCut.setIcon(icon9)
self.actionCut.setObjectName("actionCut")
self.actionCopy = QtGui.QAction(parent=MainWindow)
icon10 = QtGui.QIcon()
icon10.addPixmap(QtGui.QPixmap("images/copy.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionCopy.setIcon(icon10)
self.actionCopy.setObjectName("actionCopy")
self.actionPaste = QtGui.QAction(parent=MainWindow)
icon11 = QtGui.QIcon()
icon11.addPixmap(QtGui.QPixmap("images/paste.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionPaste.setIcon(icon11)
self.actionPaste.setObjectName("actionPaste")
self.actionBold = QtGui.QAction(parent=MainWindow)
icon12 = QtGui.QIcon()
icon12.addPixmap(QtGui.QPixmap("images/bold.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionBold.setIcon(icon12)
self.actionBold.setObjectName("actionBold")
self.actionItalic = QtGui.QAction(parent=MainWindow)
icon13 = QtGui.QIcon()
icon13.addPixmap(QtGui.QPixmap("images/italic.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionItalic.setIcon(icon13)
self.actionItalic.setObjectName("actionItalic")
self.actionUnderline = QtGui.QAction(parent=MainWindow)
icon14 = QtGui.QIcon()
icon14.addPixmap(QtGui.QPixmap("images/underline.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionUnderline.setIcon(icon14)
self.actionUnderline.setObjectName("actionUnderline")
self.actionAlign_Left = QtGui.QAction(parent=MainWindow)
icon15 = QtGui.QIcon()
icon15.addPixmap(QtGui.QPixmap("images/align-left.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionAlign_Left.setIcon(icon15)
self.actionAlign_Left.setObjectName("actionAlign_Left")
self.actionAlign_Right = QtGui.QAction(parent=MainWindow)
icon16 = QtGui.QIcon()
icon16.addPixmap(QtGui.QPixmap("images/align-right.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionAlign_Right.setIcon(icon16)
self.actionAlign_Right.setObjectName("actionAlign_Right")
self.actionCenter = QtGui.QAction(parent=MainWindow)
icon17 = QtGui.QIcon()
icon17.addPixmap(QtGui.QPixmap("images/center-align.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionCenter.setIcon(icon17)
self.actionCenter.setObjectName("actionCenter")
self.actionAlign_Justify = QtGui.QAction(parent=MainWindow)
icon18 = QtGui.QIcon()
icon18.addPixmap(QtGui.QPixmap("images/justify.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionAlign_Justify.setIcon(icon18)
self.actionAlign_Justify.setObjectName("actionAlign_Justify")
self.actionFont = QtGui.QAction(parent=MainWindow)
icon19 = QtGui.QIcon()
icon19.addPixmap(QtGui.QPixmap("images/font.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionFont.setIcon(icon19)
self.actionFont.setObjectName("actionFont")
self.actionColor = QtGui.QAction(parent=MainWindow)
icon20 = QtGui.QIcon()
icon20.addPixmap(QtGui.QPixmap("images/color.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionColor.setIcon(icon20)
self.actionColor.setObjectName("actionColor")
self.actionAbout_App = QtGui.QAction(parent=MainWindow)
icon21 = QtGui.QIcon()
icon21.addPixmap(QtGui.QPixmap("images/about.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.actionAbout_App.setIcon(icon21)
self.actionAbout_App.setObjectName("actionAbout_App")
self.menuFile.addAction(self.actionNew)
self.menuFile.addAction(self.actionOpen)
self.menuFile.addAction(self.actionSave)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionPrint)
self.menuFile.addAction(self.actionPrint_Preview)
self.menuFile.addAction(self.actionExport_PDF)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionQuit)
self.menuEdit.addAction(self.actionUndo)
self.menuEdit.addAction(self.actionRedo)
self.menuEdit.addSeparator()
self.menuEdit.addAction(self.actionCut)
self.menuEdit.addAction(self.actionCopy)
self.menuEdit.addAction(self.actionPaste)
self.menuAbout.addAction(self.actionAbout_App)
self.menuFormat.addAction(self.actionBold)
self.menuFormat.addAction(self.actionItalic)
self.menuFormat.addAction(self.actionUnderline)
self.menuFormat.addSeparator()
self.menuFormat.addAction(self.actionAlign_Left)
self.menuFormat.addAction(self.actionAlign_Right)
self.menuFormat.addAction(self.actionCenter)
self.menuFormat.addAction(self.actionAlign_Justify)
self.menuFormat.addSeparator()
self.menuFormat.addAction(self.actionFont)
self.menuFormat.addAction(self.actionColor)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuEdit.menuAction())
self.menubar.addAction(self.menuFormat.menuAction())
self.menubar.addAction(self.menuAbout.menuAction())
self.toolBar.addAction(self.actionNew)
self.toolBar.addAction(self.actionSave)
self.toolBar.addAction(self.actionCut)
self.toolBar.addAction(self.actionCopy)
self.toolBar.addAction(self.actionPaste)
self.toolBar.addAction(self.actionUndo)
self.toolBar.addAction(self.actionRedo)
self.toolBar.addAction(self.actionPrint)
self.toolBar.addAction(self.actionPrint_Preview)
self.toolBar.addAction(self.actionExport_PDF)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "NotePad App"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
self.menuAbout.setTitle(_translate("MainWindow", "About"))
self.menuFormat.setTitle(_translate("MainWindow", "Format"))
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
self.actionNew.setText(_translate("MainWindow", "New"))
self.actionNew.setShortcut(_translate("MainWindow", "Ctrl+N"))
self.actionOpen.setText(_translate("MainWindow", "Open"))
self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+O"))
self.actionSave.setText(_translate("MainWindow", "Save"))
self.actionSave.setShortcut(_translate("MainWindow", "Ctrl+S"))
# self.actionPrint.setText(_translate("MainWindow", "Print"))
# self.actionPrint_Preview.setText(_translate("MainWindow", "Print Preview"))
# self.actionQuit.setText(_translate("MainWindow", "Quit"))
self.actionPrint.setText(_translate("MainWindow", "Print"))
self.actionPrint.setShortcut(_translate("MainWindow", "Ctrl+P"))
self.actionPrint_Preview.setText(_translate("MainWindow", "Print Preview"))
self.actionPrint_Preview.setShortcut(_translate("MainWindow", "Ctrl+Shift+P"))
self.actionExport_PDF.setText(_translate("MainWindow", "Export PDF"))
self.actionExport_PDF.setShortcut(_translate("MainWindow", "Ctrl+E"))
self.actionQuit.setText(_translate("MainWindow", "Quit"))
self.actionQuit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionUndo.setText(_translate("MainWindow", "Undo"))
self.actionUndo.setShortcut(_translate("MainWindow", "Ctrl+Z"))
self.actionRedo.setText(_translate("MainWindow", "Redo"))
self.actionRedo.setShortcut(_translate("MainWindow", "Ctrl+Y"))
self.actionCut.setText(_translate("MainWindow", "Cut"))
self.actionCut.setShortcut(_translate("MainWindow", "Ctrl+X"))
self.actionCopy.setText(_translate("MainWindow", "Copy"))
self.actionCopy.setShortcut(_translate("MainWindow", "Ctrl+C"))
self.actionPaste.setText(_translate("MainWindow", "Paste"))
self.actionPaste.setShortcut(_translate("MainWindow", "Ctrl+V"))
self.actionBold.setText(_translate("MainWindow", "Bold"))
self.actionBold.setShortcut(_translate("MainWindow", "Ctrl+B"))
self.actionItalic.setText(_translate("MainWindow", "Italic"))
self.actionItalic.setShortcut(_translate("MainWindow", "Ctrl+I"))
self.actionUnderline.setText(_translate("MainWindow", "Underline"))
self.actionUnderline.setShortcut(_translate("MainWindow", "Ctrl+U"))
self.actionAlign_Left.setText(_translate("MainWindow", "Align Left"))
self.actionAlign_Left.setShortcut(_translate("MainWindow", "Ctrl+L"))
self.actionAlign_Right.setText(_translate("MainWindow", "Align Right"))
self.actionAlign_Right.setShortcut(_translate("MainWindow", "Ctrl+R"))
self.actionCenter.setText(_translate("MainWindow", "Align Center"))
self.actionCenter.setShortcut(_translate("MainWindow", "Ctrl+K"))
self.actionAlign_Justify.setText(_translate("MainWindow", "Align Justify"))
self.actionAlign_Justify.setShortcut(_translate("MainWindow", "Ctrl+J"))
self.actionFont.setText(_translate("MainWindow", "Font"))
self.actionColor.setText(_translate("MainWindow", "Color"))
self.actionAbout_App.setText(_translate("MainWindow", "About App"))
# if __name__ == "__main__":
# import sys
# app = QtWidgets.QApplication(sys.argv)
# MainWindow = QtWidgets.QMainWindow()
# ui = Ui_MainWindow()
# ui.setupUi(MainWindow)
# MainWindow.show()
# sys.exit(app.exec())