5
5
import sys
6
6
7
7
import requests
8
+ from PyQt5 import QtCore
8
9
from PyQt5 .QtGui import QFont
9
10
from PyQt5 .QtWidgets import QApplication , QWidget , QLabel , QPushButton , QVBoxLayout , QRadioButton , QSpinBox
10
11
@@ -16,9 +17,16 @@ def __init__(self):
16
17
self .result = None
17
18
self .status = None
18
19
19
- self .text_label = QLabel ()
20
- self .text_label .setText ("Port Select:" )
21
- self .text_label .setFont (QFont ('Arial' , 13 , QFont .Bold ))
20
+ self .port_label = QLabel ()
21
+
22
+ self .port_label .setText ("Port Select:" )
23
+ self .port_label .setFont (QFont ('Arial' , 13 , QFont .Bold ))
24
+
25
+ self .site_label = QLabel ()
26
+ self .site_label .setOpenExternalLinks (True )
27
+ self .site_label .setFont (QFont ('Arial' , 13 , QFont .Bold ))
28
+ self .site_label .setAlignment (QtCore .Qt .AlignCenter )
29
+ self .site_label .setVisible (False )
22
30
23
31
self .maintenance = QRadioButton ("Maintenance" )
24
32
self .maintenance .setFont (QFont ('Arial' , 13 , QFont .Bold ))
@@ -44,9 +52,10 @@ def __init__(self):
44
52
self .layout = QVBoxLayout (self )
45
53
self .layout .addWidget (self .startButton )
46
54
self .layout .addWidget (self .stopButton )
47
- self .layout .addWidget (self .text_label )
55
+ self .layout .addWidget (self .port_label )
48
56
self .layout .addWidget (self .portInput )
49
57
self .layout .addWidget (self .maintenance )
58
+ self .layout .addWidget (self .site_label )
50
59
self .setLayout (self .layout )
51
60
52
61
self .startButton .clicked .connect (self .start_app )
@@ -79,11 +88,14 @@ def start_app(self, ):
79
88
self .portInput .setReadOnly (True )
80
89
self .startButton .setStyleSheet ("background-color : yellow" )
81
90
self .stopButton .setStyleSheet ("background-color : #fc4503" )
91
+ self .site_label .setText ("<a href=\" http://127.0.0.1:" + self .portInput .text () + "\" >'http://127.0.0.1:" + self .portInput .text () + "'</a>" )
92
+ self .site_label .setVisible (True )
82
93
self .status = 1
83
94
84
95
def stop_app (self ):
85
96
try :
86
97
subprocess .Popen (['taskkill' , '/F' , '/T' , '/PID' , str (self .result .pid )])
98
+ self .site_label .setVisible (False )
87
99
if not self .maintenance .isChecked ():
88
100
self .portInput .setReadOnly (False )
89
101
else :
0 commit comments