Returns the popup widget for this editor.
        
        :return     <skyline.gui.XPopupWidget>
494081
def popupWidget(self):
        
        if not self._popup:
            btns = QDialogButtonBox.Save | QDialogButtonBox.Cancel
            self._popup = XPopupWidget(self, btns)
            self._popup.setShowTitleBar(False)
            self._popup.setAutoCalculateAnchor(True)
            self._popup.setPositionLinkedTo(self)
        return self._popup
980250
def showPopup( self ):
        
        if not self.isCheckable():
            return super(XComboBox, self).showPopup()
        
        if not self.isVisible():
            return
        
        # update the checkable widget popup
        point = self.mapToGlobal(QPoint(0, self.height() - 1))
        popup = self.checkablePopup()
        popup.setModel(self.model())
        popup.move(point)
        popup.setFixedWidth(self.width())
        
        height = (self.count() * 19) + 2
        if height > 400:
            height = 400
            popup.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        else:
            popup.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        
        popup.setFixedHeight(height)
        popup.show()
        popup.raise_()
965465
def show(self):
        
        super(XSnapshotWidget, self).show()
        
        if self.hideWindow():
            self.hideWindow().hide()
            QApplication.processEvents()
835055
def widget_for(element):
    
    view_type = _view_type_for_element(element)
    if view_type is None:
        raise KeyError('No view type for %r' % element)
    builder = view_widgets.get(view_type)
    if builder is None:
        raise KeyError('No widget type for %r' % view_type)
    return builder(element)
1101764
def show(self, ):
        
        self.update_all_buttons()
        pos = self.get_position()
        self.move(pos)
        super(WidgetToolTip, self).show()
1038359
def get_widget(self):
        
        form_field = self.get_form_field()
        widget = form_field.widget
        if isinstance(widget, type):
            widget = widget()

        # Widget instantiation needs to happen manually.
        # Auto skip if choices is not an existing attribute.
        form_field_choices = getattr(form_field, 'choices', None)
        if form_field_choices is not None:
            if hasattr(widget, 'choices'):
                widget.choices = form_field_choices
        return widget
205023
def navigator(self):
        
        if self._navigator is None:
            self._navigator = nav = XOrbColumnNavigator()
            self.lineEdit().setCompleter(None)
            
            # initialize settings
            nav.hide()
            nav.header().hide()
            nav.setWindowFlags(Qt.Popup)
            nav.setFocusPolicy(Qt.ClickFocus)
            nav.installEventFilter(self)
            nav.setVerticalScrollMode(nav.ScrollPerPixel)
            
            # create connections
            nav.itemClicked.connect(self.acceptColumn)
            self.lineEdit().textEdited.connect(self.showPopup)
            nav.schemaColumnChanged.connect(self.emitSchemaColumnChanged)
        
        return self._navigator
99686
def ganttWidget(self):
        
        tree = self.treeWidget()
        if ( not tree ):
            return None
        
        from projexui.widgets.xganttwidget import XGanttWidget
        return projexui.ancestor(tree, XGanttWidget)
116055
def create_widget(self):
        
        d = self.declaration
        style = d.style or '@style/Widget.DeviceDefault.PopupMenu'
        self.window = PopupWindow(self.get_context(), None, 0, style)
        self.showing = False
996861
function () {
        var self = this;

        self.aria('haspopup', true);

        self.on('click', function (e) {
          if (e.control === self) {
            if (self.panel && self.panel.visible()) {
              self.hidePanel();
            } else {
              self.showPanel();
              self.panel.focus(!!e.aria);
            }
          }
        });

        return self._super();
      }
466879
function showPreview(editor, popover) {
        var token, cm;

        // Figure out which editor we are over
        if (!editor) {
            editor = getHoveredEditor(lastMousePos);
        }

        if (!editor || !editor._codeMirror) {
            hidePreview();
            return;
        }

        cm = editor._codeMirror;

        // Find char mouse is over
        var pos = cm.coordsChar({left: lastMousePos.clientX, top: lastMousePos.clientY});

        // No preview if mouse is past last char on line
        if (pos.ch >= editor.document.getLine(pos.line).length) {
            return;
        }

        if (popover) {
            popoverState = popover;
        } else {
            // Query providers and append to popoverState
            token = TokenUtils.getTokenAt(cm, pos);
            popoverState = $.extend({}, popoverState, queryPreviewProviders(editor, pos, token));
        }

        if (popoverState && popoverState.start && popoverState.end) {
            popoverState.marker = cm.markText(
                popoverState.start,
                popoverState.end,
                {className: "quick-view-highlight"}
            );

            $previewContent.append(popoverState.content);
            $previewContainer.show();

            popoverState.visible = true;

            if (popoverState.onShow) {
                popoverState.onShow();
            } else {
                positionPreview(editor, popoverState.xpos, popoverState.ytop, popoverState.ybot);
            }
        }
    }
142930
def currentPlugin( self ):
        
        col    = self.uiWizardTABLE.currentColumn()
        row    = self.uiWizardTABLE.currentRow()
        item   = self.uiWizardTABLE.currentItem()
        widget = self.uiWizardTABLE.cellWidget(row, col)
        
        if ( not (widget and item and item.isSelected()) ):
            return None
            
        return widget.plugin()
113185
function popupClick(e) {

    var editor = this,
        popup = e.data.popup,
        target = e.target;

    // Check for message and prompt popups
    if (popup === popups.msg || $(popup).hasClass(PROMPT_CLASS))
      return;

    // Get the button info
    var buttonDiv = $.data(popup, BUTTON),
        buttonName = $.data(buttonDiv, BUTTON_NAME),
        button = buttons[buttonName],
        command = button.command,
        value,
        useCSS = editor.options.useCSS;

    // Get the command value
    if (buttonName == "font")
      // Opera returns the fontfamily wrapped in quotes
      value = target.style.fontFamily.replace(/"/g, "");
    else if (buttonName == "size") {
      if (target.tagName == "DIV")
        target = target.children[0];
      value = target.innerHTML;
    }
    else if (buttonName == "style")
      value = "<" + target.tagName + ">";
    else if (buttonName == "color")
      value = hex(target.style.backgroundColor);
    else if (buttonName == "highlight") {
      value = hex(target.style.backgroundColor);
      if (ie) command = 'backcolor';
      else useCSS = true;
    }

    // Fire the popupClick event
    var data = {
      editor: editor,
      button: buttonDiv,
      buttonName: buttonName,
      popup: popup,
      popupName: button.popupName,
      command: command,
      value: value,
      useCSS: useCSS
    };

    if (button.popupClick && button.popupClick(e, data) === false)
      return;

    // Execute the command
    if (data.command && !execCommand(editor, data.command, data.value, data.useCSS, buttonDiv))
      return false;

    // Hide the popup and focus the editor
    hidePopups();
    focus(editor);

  }
11847
def create_widget(self):
        
        d = self.declaration
        self.widget = WebView(self.get_context(), None, d.style)
41599
def create_widget(self):
        
        d = self.declaration
        self.widget = Icon(self.get_context(), None, d.style)
899479
def create_prj_browser(self, ):
        
        prjbrws = ComboBoxBrowser(1, headers=['Project:'])
        self.central_vbox.insertWidget(0, prjbrws)
        return prjbrws
231174
function(self, options) {

    self.options = options;
    self.editorName = self.name + '-widgets-editor';

    // Opens the editor modal of a widget, unless the widget is contextualOnly,
    // in which case we simply save the widget and call the save method
    // Widget can opitonally be set to skipInitialModal which skips the first
    // edit modal but binds future editing interactions

    self.edit = function(data, options, save) {
      if (!data) {
        data = {};
      }
      if (!data._id) {
        _.assign(data, apos.schemas.newInstance(self.schema));
      }

      // Only create a modal editor if the schema is not contextual only
      if (self.options.contextualOnly) {

        return save(checkOrGenerateId(data), function() {});

      } else {

        if (self.options.skipInitialModal && (!data || !data._id)) {
          return save(checkOrGenerateId(data), function() {});

        }

        apos.create(self.editorName, {
          label: self.label,
          action: self.options.action,
          schema: self.options.schema,
          data: data,
          templateOptions: options,
          save: save,
          module: self
        });
      }

      // Checks for an id or assign a generated one
      function checkOrGenerateId (data) {
        data = data || {};
        if (!data._id) {
          data._id = apos.utils.generateId();
        }
        return data;
      }

    };

    // Area editor calls this to determine whether to apply an empty state
    // class for the widget
    self.isEmpty = function($widget) {
      return false;
    };

    var superGetData = self.getData;
    self.getData = function($widget) {
      var data = superGetData($widget);
      // If the field is contextual and its type has a `contextualConvert`
      // function, we need to run that when retrieving the widget's data.
      // Or, if the field has a `contextualIsPresent` method, we can use that
      // to check whether an editor is actually present for it, bypassing the
      // need to restrict this feature solely to fields marked contextual
      // in the schema.
      _.each(self.schema, function(field) {
        var type = apos.schemas.fieldTypes[field.type];
        if (
          (type.contextualIsPresent && type.contextualIsPresent($widget, field) && type.contextualConvert) ||
          (field.contextual && type.contextualConvert)
        ) {
          apos.schemas.fieldTypes[field.type].contextualConvert(data, field.name, $widget, field);
        }
      });
      return data;
    };

    // Start autosaving the area containing the given widget,
    // then invoke the given function. On failure fn is not invoked.
    // Invoked by widgets that are edited contextually on the page,
    // like apostrophe-rich-text, as opposed to widgets edited
    // via a modal.

    self.startAutosavingAreaThen = function($widget, fn) {
      var $area = $widget.closest('[data-apos-area]');
      return $area.data('editor').startAutosavingThen(fn);
    };
  }