6 """ |
6 """ |
7 Module implementing a dialog to run the Flask server. |
7 Module implementing a dialog to run the Flask server. |
8 """ |
8 """ |
9 |
9 |
10 import re |
10 import re |
|
11 import webbrowser |
11 |
12 |
12 from PyQt6.QtCore import QProcess, Qt, QTimer, pyqtSlot |
13 from PyQt6.QtCore import QProcess, Qt, QTimer, pyqtSlot |
13 from PyQt6.QtGui import QTextCharFormat |
14 from PyQt6.QtGui import QTextCharFormat |
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QMenu |
15 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QMenu |
15 |
16 |
151 ok = self.__process.waitForStarted(10000) |
152 ok = self.__process.waitForStarted(10000) |
152 if not ok: |
153 if not ok: |
153 EricMessageBox.critical( |
154 EricMessageBox.critical( |
154 None, |
155 None, |
155 self.tr("Run Flask Server"), |
156 self.tr("Run Flask Server"), |
156 self.tr( |
157 self.tr("""The Flask server process could not be started."""), |
157 """The Flask server process could not be""" """ started.""" |
|
158 ), |
|
159 ) |
158 ) |
160 else: |
159 else: |
161 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled( |
160 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled( |
162 False |
161 False |
163 ) |
162 ) |
241 def on_startBrowserButton_clicked(self): |
240 def on_startBrowserButton_clicked(self): |
242 """ |
241 """ |
243 Private slot to start a web browser with the server URL. |
242 Private slot to start a web browser with the server URL. |
244 """ |
243 """ |
245 if self.__plugin.getPreferences("UseExternalBrowser"): |
244 if self.__plugin.getPreferences("UseExternalBrowser"): |
246 import webbrowser |
|
247 |
|
248 webbrowser.open(self.__serverUrl) |
245 webbrowser.open(self.__serverUrl) |
249 else: |
246 else: |
250 ericApp().getObject("UserInterface").launchHelpViewer(self.__serverUrl) |
247 ericApp().getObject("UserInterface").launchHelpViewer(self.__serverUrl) |
251 |
248 |
252 @pyqtSlot() |
249 @pyqtSlot() |