-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialog_SelectaCompany.py
More file actions
120 lines (91 loc) · 4.97 KB
/
Dialog_SelectaCompany.py
File metadata and controls
120 lines (91 loc) · 4.97 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
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
## by karton4ik
from PyQt6 import QtCore, QtGui, QtWidgets
from Dialog_EnterDecisions import Ui_Dialog
from ast import literal_eval
class Ui_Dialog_EnterallDecisions(object):
def setupUi(self, Dialog_EnterallDecisions):
self.file = literal_eval(open("Dialog_Setup.txt", "r").readline())
Dialog_EnterallDecisions.setObjectName("Dialog_EnterallDecisions")
Dialog_EnterallDecisions.resize(200, 300)
Dialog_EnterallDecisions.setMinimumSize(QtCore.QSize(200, 300))
Dialog_EnterallDecisions.setMaximumSize(QtCore.QSize(200, 300))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("Images/setting.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
Dialog_EnterallDecisions.setWindowIcon(icon)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog_EnterallDecisions)
self.buttonBox.setGeometry(QtCore.QRect(18, 260, 120, 32))
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel)
self.buttonBox.setObjectName("buttonBox")
self.listWidget = QtWidgets.QListWidget(Dialog_EnterallDecisions)
self.listWidget.setGeometry(QtCore.QRect(10, 10, 180, 190))
font = QtGui.QFont()
font.setFamily("Montserrat Medium")
font.setPointSize(10)
self.listWidget.setFont(font)
self.listWidget.setDragEnabled(False)
self.listWidget.setMovement(QtWidgets.QListView.Movement.Static)
self.listWidget.setProperty("isWrapping", False)
self.listWidget.setResizeMode(QtWidgets.QListView.ResizeMode.Fixed)
self.listWidget.setLayoutMode(QtWidgets.QListView.LayoutMode.SinglePass)
self.listWidget.setViewMode(QtWidgets.QListView.ViewMode.ListMode)
self.listWidget.setSelectionRectVisible(False)
self.listWidget.setObjectName("listWidget")
self.lable_hint = QtWidgets.QLabel(Dialog_EnterallDecisions)
self.lable_hint.setGeometry(QtCore.QRect(5, 200, 190, 60))
font = QtGui.QFont()
font.setFamily("Montserrat Medium")
font.setPointSize(9)
self.lable_hint.setFont(font)
self.lable_hint.setText("To enter a solution for a company, you need to double-click on the company for which you want to enter a solution")
self.lable_hint.setWordWrap(True)
self.lable_hint.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
for i in range(len(self.file)):
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
self.listWidget.itemDoubleClicked.connect(self.listWidget_was_doubleClicked)
self.retranslateUi(Dialog_EnterallDecisions)
#self.buttonBox.accepted.connect(Dialog_EnterallDecisions.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog_EnterallDecisions.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog_EnterallDecisions)
file = open("ClosePeriod_log.txt", "r").readline()
for i in file.split(" "):
if i== "":
pass
else:
self.listWidget.takeItem(int(i))
def retranslateUi(self, Dialog_EnterallDecisions):
_translate = QtCore.QCoreApplication.translate
Dialog_EnterallDecisions.setWindowTitle(_translate("Dialog_EnterallDecisions", "Select a Company"))
self.listWidget.setSortingEnabled(False)
__sortingEnabled = self.listWidget.isSortingEnabled()
self.listWidget.setSortingEnabled(False)
for i in range(1, len(self.file) + 1):
try:
item = self.listWidget.item(i-1)
item.setText(_translate("Dialog_EnterallDecisions", self.file[f"Company_{i}"]))
except KeyError:
pass
self.listWidget.setSortingEnabled(__sortingEnabled)
def listWidget_was_doubleClicked(self, lstitem):
self.f = open("logs.txt", "w")
self.f.write(lstitem.text()+"\n"+ str(self.listWidget.currentRow()))
self.f.close()
self.Dialog_EnterDecisions = QtWidgets.QDialog()
self.Dialog_EnterDecisions_ui = Ui_Dialog()
self.Dialog_EnterDecisions_ui.setupUi(self.Dialog_EnterDecisions)
self.Dialog_EnterDecisions.exec()
self.f1 = open("logs.txt", "r").read()
self.f2 = open("ClosePeriod_log.txt", "a")
if self.f1[-1] == "T":
self.listWidget.takeItem(int(self.f1[-2]))
self.f2.write(self.f1[-2] + " ")
self.f2.close()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Dialog_EnterallDecisions = QtWidgets.QDialog()
ui = Ui_Dialog_EnterallDecisions()
ui.setupUi(Dialog_EnterallDecisions)
Dialog_EnterallDecisions.show()
sys.exit(app.exec())