-
Notifications
You must be signed in to change notification settings - Fork 0
/
DomainJoinerInterface.py
510 lines (486 loc) · 27.8 KB
/
DomainJoinerInterface.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# -*- coding: utf-8 -*-
# Domain Joiner Program
# It runs well on Linux based operating systems.
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
import sys
from DomainJoinerBackEnd import *
domainList = list()
# Main Window Interface Code
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.setEnabled(True)
Dialog.setFixedSize(500, 460)
Dialog.setAutoFillBackground(False)
Dialog.setStyleSheet("QMainWindow\n"
"{\n"
"background-image: url('images/arkaplan_1.png');\n"
"}")
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(Dialog)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(20, 110, 161, 22))
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
self.HL2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
self.HL2.setContentsMargins(0, 0, 0, 0)
self.HL2.setObjectName("HL2")
self.cnameLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(246, 246, 245))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(119, 119, 118))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(159, 159, 157))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(246, 246, 245))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(246, 246, 245))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(119, 119, 118))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(159, 159, 157))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(246, 246, 245))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
brush = QtGui.QBrush(QtGui.QColor(119, 119, 118))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
brush = QtGui.QBrush(QtGui.QColor(246, 246, 245))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
brush = QtGui.QBrush(QtGui.QColor(119, 119, 118))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
brush = QtGui.QBrush(QtGui.QColor(159, 159, 157))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
brush = QtGui.QBrush(QtGui.QColor(119, 119, 118))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(119, 119, 118))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(238, 238, 236))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
self.cnameLabel.setPalette(palette)
font = QtGui.QFont()
font.setFamily("URW Gothic L")
font.setPointSize(11)
font.setBold(True)
font.setWeight(75)
self.cnameLabel.setFont(font)
self.cnameLabel.setObjectName("cnameLabel")
self.HL2.addWidget(self.cnameLabel)
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(Dialog)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(20, 140, 461, 31))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.HL3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.HL3.setContentsMargins(0, 0, 0, 0)
self.HL3.setObjectName("HL3")
self.newcnameLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_3)
font = QtGui.QFont()
font.setFamily("URW Gothic L")
font.setPointSize(11)
font.setBold(True)
font.setWeight(75)
self.newcnameLabel.setFont(font)
self.newcnameLabel.setObjectName("newcnameLabel")
self.HL3.addWidget(self.newcnameLabel)
self.newcname = QtWidgets.QLineEdit(self.horizontalLayoutWidget_3)
self.newcname.setObjectName("newcname")
self.HL3.addWidget(self.newcname)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(Dialog)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(20, 180, 461, 221))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.HL4 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.HL4.setContentsMargins(0, 0, 0, 0)
self.HL4.setObjectName("HL4")
self.membershipof = QtWidgets.QGroupBox(self.horizontalLayoutWidget_4)
self.membershipof.setTitle("")
self.membershipof.setObjectName("membershipof")
self.localRadio = QtWidgets.QRadioButton(self.membershipof)
self.localRadio.setGeometry(QtCore.QRect(10, 30, 101, 20))
self.localRadio.setStyleSheet("QRadioButton\n"
"{\n"
"color: #6f85e4;\n"
"font-weight: bold;\n"
"}")
self.localRadio.setObjectName("localRadio")
self.domainRadio = QtWidgets.QRadioButton(self.membershipof)
self.domainRadio.setGeometry(QtCore.QRect(10, 100, 101, 20))
self.domainRadio.setStyleSheet("QRadioButton\n"
"{\n"
"color: #6f85e4;\n"
"font-weight: bold;\n"
"}")
self.domainRadio.setObjectName("domainRadio")
self.localLabel = QtWidgets.QLabel(self.membershipof)
self.localLabel.setGeometry(QtCore.QRect(30, 50, 421, 41))
self.localLabel.setOpenExternalLinks(False)
self.localLabel.setObjectName("localLabel")
self.domainname = QtWidgets.QLineEdit(self.membershipof)
self.domainname.setGeometry(QtCore.QRect(30, 120, 411, 21))
self.domainname.setObjectName("domainname")
self.domainLabel = QtWidgets.QLabel(self.membershipof)
self.domainLabel.setGeometry(QtCore.QRect(30, 140, 411, 71))
self.domainLabel.setObjectName("domainLabel")
self.verticalLayoutWidget = QtWidgets.QWidget(self.membershipof)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 114, 22))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.membershipofLabel = QtWidgets.QLabel(self.verticalLayoutWidget)
font = QtGui.QFont()
font.setFamily("URW Gothic L")
font.setPointSize(11)
font.setBold(True)
font.setWeight(75)
self.membershipofLabel.setFont(font)
self.membershipofLabel.setObjectName("membershipofLabel")
self.verticalLayout_2.addWidget(self.membershipofLabel)
self.localLabel.raise_()
self.localRadio.raise_()
self.domainname.raise_()
self.domainRadio.raise_()
self.domainLabel.raise_()
self.verticalLayoutWidget.raise_()
self.HL4.addWidget(self.membershipof)
self.horizontalLayoutWidget = QtWidgets.QWidget(Dialog)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 410, 461, 31))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.HL5 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.HL5.setContentsMargins(0, 0, 0, 0)
self.HL5.setObjectName("HL5")
self.confirmButton = QtWidgets.QPushButton(self.horizontalLayoutWidget)
self.confirmButton.setObjectName("confirmButton")
self.HL5.addWidget(self.confirmButton)
self.cancelButton = QtWidgets.QPushButton(self.horizontalLayoutWidget)
self.cancelButton.setObjectName("cancelButton")
self.HL5.addWidget(self.cancelButton)
self.horizontalLayoutWidget_5 = QtWidgets.QWidget(Dialog)
self.horizontalLayoutWidget_5.setGeometry(QtCore.QRect(20, 10, 461, 102))
self.horizontalLayoutWidget_5.setObjectName("horizontalLayoutWidget_5")
self.HL1 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_5)
self.HL1.setContentsMargins(0, 0, 0, 0)
self.HL1.setObjectName("HL1")
self.firstLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_5)
self.firstLabel.setObjectName("firstLabel")
self.HL1.addWidget(self.firstLabel)
self.logoLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_5)
self.logoLabel.setMaximumSize(QtCore.QSize(100, 100))
self.logoLabel.setAutoFillBackground(False)
self.logoLabel.setText("")
self.logoLabel.setScaledContents(True)
self.logoLabel.setAlignment(QtCore.Qt.AlignCenter)
self.logoLabel.setObjectName("logoLabel")
self.HL1.addWidget(self.logoLabel)
self.horizontalLayoutWidget_6 = QtWidgets.QWidget(Dialog)
self.horizontalLayoutWidget_6.setGeometry(QtCore.QRect(190, 110, 291, 21))
self.horizontalLayoutWidget_6.setObjectName("horizontalLayoutWidget_6")
self.HL2_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_6)
self.HL2_2.setContentsMargins(0, 0, 0, 0)
self.HL2_2.setObjectName("HL2_2")
self.cname = QtWidgets.QLabel(self.horizontalLayoutWidget_6)
self.cname.setStyleSheet("QLabel\n"
"{\n"
"color: white\n"
"}")
self.cname.setObjectName("cname")
self.HL2_2.addWidget(self.cname)
# Adding Action and Events
self.domainRadio.toggled.connect(self.domainRadio_clicked)
self.confirmButton.clicked.connect(self.confirmButtonAction)
self.cancelButton.clicked.connect(app.exit)
self.localordomain()
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Domain Joiner"))
self.cnameLabel.setText(_translate("Dialog",
"<html><head/><body><p><span style=\" color:#eeeeec;\">Computer Name:</span></p></body></html>"))
self.newcnameLabel.setText(_translate("Dialog",
"<html><head/><body><p><span style=\" color:#eeeeec;\">New Computer Name:</span></p></body></html>"))
self.localRadio.setText(_translate("Dialog", "Local"))
self.domainRadio.setText(_translate("Dialog", "Domain"))
self.localLabel.setText(_translate("Dialog",
"<html><head/><body><p><span style=\" font-size:8pt; color:#888a85;\">Choose local if you aren\'t a system administrator. Thus, you will change</span></p><p><span style=\" font-size:8pt; color:#888a85;\">only computer name.</span></p></body></html>"))
self.domainLabel.setText(_translate("Dialog",
"<html><head/><body><p align=\"justify\"><span style=\" font-size:8pt; color:#888a85;\">All necessary configuration files will be reconfigured if a new domain</span></p><p align=\"justify\"><span style=\" font-size:8pt; color:#888a85;\">address is chosen as domain then an authorized user will be asked to</span></p><p align=\"justify\"><span style=\" font-size:8pt; color:#888a85;\">login to add the system to new domain.</span></p></body></html>"))
self.membershipofLabel.setText(_translate("Dialog",
"<html><head/><body><p><span style=\" color:#eeeeec;\">Membership of</span></p></body></html>"))
self.confirmButton.setText(_translate("Dialog", "Confirm"))
self.cancelButton.setText(_translate("Dialog", "Cancel"))
self.firstLabel.setText(_translate("Dialog",
"<html><head/><body><p><span style=\" color:#ffffff;\">Enter a new computer name or do not make any</span></p><p><span style=\" color:#ffffff;\">changes to keep using the same computer name.</span></p></body></html>"))
computer_name = str(gethostname())
cn1 = computer_name.replace("b'", "")
cn2 = cn1[:-3]
self.cname.setText(_translate("Dialog", str(cn2)))
# Main Window Action Functions Code
# This function determines whether the user is in local or domain when the screen is first opened.
def localordomain(self):
a = list()
sonuc = LocalorDomain()
a.append(sonuc)
if (sonuc == False): # For Local
self.localRadio.setChecked(True)
self.logoLabel.setPixmap(QtGui.QPixmap("images/Local-icon.png"))
elif (sonuc == True): # For Domain
realmname = realmnameUpper()
liste = str(realmname).split(": ")
self.domainname.setText(liste[1][:-3])
self.domainRadio.setChecked(True)
self.logoLabel.setPixmap(QtGui.QPixmap("images/Domain-icon.png"))
# This function determines the domain line edit activity.
def domainRadio_clicked(self):
if (self.domainRadio.isChecked() == True):
self.domainname.setEnabled(True)
else:
self.domainname.setEnabled(False)
# This function determines "Confirm" button actions and events.
def confirmButtonAction(self):
if (self.localRadio.isChecked() == True):
if (checkHostname(self.newcname.text(), self.cname.text()) == True):
addDomainExt(self.newcname.text(), "None")
self.domainname.clear()
leave = leaveDomain()
if (leave == True):
msg = QMessageBox()
self.icon = QtGui.QIcon()
msg.setIcon(QMessageBox.Critical)
msg.setWindowIcon(self.icon)
msg.setText("You leaved domain and updated domain name for local.")
msg.setWindowTitle("Info")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
msg.exec_()
self.cname.setText(self.newcname.text())
else:
return
elif (self.domainRadio.isChecked() == True):
realmnameUpper = self.domainname.text().upper()
self.domainname.setText(realmnameUpper)
domainList.append(self.domainname.text())
Dialog = QDialog()
ui = Ui_UserLogin()
ui.setupUi2(Dialog)
Dialog.show()
Dialog.exec_()
# getrealmname(realmnameUpper)
# User Authentication Window Interface Code
class Ui_UserLogin(object):
def setupUi2(self, UserLogin):
UserLogin.setObjectName("UserLogin")
UserLogin.resize(361, 344)
self.horizontalLayoutWidget_2 = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(30, 230, 91, 21))
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
self.HL2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
self.HL2.setContentsMargins(0, 0, 0, 0)
self.HL2.setObjectName("HL2")
self.usernameLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_2)
self.usernameLabel.setObjectName("usernameLabel")
self.HL2.addWidget(self.usernameLabel)
self.horizontalLayoutWidget_6 = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget_6.setGeometry(QtCore.QRect(130, 230, 181, 25))
self.horizontalLayoutWidget_6.setObjectName("horizontalLayoutWidget_6")
self.HL2_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_6)
self.HL2_2.setContentsMargins(0, 0, 0, 0)
self.HL2_2.setObjectName("HL2_2")
self.username = QtWidgets.QLineEdit(self.horizontalLayoutWidget_6)
self.username.setFocusPolicy(QtCore.Qt.WheelFocus)
self.username.setObjectName("username")
self.HL2_2.addWidget(self.username)
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(30, 260, 91, 21))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.HL2_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.HL2_3.setContentsMargins(0, 0, 0, 0)
self.HL2_3.setObjectName("HL2_3")
self.passwordLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_3)
self.passwordLabel.setObjectName("passwordLabel")
self.HL2_3.addWidget(self.passwordLabel)
self.horizontalLayoutWidget_7 = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget_7.setGeometry(QtCore.QRect(130, 260, 181, 25))
self.horizontalLayoutWidget_7.setObjectName("horizontalLayoutWidget_7")
self.HL2_4 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_7)
self.HL2_4.setContentsMargins(0, 0, 0, 0)
self.HL2_4.setObjectName("HL2_4")
self.password = QtWidgets.QLineEdit(self.horizontalLayoutWidget_7)
self.password.setEchoMode(QtWidgets.QLineEdit.Password)
self.password.setObjectName("password")
self.HL2_4.addWidget(self.password)
self.horizontalLayoutWidget = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(110, 20, 152, 152))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.imageLabel = QtWidgets.QLabel(self.horizontalLayoutWidget)
self.imageLabel.setMaximumSize(QtCore.QSize(150, 150))
self.imageLabel.setText("")
self.imageLabel.setPixmap(QtGui.QPixmap("/home/test/Masaüstü/a.png"))
self.imageLabel.setScaledContents(True)
self.imageLabel.setAlignment(QtCore.Qt.AlignCenter)
self.imageLabel.setObjectName("imageLabel")
self.horizontalLayout.addWidget(self.imageLabel)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(20, 170, 311, 44))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.pleaseLabel = QtWidgets.QLabel(self.horizontalLayoutWidget_4)
self.pleaseLabel.setObjectName("pleaseLabel")
self.horizontalLayout_2.addWidget(self.pleaseLabel)
self.horizontalLayoutWidget_5 = QtWidgets.QWidget(UserLogin)
self.horizontalLayoutWidget_5.setGeometry(QtCore.QRect(130, 290, 181, 31))
self.horizontalLayoutWidget_5.setObjectName("horizontalLayoutWidget_5")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_5)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.loginButton = QtWidgets.QPushButton(self.horizontalLayoutWidget_5)
self.loginButton.setObjectName("loginButton")
self.horizontalLayout_3.addWidget(self.loginButton)
self.horizontalLayoutWidget_2.raise_()
self.horizontalLayoutWidget_6.raise_()
self.horizontalLayoutWidget_3.raise_()
self.horizontalLayoutWidget_7.raise_()
self.horizontalLayoutWidget.raise_()
self.imageLabel.raise_()
self.horizontalLayoutWidget_4.raise_()
self.horizontalLayoutWidget_5.raise_()
self.pleaseLabel.raise_()
# Adding Action and Events
self.loginButton.clicked.connect(self.loginButtonAction)
self.retranslateUi(UserLogin)
QtCore.QMetaObject.connectSlotsByName(UserLogin)
def retranslateUi(self, UserLogin):
_translate = QtCore.QCoreApplication.translate
UserLogin.setWindowTitle(_translate("UserLogin", "Domain Joiner"))
self.usernameLabel.setText(_translate("UserLogin",
"<html><head/><body><p align=\"right\"><span style=\" font-weight:600;\">Username:</span></p></body></html>"))
self.passwordLabel.setText(_translate("UserLogin",
"<html><head/><body><p align=\"right\"><span style=\" font-weight:600;\">Password:</span></p></body></html>"))
self.pleaseLabel.setText(_translate("UserLogin",
"<html><head/><body><p align=\"center\">Please login with username and password</p><p align=\"center\">for user authentication.</p></body></html>"))
self.loginButton.setText(_translate("UserLogin", "Login"))
# This function determines "Login" button action and events.
def loginButtonAction(self):
hostnameParameter = gethostname()
message = checkUsernamePasswordDomain(str(hostnameParameter), self.username.text(), domainList[0])
msg = QMessageBox()
self.icon = QtGui.QIcon()
msg.setIcon(QMessageBox.Critical)
msg.setWindowIcon(self.icon)
msg.setText(message)
msg.setWindowTitle("Info")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
msg.exec_()
domainList.clear()
if __name__ == "__main__":
app = QApplication(sys.argv)
MainWindow = QMainWindow()
ui = Ui_Dialog()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())