def __init__(self, color_caption): TestableWidget.__init__(self) self.setWindowFlags(Qt.Popup) self._text = self.tr("Alignment text") main_layout = QVBoxLayout() main_layout.setContentsMargins(0, 0, 0, 0) b = "border: 1px solid #9b9b9b;" self._styles = { "border": b, "border_blue": "border: 0px solid blue;", "frame": 'QFrame[frameShape="4"]{color: #9b9b9b;}' } self.setStyleSheet(self._styles["frame"]) # -- CAPTION ---------------------------------- caption = QFrame(self, flags=Qt.WindowFlags()) caption_layout = QHBoxLayout() self._lbl_caption = QLabel(self._text) self._lbl_caption.setStyleSheet(self._styles["border_blue"]) caption_layout.addWidget(self._lbl_caption, alignment=Qt.Alignment()) caption.setLayout(caption_layout) caption_layout.setContentsMargins(9, 5, 9, 5) caption.setStyleSheet( f"background-color: {color_caption}; {self._styles['border']}") # -- CELLS GRID ------------------------------- cellsbox = QFrame(self, flags=Qt.WindowFlags()) cells = QGridLayout() cellsbox.setLayout(cells) cells.setContentsMargins(9, 0, 9, 9) self._clrbtn = [] for i in range(1, 4): for j in range(1, 5): self._clrbtn.append(QToolButton()) self._clrbtn[-1].clicked.connect( lambda z, y=i, x=j: self.select_align_(x, y)) self._clrbtn[-1].setAutoRaise(True) sz = 48 self._clrbtn[-1].setFixedSize(sz, sz) self._clrbtn[-1].setIconSize(QSize(sz, sz)) self._clrbtn[-1].setIcon(QIcon(img(f"editor/a{i}{j}.png"))) # noinspection PyArgumentList cells.addWidget(self._clrbtn[-1], i - 1, j - 1) # --------------------------------------------- main_layout.addWidget(caption, alignment=Qt.Alignment()) main_layout.addWidget(cellsbox, alignment=Qt.Alignment()) self.setLayout(main_layout)
def __init__(self, title, icon, width, height, x, y, type, text, parent=None, flags=Qt.WindowFlags()): super().__init__(title, icon, width, height, x, y, parent=parent, flags=flags) self.grid_layout = QGridLayout() self.grid_layout.setContentsMargins(0, 0, 0, 0) self.init_layout(title, icon) self.init_widget(type, text) self.finish_layout() pass
def __init__(self, parent, flags=Qt.WindowFlags()): QDialog.__init__(self, parent, flags) self.setModal(False) self.setWindowTitle("Select sources by...") lo = QVBoxLayout(self) lo.setContentsMargins(10, 10, 10, 10) lo.setSpacing(5) # select by lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) # lab = QLabel("Select:") # lo1.addWidget(lab) self.wselby = QComboBox(self) lo1.addWidget(self.wselby, 0) self.wselby.activated[str].connect(self._setup_selection_by) # under/over self.wgele = QComboBox(self) lo1.addWidget(self.wgele, 0) self.wgele.addItems([">", ">=", "<=", "<", "sum<=", "sum>", "=="]) self.wgele.activated[str].connect(self._select_threshold) # threshold value self.wthreshold = QLineEdit(self) self.wthreshold.editingFinished.connect(self._select_threshold) lo1.addWidget(self.wthreshold, 1) # min and max label self.wminmax = QLabel(self) lo.addWidget(self.wminmax) # selection slider lo1 = QHBoxLayout() lo.addLayout(lo1) self.wpercent = QSlider(self) self.wpercent.setTracking(False) self.wpercent.valueChanged[int].connect(self._select_percentile) self.wpercent.sliderMoved[int].connect( self._select_percentile_threshold) self.wpercent.setRange(0, 100) self.wpercent.setOrientation(Qt.Horizontal) lo1.addWidget(self.wpercent) self.wpercent_lbl = QLabel("0%", self) self.wpercent_lbl.setMinimumWidth(64) lo1.addWidget(self.wpercent_lbl) # # hide button # lo.addSpacing(10) # lo2 = QHBoxLayout() # lo.addLayout(lo2) # lo2.setContentsMargins(0,0,0,0) # hidebtn = QPushButton("Close",self) # hidebtn.setMinimumWidth(128) # QObject.connect(hidebtn,pyqtSignal("clicked()"),self.hide) # lo2.addStretch(1) # lo2.addWidget(hidebtn) # lo2.addStretch(1) # self.setMinimumWidth(384) self._in_select_threshold = False self._sort_index = None self.qerrmsg = QErrorMessage(self)
def __init__(self, title, icon, width, height, x, y, parent=None, flags=Qt.WindowFlags()): super().__init__(parent=parent, flags=flags) pass
def __init__(self, parent = None, flags = Qt.WindowFlags()): super().__init__(parent = parent, flags = flags) # set grid layout self.window_grid_layout = QGridLayout() self.window_grid_layout.setContentsMargins(0, 0, 0, 0) self.init_layout() self.init_widgets() self.finish_layout() self.events_of_window() self.message_box = MessageWindow(text = 'Here goes something you must attention before it\'s too late', title = 'Hey, there!', type = True) self.error_box = MessageWindow(text = 'It seems something wrong here...', title = 'Hey, STOP!', type = False) # alg settings self.alg = AnalyzeAlg() pass
def __init__(self, parent=None, flags=Qt.WindowFlags()): super().__init__(parent=parent, flags=flags) # set x, y, width, height for ui self.WINDOW_MAX_WIDTH = QApplication.desktop().width() self.WINDOW_MAX_HEIGHT = QApplication.desktop().height() self.WINDOW_INIT_HEIGHT = int(self.WINDOW_MAX_HEIGHT / 2) self.WINDOW_INIT_WIDTH = int(self.WINDOW_MAX_WIDTH / 2) self.X = int(self.WINDOW_MAX_WIDTH / 4) self.Y = int(self.WINDOW_MAX_HEIGHT / 4) # set x, y, width, height for box self.BOX_WIDTH = int(self.WINDOW_INIT_WIDTH / 2) self.BOX_HEIGHT = int(self.WINDOW_INIT_HEIGHT / 2) self.BOX_X = int(self.WINDOW_MAX_WIDTH *3 / 8) self.BOX_Y = int(self.WINDOW_MAX_HEIGHT * 3 / 8) # set height for buttons self.BUTTON_HEIGHT = int(self.WINDOW_INIT_HEIGHT / 6) pass
def __init__(self, title, icon, width=CONFIG.WINDOW_WIDTH, height=CONFIG.WINDOW_HEIGHT, x=CONFIG.WINDOW_X, y=CONFIG.WINDOW_Y, parent=None, flags=Qt.WindowFlags()): super().__init__(title, icon, width, height, x, y, parent=parent, flags=flags) self.grid_layout = QGridLayout() self.grid_layout.setContentsMargins(0, 0, 0, 0) self.init_layout(title, icon) self.init_widget() self.finish_layout() self.set_events() self.about_box = Box( title='About', icon=qta.icon('fa5s.broadcast-tower', color='red'), width=CONFIG.BOX_WIDTH, height=CONFIG.BOX_HEIGHT, x=CONFIG.BOX_X, y=CONFIG.BOX_Y, type=0, text='Here goes something you must attention before it\'s too late' ) self.predict_box = Box(title='Prediction', icon=qta.icon('fa5s.broadcast-tower', color='red'), width=CONFIG.BOX_WIDTH, height=CONFIG.BOX_HEIGHT, x=CONFIG.BOX_X, y=CONFIG.BOX_Y, type=1, text='') self.alg = AnalyzeAlg() pass
def __init__(self, str, owner: LabeledObject, owner_widget: GraphItem, parent=None, flags=Qt.WindowFlags()): super().__init__(str, parent=parent, flags=flags) self.__owner = owner self.__owner_widget = owner_widget font_database = QFontDatabase() # Build absolute path to prevent problems on macOS path = os.path.join(os.path.dirname(__file__), "../ressources/fonts/lmroman8-regular.otf") font_id = font_database.addApplicationFont(path) if (font_id == -1): raise IOError("Font could not be loaded") font_name = QFontDatabase.applicationFontFamilies(font_id)[0] font = QFont(font_name, 16) self.setFont(font) self.adjustSize() self.__reposition()
def __init__(self, parent, modal=True, flags=Qt.WindowFlags()): QDialog.__init__(self, parent, flags) self.model = None self.setModal(modal) self.setWindowTitle("Export Karma annotations") lo = QVBoxLayout(self) lo.setContentsMargins(10, 10, 10, 10) lo.setSpacing(5) # file selector self.wfile = FileSelector(self, label="Filename:", dialog_label="Karma annotations filename", default_suffix="ann", file_types="Karma annotations (*.ann)") lo.addWidget(self.wfile) # selected sources checkbox self.wsel = QCheckBox("selected sources only", self) lo.addWidget(self.wsel) # OK/cancel buttons lo.addSpacing(10) lo2 = QHBoxLayout() lo.addLayout(lo2) lo2.setContentsMargins(5, 5, 5, 5) self.wokbtn = QPushButton("OK", self) self.wokbtn.setMinimumWidth(128) self.wokbtn.clicked.connect(self.accept) self.wokbtn.setEnabled(False) cancelbtn = QPushButton("Cancel", self) cancelbtn.setMinimumWidth(128) cancelbtn.clicked.connect(self.reject) lo2.addWidget(self.wokbtn) lo2.addStretch(1) lo2.addWidget(cancelbtn) self.setMinimumWidth(384) # signals self.wfile.valid.connect(self.wokbtn.setEnabled) # internal state self.qerrmsg = QErrorMessage(self) self._model_filename = None
def __init__(self, parent=None, flags=Qt.WindowFlags()): super(MainWindow, self).__init__(parent, flags) self.setupUi(self) self.home_path = os.path.join(os.environ["USERPROFILE"], "Desktop") self.image_file_path = None self.get_save_path_history() self.bg_color = (0, 0, 0) self.save_path = "" self.clip_width = None self.clip_height = None self.image_counts = 0 self.success_counts = 0 self.is_running = False self.userPlatform = platform.system() self.pushButton.clicked.connect(self.load_image_files) self.treeWidget.itemDoubleClicked.connect(self.show_image) self.toolButton.clicked.connect(self.get_save_path) self.pushButton_2.clicked.connect(self.start_clip) self.clip_thread = ClipThread(self) self.clip_thread.output.connect(self.output_message) self.clip_thread.over.connect(self.over_clip) self.comboBox_3.activated.connect(self.update_save_item)
def __init__(self, text, colors, color_caption): TestableWidget.__init__(self) self.setWindowFlags(Qt.Popup) main_layout = QVBoxLayout() main_layout.setContentsMargins(0, 0, 0, 0) border = "border: 1px solid #9b9b9b;" self.setStyleSheet('QFrame[frameShape="4"]{ color: #9b9b9b;}') # -- CAPTION ---------------------------------- caption = QFrame(self, flags=Qt.WindowFlags()) caption_layout = QHBoxLayout() self._lbl_caption = QLabel(text) self._lbl_caption.setStyleSheet("border: 0px solid blue;") caption_layout.addWidget(self._lbl_caption, alignment=Qt.Alignment()) caption.setLayout(caption_layout) caption_layout.setContentsMargins(9, 5, 9, 5) caption.setStyleSheet(f"background-color: {color_caption}; {border}") # -- COLORS GRID ------------------------------ colorbox = QFrame(self, flags=Qt.WindowFlags()) color_layout = QGridLayout() colorbox.setLayout(color_layout) color_layout.setContentsMargins(9, 0, 9, 0) nn = 7 self.clrbtn = [] for i, color in enumerate(colors): self.clrbtn.append(QToolButton()) css = (f"QToolButton {{{border}background-color:{color};}}" f"QToolButton:hover {{border: 1px solid red; }}") self.clrbtn[-1].setStyleSheet(css) self.clrbtn[-1].clicked.connect( lambda x, c=color: self.select_color_(c)) # noinspection PyArgumentList color_layout.addWidget(self.clrbtn[-1], i // nn, i % nn) # -- SPLITTER --------------------------------- h_frame = QFrame(None, flags=Qt.WindowFlags()) h_frame.setFrameShape(QFrame.HLine) h_frame.setContentsMargins(0, 0, 0, 0) # -- BOTTOM (other color) --------------------- btns = QFrame(self, flags=Qt.WindowFlags()) btn_layout = QHBoxLayout() other = QToolButton() other.clicked.connect(self.other_color_) other.setAutoRaise(True) other.setIcon(QIcon(img("editor/colorwheel"))) btn_layout.addWidget(other, alignment=Qt.Alignment()) self._lbl_other = QLabel(self.tr("other colors")) btn_layout.addWidget(self._lbl_other, alignment=Qt.Alignment()) btns.setLayout(btn_layout) btn_layout.setContentsMargins(9, 0, 9, 9) self.clrbtn.append(other) # --------------------------------------------- main_layout.addWidget(caption, alignment=Qt.Alignment()) main_layout.addWidget(colorbox, alignment=Qt.Alignment()) main_layout.addWidget(h_frame, alignment=Qt.Alignment()) main_layout.addWidget(btns, alignment=Qt.Alignment()) self.setLayout(main_layout)
def __init__(self, parent, modal=True, flags=Qt.WindowFlags()): QDialog.__init__(self, parent, flags) self.model = None self._model_dir = None self.setModal(modal) self.setWindowTitle("Convert sources to FITS brick") lo = QVBoxLayout(self) lo.setContentsMargins(10, 10, 10, 10) lo.setSpacing(5) # file selector self.wfile = FileSelector(self, label="FITS filename:", dialog_label="Output FITS file", default_suffix="fits", file_types="FITS files (*.fits *.FITS)", file_mode=QFileDialog.ExistingFile) lo.addWidget(self.wfile) # reference frequency lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) label = QLabel("Frequency, MHz:", self) lo1.addWidget(label) tip = """<P>If your sky model contains spectral information (such as spectral indices), then a brick may be generated for a specific frequency. If a frequency is not specified here, the reference frequency of the model sources will be assumed.</P>""" self.wfreq = QLineEdit(self) self.wfreq.setValidator(QDoubleValidator(self)) label.setToolTip(tip) self.wfreq.setToolTip(tip) lo1.addWidget(self.wfreq) # beam gain lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) self.wpb_apply = QCheckBox("Apply primary beam expression:", self) self.wpb_apply.setChecked(True) lo1.addWidget(self.wpb_apply) tip = """<P>If this option is specified, a primary power beam gain will be applied to the sources before inserting them into the brick. This can be any valid Python expression making use of the variables 'r' (corresponding to distance from field centre, in radians) and 'fq' (corresponding to frequency.)</P>""" self.wpb_exp = QLineEdit(self) self.wpb_apply.setToolTip(tip) self.wpb_exp.setToolTip(tip) lo1.addWidget(self.wpb_exp) # overwrite or add mode lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) self.woverwrite = QRadioButton("overwrite image", self) self.woverwrite.setChecked(True) lo1.addWidget(self.woverwrite) self.waddinto = QRadioButton("add into image", self) lo1.addWidget(self.waddinto) # add to model self.wadd = QCheckBox( "Add resulting brick to sky model as a FITS image component", self) lo.addWidget(self.wadd) lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) self.wpad = QLineEdit(self) self.wpad.setValidator(QDoubleValidator(self)) self.wpad.setText("1.1") lab = QLabel("...with padding factor:", self) lab.setToolTip( """<P>The padding factor determines the amount of null padding inserted around the image during the prediction stage. Padding alleviates the effects of tapering and detapering in the uv-brick, which can show up towards the edges of the image. For a factor of N, the image will be padded out to N times its original size. This increases memory use, so if you have no flux at the edges of the image anyway, then a pad factor of 1 is perfectly fine.</P>""") self.wpad.setToolTip(lab.toolTip()) self.wadd.toggled[bool].connect(self.wpad.setEnabled) self.wadd.toggled[bool].connect(lab.setEnabled) self.wpad.setEnabled(False) lab.setEnabled(False) lo1.addStretch(1) lo1.addWidget(lab, 0) lo1.addWidget(self.wpad, 1) self.wdel = QCheckBox( "Remove from the sky model sources that go into the brick", self) lo.addWidget(self.wdel) # OK/cancel buttons lo.addSpacing(10) lo2 = QHBoxLayout() lo.addLayout(lo2) lo2.setContentsMargins(5, 5, 5, 5) self.wokbtn = QPushButton("OK", self) self.wokbtn.setMinimumWidth(128) self.wokbtn.clicked.connect(self.accept) self.wokbtn.setEnabled(False) cancelbtn = QPushButton("Cancel", self) cancelbtn.setMinimumWidth(128) cancelbtn.clicked.connect(self.reject) lo2.addWidget(self.wokbtn) lo2.addStretch(1) lo2.addWidget(cancelbtn) self.setMinimumWidth(384) # signals self.wfile.filenameSelected.connect(self._fileSelected) # internal state self.qerrmsg = QErrorMessage(self)
def __init__(self, parent, modal=True, flags=Qt.WindowFlags()): QDialog.__init__(self, parent, flags) self.model = None self.setModal(modal) self.setWindowTitle("Restore model into image") lo = QVBoxLayout(self) lo.setContentsMargins(10, 10, 10, 10) lo.setSpacing(5) # file selector self.wfile_in = FileSelector(self, label="Input FITS file:", dialog_label="Input FITS file", default_suffix="fits", file_types="FITS files (*.fits *.FITS)", file_mode=QFileDialog.ExistingFile) lo.addWidget(self.wfile_in) self.wfile_out = FileSelector(self, label="Output FITS file:", dialog_label="Output FITS file", default_suffix="fits", file_types="FITS files (*.fits *.FITS)", file_mode=QFileDialog.AnyFile) lo.addWidget(self.wfile_out) # beam size lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) lo1.addWidget(QLabel("Restoring beam FWHM, major axis:", self)) self.wbmaj = QLineEdit(self) lo1.addWidget(self.wbmaj) lo1.addWidget(QLabel("\" minor axis:", self)) self.wbmin = QLineEdit(self) lo1.addWidget(self.wbmin) lo1.addWidget(QLabel("\" P.A.:", self)) self.wbpa = QLineEdit(self) lo1.addWidget(self.wbpa) lo1.addWidget(QLabel("\u00B0", self)) for w in self.wbmaj, self.wbmin, self.wbpa: w.setValidator(QDoubleValidator(self)) lo1 = QHBoxLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) self.wfile_psf = FileSelector( self, label="Set restoring beam by fitting PSF image:", dialog_label="PSF FITS file", default_suffix="fits", file_types="FITS files (*.fits *.FITS)", file_mode=QFileDialog.ExistingFile) lo1.addSpacing(32) lo1.addWidget(self.wfile_psf) # selection only self.wselonly = QCheckBox("restore selected model sources only", self) lo.addWidget(self.wselonly) # OK/cancel buttons lo.addSpacing(10) lo2 = QHBoxLayout() lo.addLayout(lo2) lo2.setContentsMargins(0, 0, 0, 0) lo2.setContentsMargins(5, 5, 5, 5) self.wokbtn = QPushButton("OK", self) self.wokbtn.setMinimumWidth(128) self.wokbtn.clicked.connect(self.accept) self.wokbtn.setEnabled(False) cancelbtn = QPushButton("Cancel", self) cancelbtn.setMinimumWidth(128) cancelbtn.clicked.connect(self.reject) lo2.addWidget(self.wokbtn) lo2.addStretch(1) lo2.addWidget(cancelbtn) self.setMinimumWidth(384) # signals self.wfile_in.filenameSelected.connect(self._fileSelected) self.wfile_in.filenameSelected.connect(self._inputFileSelected) self.wfile_out.filenameSelected.connect(self._fileSelected) self.wfile_psf.filenameSelected.connect(self._psfFileSelected) # internal state self.qerrmsg = QErrorMessage(self)
def __init__(self, text, title = 'Hey, there!', type = True, parent = None, flags = Qt.WindowFlags()): super().__init__(parent = parent, flags = flags) # set grid layout self.window_grid_layout = QGridLayout() self.window_grid_layout.setContentsMargins(0, 0, 0, 0) self.init_layout(title) self.init_widgets(type, text) self.finish_layout() pass
def __init__(self, color_caption): TestableWidget.__init__(self) self.setWindowFlags(Qt.Popup) self._text = self.tr("Table") main_layout = QVBoxLayout() main_layout.setContentsMargins(0, 0, 0, 0) b = "border: 1px solid #9b9b9b;" self._styles = { "border": b, "border_blue": "border: 0px solid blue;", "selection": f"QToolButton {{{b}background-color:#fee5e2;}}", "white": f"QToolButton {{{b}background-color:white;}}", "frame": 'QFrame[frameShape="4"]{color: #9b9b9b;}'} self.setStyleSheet(self._styles["frame"]) # -- CAPTION ---------------------------------- caption = QFrame(self, flags=Qt.WindowFlags()) caption_layout = QHBoxLayout() self._lbl_caption = QLabel(self._text) self._lbl_caption.setStyleSheet(self._styles["border_blue"]) caption_layout.addWidget(self._lbl_caption, alignment=Qt.Alignment()) caption.setLayout(caption_layout) caption_layout.setContentsMargins(9, 5, 9, 5) caption.setStyleSheet( f"background-color: {color_caption}; {self._styles['border']}") # -- CELLS GRID ------------------------------- cellsbox = QFrame(self, flags=Qt.WindowFlags()) cells = QGridLayout() cells.setSpacing(1) cellsbox.setLayout(cells) cells.setContentsMargins(9, 0, 9, 0) self._nn = 10 self._clrbtn = [] colors = ["white" for _ in range(self._nn ** 2)] cellsbox.leaveEvent = lambda x: self._leave_cell() for i, color in enumerate(colors): self._clrbtn.append(QToolButton()) # noinspection PyPep8Naming self._clrbtn[-1].enterEvent = lambda x, n=i: self._enter_cell(n) self._clrbtn[-1].setStyleSheet(self._styles["white"]) self._clrbtn[-1].clicked.connect( lambda x, n=i: self.select_size_(n)) # noinspection PyArgumentList cells.addWidget(self._clrbtn[-1], i // self._nn, i % self._nn) # -- SPLITTER --------------------------------- h_frame = QFrame(None, flags=Qt.WindowFlags()) h_frame.setFrameShape(QFrame.HLine) h_frame.setContentsMargins(0, 0, 0, 0) # -- BOTTOM (other color) --------------------- btns = QFrame(self, flags=Qt.WindowFlags()) btn_layout = QHBoxLayout() other = QToolButton() other.clicked.connect(self.other_size_) other.setAutoRaise(True) other.setIcon(QIcon(img("editor/table_gray"))) btn_layout.addWidget(other, alignment=Qt.Alignment()) self._lbl_other = QLabel(self.tr("insert table")) btn_layout.addWidget(self._lbl_other, alignment=Qt.Alignment()) btns.setLayout(btn_layout) btn_layout.setContentsMargins(9, 0, 9, 9) self._clrbtn.append(other) # --------------------------------------------- main_layout.addWidget(caption, alignment=Qt.Alignment()) main_layout.addWidget(cellsbox, alignment=Qt.Alignment()) main_layout.addWidget(h_frame, alignment=Qt.Alignment()) main_layout.addWidget(btns, alignment=Qt.Alignment()) self.setLayout(main_layout)
def __init__(self, parent=None): QMainWindow.__init__(self, parent, Qt.WindowFlags()) if not QTestHelper().is_interactive(): self.setAttribute(Qt.WA_DontShowOnScreen)
def __init__(self, parent, modal=True, flags=Qt.WindowFlags()): QDialog.__init__(self, parent, flags) self.model = None self._model_dir = None self.setModal(modal) self.setWindowTitle("Add FITS brick") lo = QVBoxLayout(self) lo.setContentsMargins(10, 10, 10, 10) lo.setSpacing(5) # file selector self.wfile = FileSelector(self, label="FITS filename:", dialog_label="FITS file", default_suffix="fits", file_types="FITS files (*.fits *.FITS)", file_mode=QFileDialog.ExistingFile) lo.addWidget(self.wfile) # overwrite or add mode lo1 = QGridLayout() lo.addLayout(lo1) lo1.setContentsMargins(0, 0, 0, 0) lo1.addWidget(QLabel("Padding factor:", self), 0, 0) self.wpad = QLineEdit("2", self) self.wpad.setValidator(QDoubleValidator(self)) lo1.addWidget(self.wpad, 0, 1) lo1.addWidget(QLabel("Assign source name:", self), 1, 0) self.wname = QLineEdit(self) lo1.addWidget(self.wname, 1, 1) # OK/cancel buttons lo.addSpacing(10) lo2 = QHBoxLayout() lo.addLayout(lo2) lo2.setContentsMargins(0, 0, 0, 0) lo2.setContentsMargins(5, 5, 5, 5) self.wokbtn = QPushButton("OK", self) self.wokbtn.setMinimumWidth(128) self.wokbtn.clicked.connect(self.accept) self.wokbtn.setEnabled(False) cancelbtn = QPushButton("Cancel", self) cancelbtn.setMinimumWidth(128) cancelbtn.clicked.connect(self.reject) lo2.addWidget(self.wokbtn) lo2.addStretch(1) lo2.addWidget(cancelbtn) self.setMinimumWidth(384) # signals self.wfile.filenameSelected.connect(self._fileSelected) # internal state self.qerrmsg = QErrorMessage(self)