-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinterface.py
229 lines (172 loc) · 7.65 KB
/
interface.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
from PyQt5.QtWidgets import (QApplication, QLabel, QWidget, QTableWidget, QHBoxLayout, QGridLayout,
QTabWidget, QSizePolicy, QStyleFactory, QDialog, QTableWidgetItem, QVBoxLayout, QGroupBox, QFormLayout
, QLineEdit, QPushButton,QMainWindow, QStackedWidget)
from PyQt5.QtGui import QDesktopServices
from PyQt5 import QtCore
from tms_assigned import Tms_task
from outlook import Outlook_task
from showjira import ShowJIRA
from rrt import showRes
class SneakPeek(QMainWindow):
my_ready_flag = 0
def __init__(self, parent=None):
super(SneakPeek, self).__init__(parent)
self.resize(250, 100)
self.mainLayout = QHBoxLayout()
self.wid_stack = QStackedWidget()
self.formGroupBox = QGroupBox("Enter one time credentials")
self.wid_stack.addWidget(self.formGroupBox)
self.main_wid = QTabWidget()
self.wid_stack.addWidget(self.main_wid)
self.wid_stack.setCurrentWidget(self.formGroupBox)
self.createLoginWidget()
def createSneakpeek(self):
self.jira_wid = QWidget()
self.tms_wid = QWidget()
self.outlook_wid = QWidget()
self.res_wid = QWidget()
self.createTmsWidget()
self.createJiraWidget()
self.createOutlookWidget()
self.createResWidget()
jiraLayout = QHBoxLayout()
jiraLayout.addWidget(self.JiraWidget)
self.jira_wid.setLayout(jiraLayout)
tmsLayout = QHBoxLayout()
tmsLayout.addWidget(self.TmsWidget)
self.tms_wid.setLayout(tmsLayout)
outlookLayout = QHBoxLayout()
outlookLayout.addWidget(self.OutlookWidget)
self.outlook_wid.setLayout(outlookLayout)
rrtlayout = QHBoxLayout()
rrtlayout.addWidget(self.ResWidget)
self.res_wid.setLayout(rrtlayout)
self.main_wid.addTab(self.jira_wid,"JIRA")
self.main_wid.addTab(self.tms_wid, "TMS")
self.main_wid.addTab(self.outlook_wid, "OUTLOOK")
self.main_wid.addTab(self.res_wid, "RRT")
self.wid_stack.setCurrentWidget(self.main_wid)
self.resize(900, 400)
# self.mainLayout.addWidget(self.main_wid)
# self.setLayout(self.mainLayout)
self.setWindowTitle("Sneakpeek")
self.changeStyle('Macintosh')
# sshFile="darkornage.stylesheet"
# with open(sshFile,"r") as fh:
# self.setStyleSheet(fh.read())
def changeStyle(self, styleName):
QApplication.setStyle(QStyleFactory.create(styleName))
def createJiraWidget(self):
jro = ShowJIRA()
output_df = jro.getIssuDat()
self.JiraWidget = QTabWidget()
jira = QWidget()
tabHeaderList = list(output_df.columns)
tabIndexList = list(output_df.index)
tableWidget = QTableWidget(len(tabIndexList),len(tabHeaderList))
tableWidget.setHorizontalHeaderLabels(tabHeaderList)
for i in tabHeaderList:
for j in tabIndexList:
tableWidget.setItem(j,tabHeaderList.index(i), QTableWidgetItem(str(output_df.loc[j,i])))
tableWidget.resizeColumnsToContents()
jirahbox = QHBoxLayout()
jirahbox.setContentsMargins(5,5,5,5)
jirahbox.addWidget(tableWidget)
jira.setLayout(jirahbox)
self.JiraWidget.addTab(jira,'JIRA')
def createResWidget(self) :
rro = showRes()
output_df = rro.getResourcesData()
self.ResWidget = QTabWidget()
rrt = QWidget()
tabHeaderList = ['Resource', 'StartDate', 'EndDate']
tabIndexList = list(output_df.index)
tableWidget = QTableWidget(len(tabIndexList), len(tabHeaderList))
tableWidget.setHorizontalHeaderLabels(tabHeaderList)
for i in tabHeaderList:
for j in tabIndexList:
tableWidget.setItem(j,tabHeaderList.index(i), QTableWidgetItem(str(output_df.loc[j,i])))
tableWidget.resizeColumnsToContents()
reshbox = QHBoxLayout()
reshbox.setContentsMargins(5, 5, 5, 5)
reshbox.addWidget(tableWidget)
rrt.setLayout(reshbox)
self.ResWidget.addTab(rrt, 'Showing Resource Reservation for 2 weeks')
self.ResWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
def createOutlookWidget(self):
olo = Outlook_task()
output_df = olo.getCalendarEntry()
self.OutlookWidget = QTabWidget()
outlook = QWidget()
tabHeaderList = list(output_df.columns)
tabIndexList = list(output_df.index)
tableWidget = QTableWidget(len(tabIndexList), len(tabHeaderList))
tableWidget.setHorizontalHeaderLabels(tabHeaderList)
for i in tabHeaderList:
for j in tabIndexList:
tableWidget.setItem(j,tabHeaderList.index(i), QTableWidgetItem(str(output_df.loc[j,i])))
tableWidget.resizeColumnsToContents()
oulookhbox = QHBoxLayout()
oulookhbox.setContentsMargins(5, 5, 5, 5)
oulookhbox.addWidget(tableWidget)
outlook.setLayout(oulookhbox)
self.OutlookWidget.addTab(outlook, 'Outlook events')
self.OutlookWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
def createTmsWidget(self):
tmo = Tms_task(Tms_task.username, Tms_task.password)
output_df = tmo.assigned_func()
self.TmsWidget = QTabWidget()
if output_df != None:
tms_assigned = self.createAssignedWidget(output_df[0])
self.TmsWidget.addTab(tms_assigned, 'TMS Assigned by me')
tms_assigned1 = self.createAssignedWidget(output_df[1])
self.TmsWidget.addTab(tms_assigned1, 'TMS Assigned to me')
tms_jobqueue = self.createAssignedWidget(output_df[2])
self.TmsWidget.addTab(tms_jobqueue, 'BISTQ Job Queue Status')
def createAssignedWidget(self, df):
tms = QWidget()
tabHeaderList = list(df.columns)
tabIndexList = list(df.index)
tableWidget = QTableWidget(len(tabIndexList), len(tabHeaderList))
tableWidget.setHorizontalScrollBar = 0
tableWidget.setHorizontalHeaderLabels(tabHeaderList)
for i in tabHeaderList:
for j in tabIndexList:
tableWidget.setItem(j,tabHeaderList.index(i), QTableWidgetItem(df.loc[j,i]))
tableWidget.resizeColumnsToContents()
tmshbox = QHBoxLayout()
tmshbox.setContentsMargins(5, 5, 5, 5)
tmshbox.addWidget(tableWidget)
tms.setLayout(tmshbox)
return tms
def createLoginWidget(self):
#mainLayout = QVBoxLayout()
# self.setLayout(mainLayout)
# #self.changeStyle('Plastique')
# sshFile="darkornage.stylesheet"
# with open(sshFile,"r") as fh:
# self.setStyleSheet(fh.read())
self.setWindowTitle("SneakPeek")
layout = QFormLayout()
self.username = QLineEdit()
self.password = QLineEdit()
self.submit = QPushButton("Submit")
self.submit.clicked.connect(self.closeLogin)
self.password.setEchoMode(QLineEdit.Password)
layout.addRow(QLabel("Name:"), self.username)
layout.addRow(QLabel("Password:"), self.password)
layout.addRow(self.submit)
self.formGroupBox.setLayout(layout)
self.setCentralWidget(self.wid_stack)
def closeLogin(self):
Tms_task.username = self.username.text()
Tms_task.password = self.password.text()
self.submit.setEnabled(False)
self.createSneakpeek()
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
dialog1 = SneakPeek()
app.processEvents()
dialog1.show()
sys.exit(app.exec_())