-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDialog.py
141 lines (128 loc) · 5.68 KB
/
Dialog.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
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\Dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
import os
class Ui_Dialog(object):
def setupUi(self, Dialog, name='', path='', notes='', tags='', add=0):
Dialog.setObjectName("Dialog")
Dialog.resize(433, 310)
self.dialog = Dialog
self.add = add
self.data = {}
self.data['delete'] = False
self.data['name'] = ''
self.data['path'] = ''
self.data['tags'] = ''
self.data['notes'] = ''
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(20, 30, 55, 16))
self.label.setObjectName("label")
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(20, 60, 55, 16))
self.label_2.setObjectName("label_2")
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setGeometry(QtCore.QRect(20, 90, 55, 16))
self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setGeometry(QtCore.QRect(20, 130, 55, 16))
self.label_4.setObjectName("label_4")
self.lineEdit = QtWidgets.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(100, 30, 261, 22))
self.lineEdit.setObjectName("lineEdit")
self.lineEdit.setText(name)
self.lineEdit_2 = QtWidgets.QLabel(Dialog)
self.lineEdit_2.setGeometry(QtCore.QRect(100, 60, 261, 22))
self.lineEdit_2.setObjectName("lineEdit_2")
self.lineEdit_2.setText(path)
self.lineEdit_3 = QtWidgets.QLineEdit(Dialog)
self.lineEdit_3.setGeometry(QtCore.QRect(100, 90, 261, 22))
self.lineEdit_3.setObjectName("lineEdit_3")
self.lineEdit_3.setText(tags)
self.textEdit = QtWidgets.QTextEdit(Dialog)
self.textEdit.setGeometry(QtCore.QRect(100, 130, 261, 87))
self.textEdit.setObjectName("textEdit")
self.textEdit.setText(notes)
if add == 0:
self.pushButton_delete = QtWidgets.QPushButton(Dialog)
self.pushButton_delete.setGeometry(
QtCore.QRect(20, 250, 93, 28))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(".\\Icons/delete.webp"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_delete.setIcon(icon)
self.pushButton_delete.setObjectName("pushButton_delete")
self.pushButton_delete.clicked.connect(self.delete_clicked)
self.pushButton_ok = QtWidgets.QPushButton(Dialog)
self.pushButton_ok.setGeometry(QtCore.QRect(210, 250, 93, 28))
self.pushButton_ok.setObjectName("pushButton_ok")
self.pushButton_ok.clicked.connect(self.ok_clicked)
self.pushButton_open = QtWidgets.QPushButton(Dialog)
self.pushButton_open.setGeometry(QtCore.QRect(370, 60, 31, 21))
self.pushButton_open.clicked.connect(self.open_clicked)
self.pushButton_open.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(".\\Icons/open.webp"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton_open.setIcon(icon1)
self.pushButton_open.setObjectName("pushButton_open")
self.pushButton_cancel = QtWidgets.QPushButton(Dialog)
self.pushButton_cancel.setGeometry(QtCore.QRect(320, 250, 93, 28))
self.pushButton_cancel.setObjectName("pushButton_cancel")
self.pushButton_cancel.clicked.connect(self.cancel_clicked)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Properties"))
self.label.setText(_translate("Dialog", "Name"))
self.label_2.setText(_translate("Dialog", "Path"))
self.label_3.setText(_translate("Dialog", "Tags"))
self.label_4.setText(_translate("Dialog", "Notes"))
if self.add == 0:
self.pushButton_delete.setText(_translate("Dialog", "Delete"))
self.pushButton_ok.setText(_translate("Dialog", "OK"))
self.pushButton_cancel.setText(_translate("Dialog", "Cancel"))
def delete_clicked(self):
self.data['delete'] = True
self.dialog.accept()
def cancel_clicked(self):
self.dialog.reject()
# pass
def open_clicked(self):
try:
item = self.lineEdit_2.text().split('/')
finalpath = '/'.join(item[:-1])
if finalpath:
os.startfile(finalpath)
except Exception as e:
print("Open Error Occurred", e)
def ok_clicked(self):
self.data['name'] = self.lineEdit.text()
self.data['path'] = self.lineEdit_2.text()
self.data['tags'] = [i.strip()
for i in self.lineEdit_3.text().split(', ')]
self.data['notes'] = self.textEdit.toPlainText()
self.dialog.accept()
# pass
# def checkval(self):
# self.data['name']=self.lineEdit.text()
# self.data['path'] = self.lineEdit_2.text()
# self.data['tags'] = self.lineEdit_3.text()
# self.data['notes'] = self.textEdit.toPlainText()
# self.dialog.accept()
# print(name)
# return name
# Dialog.done(name)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Dialog = QtWidgets.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec_())