def __init__(self, parent): QWebView.__init__(self, parent) s = self.settings() s.setAttribute(s.JavascriptEnabled, False) self.page().setLinkDelegationPolicy(self.page().DelegateAllLinks) self.setAttribute(Qt.WA_OpaquePaintEvent, False) palette = self.palette() palette.setBrush(QPalette.Base, Qt.transparent) self.page().setPalette(palette) self.setVisible(False)
def __init__(self, parent): QWebView.__init__(self, parent) s = self.settings() s.setAttribute(s.JavascriptEnabled, False) self.page().setLinkDelegationPolicy(self.page().DelegateAllLinks) self.setAttribute(Qt.WA_OpaquePaintEvent, False) palette = self.palette() palette.setBrush(QPalette.Base, Qt.transparent) self.page().setPalette(palette) self.css = P('templates/book_details.css', data=True).decode('utf-8') self.setVisible(False)
def __init__(self, *args): QWebView.__init__(self, *args) # Allow the network panel to grow as large as desired self.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)) self.manager = None self.ebook_network = None self.setMinimumWidth(80) self.loadFinished.connect(self.load_finished) self.curr_page = -1 self.loaded = False
def showHelpButtonClicked(self): if not hasattr(self, "helpview"): helpBasepath = "%s/help" % os.path.normpath( os.path.dirname(__file__)) helpUrl = QUrl( pathlib.Path("%s/index.html" % helpBasepath).as_uri()) cssUrl = QUrl(pathlib.Path("%s/help.css" % helpBasepath).as_uri()) self.helpview = QWebView() self.helpview.settings().setUserStyleSheetUrl(cssUrl) self.helpview.load(helpUrl) self.helpview.show()
def __init__(self, book_mi, annotations, parent=None): #QDialog.__init__(self, parent) self.prefs = plugin_prefs super(PreviewDialog, self).__init__(parent, 'annotations_preview_dialog') self.pl = QVBoxLayout(self) self.setLayout(self.pl) self.label = QLabel() self.label.setText("<b>" + _("{0} annotations · {1}").format( book_mi.reader_app, book_mi.title) + "</b>") self.label.setAlignment(Qt.AlignHCenter) self.pl.addWidget(self.label) self.wv = QWebView() self.wv.setHtml(annotations) self.pl.addWidget(self.wv) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Close) # self.buttonbox.addButton('Close', QDialogButtonBox.AcceptRole) self.buttonbox.setOrientation(Qt.Horizontal) # self.buttonbox.accepted.connect(self.close) self.buttonbox.rejected.connect(self.close) # self.connect(self.buttonbox, pyqtSignal('accepted()'), self.close) # self.connect(self.buttonbox, pyqtSignal('rejected()'), self.close) self.pl.addWidget(self.buttonbox) # Sizing sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) self.resize_dialog()
def __init__(self, parent, icon, prefs, html=None, page=None, title=''): self.prefs = prefs #QDialog.__init__(self, parent=parent) super(HelpView, self).__init__(parent, 'help_dialog') self.setWindowTitle(title) self.setWindowIcon(icon) self.l = QVBoxLayout(self) self.setLayout(self.l) self.wv = QWebView() if html is not None: self.wv.setHtml(html) elif page is not None: self.wv.load(QUrl(page)) self.wv.setMinimumHeight(100) self.wv.setMaximumHeight(16777215) self.wv.setMinimumWidth(400) self.wv.setMaximumWidth(16777215) self.wv.setGeometry(0, 0, 400, 100) self.wv.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.l.addWidget(self.wv) # Sizing sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) self.resize_dialog()
class CoordinatorDockWidget(QtWidgets.QDockWidget, FORM_CLASS): SectionInput = 1 SectionOutput = 2 SectionBoth = 3 SideRight = 1 SideLeft = 2 SideBoth = 3 closingPlugin = pyqtSignal() inputChanged = pyqtSignal() mapConnectionChanged = pyqtSignal(int, bool) def __init__(self, parent=None): """Constructor.""" super(CoordinatorDockWidget, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.decDegreeValidator = QDoubleValidator(0.0, 180.0, 8, parent=self) self.decDegreeValidator.setNotation(QDoubleValidator.StandardNotation) self.projectedValidator = QDoubleValidator(-999999999.0, 999999999.0, 4, parent=self) self._eastingLeftNorthingRight = True self._eastingInverted = False self._northingInverted = False self.sectionIsGeographic = { CoordinatorDockWidget.SectionInput: True, CoordinatorDockWidget.SectionOutput: True } self.setupUi(self) # setup some lists of the input for easier access later self._widgetlistInputDms = [ self.inLeft, self.inRight, self.inLeftSec, self.inRightSec, self.inLeftMin, self.inRightMin ] self._widgetlistInput = self._widgetlistInputDms + [ self.inLeftDec, self.inRightDec ] self.resetInterface() self.setupInternal() # need to init that after setupUi because of message icon label size messageIconWidgetSize = self.messageIcon.size() messageIconSize = QSize(messageIconWidgetSize.width() - 2, messageIconWidgetSize.height() - 2) self.warningPixmap = QIcon( ':/plugins/coordinator/icons/warning.svg').pixmap(messageIconSize) self.messageHideTimer = QTimer(parent=self) self.messageHideTimer.setSingleShot(True) self.messageHideTimer.timeout.connect(self.hideMessages) def setupInternal(self): self.leftDecimal.hide() self.rightDecimal.hide() self.leftDmsDisplay = DmsHandler(self.inLeft, self.inLeftMin, self.inLeftSec, 180) self.leftDmsDisplay.inputDidChange.connect( self.__inputFieldsChangedInternal) self.rightDmsDisplay = DmsHandler(self.inRight, self.inRightMin, self.inRightSec, 90) self.rightDmsDisplay.inputDidChange.connect( self.__inputFieldsChangedInternal) for dirButton in [self.leftDirButton, self.rightDirButton]: # see https://stackoverflow.com/questions/4578861/connecting-slots-and-signals-in-pyqt4-in-a-loop dirButton.clicked.connect( partial(self.toggleCardinalDirectionButton, dirButton)) for inputField in self._widgetlistInputDms: inputField.installEventFilter(self) for inputField in [self.inLeftDec, self.inRightDec]: inputField.textEdited.connect(self.__inputFieldsChangedInternal) inputField.setValidator(self.decDegreeValidator) inputField.installEventFilter(self) self.leftDecIncrementor = ValueIncrementor(self.inLeftDec, 180, -180) self.rightDecIncrementor = ValueIncrementor(self.inLeftDec, 90, -90) self.outputCrsConn.clicked.connect( partial(self.toggledMapConnection, CoordinatorDockWidget.SectionOutput)) self.copyLeft.clicked.connect( partial(self.copyResultToClipBoard, CoordinatorDockWidget.SideLeft)) self.copyRight.clicked.connect( partial(self.copyResultToClipBoard, CoordinatorDockWidget.SideRight)) self.copyResultComplete.clicked.connect( partial(self.copyResultToClipBoard, CoordinatorDockWidget.SideBoth)) self.clearInput.clicked.connect( partial(self.resetInterface, self.SectionBoth)) self.showHelp.clicked.connect(self.showHelpButtonClicked) def _setToolsEnabled(self, enabled, section=None): if (section == None): section = self.SectionBoth if (section & self.SectionInput): self.moveCanvas.setEnabled(enabled) if (section & self.SectionOutput): for widget in [ self.copyResultComplete, self.copyLeft, self.copyRight ]: widget.setEnabled(enabled) def resetInterface(self, section=None): if section == None: section = self.SectionBoth self.clearSection(section) self._setToolsEnabled(False, section) def eventFilter(self, obj, event): if (type(event) == QKeyEvent and event.type() == QEvent.KeyRelease): key = event.key() if (self.sectionIsGeographic[self.SectionInput] and event.text() == "-"): # maybe we should switch the hemisphere? if (obj in [ self.inLeft, self.inLeftDec, self.inLeftMin, self.inLeftSec ]): self.toggleCardinalDirectionButton(self.leftDirButton) else: self.toggleCardinalDirectionButton(self.rightDirButton) elif (key in [Qt.Key_Return, Qt.Key_Enter]): if (self.addFeatureButton.isEnabled()): #coordinatorLog("Clicking add Feature Button") self.addFeatureButton.click() #coordinatorLog("Yakub Key Event (Filter): %s (%s)" % (event.key(), event.text()) ) return super(CoordinatorDockWidget, self).eventFilter(obj, event) def __styleInputStyleSelectorForGeographicCrs(self, isGeographic): for widget in [self.geoLabel, self.inputAsDMS, self.inputAsDec]: widget.setEnabled(isGeographic) def setSectionIsGeographic(self, section, isGeographic): if (section & self.SectionInput): # switch validators for the decimal field, as we may support different ranges # switch to DMS view accordingly if isGeographic: self.inLeftDec.setValidator(self.decDegreeValidator) self.inRightDec.setValidator(self.decDegreeValidator) # switch to DMS view if it is selected self.setInputToDMS(self.inputAsDMS.isChecked()) else: self.inLeftDec.setValidator(self.projectedValidator) self.inRightDec.setValidator(self.projectedValidator) self.setInputToDMS(False) for widget in [ self.labelDecDegreeLeft, self.labelDecDegreeRight, self.leftDirButton, self.rightDirButton ]: widget.show() if isGeographic else widget.hide() self.__styleInputStyleSelectorForGeographicCrs(isGeographic) if (section & self.SectionOutput): for widget in [self.resultAsDMS, self.resultAsDec]: widget.setEnabled(isGeographic) self.sectionIsGeographic[section] = isGeographic def setSectionCrs(self, section, crs): #QgsMessageLog.logMessage("set SectionCrs, is Geographic: %s" % crs.isGeographic(), "Coordinator") self.setSectionIsGeographic(section, crs.isGeographic()) if (section == self.SectionInput): self.selectCrsButton.setText(crs.authid()) elif (section == self.SectionOutput): self.outputCrs.setText(crs.authid()) def setInputToDMS(self, isDms): if isDms: self.leftDMS.show() self.rightDMS.show() self.leftDecimal.hide() self.rightDecimal.hide() else: self.leftDMS.hide() self.rightDMS.hide() self.leftDecimal.show() self.rightDecimal.show() def setInputPoint(self, point): #QgsMessageLog.logMessage("%s/%s" % (point.x(), point.y())) if self.sectionIsGeographic[self.SectionInput]: precision = 9 # remove leading minus when setting decimal fields. The correct state for # the hemisphere buttons is applied in setDmsInputFromDecimal() later. xDec = abs(point.x()) yDec = abs(point.y()) else: precision = 3 xDec = point.x() yDec = point.y() self.inLeftDec.setText(QLocale().toString( xDec if self._eastingLeftNorthingRight else yDec, "f", precision)) self.inRightDec.setText(QLocale().toString( yDec if self._eastingLeftNorthingRight else xDec, "f", precision)) self.setDmsInputFromDecimal(point.x(), point.y()) self.__inputFieldsChangedInternal() def setDmsInputFromDecimal(self, x, y, setEastingNorthingInversion=True): xDMS = coordinatorDecimalToDms(x) yDMS = coordinatorDecimalToDms(y) #QgsMessageLog.logMessage(str(xDMS)) if (setEastingNorthingInversion): self.setEastingInverted(xDMS[0]) self.setNorthingInverted(yDMS[0]) leftDMS = xDMS if self._eastingLeftNorthingRight else yDMS rightDMS = yDMS if self._eastingLeftNorthingRight else xDMS self.inLeft.setText(QLocale().toString(leftDMS[1])) self.inLeftMin.setText(QLocale().toString(leftDMS[2])) self.inLeftSec.setText(QLocale().toString(leftDMS[3], "f", 2)) self.inRight.setText(QLocale().toString(rightDMS[1])) self.inRightMin.setText(QLocale().toString(rightDMS[2])) self.inRightSec.setText(QLocale().toString(rightDMS[3], "f", 2)) def setResultPoint(self, point): if self.sectionIsGeographic[CoordinatorDockWidget.SectionOutput]: if (self.resultAsDec.isChecked()): f = QgsCoordinateFormatter.FormatDecimalDegrees precision = 9 else: f = QgsCoordinateFormatter.FormatDegreesMinutesSeconds precision = 3 transformedX = QgsCoordinateFormatter.formatX( point.x(), f, precision) transformedY = QgsCoordinateFormatter.formatY( point.y(), f, precision) # if we use FormatDecimalDegrees QgsCoordinateFormatter produces # a string just with a QString::number(). Therefore the string is NOT # localized. But QgsCoordinateFormatter provides coordinate wrapping already # so we just hack the correct decimal sign into the string and should be # fine... juuust fine! decPoint = QLocale().decimalPoint() #coordinatorLog("Decimal Point: %s" % decPoint) if (decPoint != "."): #coordinatorLog("replace!!") transformedX = transformedX.replace(".", decPoint) transformedY = transformedY.replace(".", decPoint) else: #self.log(" -> using decimal output") transformedX = QLocale().toString(point.x(), 'f', 2) transformedY = QLocale().toString(point.y(), 'f', 2) self.setResult(transformedX, transformedY) def setResult(self, x, y): if (self._eastingLeftNorthingRight): self.resultLeft.setText(x) self.resultRight.setText(y) else: self.resultLeft.setText(y) self.resultRight.setText(x) def setWarningMessage(self, message): if (message and len(message) > 0): self.messageIcon.setPixmap(self.warningPixmap) self.messageIcon.show() self.messageText.setText(message) else: self.hideMessages() def showInfoMessage(self, message, hideAfterMilliseconds=None): self.messageIcon.clear() self.messageText.setText(message) if (hideAfterMilliseconds): self.messageHideTimer.setInterval(hideAfterMilliseconds) self.messageHideTimer.start() def hideMessages(self): self.messageIcon.clear() self.messageIcon.hide() self.messageText.clear() def clearFieldsInSection(self, section): if (section & self.SectionInput): for inputField in self._widgetlistInput: inputField.setText("") if (section & self.SectionOutput): for inputField in [ self.resultRight, self.resultLeft, ]: inputField.setText("") def clearSection(self, section): self.clearFieldsInSection(section) # the following code will also reset # the buttons designating the hemisphere: #if (section & self.SectionInput ) : # self.setEastingInverted(False) # self.setNorthingInverted(False) self.addFeatureButton.setEnabled(False) self.inputChanged.emit() def calculateDecimalDegreesFromDMS(self): #QgsMessageLog.logMessage("calc DMS", "Coordinator") valueLeft = coordinatorDmsStringsToDecimal(self.inLeft.text(), self.inLeftMin.text(), self.inLeftSec.text()) valueRight = coordinatorDmsStringsToDecimal(self.inRight.text(), self.inRightMin.text(), self.inRightSec.text()) return (valueLeft, valueRight) def hasInput(self): if self.leftDMS.isVisible(): hasInput = False for field in self._widgetlistInputDms: if len(field.text()) > 0: hasInput = True break else: hasInput = (len(self.inLeftDec.text()) > 0 or len(self.inRightDec.text()) > 0) return hasInput def __rawInputCoordinates(self): if (self.leftDMS.isVisible()): return (self.calculateDecimalDegreesFromDMS()) else: valueLeft = 0.0 valueRight = 0.0 if (len(self.inLeftDec.text())): valueLeft = QLocale().toFloat(self.inLeftDec.text())[0] if (len(self.inRightDec.text())): valueRight = QLocale().toFloat(self.inRightDec.text())[0] return (valueLeft, valueRight) def inputCoordinates(self): (valueLeft, valueRight) = self.__rawInputCoordinates() if (self._eastingLeftNorthingRight): inX = valueLeft inY = valueRight else: inX = valueRight inY = valueLeft if (self.sectionIsGeographic[self.SectionInput] and self._eastingInverted): inX *= -1 if (self.sectionIsGeographic[self.SectionInput] and self._northingInverted): inY *= -1 return (inX, inY) def setNorthingInverted(self, northingInverted): self._northingInverted = northingInverted label = self.tr("S", "lblSouth") if northingInverted else self.tr( "N", "lblNorth") if (self._eastingLeftNorthingRight): self.rightDirButton.setText(label) else: self.leftDirButton.setText(label) def setEastingInverted(self, eastingInverted): self._eastingInverted = eastingInverted label = self.tr("W", "lblWest") if eastingInverted else self.tr( "E", "lblEast") if (self._eastingLeftNorthingRight): self.leftDirButton.setText(label) else: self.rightDirButton.setText(label) def toggleCardinalDirectionButton(self, button): if (self._eastingLeftNorthingRight): toggleEasting = (button == self.leftDirButton) else: toggleEasting = (button == self.rightDirButton) if (toggleEasting): self.setEastingInverted(not self._eastingInverted) else: self.setNorthingInverted(not self._northingInverted) self.inputChanged.emit() def toggledMapConnection(self, section, isConnected): if section == CoordinatorDockWidget.SectionOutput: self.outputCrs.setEnabled(not isConnected) self.mapConnectionChanged.emit(section, isConnected) def __inputFieldsChangedInternal(self): #coordinatorLog("fields changed internal triggered") self._setToolsEnabled(self.hasInput()) if (self.hasInput()): if (self.leftDMS.isVisible()): (leftValue, rightValue) = self.calculateDecimalDegreesFromDMS() self.inLeftDec.setText(QLocale().toString(leftValue, "f", 9)) self.inRightDec.setText(QLocale().toString(rightValue, "f", 9)) else: # calculate DMS Values leftValue = QLocale().toFloat(self.inLeftDec.text())[0] rightValue = QLocale().toFloat(self.inRightDec.text())[0] x = leftValue if self._eastingLeftNorthingRight else rightValue y = rightValue if self._eastingLeftNorthingRight else leftValue self.setDmsInputFromDecimal(x, y, False) else: if (self.leftDMS.isVisible()): self.inLeftDec.setText(None) self.inRightDec.setText(None) else: for f in self._widgetlistInputDms: f.setText(None) self.inputChanged.emit() def copyResultToClipBoard(self, which): cb = QApplication.clipboard() cb.clear(mode=cb.Clipboard) if which == CoordinatorDockWidget.SideLeft: content = self.resultLeft.text() elif which == CoordinatorDockWidget.SideRight: content = self.resultRight.text() else: content = "%s\t%s" % (self.resultLeft.text(), self.resultRight.text()) cb.setText(content, mode=cb.Clipboard) def showHelpButtonClicked(self): if not hasattr(self, "helpview"): helpBasepath = "%s/help" % os.path.normpath( os.path.dirname(__file__)) helpUrl = QUrl( pathlib.Path("%s/index.html" % helpBasepath).as_uri()) cssUrl = QUrl(pathlib.Path("%s/help.css" % helpBasepath).as_uri()) self.helpview = QWebView() self.helpview.settings().setUserStyleSheetUrl(cssUrl) self.helpview.load(helpUrl) self.helpview.show() def closeEvent(self, event): self.closingPlugin.emit() event.accept()
def paintEvent(self, ev): p = QPainter(self) p.fillRect(ev.region().boundingRect(), QBrush(QColor(200, 200, 200, 220), Qt.SolidPattern)) p.end() QWebView.paintEvent(self, ev)
def setVisible(self, x): if x: self.update_layout() QWebView.setVisible(self, x)
def __init__(self, Parent=None): QWebView.__init__(self) self.setHtml(str(myS)) self.setVisible(True) self.setWindowOpacity(0.8)
class Ui_MWindow(): # Two column Layout layout_top = QHBoxLayout() # Vertical layout for each column layout_l = QVBoxLayout() layout_r = QVBoxLayout() # Horizontal layout for controls layout_r_h = QHBoxLayout() # Edit raw markdown mdtext = QPlainMdTextEdit() # shows html html_view = QWebView() # Mail Subject subject_edit = QLineEdit() # Recipient Mail to_edit = QLineEdit() # Open recipientsWindow multi_rec_btn = QPushButton() # Send EMail send_btn = QPushButton() # Add attachment add_att_btn = QPushButton() # QProgressBar progress_bar = QProgressBar() # attachment QListWidget attachments = QListWidget() def __init__(self): # build layout self.layout_l.addWidget(self.subject_edit) self.subject_edit.setPlaceholderText("Subject") self.layout_l.addWidget(self.mdtext) self.layout_r.addLayout(self.layout_r_h) self.layout_r_h.addWidget(self.to_edit) self.to_edit.setPlaceholderText("To:") self.layout_r_h.addWidget(self.multi_rec_btn) self.multi_rec_btn.setText("...") self.layout_r_h.addWidget(self.send_btn) self.send_btn.setText("Send") self.layout_r_h.addWidget(self.add_att_btn) self.add_att_btn.setText("Attach..") self.attachments.setMaximumHeight(100) self.layout_r.addWidget(self.html_view) self.progress_bar.setTextVisible(False) self.progress_bar.setFixedHeight(10) self.progress_bar.setValue(1) self.layout_r.addWidget(self.progress_bar) self.layout_r.addWidget(self.attachments) self.layout_top.addLayout(self.layout_l) self.layout_top.addLayout(self.layout_r) self.setLayout(self.layout_top) # other self.attachments.setSelectionMode(QAbstractItemView.ExtendedSelection)
def __init__(self, parent, icon, prefs): self.parent = parent self.prefs = prefs self.icon = icon super(AnnotationsAppearance, self).__init__(parent, 'appearance_dialog') self.setWindowTitle(_('Modify appearance')) self.setWindowIcon(icon) self.l = QVBoxLayout(self) self.setLayout(self.l) # Add a label for description #self.description_label = QLabel(_("Descriptive text here")) #self.l.addWidget(self.description_label) # Add a group box, vertical layout for preview window self.preview_gb = QGroupBox(self) self.preview_gb.setTitle(_("Preview")) self.preview_vl = QVBoxLayout(self.preview_gb) self.l.addWidget(self.preview_gb) self.wv = QWebView() self.wv.setHtml('<p></p>') self.wv.setMinimumHeight(100) self.wv.setMaximumHeight(16777215) self.wv.setGeometry(0, 0, 200, 100) self.wv.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.preview_vl.addWidget(self.wv) # Create a group box, horizontal layout for the table self.css_table_gb = QGroupBox(self) self.css_table_gb.setTitle(_("Annotation elements")) self.elements_hl = QHBoxLayout(self.css_table_gb) self.l.addWidget(self.css_table_gb) # Add the group box to the main layout self.elements_table = AnnotationElementsTable( self, 'annotation_elements_tw') self.elements_hl.addWidget(self.elements_table) self.elements_table.initialize() # Options self.options_gb = QGroupBox(self) self.options_gb.setTitle(_("Options")) self.options_gl = QGridLayout(self.options_gb) self.l.addWidget(self.options_gb) current_row = 0 # <hr/> separator # addWidget(widget, row, col, rowspan, colspan) self.hr_checkbox = QCheckBox( _('Add horizontal rule between annotations')) self.hr_checkbox.stateChanged.connect(self.hr_checkbox_changed) self.hr_checkbox.setCheckState( JSONConfig('plugins/annotations').get('appearance_hr_checkbox', False)) self.options_gl.addWidget(self.hr_checkbox, current_row, 0, 1, 4) current_row += 1 # Timestamp self.timestamp_fmt_label = QLabel(_("Timestamp format:")) self.options_gl.addWidget(self.timestamp_fmt_label, current_row, 0) self.timestamp_fmt_le = QLineEdit( JSONConfig('plugins/annotations').get( 'appearance_timestamp_format', default_timestamp), parent=self) self.timestamp_fmt_le.textEdited.connect(self.timestamp_fmt_changed) self.timestamp_fmt_le.setFont(self.FONT) self.timestamp_fmt_le.setObjectName('timestamp_fmt_le') self.timestamp_fmt_le.setToolTip(_('Format string for timestamp')) self.timestamp_fmt_le.setMaximumWidth(16777215) self.timestamp_fmt_le.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) self.options_gl.addWidget(self.timestamp_fmt_le, current_row, 1) self.timestamp_fmt_reset_tb = QToolButton(self) self.timestamp_fmt_reset_tb.setToolTip(_("Reset to default")) self.timestamp_fmt_reset_tb.setIcon(QIcon(I('trash.png'))) self.timestamp_fmt_reset_tb.clicked.connect( self.reset_timestamp_to_default) self.options_gl.addWidget(self.timestamp_fmt_reset_tb, current_row, 2) self.timestamp_fmt_help_tb = QToolButton(self) self.timestamp_fmt_help_tb.setToolTip(_("Format string reference")) self.timestamp_fmt_help_tb.setIcon(QIcon(I('help.png'))) self.timestamp_fmt_help_tb.clicked.connect(self.show_help) self.options_gl.addWidget(self.timestamp_fmt_help_tb, current_row, 3) # Button box bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bb.accepted.connect(self.accept) bb.rejected.connect(self.reject) self.l.addWidget(bb) # Spacer self.spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.l.addItem(self.spacerItem) # Sizing sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) self.resize_dialog()