-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd.py
122 lines (104 loc) · 3.86 KB
/
add.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
from PyQt5 import QtWidgets
from PyQt5.uic import loadUiType
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from os import path
from sys import argv
from qt_material import apply_stylesheet
FORM_CLASS,_=loadUiType(path.join(path.dirname(__file__),r"GUI/add_to_db.ui"))
class myapp(QMainWindow,FORM_CLASS):
def __init__(self, parent=None):
super(myapp,self).__init__(parent)
QMainWindow.__init__(self)
self.setupUi(self)
self.admin_password = "1"
self.first_open()
self.button_setup()
def button_setup(self):
self.proceed_BT.clicked.connect(self.proceed)
self.word_type.currentIndexChanged.connect(self.change_labels)
def first_open(self):
self.article_LB.hide()
self.word_LB.hide()
self.password.setGeometry(15,20,230,20)
self.word_type.setGeometry(209,20,90,20)
self.proceed_BT.setGeometry(112,50,75,25)
self.setGeometry(200,200,320,85)
self.setFixedSize(320,85)
self.image_LB.hide()
self.imageurl_input.hide()
def proceed(self):
if self.password.text() == self.admin_password:
self.setGeometry(200,200,445,300)
self.setFixedSize(445,300)
self.word_type.setGeometry(280,139,150,25)
self.word_type.setStyleSheet("border:0;")
self.password.hide()
self.proceed_BT.hide()
self.article_LB.show()
self.word_LB.show()
self.change_labels()
self.move_things()
else:
print("error")
def change_labels(self):
self.wordtyp = self.word_type.currentText()
if self.wordtyp == "Verb":
self.word_LB.setText("Verb :")
self.article_LB.setText("Perfect :")
self.plural_LB.setText("Status :")
self.category_LB.setText("Hilfsverb :")
self.type_LB.setText("Type :")
self.image_LB.hide()
self.imageurl_input.hide()
self.resize(445, 280)
self.setFixedSize(445,280)
self.add_BT.setGeometry(180,235,75,25)
elif self.wordtyp == "Noun":
self.word_LB.setText("Word :")
self.article_LB.setText("Article :")
self.plural_LB.setText("Plural :")
self.category_LB.setText("Category :")
self.type_LB.setText("Type :")
self.image_LB.show()
self.imageurl_input.show()
self.resize(445, 330)
self.setFixedSize(445,330)
self.add_BT.setGeometry(180,295,75,25)
elif self.wordtyp == "Adjective":
self.word_LB.setText("Adjective :")
self.article_LB.setText("männlich :")
self.plural_LB.setText("Weiblich :")
self.category_LB.setText("Neutral :")
self.type_LB.setText("Type :")
self.image_LB.hide()
self.imageurl_input.hide()
self.resize(445, 280)
self.setFixedSize(445,280)
self.add_BT.setGeometry(180,235,75,25)
def move_things(self):
self.word_LB.setGeometry(15,29,210,20)
self.meaning_LB.setGeometry(15,79,210,20)
self.plural_LB.setGeometry(15,129,210,20)
self.word_input.setGeometry(15,49,210,25)
self.meaning_input.setGeometry(15,99,210,25)
self.plural_input.setGeometry(15,149,210,25)
self.article_LB.setGeometry(280,29,140,20)
self.type_LB.setGeometry(280,79,140,20)
self.category_LB.setGeometry(280,129,140,20)
self.example_LB.setGeometry(190,182,140,20)
self.article_input.setGeometry(280,49,150,25)
self.word_type.setGeometry(280,99,150,25)
self.category_input.setGeometry(280,149,150,25)
self.example_input.setGeometry(15,202,415,25)
self.add_BT.setGeometry(180,235,75,25)
self.resize(445, 280)
self.setFixedSize(445,280)
if __name__ == "__main__":
app = QApplication(argv)
MainWindow = QtWidgets.QMainWindow()
window = myapp()
window.show()
apply_stylesheet(app, theme='dark_teal.xml')
app.exec()