(self)
| 60 | pass |
| 61 | |
| 62 | def setup(self): |
| 63 | ScriptedLoadableModuleWidget.setup(self) |
| 64 | |
| 65 | # start button |
| 66 | self.startServerButton = qt.QPushButton(_("Start server")) |
| 67 | self.startServerButton.name = "StartWebServer" |
| 68 | self.startServerButton.toolTip = _("Start web server with the selected options.") |
| 69 | self.layout.addWidget(self.startServerButton) |
| 70 | |
| 71 | # stop button |
| 72 | self.stopServerButton = qt.QPushButton(_("Stop server")) |
| 73 | self.stopServerButton.name = "StopWebServer" |
| 74 | self.stopServerButton.toolTip = _("Stop the web server.") |
| 75 | self.layout.addWidget(self.stopServerButton) |
| 76 | |
| 77 | # open browser page |
| 78 | self.localConnectionButton = qt.QPushButton(_("Open static pages in external browser")) |
| 79 | self.localConnectionButton.toolTip = _("Open a connection to the server on the local machine with your system browser.") |
| 80 | self.layout.addWidget(self.localConnectionButton) |
| 81 | |
| 82 | # open slicer widget |
| 83 | self.localQtConnectionButton = qt.QPushButton(_("Open static pages in internal browser")) |
| 84 | self.localQtConnectionButton.toolTip = _("Open a connection with Qt to the server on the local machine.") |
| 85 | self.layout.addWidget(self.localQtConnectionButton) |
| 86 | |
| 87 | # log window |
| 88 | self.log = qt.QTextEdit() |
| 89 | self.log.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) |
| 90 | self.log.readOnly = True |
| 91 | self.layout.addWidget(self.log) |
| 92 | self.logMessage("<p>Status: <i>Idle</i>\n") |
| 93 | |
| 94 | # clear log button |
| 95 | self.clearLogButton = qt.QPushButton(_("Clear Log")) |
| 96 | self.clearLogButton.toolTip = _("Clear the log window.") |
| 97 | self.layout.addWidget(self.clearLogButton) |
| 98 | |
| 99 | # TODO: warning dialog on first connect |
| 100 | # TODO: config option for port |
| 101 | # TODO: config option for optional plugins |
| 102 | |
| 103 | self.advancedCollapsibleButton = ctk.ctkCollapsibleButton() |
| 104 | self.advancedCollapsibleButton.text = _("Advanced") |
| 105 | self.layout.addWidget(self.advancedCollapsibleButton) |
| 106 | advancedFormLayout = qt.QFormLayout(self.advancedCollapsibleButton) |
| 107 | self.advancedCollapsibleButton.collapsed = True |
| 108 | |
| 109 | # handlers |
| 110 | |
| 111 | self.enableCORSCheck = qt.QCheckBox() |
| 112 | self.enableCORSCheck.toolTip = _("Enable Cross Origin Resource Sharing (stop server to change option)." |
| 113 | " Warning: this option allows any web page to access the server.") |
| 114 | advancedFormLayout.addRow(_("Enable CORS: "), self.enableCORSCheck) |
| 115 | |
| 116 | self.enableSlicerHandler = qt.QCheckBox() |
| 117 | self.enableSlicerHandler.toolTip = _("Enable remote control of Slicer application (stop server to change option)") |
| 118 | advancedFormLayout.addRow(_("Slicer API: "), self.enableSlicerHandler) |
| 119 |
nothing calls this directly
no test coverage detected