def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg", edit=False, toolbar=False, options=None, parent=None, panels=None): if not PYQT5: QDialog.__init__(self, parent) self.edit = edit self.button_box = None self.button_layout = None if PYQT5: super(CurveDialog, self).__init__(parent, wintitle=wintitle, icon=icon, toolbar=toolbar, options=options, panels=panels) else: CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon, toolbar=toolbar, options=options, panels=panels) self.setWindowFlags(Qt.Window)
def __init__(self, wintitle=None, icon="guiqwt.svg", edit=True, toolbar=False, options=None, parent=None, panels=None, param_cols=1, legend_anchor='TR', auto_fit=False): if not PYQT5: QDialog.__init__(self, parent) self.edit = edit self.button_layout = None if PYQT5: super(FitDialog, self).__init__(parent, wintitle=wintitle, icon=icon, toolbar=toolbar, options=options, panels=panels, param_cols=param_cols, legend_anchor=legend_anchor, auto_fit=auto_fit) else: FitWidgetMixin.__init__(self, wintitle, icon, toolbar, options, panels, param_cols, legend_anchor, auto_fit) self.setWindowFlags(Qt.Window)
def __init__(self, parent, new_size, old_size, text="", keep_original_size=False): QDialog.__init__(self, parent) intfunc = lambda tup: [int(val) for val in tup] if intfunc(new_size) == intfunc(old_size): self.keep_original_size = True else: self.keep_original_size = keep_original_size self.width, self.height = new_size self.old_width, self.old_height = old_size self.ratio = self.width / self.height layout = QVBoxLayout() self.setLayout(layout) formlayout = QFormLayout() layout.addLayout(formlayout) if text: label = QLabel(text) label.setAlignment(Qt.AlignHCenter) formlayout.addRow(label) self.w_edit = w_edit = QLineEdit(self) w_valid = QIntValidator(w_edit) w_valid.setBottom(1) w_edit.setValidator(w_valid) self.h_edit = h_edit = QLineEdit(self) h_valid = QIntValidator(h_edit) h_valid.setBottom(1) h_edit.setValidator(h_valid) zbox = QCheckBox(_("Original size"), self) formlayout.addRow(_("Width (pixels)"), w_edit) formlayout.addRow(_("Height (pixels)"), h_edit) formlayout.addRow("", zbox) formlayout.addRow(_("Original size:"), QLabel("%d x %d" % old_size)) self.z_label = QLabel() formlayout.addRow(_("Zoom factor:"), self.z_label) # Button box self.bbox = bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) layout.addWidget(bbox) self.w_edit.setText(str(self.width)) self.h_edit.setText(str(self.height)) self.update_widgets() self.setWindowTitle(_("Resize")) w_edit.textChanged.connect(self.width_changed) h_edit.textChanged.connect(self.height_changed) zbox.toggled.connect(self.toggled_no_zoom) zbox.setChecked(self.keep_original_size)
def __init__(self, parent, new_size, old_size, text=""): QDialog.__init__(self, parent) self.keep_original_size = False self.width, self.height = new_size self.old_width, self.old_height = old_size self.ratio = self.width/self.height layout = QVBoxLayout() self.setLayout(layout) formlayout = QFormLayout() layout.addLayout(formlayout) if text: label = QLabel(text) label.setAlignment(Qt.AlignHCenter) formlayout.addRow(label) self.w_edit = w_edit = QLineEdit(self) w_valid = QIntValidator(w_edit) w_valid.setBottom(1) w_edit.setValidator(w_valid) self.h_edit = h_edit = QLineEdit(self) h_valid = QIntValidator(h_edit) h_valid.setBottom(1) h_edit.setValidator(h_valid) zbox = QCheckBox(_("Original size"), self) formlayout.addRow(_("Width (pixels)"), w_edit) formlayout.addRow(_("Height (pixels)"), h_edit) formlayout.addRow('', zbox) formlayout.addRow(_("Original size:"), QLabel("%d x %d" % old_size)) self.z_label = QLabel() formlayout.addRow(_("Zoom factor:"), self.z_label) # Button box self.bbox = bbox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel) self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()")) self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()")) layout.addWidget(bbox) self.w_edit.setText(str(self.width)) self.h_edit.setText(str(self.height)) self.update_widgets() self.setWindowTitle(_("Resize")) self.connect(w_edit, SIGNAL("textChanged(QString)"), self.width_changed) self.connect(h_edit, SIGNAL("textChanged(QString)"), self.height_changed) self.connect(zbox, SIGNAL("toggled(bool)"), self.toggled_no_zoom)
def __init__(self, wintitle=None, icon="guiqwt.svg", edit=True, toolbar=False, options=None, parent=None, panels=None, param_cols=1, legend_anchor='TR', auto_fit=False): QDialog.__init__(self, parent) self.edit = edit self.button_layout = None FitWidgetMixin.__init__(self, wintitle, icon, toolbar, options, panels, param_cols, legend_anchor, auto_fit) self.setWindowFlags(Qt.Window)
def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg", edit=False, toolbar=False, options=None, parent=None, panels=None): QDialog.__init__(self, parent) self.edit = edit self.button_box = None self.button_layout = None CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon, toolbar=toolbar, options=options, panels=panels) self.setWindowFlags(Qt.Window)
def __init__(self, parent=None, **kwargs): QDialog.__init__(self) layout = QVBoxLayout() self.tdms_widget = TdmsChannelSelectWidget(parent=self, **kwargs) layout.addWidget(self.tdms_widget) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) self.setLayout(layout)
def __init__(self, instance, icon='', parent=None, apply=None, wordwrap=True, size=None): QDialog.__init__(self, parent) self.wordwrap = wordwrap self.apply_func = apply self.layout = QVBoxLayout() if instance.get_comment(): label = QLabel(instance.get_comment()) label.setWordWrap(wordwrap) self.layout.addWidget(label) self.instance = instance self.edit_layout = [] self.setup_instance(instance) if apply is not None: apply_button = QDialogButtonBox.Apply else: apply_button = QDialogButtonBox.NoButton bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | apply_button) self.bbox = bbox bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) bbox.clicked.connect(self.button_clicked) self.layout.addWidget(bbox) self.setLayout(self.layout) if parent is None: if not isinstance(icon, QIcon): icon = get_icon(icon, default="guidata.svg") self.setWindowIcon(icon) self.setModal(True) self.setWindowTitle(instance.get_title()) if size is not None: if isinstance(size, QSize): self.resize(size) else: self.resize(*size)
def __init__(self): QDialog.__init__(self) self.setWindowTitle("Data Logger") self.groupbox1 = DataSetEditGroupBox("Parametres de lock",Loggerdataset,show_button = False) self.groupbox1.dataset.parent = self self.values = self.groupbox1.dataset self.groupbox1.dataset.parent = self lay = QVBoxLayout() lay.addWidget(self.groupbox1) self.setLayout(lay) self.resize(800,300) self.timer = QTimer() self.timer.timeout.connect(self.log) #self.timer.timeout.connect(self.update_values) self.timer.setInterval(100) #ms self.show()
def __init__(self, instance, icon='', parent=None, apply=None, wordwrap=True, size=None): QDialog.__init__(self, parent) self.wordwrap = wordwrap self.apply_func = apply self.layout = QVBoxLayout() if instance.get_comment(): label = QLabel(instance.get_comment()) label.setWordWrap(wordwrap) self.layout.addWidget(label) self.instance = instance self.edit_layout = [ ] self.setup_instance( instance ) if apply is not None: apply_button = QDialogButtonBox.Apply else: apply_button = QDialogButtonBox.NoButton bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | apply_button ) self.bbox = bbox self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()")) self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()")) self.connect(bbox, SIGNAL("clicked(QAbstractButton*)"), self.button_clicked) self.layout.addWidget(bbox) self.setLayout(self.layout) if parent is None: if not isinstance(icon, QIcon): icon = get_icon(icon, default="guidata.svg") self.setWindowIcon(icon) self.setModal(True) self.setWindowTitle(instance.get_title()) if size is not None: if isinstance(size, QSize): self.resize(size) else: self.resize(*size)
def accept(self): """Validate inputs""" if self.check(): for edl in self.edit_layout: edl.accept_changes() QDialog.accept(self)
def __init__(self, parent, new_size, old_size, text="", keep_original_size=False): QDialog.__init__(self, parent) intfunc = lambda tup: [int(val) for val in tup] if intfunc(new_size) == intfunc(old_size): self.keep_original_size = True else: self.keep_original_size = keep_original_size self.width, self.height = new_size self.old_width, self.old_height = old_size self.ratio = self.width/self.height layout = QVBoxLayout() self.setLayout(layout) formlayout = QFormLayout() layout.addLayout(formlayout) if text: label = QLabel(text) label.setAlignment(Qt.AlignHCenter) formlayout.addRow(label) self.w_edit = w_edit = QLineEdit(self) w_valid = QIntValidator(w_edit) w_valid.setBottom(1) w_edit.setValidator(w_valid) self.h_edit = h_edit = QLineEdit(self) h_valid = QIntValidator(h_edit) h_valid.setBottom(1) h_edit.setValidator(h_valid) zbox = QCheckBox(_("Original size"), self) formlayout.addRow(_("Width (pixels)"), w_edit) formlayout.addRow(_("Height (pixels)"), h_edit) formlayout.addRow('', zbox) formlayout.addRow(_("Original size:"), QLabel("%d x %d" % old_size)) self.z_label = QLabel() formlayout.addRow(_("Zoom factor:"), self.z_label) # Button box self.bbox = bbox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel) bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) layout.addWidget(bbox) self.w_edit.setText(str(self.width)) self.h_edit.setText(str(self.height)) self.update_widgets() self.setWindowTitle(_("Resize")) w_edit.textChanged.connect(self.width_changed) h_edit.textChanged.connect(self.height_changed) zbox.toggled.connect(self.toggled_no_zoom) zbox.setChecked(self.keep_original_size)