def webViewFormTest(self): """Just as a demo, load a google search in a web view and use the qt api to fill in a search term""" self.webView = qt.QWebView() self.webView.settings().setAttribute( qt.QWebSettings.DeveloperExtrasEnabled, True) self.webView.connect('loadFinished(bool)', self.webViewFormLoadedCallback) self.webView.show() u = qt.QUrl('http://www.google.com') self.webView.setUrl(u)
def webViewTest(self): self.webView = qt.QWebView() html = """ <a href="reslicing">Run reslicing test</a> <p> <a href="chart">Run chart test</a> """ self.webView.setHtml(html) self.webView.page().setLinkDelegationPolicy( qt.QWebPage.DelegateAllLinks) self.webView.connect('linkClicked(QUrl)', self.webViewCallback) self.webView.show()
def webViewTest(self): self.webView = qt.QWebView() html = """ <a href="reslicing">Run reslicing test</a> <p> <a href="chart">Run chart test</a> """ self.webView.setHtml(html) self.webView.settings().setAttribute( qt.QWebSettings.DeveloperExtrasEnabled, True) self.webView.page().setLinkDelegationPolicy( qt.QWebPage.DelegateAllLinks) self.webView.connect('linkClicked(QUrl)', self.webViewCallback) self.webView.show()
def setup(self): # Instantiate and connect widgets ... # reload button # (use this during development, but remove it when delivering # your module to users) self.reloadButton = qt.QPushButton("Reload") self.reloadButton.toolTip = "Reload this module." self.reloadButton.name = "MurineTrial Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # reload and test button # (use this during development, but remove it when delivering # your module to users) self.reloadAndTestButton = qt.QPushButton("Reload and Test") self.reloadAndTestButton.toolTip = "Reload this module and then run the self tests." self.layout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # Collapsible button measurementsCollapsibleButton = ctk.ctkCollapsibleButton() measurementsCollapsibleButton.text = "Materials" self.layout.addWidget(measurementsCollapsibleButton) # Layout within the measurements collapsible button measurementsFormLayout = qt.QFormLayout(measurementsCollapsibleButton) # list of materials in the trial measurementsFormLayout.addWidget(qt.QLabel("Individual Segmentations")) self.materialsScrollArea = qt.QScrollArea() measurementsFormLayout.addWidget(self.materialsScrollArea) self.materialsListWidget = qt.QListWidget() self.materialsScrollArea.setWidget(self.materialsListWidget) self.materialsScrollArea.setWidgetResizable(True) self.materialsListWidget.setProperty( 'SH_ItemView_ActivateItemOnSingleClick', 1) self.materialsListWidget.connect('activated(QModelIndex)', self.onMaterialActivated) # populate it materialKeys = self.logic.materials.keys() materialKeys.sort() for materialKey in materialKeys: self.materialsListWidget.addItem(materialKey) # list of sampleIDs in the trial measurementsFormLayout.addWidget( qt.QLabel("Segmentation Comparisions")) self.sampleIDsScrollArea = qt.QScrollArea() measurementsFormLayout.addWidget(self.sampleIDsScrollArea) self.sampleIDsListWidget = qt.QListWidget() self.sampleIDsScrollArea.setWidget(self.sampleIDsListWidget) self.sampleIDsScrollArea.setWidgetResizable(True) self.sampleIDsListWidget.setProperty( 'SH_ItemView_ActivateItemOnSingleClick', 1) self.sampleIDsListWidget.connect('activated(QModelIndex)', self.onSampleIDActivated) # populate it for sampleID in self.logic.gigSegComparisonSampleIDs(): self.sampleIDsListWidget.addItem(sampleID) # list of retestIDs in the trial measurementsFormLayout.addWidget(qt.QLabel("Repeatability Tests")) self.retestIDsScrollArea = qt.QScrollArea() measurementsFormLayout.addWidget(self.retestIDsScrollArea) self.retestIDsListWidget = qt.QListWidget() self.retestIDsScrollArea.setWidget(self.retestIDsListWidget) self.retestIDsScrollArea.setWidgetResizable(True) self.retestIDsListWidget.setProperty( 'SH_ItemView_ActivateItemOnSingleClick', 1) self.retestIDsListWidget.connect('activated(QModelIndex)', self.onRetestActivated) # populate it for retestID in self.logic.retestComparisonSampleIDs(): self.retestIDsListWidget.addItem(retestID) # process all button processAllButton = qt.QPushButton("Process All") processAllButton.toolTip = "Loads all subjecs at all timepoints." measurementsFormLayout.addWidget(processAllButton) processAllButton.connect('clicked(bool)', self.logic.processAll) # results area self.resultsView = qt.QWebView() self.resultsView.minimumSize = qt.QSize(100, 100) policy = qt.QSizePolicy() policy.setHorizontalPolicy(qt.QSizePolicy.Ignored) self.resultsView.setSizePolicy(policy) self.layout.addWidget(self.resultsView) # Add vertical spacer self.layout.addStretch(1)