def updateSettings(self): """ When the current format change (through the combobox), we update the settings widget using the current format provided settings widget. """ # We check if we have to open an URL data = self.cmbImporters.currentData() if data and data[:7] == "::URL::" and data[7:]: # FIXME: use functions.openURL after merge with feature/Exporters openURL(data[7:]) return F = self.currentFormat() self._format = F # Checking if we have a valid importer (otherwise a header) if not F: self.grpSettings.setEnabled(False) self.grpPreview.setEnabled(False) return self.grpSettings.setEnabled(True) self.grpPreview.setEnabled(True) self.settingsWidget = generalSettings() #TODO: custom format widget self.settingsWidget = F.settingsWidget(self.settingsWidget) # Set the settings widget in place self.setGroupWidget(self.grpSettings, self.settingsWidget) self.grpSettings.setMinimumWidth(200) # Clear file name self.setFileName("")
def updateUi(self, index): # We check if we have an URL to open data = self.cmbExporters.currentData() if data and data[:7] == "::URL::" and data[7:]: openURL(data[7:]) E, F = self.getSelectedExporter() if not E or not F or not F.implemented: self.setWidgetsEnabled(False) return self.setWidgetsEnabled(True) self.grpSettings.setVisible(F.requires["Settings"]) self.grpPreview.setVisible(F.requires["Preview"]) self.btnPreview.setVisible(F.requires["Preview"]) if F.requires["Settings"]: self.settingsWidget = F.settingsWidget() self.setGroupWidget(self.grpSettings, self.settingsWidget) if F.requires["Preview"]: self.previewWidget = F.previewWidget() self.setGroupWidget(self.grpPreview, self.previewWidget) self.splitter.setStretchFactor(0, 3) self.splitter.setStretchFactor(1, 6)
def mouseReleaseEvent(self, event): textEditView.mouseReleaseEvent(self, event) onRect = [r for r in self.clickRects if r.rect.contains(event.pos())] if onRect and event.modifiers() & Qt.ControlModifier: ct = onRect[0] if ct.regex == self.automaticLinkRegex: url = ct.texts[2] or ct.texts[4] elif ct.regex == self.imageRegex: url = ct.texts[2] elif ct.regex == self.inlineLinkRegex: url = ct.texts[2] F.openURL(url) qApp.restoreOverrideCursor()