Inherited from tkinter.simpledialog.Dialog
769090
def apply(self):
        """"""
        user_type = self.rb_choice.get()
        if user_type == 'student' or user_type == 'tutor':
            self.result = user_type
307413
public static ProcessContext showDialog(Window parentWindow) throws Exception {
        ProcessContextDialog contextDialog = new ProcessContextDialog(parentWindow);
        contextDialog.setUpGUI();
        return contextDialog.getDialogObject();
    }
1347079
protected void closeDialog() {
		if (m_CustomEditor instanceof Container) {
			Dialog dlg = PropertyDialog.getParentDialog((Container) m_CustomEditor);
			if (dlg != null)
				dlg.setVisible(false);
		}
	}
29579
private void initializeShowCustomDialogPreference() {
        Preference preference =
                findPreference(getString(R.string.show_custom_dialog_preference_key));
        preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {

            @Override
            public boolean onPreferenceClick(final Preference preference) {
                initializeCustomDialog();
                customDialog.setShowAnimation(createRectangularRevealAnimation(preference));
                customDialog.setDismissAnimation(createRectangularRevealAnimation(preference));
                customDialog.setCancelAnimation(createRectangularRevealAnimation(preference));
                customDialog.show();
                return true;
            }

        });
    }
581256
function() {
			// Insert the dialog's element to the root document.
			var element = this._.element;
			var definition = this.definition;
			if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) )
				element.appendTo( CKEDITOR.document.getBody() );
			else
				element.setStyle( 'display', 'block' );

			// First, set the dialog to an appropriate size.
			this.resize( this._.contentSize && this._.contentSize.width || definition.width || definition.minWidth, this._.contentSize && this._.contentSize.height || definition.height || definition.minHeight );

			// Reset all inputs back to their default value.
			this.reset();

			// Select the first tab by default.
			this.selectPage( this.definition.contents[ 0 ].id );

			// Set z-index.
			if ( CKEDITOR.dialog._.currentZIndex === null )
				CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex;
			this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 );

			// Maintain the dialog ordering and dialog cover.
			if ( CKEDITOR.dialog._.currentTop === null ) {
				CKEDITOR.dialog._.currentTop = this;
				this._.parentDialog = null;
				showCover( this._.editor );

			} else {
				this._.parentDialog = CKEDITOR.dialog._.currentTop;
				var parentElement = this._.parentDialog.getElement().getFirst();
				parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 );
				CKEDITOR.dialog._.currentTop = this;
			}

			element.on( 'keydown', accessKeyDownHandler );
			element.on( 'keyup', accessKeyUpHandler );

			// Reset the hasFocus state.
			this._.hasFocus = false;

			for ( var i in definition.contents ) {
				if ( !definition.contents[ i ] )
					continue;

				var content = definition.contents[ i ],
					tab = this._.tabs[ content.id ],
					requiredContent = content.requiredContent,
					enableElements = 0;

				if ( !tab )
					continue;

				for ( var j in this._.contents[ content.id ] ) {
					var elem = this._.contents[ content.id ][ j ];

					if ( elem.type == 'hbox' || elem.type == 'vbox' || !elem.getInputElement() )
						continue;

					if ( elem.requiredContent && !this._.editor.activeFilter.check( elem.requiredContent ) )
						elem.disable();
					else {
						elem.enable();
						enableElements++;
					}
				}

				if ( !enableElements || ( requiredContent && !this._.editor.activeFilter.check( requiredContent ) ) )
					tab[ 0 ].addClass( 'cke_dialog_tab_disabled' );
				else
					tab[ 0 ].removeClass( 'cke_dialog_tab_disabled' );
			}

			CKEDITOR.tools.setTimeout( function() {
				this.layout();
				resizeWithWindow( this );

				this.parts.dialog.setStyle( 'visibility', '' );

				// Execute onLoad for the first show.
				this.fireOnce( 'load', {} );
				CKEDITOR.ui.fire( 'ready', this );

				this.fire( 'show', {} );
				this._.editor.fire( 'dialogShow', this );

				if ( !this._.parentDialog )
					this._.editor.focusManager.lock();

				// Save the initial values of the dialog.
				this.foreach( function( contentObj ) {
					contentObj.setInitValue && contentObj.setInitValue();
				} );

			}, 100, this );
		}
849634
private void initializeEditTextDialog() {
        EditTextDialog.Builder builder =
                new EditTextDialog.Builder(getActivity()).setHint(R.string.edit_text_dialog_hint)
                        .setText(getContext().getString(R.string.edit_text_dialog_text))
                        .addValidator(Validators.notEmpty(getContext()));
        configureHeaderDialogBuilder(builder);
        configureButtonBarDialogBuilder(builder);
        editTextDialog = builder.create();
    }
736622
def __buttonEvent(event):
    
    global  boxRoot, __widgetTexts, __replyButtonText
    __replyButtonText = __widgetTexts[event.widget]
    boxRoot.quit()
320674
@Override
    protected void defineWidgets() {

        // initialize the object to use for the dialog
        initLoginMessageObject();

        setKeyPrefix(KEY_PREFIX);

        // required to read the default values for the optional context parameters for the widgets
        CmsLoginMessage def = new CmsLoginMessage();

        addWidget(new CmsWidgetDialogParameter(m_loginMessage, "enabled", PAGES[0], new CmsCheckboxWidget()));
        addWidget(new CmsWidgetDialogParameter(m_loginMessage, "message", PAGES[0], new CmsTextareaWidget()));
        addWidget(new CmsWidgetDialogParameter(m_loginMessage, "loginForbidden", PAGES[0], new CmsCheckboxWidget()));
        addWidget(
            new CmsWidgetDialogParameter(
                m_loginMessage,
                "timeStart",
                String.valueOf(def.getTimeStart()),
                PAGES[0],
                new CmsCalendarWidget(),
                0,
                1));
        addWidget(
            new CmsWidgetDialogParameter(
                m_loginMessage,
                "timeEnd",
                String.valueOf(def.getTimeEnd()),
                PAGES[0],
                new CmsCalendarWidget(),
                0,
                1));
    }
543430
function() {

    // private object for Alerty object inherit
    var Dialog = {
      
      // static defaults params
      defaults: {
        okLabel: '\u786e\u5b9a',
        cancelLabel: '\u53d6\u6d88',
        time: 2000
      },

      previousCallback: null,  // for cache previous toasts callbak, to handle if call more than 1 alerty

      // html templates
      template: '<div class="alerty-overlay" tabindex="-1"></div>'+
                '<div class="alerty">'+
                  '<div class="alerty-title"></div>'+
                  '<div class="alerty-content">'+
                    '<p class="alerty-message"></p>'+
                    '<div class="alerty-prompt">'+
                      '<input type="text" placeholder="" value="">'+
                      '<div class="input-line"></div>'+
                    '</div>'+
                  '</div>'+
                  '<div class="alerty-action">'+
                    '<a class="btn-cancel"></a>'+
                    '<a class="btn-ok"></a>'+
                  '</div>'+
                '</div>',



      /** 
       * [Build the HTML contents]
       *
       * @param type {String}           -- get the dialog type to arrange the correspondent html content.
       * @param content {String}        -- the text contents dialog to users.
       * @param opts {Object}           -- options.
       * @param onOk {Function}         -- custom callback function after click ok button.
       * @param onCancel {Function}     -- custom callback function after click cancel button.
       */
      setup: function(type, content, opts, onOk, onCancel) {
        // for if argument opts is not given.
        var detect = typeof opts === 'function';
        if (detect) {
          onCancel = onOk;
          onOk = opts;
        }

        var $oldModal = document.querySelector('.alerty');


        // if previous modal is open, remove it and immediately callback
        if ($oldModal) {
          commonUse.removeElement($oldModal);
          var _callback = this.previousCallback;
          if (_callback) _callback();
        }

        var $wrapper = document.createElement('div');
        $wrapper.innerHTML = this.template;

        // append alerty to body
        while ($wrapper.firstChild) {
          document.body.appendChild($wrapper.firstChild);
        }

        // cache alerty dom for next use
        var $modal = document.querySelector('.alerty');
        var $overlay = document.querySelector('.alerty-overlay');
        var $title = $modal.querySelector('.alerty-title');
        var $message = $modal.querySelector('.alerty-message');
        var $btnArea = $modal.querySelector('.alerty-action');
        var $btnOk = $modal.querySelector('.btn-ok');
        var $btnCancel = $modal.querySelector('.btn-cancel');
        var $prompt = $modal.querySelector('.alerty-prompt');
        var $input = $prompt.querySelector('input');

        // set uid
        $modal.id = commonUse.setUid('alerty');
        $overlay.id = 'overlay-'+$modal.id;

        // animation show alerty
        commonUse.addClass($overlay, 'active');
        commonUse.addClass($modal, 'alerty-show');
        $message.innerHTML = content;  // set msg

        if (opts && opts.time) this.defaults.time = opts.time; // handle time if set

        if (type !== 'prompt') {
          commonUse.removeElement($prompt); // other type do not need
        } else {
          $input.focus(); // auto focus input if type prompt

          if(opts && opts.inputType) $input.setAttribute('type', opts.inputType); // handle input type, such as 'password'
          if(opts && opts.inputPlaceholder) $input.setAttribute('placeholder', opts.inputPlaceholder); // handle input placeholder
          if(opts && opts.inputValue) $input.setAttribute('value', opts.inputValue); // handle input default value 
        }

        if (type === 'toasts') {
          this.previousCallback = onOk;  // cache callback

          // rearrange template
          commonUse.removeElement($title);
          commonUse.removeElement($btnArea);
          commonUse.removeElement($overlay);
          commonUse.addClass($modal, 'toasts');

          if (opts && opts.place === 'top') commonUse.addClass($modal, 'place-top'); // handle toasts top place
          if (opts && opts.bgColor) $modal.style.backgroundColor = opts.bgColor;
          if (opts && opts.fontColor) $message.style.color =opts.fontColor;

        } else {
          commonUse.addClass(document.body, 'no-scrolling'); // body no scorll
          (opts && opts.title) ? $title.innerHTML = opts.title : commonUse.removeElement($title); // handle title if set
          (opts && opts.okLabel) ? $btnOk.innerHTML = opts.okLabel : $btnOk.innerHTML = this.defaults.okLabel; // handle ok text if set
          $modal.style.marginTop =  - $modal.offsetHeight / 2 + 'px'; // set the place to center using margin-top;

          if (type === 'confirm' || type === 'prompt') {
            (opts && opts.cancelLabel) ? $btnCancel.innerHTML = opts.cancelLabel : $btnCancel.innerHTML = this.defaults.cancelLabel; // handle cancel text if set
          } else {
            commonUse.removeElement($btnCancel); // toasts and alery type do not need cancel btn
          }
        }

        this.bindEvent($modal, onOk, onCancel); // see next
      },

      /** 
       * [Bind event to dialog]
       *
       * @param $modal {Object}       -- modal node.
       * @param: onOk {Function}      -- ok callback.
       * @param: onCancel {Function}  -- cancel callback.
       */
      bindEvent: function($modal, onOk, onCancel) {
        var that = this;
        var $btnOk = $modal.querySelector('.btn-ok');
        var $btnCancel = $modal.querySelector('.btn-cancel');

        // toasts delay hide
        if (commonUse.hasClass($modal, 'toasts')) {
          setTimeout(function() {
            // if toasts has been removed
            if (document.getElementById($modal.id) === null) return;
            that.close($modal, onOk);
          }, that.defaults.time);
        }
        // click ok button
        if ($btnOk) {
          commonUse.addEvent($btnOk, 'click', function() {
            that.close($modal, onOk);
          });
        }
        // click cancel button
        if ($btnCancel) {
          commonUse.addEvent($btnCancel, 'click', function() {
            that.close($modal, onCancel);
          });
        }
      },

      /** 
       * [Close the actived modal and remove it]
       *
       * @param: $modal {Obejct}  -- modal element to remove.
       * @param: callback {Function}  -- callback function.
       */
      close: function($modal, callback) {
        var $input = $modal.querySelector('input');
        var $overlay = document.getElementById('overlay-'+$modal.id);

        // hide alerty with animation
        commonUse.removeClass($modal, 'alerty-show');
        commonUse.addClass($modal, 'alerty-hide');

        // remove alerty and other added elements
        setTimeout(function(){
          $overlay && commonUse.removeClass($overlay, 'active'), commonUse.removeClass(document.body, 'no-scrolling');
          
          commonUse.removeElement($modal);
          commonUse.removeElement($overlay);
          if (callback) {
            setTimeout(function(){
              !$input ? callback() : callback($input.value);  // handle prompt type, callback the input value
            }, 100);
          }
        },100);
      }
    };

    return {
      // return alerty.toasts();
      toasts: function(content, opts, callback) {
        Dialog.setup('toasts', content, opts, callback);
      },

      // return alerty.alert();
      alert: function(content, opts, onOk) {
        Dialog.setup('alert', content, opts, onOk);
      },

      // return alerty.confirm();
      confirm: function(content, opts, onOk, onCancel) {
        Dialog.setup('confirm', content, opts, onOk, onCancel);
      },

      // return alerty.prompt();
      prompt: function(content, opts, onOk, oncancel) {
        Dialog.setup('prompt', content, opts, onOk, oncancel);
      }
    };
  }
995884
private static <T> void createConvertDialog(final JFrame frm, final Formatting fmt, final UnaryFunction<Document,Callable<T>> init, final Callable<Void> end) {

        // Prepares UI components
        final JLabel dialogLabel =
            new JLabel("<html><b>Formatted data</b></html>");
        dialogLabel.setHorizontalTextPosition(SwingConstants.LEFT);

        final JEditorPane rowArea = new JEditorPane();
        rowArea.setEditable(false);
        dialogLabel.setLabelFor(rowArea);
        final JScrollPane rowPanel =
            new JScrollPane(rowArea,
                            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        rowPanel.setBorder(BorderFactory.createLoweredBevelBorder());
        rowArea.setContentType(fmt.mimeType);

        final JDialog dlg = new JDialog(frm, "Convert");
        final Container content = dlg.getContentPane();
        final GroupLayout layout = new GroupLayout(content);

        final Clipboard pb = Toolkit.getDefaultToolkit().getSystemClipboard();
        final AbstractAction pbcopy = new AbstractAction() {
                public void actionPerformed(final ActionEvent evt) {
                    final StringSelection codeSel =
                        new StringSelection(rowArea.getText());

                    pb.setContents(codeSel, null);
                }
            };
        pbcopy.putValue(Action.NAME, "Copy");
        pbcopy.putValue(Action.SHORT_DESCRIPTION, "Copy to paste board");
        final JButton copyBut = new JButton(pbcopy);

        // Lays out UI component
        content.setLayout(layout);

	layout.setAutoCreateGaps(true);
	layout.setAutoCreateContainerGaps(true);

        final GroupLayout.SequentialGroup vgroup =
            layout.createSequentialGroup().
            addComponent(dialogLabel).
            addComponent(rowPanel,
                         GroupLayout.PREFERRED_SIZE,
                         GroupLayout.DEFAULT_SIZE,
                         Short.MAX_VALUE).
            addComponent(copyBut);

        final GroupLayout.ParallelGroup hgroup =
            layout.createParallelGroup(Alignment.LEADING).
            addComponent(dialogLabel).
            addComponent(rowPanel).
            addGroup(layout.createSequentialGroup().
                     addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
                                     GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
                     addComponent(copyBut));

        layout.setVerticalGroup(vgroup);
        layout.setHorizontalGroup(hgroup);

        dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dlg.setMinimumSize(new Dimension(frm.getWidth(), frm.getHeight()/3));

        dlg.pack();
        dlg.setLocationRelativeTo(null);
        dlg.setVisible(true);

        final KeyAdapter kl = closeKeyStrokes(dlg);
        dlg.addKeyListener(kl);
        content.addKeyListener(kl);
        rowArea.addKeyListener(kl);

        rowArea.grabFocus();

        final ImageIcon waitIco = setWaitIcon(dialogLabel);

        try {
            final Callable<T> f = init.apply(rowArea.getDocument());

            final SwingWorker<Void,Void> w = new SwingWorker<Void,Void>() {
                public Void doInBackground() throws Exception {
                    try {
                        f.call();
                    } catch (Exception e) {
                        e.printStackTrace();
                        throw e;
                    } finally {
                        try { end.call(); } catch (Exception e) { }
                    }

                    return null;
                }
            };

            w.execute();
        } finally {
            waitIco.setImageObserver(null);
            dialogLabel.setIcon(null);
        } // end of finally
    }
29909
def display_dialog(self, *args, **kwargs):
        """"""
        form = kwargs.pop('form_instance', None)
        success_message = kwargs.pop('success_message', None)

        if not form:
            form = self.get_form_class()(initial=kwargs, instance=self.object)

        if not hasattr(form, "helper"):
            form.helper = FormHelper()
        form.helper.form_tag = False

        return {
            'title': self.title.format(
                model_name=self.get_model_config().model_name,
                object=str(self.object) if self.object else '',
            ),
            'content': self.render_to_string(self.template, {
                'form': form,
                'success_message': success_message,
            }),
            'submit_label': self.submit_label,
            'success': bool(success_message),
        }
450221
def create_dialog(self):
        """"""
        bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.idx_ok = bbox.button(QDialogButtonBox.Ok)
        self.idx_cancel = bbox.button(QDialogButtonBox.Cancel)

        """ ------ FILE LOCATION ------ """

        box_file = QGroupBox('File location')

        filebutton = QPushButton('Choose')
        filebutton.clicked.connect(self.save_as)
        self.idx_filename = filebutton

        flayout = QFormLayout()
        box_file.setLayout(flayout)
        flayout.addRow('Filename',
                           self.idx_filename)

        """ ------ N_SEG ------ """

        box_nseg = QGroupBox('Info')

        self.show_nseg = QLabel('')

        form = QFormLayout(box_nseg)
        form.addRow(self.show_nseg)

        """ ------ LOCATION ------ """

        box_loc = QGroupBox('Location')

        cghl = QHBoxLayout()
        cghl.addWidget(QLabel('Channel group'))
        cghl.addWidget(self.idx_group)
        cghl.addStretch(1)

        grid = QGridLayout(box_loc)
        grid.addLayout(cghl, 0, 0, 1, 3)
        grid.addWidget(QLabel('Channel(s)'), 1, 0)
        grid.addWidget(QLabel('Cycle(s)'), 1, 1)
        grid.addWidget(QLabel('Stage(s)'), 1, 2)
        grid.addWidget(self.idx_chan, 2, 0)
        grid.addWidget(self.idx_cycle, 2, 1)
        grid.addWidget(self.idx_stage, 2, 2)

        """ ------ CHUNKING ------ """

        box_chunk = QGroupBox('Chunking')

        self.chunk = {}
        self.chunk['event'] = FormRadio('by e&vent')
        self.evt_chan_only = FormBool('Channel-specific')
        self.chunk['epoch'] = FormRadio('by e&poch')
        self.epoch_param = epop = {}
        self.lock_to_staging = FormBool('Lock to staging epochs')
        epop['dur_label'] = QLabel('Duration (sec)')
        epop['dur'] = FormFloat(30.)
        epop['overlap'] = FormRadio('Overlap (0-1)')
        epop['step'] = FormRadio('Step (sec)')
        epop['overlap_val'] = QDoubleSpinBox()
        epop['overlap_val'].setRange(0, 0.9)
        epop['overlap_val'].setSingleStep(0.1)
        epop['overlap_val'].setValue(0.)
        epop['step_val'] = FormFloat(30.)
        self.chunk['segment'] = FormRadio('by longest &run')

        evt_box = QListWidget()
        evt_box.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.idx_evt_type = evt_box

        chunk_grp = QButtonGroup(box_chunk)
        chunk_grp.addButton(self.chunk['event'])
        chunk_grp.addButton(self.chunk['epoch'])
        chunk_grp.addButton(self.chunk['segment'])

        epoch_grp = QButtonGroup(box_chunk)
        epoch_grp.addButton(epop['overlap'])
        epoch_grp.addButton(epop['step'])

        grid = QGridLayout(box_chunk)
        grid.addWidget(self.chunk['event'], 0, 0, 1, 3)
        grid.addWidget(QLabel('  '), 1, 0)
        grid.addWidget(self.evt_chan_only, 1, 1, 1, 2)
        grid.addWidget(self.idx_evt_type, 2, 1, 3, 2)
        grid.addWidget(self.chunk['epoch'], 0, 3, 1, 3)
        grid.addWidget(QLabel('  '), 1, 3)
        grid.addWidget(self.lock_to_staging, 1, 4, 1, 2)
        grid.addWidget(epop['dur_label'], 2, 4)
        grid.addWidget(epop['dur'], 2, 5)
        grid.addWidget(epop['overlap'], 3, 4)
        grid.addWidget(epop['overlap_val'], 3, 5)
        grid.addWidget(epop['step'], 4, 4)
        grid.addWidget(epop['step_val'], 4, 5)
        grid.addWidget(self.chunk['segment'], 0, 6)

        """ ------ REJECTION ------ """

        box_r = QGroupBox('Rejection')

        self.min_dur = FormFloat(0.0)
        self.reject_epoch = FormBool('Exclude Poor signal epochs')
        self.reject_event = FormMenu(['none', 'channel-specific',
                                      'from any channel'])

        flayout = QFormLayout()
        box_r.setLayout(flayout)
        flayout.addRow(self.reject_epoch)
        flayout.addRow('Exclude Artefact events',
                       self.reject_event)
        flayout.addRow('Minimum duration (sec)',
                           self.min_dur)

        """ ------ CONCATENATION ------ """

        box_c = QGroupBox('Concatenation')

        self.cat = {}
        self.cat['chan'] = FormBool('Concatenate channels')
        self.cat['cycle'] = FormBool('Concatenate cycles')
        self.cat['stage'] = FormBool('Concatenate between stages')
        self.cat['discontinuous'] = FormBool(''
                'Concatenate discontinuous signal')
        self.cat['evt_type'] = FormBool('Concatenate between event types')

        for box in self.cat.values():
            box.setEnabled(False)

        flayout = QFormLayout()
        box_c.setLayout(flayout)
        flayout.addRow(self.cat['stage'])
        flayout.addRow(self.cat['cycle'])
        flayout.addRow(self.cat['evt_type'])
        flayout.addRow(self.cat['discontinuous'])
        flayout.addRow(self.cat['chan'])

        """ ------ PRE-PROCESSING ------ """

        box_pp = QGroupBox('Pre-processing')

        self.trans = {}
        self.trans['diff'] = FormBool('Differentiate')

        ftypes = ['none', 'butter', 'cheby1', 'cheby2', 'ellip', 'bessel',
                  'diff']

        self.trans['bp'] = tbp = {}
        self.trans['bandpass'] = FormMenu(ftypes)
        tbp['order'] = QLabel('Order'), FormSpin(3, 0, 8, 1)
        tbp['f1'] = QLabel('Lowcut (Hz)'), FormFloat()
        tbp['f2'] = QLabel('Highcut (Hz)'), FormFloat()

        self.trans['n1'] = tn1 = {}
        self.trans['notch1'] = FormMenu(ftypes)
        tn1['order'] = QLabel('Order'), FormSpin(3, 0, 8, 1)
        tn1['cf'] = QLabel('CF (Hz)'), FormFloat()
        tn1['bw'] = QLabel('BW (Hz)'), FormFloat()

        self.trans['n2'] = tn2 = {}
        self.trans['notch2'] = FormMenu(ftypes)
        tn2['order'] = QLabel('Order'), FormSpin(3, 0, 8, 1)
        tn2['cf'] = QLabel('CF (Hz)'), FormFloat()
        tn2['bw'] = QLabel('BW (Hz)'), FormFloat()

        form1 = QFormLayout()
        form1.addRow('Bandpass', self.trans['bandpass'])
        form1.addRow(*tbp['order'])
        form1.addRow(*tbp['f1'])
        form1.addRow(*tbp['f2'])

        form2 = QFormLayout()
        form2.addRow('Notch 1', self.trans['notch1'])
        form2.addRow(*tn1['order'])
        form2.addRow(*tn1['cf'])
        form2.addRow(*tn1['bw'])

        form3 = QFormLayout()
        form3.addRow('Notch 2', self.trans['notch2'])
        form3.addRow(*tn2['order'])
        form3.addRow(*tn2['cf'])
        form3.addRow(*tn2['bw'])

        grid = QGridLayout(box_pp)
        grid.addWidget(self.trans['diff'], 0, 0, 1, 3)
        grid.addLayout(form1, 1, 0)
        grid.addLayout(form2, 1, 1)
        grid.addLayout(form3, 1, 2)

        """ ------ FREQUENCY ------ """

        self.tab_freq = tab_freq = QWidget()

        self.frequency = freq = {}

        box_freq_main = QGroupBox('Options')

        #freq['freq_on'] = FormBool('Compute frequency domain')
        freq['export_full'] = FormBool('Full spectrum')
        freq['export_band'] = FormBool('Band-limited')
        freq['plot_on'] = FormBool('Plot mean spectrum')
        freq['fooof_on'] = FormBool('Parametrize')
        freq['prep'] = FormBool('Pre-process')

        form = QFormLayout(box_freq_main)
        form.addRow(freq['prep'])
        form.addRow(freq['export_full'])
        form.addRow(freq['export_band'])
        form.addRow(freq['plot_on'])
        form.addRow(freq['fooof_on'])

        freq['box_param'] = QGroupBox('Parameters')

        freq['scaling'] = FormMenu(['power', 'energy', 'fieldtrip', 'chronux'])
        freq['taper'] = FormMenu(['boxcar', 'hann', 'dpss', 'triang',
            'blackman', 'hamming', 'bartlett', 'flattop', 'parzen', 'bohman',
                'blackmanharris', 'nuttall', 'barthann'])
        freq['detrend'] = FormMenu(['none', 'constant', 'linear'])
        freq['welch_on'] = FormBool("Time-averaged")
        freq['log_trans']= FormBool('Log-transform')

        form = QFormLayout(freq['box_param'])
        form.addRow('Scaling', freq['scaling'])
        form.addRow('Taper', freq['taper'])
        form.addRow('Detrend', freq['detrend'])
        form.addRow(freq['welch_on'])
        form.addRow(freq['log_trans'])

        freq['box_welch'] = QGroupBox("Time averaging")

        freq['duration'] = FormFloat(1)
        freq['overlap'] = FormRadio('Overlap (0-1)')
        freq['step'] = FormRadio('Step (sec)')
        freq['overlap_val'] = QDoubleSpinBox()
        freq['overlap_val'].setRange(0, 1)
        freq['overlap_val'].setSingleStep(0.1)
        freq['overlap_val'].setValue(0.5)
        freq['step_val'] = FormFloat(0.5)
        freq['centend'] = FormMenu(['mean', 'median'])

        grid = QGridLayout(freq['box_welch'])
        grid.addWidget(QLabel('Duration (sec)'), 0, 0)
        grid.addWidget(freq['duration'], 0, 1)
        grid.addWidget(freq['overlap'], 1, 0)
        grid.addWidget(freq['step'], 2, 0)
        grid.addWidget(freq['overlap_val'], 1, 1)
        grid.addWidget(freq['step_val'], 2, 1)
        grid.addWidget(QLabel('Central tendency'), 3, 0)
        grid.addWidget(freq['centend'], 3, 1)

        freq['box_mtap'] = QGroupBox('Multitaper method (DPSS) smoothing')

        freq['nhbw'] = FormBool('Normalized')
        freq['hbw'] = FormSpin(3, 0)
        freq['nhbw_val'] = FormSpin(min_val=0)

        grid = QGridLayout(freq['box_mtap'])
        grid.addWidget(QLabel('Half bandwidth (Hz)'), 0, 0)
        grid.addWidget(freq['nhbw'], 1, 0)
        grid.addWidget(freq['hbw'], 0, 1)
        grid.addWidget(freq['nhbw_val'], 1, 1)

        freq['box_output'] = QGroupBox('Output')

        freq['spectrald'] = FormRadio('Spectral density')
        freq['complex'] = FormRadio('Complex')
        freq['sides'] = FormSpin(min_val=1, max_val=2)

        grid = QGridLayout(freq['box_output'])
        grid.addWidget(freq['spectrald'], 0, 0, 1, 3)
        grid.addWidget(freq['complex'], 1, 0, 1, 3)
        #grid.addWidget(QLabel('      '), 2, 0)
        #grid.addWidget(QLabel('Side(s)'), 2, 1)
        #grid.addWidget(freq['sides'], 2, 2)

        freq['box_nfft'] = QGroupBox('FFT length')

        freq['nfft_seg'] = FormRadio('Same as segment')
        freq['nfft_fixed'] = FormRadio('Fixed:')
        freq['nfft_fixed_val'] = FormInt()
        freq['nfft_zeropad'] = FormRadio('Zero-pad to longest segment')

        grid = QGridLayout(freq['box_nfft'])
        grid.addWidget(freq['nfft_seg'], 0, 0, 1, 2)
        grid.addWidget(freq['nfft_fixed'], 1, 0)
        grid.addWidget(freq['nfft_fixed_val'], 1, 1)
        grid.addWidget(freq['nfft_zeropad'], 2, 0, 1, 2)

        freq['box_norm'] = QGroupBox('Normalization')

        freq['norm'] = FormMenu(['none', 'by integral of each segment',
           'by mean of event type(s)', 'by mean of stage(s)'])
        evt_box = QListWidget()
        evt_box.setSelectionMode(QAbstractItemView.ExtendedSelection)
        freq['norm_evt_type'] = evt_box
        stage_box = QListWidget()
        stage_box.setSelectionMode(QAbstractItemView.ExtendedSelection)
        stage_box.addItems(STAGE_NAME)
        freq['norm_stage'] = stage_box
        freq['norm_concat'] = FormBool('Concatenate')

        grid = QGridLayout(freq['box_norm'])
        grid.addWidget(freq['norm'], 0, 0, 1, 2)
        grid.addWidget(QLabel('Event type(s)'), 1, 0)
        grid.addWidget(QLabel('Stage(s)'), 1, 1)
        grid.addWidget(freq['norm_evt_type'], 2, 0)
        grid.addWidget(freq['norm_stage'], 2, 1)
        grid.addWidget(freq['norm_concat'], 3, 0, 1, 2)

        freq['box_cross'] = QGroupBox('Cross-spectrum')

        freq['csd'] = FormBool('Cross-spectrum')
        freq['gainphase'] = FormBool('Gain and phase shift')
        #freq['phaseshift'] = FormBool('Phase shift')
        freq['coh'] = FormBool('Coherence')

        form = QFormLayout(freq['box_cross'])
        form.addRow(freq['csd'])
        form.addRow(freq['gainphase'])
        #form.addRow(freq['phaseshift'])
        form.addRow(freq['coh'])

        freq['box_fooof'] = QGroupBox('Parametrization')

        freq['fo_min_freq'] = FormFloat(2.)
        freq['fo_max_freq'] = FormFloat(30.)
        freq['fo_pk_thresh'] = FormFloat(2.)
        freq['fo_pk_width_min'] = FormFloat(.5)
        freq['fo_pk_width_max'] = FormFloat(12.)
        freq['fo_max_n_pk'] = FormInt()
        freq['fo_min_pk_amp'] = FormFloat(0)
        freq['fo_bg_mode'] = FormMenu(['fixed', 'knee'])

        freqhbox = QHBoxLayout()
        freqhbox.addWidget(QLabel('Frequencies:'))
        freqhbox.addWidget(freq['fo_min_freq'])
        freqhbox.addWidget(QLabel('-'))
        freqhbox.addWidget(freq['fo_max_freq'])
        freqhbox.addWidget(QLabel('Hz'))

        widhbox = QHBoxLayout()
        widhbox.addWidget(QLabel('Peak width:'))
        widhbox.addWidget(freq['fo_pk_width_min'])
        widhbox.addWidget(QLabel('-'))
        widhbox.addWidget(freq['fo_pk_width_max'])
        widhbox.addWidget(QLabel('Hz'))

        form = QFormLayout(freq['box_fooof'])
        form.addRow(freqhbox)
        form.addRow(widhbox)
        form.addRow('Peak threshold (SD)',
                    freq['fo_pk_thresh'])
        form.addRow('Max. number of peaks',
                    freq['fo_max_n_pk'])
        form.addRow('Min. peak amplitude',
                    freq['fo_min_pk_amp'])
        form.addRow('Background fitting mode',
                    freq['fo_bg_mode'])

        freq['box_band'] = QGroupBox('Define bands')

        freq['band'] = FormStr()
        freq['band_help'] = QPushButton(QIcon(ICON['help-about']), '', self)

        hlayout = QHBoxLayout()
        hlayout.addWidget(freq['band'])
        hlayout.addWidget(freq['band_help'])

        vlayout = QVBoxLayout(freq['box_band'])
        vlayout.addLayout(hlayout)

        vlayout1 = QVBoxLayout()
        vlayout1.addWidget(box_freq_main)
        vlayout1.addWidget(freq['box_param'])
        vlayout1.addWidget(freq['box_welch'])
        vlayout1.addWidget(freq['box_nfft'])
        vlayout1.addWidget(freq['box_mtap'])
        vlayout1.addWidget(freq['box_output'])
        vlayout1.addStretch(1)

        vlayout2 = QVBoxLayout()
        vlayout2.addWidget(freq['box_band'])
        vlayout2.addWidget(freq['box_norm'])
        vlayout2.addWidget(freq['box_cross'])
        vlayout2.addWidget(freq['box_fooof'])
        vlayout2.addStretch(1)

        hlayout = QHBoxLayout()
        hlayout.addLayout(vlayout1)
        hlayout.addLayout(vlayout2)

        vlayout = QVBoxLayout(tab_freq)
        vlayout.addLayout(hlayout)

        """ ------ PAC ------ """
        if Pac is not None:

            self.tab_pac = tab_pac = QWidget()

            pac_metrics = [pacstr((x, 0, 0))[0] for x in range(1,6)]
            pac_metrics = [x[:x.index('(') - 1] for x in pac_metrics]
            pac_metrics[1] = 'Kullback-Leibler Distance' # corrected typo
            pac_surro = [pacstr((1, x, 0))[1] for x in range(5)]
            pac_norm = [pacstr((1, 0, x))[2] for x in range(5)]

            self.pac = pac = {}

            pac['box_complex'] = QGroupBox('Complex definition')

            pac['hilbert_on'] = FormRadio('Hilbert transform')
            pac['hilbert'] = hilb = {}
            hilb['filt'] = QLabel('Filter'), FormMenu(['fir1', 'butter',
                'bessel'])
            hilb['cycle_pha'] = QLabel('Cycles, phase'), FormInt(default=3)
            hilb['cycle_amp'] = QLabel('Cycles, amp'), FormInt(default=6)
            hilb['order'] = QLabel('Order'), FormInt(default=3)
            pac['wavelet_on'] = FormRadio('Wavelet convolution')
            pac['wav_width'] = QLabel('Width'), FormInt(default=7)

            grid = QGridLayout(pac['box_complex'])
            grid.addWidget(pac['hilbert_on'], 0, 0, 1, 2)
            grid.addWidget(hilb['filt'][0], 1, 0)
            grid.addWidget(hilb['filt'][1], 1, 1)
            grid.addWidget(hilb['cycle_pha'][0], 2, 0)
            grid.addWidget(hilb['cycle_pha'][1], 2, 1)
            grid.addWidget(hilb['cycle_amp'][0], 3, 0)
            grid.addWidget(hilb['cycle_amp'][1], 3, 1)
            grid.addWidget(hilb['order'][0], 4, 0)
            grid.addWidget(hilb['order'][1], 4, 1)
            grid.addWidget(pac['wavelet_on'], 0, 3, 1, 2)
            grid.addWidget(pac['wav_width'][0], 1, 3)
            grid.addWidget(pac['wav_width'][1], 1, 4)

            pac['box_metric'] = QGroupBox('PAC metric')

            pac['pac_on'] = FormBool('Compute PAC')
            pac['prep'] = FormBool('Pre-process')
            pac['metric'] = FormMenu(pac_metrics)
            pac['fpha'] = FormStr()
            pac['famp'] = FormStr()
            pac['band_help_p'] = QPushButton(QIcon(ICON['help-about']), '',
               self)
            pac['band_help_a'] = QPushButton(QIcon(ICON['help-about']), '',
               self)
            pac['nbin'] = QLabel('Number of bins'), FormInt(default=18)

            hlayoutp = QHBoxLayout()
            hlayoutp.addWidget(pac['fpha'])
            hlayoutp.addWidget(pac['band_help_p'])

            hlayouta = QHBoxLayout()
            hlayouta.addWidget(pac['famp'])
            hlayouta.addWidget(pac['band_help_a'])

            flayout = QFormLayout(pac['box_metric'])
            flayout.addRow(pac['pac_on'])
            flayout.addRow('PAC metric',
                               pac['metric'])
            flayout.addRow('Phase frequencies (Hz)',
                               hlayoutp)
            flayout.addRow('Amplitude frequencies (Hz)',
                               hlayouta)
            flayout.addRow(*pac['nbin'])

            pac['box_surro'] = QGroupBox('Surrogate data')

            pac['surro_method'] = FormMenu(pac_surro)
            pac['surro_norm'] = FormMenu(pac_norm)
            pac['surro'] = sur = {}
            sur['nperm'] = QLabel('Number of surrogates'), FormInt(default=200)
            sur['nblocks'] = (QLabel('Number of amplitude blocks'),
                              FormInt(default=2))
            sur['pval'] = FormBool('Get p-values'), None
            sur['save_surro'] = FormBool('Save surrogate data'), None

            flayout = QFormLayout(pac['box_surro'])
            flayout.addRow(pac['surro_method'])
            flayout.addRow(pac['surro_norm'])
            flayout.addRow(*sur['nperm'])
            flayout.addRow(*sur['nblocks'])
            flayout.addRow(sur['pval'][0])
            flayout.addRow(sur['save_surro'][0])

            pac['box_opts'] = QGroupBox('Options')

            pac['optimize'] = FormMenu(['True', 'False', 'greedy', 'optimal'])
            pac['njobs'] = FormInt(default=-1)

            flayout = QFormLayout(pac['box_opts'])
            flayout.addRow('Optimize einsum',
                               pac['optimize'])
            flayout.addRow('Number of jobs',
                               pac['njobs'])

            hlayout = QHBoxLayout()
            hlayout.addWidget(pac['pac_on'])
            hlayout.addWidget(pac['prep'])

            vlayout = QVBoxLayout(tab_pac)
            vlayout.addLayout(hlayout)
            #vlayout.addWidget(QLabel(''))
            vlayout.addWidget(pac['box_metric'])
            vlayout.addWidget(pac['box_complex'])
            vlayout.addWidget(pac['box_surro'])
            vlayout.addWidget(pac['box_opts'])
            vlayout.addStretch(1)

        """ ------ EVENTS ------ """

        self.tab_evt = tab_evt = QWidget()

        self.event = ev = {}
        ev['global'] = eg = {}
        eg['count'] = FormBool('Count')
        eg['density'] = FormBool('Density, per (sec)')
        eg['density_per'] = FormFloat(30.0)
        eg['all_local'] = FormBool('All')
        eg['all_local_prep'] = FormBool('')

        ev['local'] = el = {}
        el['dur'] = FormBool('Duration (sec)'), FormBool('')
        el['minamp'] = FormBool('Min. amplitude (uV)'), FormBool('')
        el['maxamp'] = FormBool('Max. amplitude (uV)'), FormBool('')
        el['ptp'] = FormBool('Peak-to-peak amplitude (uV)'), FormBool('')
        el['rms'] = FormBool('RMS (uV)'), FormBool('')
        el['power'] = FormBool('Power (uV^2)'), FormBool('')
        el['energy'] = FormBool('Energy (uV^2s)'), FormBool('')
        el['peakpf'] = FormBool('Peak power frequency (Hz)'), FormBool('')
        el['peakef'] = FormBool('Peak energy frequency (Hz)'), FormBool('')

        ev['f1'] = FormFloat()
        ev['f2'] = FormFloat()

        ev['sw'] = {}
        ev['sw']['invert'] = FormBool('Inverted (down-then-up)')
        ev['sw']['prep'] = FormBool('Pre-process')
        ev['sw']['avg_slope'] = FormBool('Average slopes (uV/s)')
        ev['sw']['max_slope'] = FormBool('Max. slopes (uV/s^2)')

        box_global = QGroupBox('Global')

        grid1 = QGridLayout(box_global)
        grid1.addWidget(eg['count'], 0, 0)
        grid1.addWidget(eg['density'], 1, 0)
        grid1.addWidget(eg['density_per'], 1, 1)

        box_local = QGroupBox('Local')

        grid2 = QGridLayout(box_local)
        grid2.addWidget(QLabel('Parameter'), 0, 0)
        grid2.addWidget(QLabel('  '), 0, 1)
        grid2.addWidget(QLabel('Pre-process'), 0, 2)
        grid2.addWidget(eg['all_local'], 1, 0)
        grid2.addWidget(eg['all_local_prep'], 1, 2)
        grid2.addWidget(el['dur'][0], 2, 0)
        grid2.addWidget(el['minamp'][0], 3, 0)
        grid2.addWidget(el['minamp'][1], 3, 2)
        grid2.addWidget(el['maxamp'][0], 4, 0)
        grid2.addWidget(el['maxamp'][1], 4, 2)
        grid2.addWidget(el['ptp'][0], 5, 0)
        grid2.addWidget(el['ptp'][1], 5, 2)
        grid2.addWidget(el['rms'][0], 6, 0)
        grid2.addWidget(el['rms'][1], 6, 2)
        grid2.addWidget(el['power'][0], 7, 0)
        grid2.addWidget(el['power'][1], 7, 2)
        grid2.addWidget(el['energy'][0], 8, 0)
        grid2.addWidget(el['energy'][1], 8, 2)
        grid2.addWidget(el['peakpf'][0], 9, 0)
        grid2.addWidget(el['peakpf'][1], 9, 2)
        grid2.addWidget(el['peakef'][0], 10, 0)
        grid2.addWidget(el['peakef'][1], 10, 2)

        ev['band_box'] = QGroupBox('Band of interest')

        form = QFormLayout(ev['band_box'])
        form.addRow('Lowcut (Hz)', ev['f1'])
        form.addRow('Highcut (Hz)', ev['f2'])

        box_sw = QGroupBox('Slow wave')

        form = QFormLayout(box_sw)
        form.addRow(ev['sw']['avg_slope'])
        form.addRow(ev['sw']['max_slope'])
        form.addRow(ev['sw']['prep'])
        form.addRow(ev['sw']['invert'])

        grid = QGridLayout()
        grid.addWidget(box_global, 0, 0)
        grid.addWidget(ev['band_box'], 0, 1)
        grid.addWidget(box_local, 1, 0, 1, 2)
        grid.addWidget(box_sw, 2, 0, 1, 2)

        vlayout = QVBoxLayout(tab_evt)
        vlayout.addLayout(grid)
        vlayout.addStretch(1)

        """ ------ TRIGGERS ------ """

        for button in self.chunk.values():
            button.toggled.connect(self.toggle_buttons)
            button.toggled.connect(self.toggle_freq)

        for lw in [self.idx_chan, self.idx_cycle, self.idx_stage,
                   self.idx_evt_type]:
            lw.itemSelectionChanged.connect(self.toggle_concatenate)

        for button in [x[0] for x in self.event['local'].values()]:
            button.connect(self.toggle_buttons)

        self.chunk['epoch'].toggled.connect(self.toggle_concatenate)
        self.chunk['event'].toggled.connect(self.toggle_concatenate)
        self.idx_group.activated.connect(self.update_channels)
        self.lock_to_staging.connect(self.toggle_buttons)
        self.lock_to_staging.connect(self.toggle_concatenate)
        self.cat['discontinuous'].connect(self.toggle_concatenate)
        self.evt_chan_only.connect(self.update_nseg)

        epop['dur'].editingFinished.connect(self.update_nseg)
        epop['overlap_val'].valueChanged.connect(self.update_nseg)
        epop['step_val'].editingFinished.connect(self.update_nseg)
        epop['overlap'].connect(self.update_nseg)
        epop['overlap'].connect(self.toggle_buttons)
        self.min_dur.textChanged.connect(self.update_nseg)
        self.reject_epoch.connect(self.update_nseg)
        self.reject_event.connect(self.update_nseg)

        for box in self.cat.values():
            box.connect(self.update_nseg)

        self.trans['bandpass'].connect(self.toggle_buttons)
        self.trans['notch1'].connect(self.toggle_buttons)
        self.trans['notch2'].connect(self.toggle_buttons)

        freq['export_full'].connect(self.toggle_freq)
        freq['export_band'].connect(self.toggle_freq)
        freq['plot_on'].connect(self.toggle_freq)
        freq['fooof_on'].connect(self.toggle_freq)
        freq['taper'].connect(self.toggle_freq)
        freq['welch_on'].connect(self.toggle_freq)
        freq['complex'].clicked.connect(self.toggle_freq)
        freq['overlap'].connect(self.toggle_freq)
        freq['nhbw'].connect(self.toggle_freq)
        freq['norm'].activated.connect(self.toggle_freq)
        freq['nfft_fixed'].connect(self.toggle_freq)
        freq['nfft_zeropad'].connect(self.toggle_freq)
        freq['csd'].connect(self.toggle_freq)
        freq['gainphase'].connect(self.toggle_freq)
        #freq['phaseshift'].connect(self.toggle_freq)
        freq['coh'].connect(self.toggle_freq)
        freq['band_help'].clicked.connect(self.band_help)

        if Pac is not None:
            pac['pac_on'].connect(self.toggle_pac)
            pac['hilbert_on'].toggled.connect(self.toggle_pac)
            pac['wavelet_on'].toggled.connect(self.toggle_pac)
            pac['metric'].connect(self.toggle_pac)
            pac['surro_method'].connect(self.toggle_pac)
            pac['surro_norm'].connect(self.toggle_pac)
            pac['band_help_p'].clicked.connect(self.band_help)
            pac['band_help_a'].clicked.connect(partial(self.band_help, 'amp'))

        eg['density'].connect(self.toggle_buttons)
        eg['all_local'].clicked.connect(self.check_all_local)
        eg['all_local_prep'].clicked.connect(self.check_all_local_prep)
        for button in el.values():
            button[0].clicked.connect(self.uncheck_all_local)
            button[1].clicked.connect(self.uncheck_all_local)
        #ev['sw']['all_slope'].connect(self.check_all_slopes)
        ev['sw']['avg_slope'].connect(self.toggle_buttons)
        ev['sw']['max_slope'].connect(self.toggle_buttons)

        bbox.clicked.connect(self.button_clicked)

        """ ------ SET DEFAULTS ------ """

        self.evt_chan_only.setChecked(True)
        self.lock_to_staging.setChecked(True)
        self.chunk['epoch'].setChecked(True)
        self.reject_epoch.setChecked(True)
        epop['overlap'].setChecked(True)

        freq['prep'].setEnabled(False)
        freq['plot_on'].setEnabled(False)
        freq['box_param'].setEnabled(False)
        freq['box_welch'].setEnabled(False)
        freq['box_nfft'].setEnabled(False)
        freq['box_mtap'].setEnabled(False)
        freq['box_output'].setEnabled(False)
        freq['box_norm'].setEnabled(False)
        freq['box_cross'].setEnabled(False)
        freq['box_fooof'].setEnabled(False)
        freq['welch_on'].set_value(True)
        freq['nfft_seg'].setChecked(True)
        freq['spectrald'].setChecked(True)
        freq['detrend'].set_value('linear')
        freq['overlap'].setChecked(True)

        if Pac is not None:
            pac['prep'].setEnabled(False)
            pac['hilbert_on'].setChecked(True)
            pac['hilbert']['filt'][1].set_value('butter')
            pac['metric'].set_value('Kullback-Leibler Distance')
            pac['optimize'].set_value('False')
            pac['box_metric'].setEnabled(False)
            pac['box_complex'].setEnabled(False)
            pac['box_surro'].setEnabled(False)
            pac['box_opts'].setEnabled(False)

        el['dur'][1].set_value(False)

        """ ------ LAYOUT MASTER ------ """

        box3 = QTabWidget()

        box3.addTab(tab_freq, 'Frequency')
        if Pac is not None:
            box3.addTab(tab_pac, 'PAC')
        box3.addTab(tab_evt, 'Events')

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(bbox)

        hlayout1 = QHBoxLayout()
        hlayout1.addWidget(box_file)
        hlayout1.addWidget(box_nseg)

        hlayout2 = QHBoxLayout()
        hlayout2.addWidget(box_r)
        hlayout2.addWidget(box_c)

        vlayout1 = QVBoxLayout()
        vlayout1.addLayout(hlayout1)
        vlayout1.addWidget(box_loc)
        vlayout1.addWidget(box_chunk)
        vlayout1.addLayout(hlayout2)
        vlayout1.addWidget(box_pp)
        vlayout1.addStretch(1)

        vlayout2 = QVBoxLayout()
        vlayout2.addWidget(box3)
        vlayout2.addLayout(btnlayout)

        mhlayout = QHBoxLayout()
        mhlayout.addLayout(vlayout1)
        mhlayout.addLayout(vlayout2)
        mhlayout.addStretch(1)

        self.setLayout(mhlayout)
1236421
def dialog(self=None, wid=None, text=None, title=None, url=None, debug=False, verbose=False):
        

        PARAMS=set_param(["id","text","title","url","debug"],[wid,text,title,url,debug])
        response=api(url=self.__url+"/dialog?",PARAMS=PARAMS, method="GET", verbose=verbose)
        return response
769251
private void obtainDialogMargin(@NonNull final TypedArray typedArray) {
        int defaultHorizontalMargin =
                getContext().getResources().getDimensionPixelSize(R.dimen.dialog_horizontal_margin);
        int defaultVerticalMargin =
                getContext().getResources().getDimensionPixelSize(R.dimen.dialog_vertical_margin);
        int left = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginLeft,
                defaultHorizontalMargin);
        int top = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginTop,
                defaultVerticalMargin);
        int right = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginRight,
                defaultHorizontalMargin);
        int bottom = typedArray
                .getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginBottom,
                        defaultVerticalMargin);
        setDialogMargin(left, top, right, bottom);
    }
333450
def create_widget(self):
        
        d = self.declaration
        self.dialog = BottomSheetDialog(self.get_context(), d.style)
350678
def show(self, dialog):
        """"""
        for dlg in list(self.dialogs.values()):
            if to_text_string(dlg.windowTitle()) \
               == to_text_string(dialog.windowTitle()):
                dlg.show()
                dlg.raise_()
                break
        else:
            dialog.show()
            self.dialogs[id(dialog)] = dialog
            dialog.accepted.connect(
                              lambda eid=id(dialog): self.dialog_finished(eid))
            dialog.rejected.connect(
                              lambda eid=id(dialog): self.dialog_finished(eid))
987510
public VisDialog button (String text, Object object) {
		if (skin == null)
			throw new IllegalStateException("This method may only be used if the dialog was constructed with a Skin.");
		return button(text, object, skin.get(VisTextButtonStyle.class));
	}