child process - this holds GUI elements
979442
def child_task(self, q, l, gq, gl, cw_sem):
        ''''''
        mp_util.child_close_fds()

        from MAVProxy.modules.lib import wx_processguard
        from ..lib.wx_loader import wx
        from MAVProxy.modules.mavproxy_misseditor import missionEditorFrame

        self.app = wx.App(False)
        self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None,id=wx.ID_ANY)

        self.app.frame.set_event_queue(q)
        self.app.frame.set_event_queue_lock(l)
        self.app.frame.set_gui_event_queue(gq)
        self.app.frame.set_gui_event_queue_lock(gl)
        self.app.frame.set_close_window_semaphore(cw_sem)

        self.app.SetExitOnFrameDelete(True)
        self.app.frame.Show()

        # start a thread to monitor the "close window" semaphore:
        class CloseWindowSemaphoreWatcher(threading.Thread):
            def __init__(self, task, sem):
                threading.Thread.__init__(self)
                self.task = task
                self.sem = sem
            def run(self):
                self.sem.acquire(True)
                self.task.app.ExitMainLoop()
        watcher_thread = CloseWindowSemaphoreWatcher(self, cw_sem)
        watcher_thread.start()

        self.app.MainLoop()
        # tell the watcher it is OK to quit:
        cw_sem.release()
        watcher_thread.join()
808016
function() {
        if (process.platform !== 'win32') {
            return;
        }

        var id = $$persistence.processId();
        if (id) {
            child_process.exec('tasklist /FI "PID eq ' + id + '" /FO LIST', _.bind(function(error, stdout, stderror) {
                /*
                // tasklist.exe output looks like this:
                Image Name:   Client.exe
                PID:          12008
                Session Name: Console
                Session#:     1
                Mem Usage:    39,384 K
                */

                stdout = stdout.toString();
                var match = XRegExp.exec(stdout, XRegExp('[\\d,]+\\sK'));
                if (!match) {
                    return;
                }

                match = match[0]; // "39,384 K"
                match = match.replace(',', '').replace(' K', ''); // "39384"
                var memory = parseInt(match) * 1024; // 40329216
                this._memoryFrame(memory);

                clearTimeout(this._updateMemoryWinTimeout);
                this._updateMemoryWinTimeout = setTimeout(_.bind(this._updateMemoryWin, this), this._updateStatsRate);

                $$persistence.checkMemory(memory);
            }, this));
        } else {
            clearTimeout(this._updateMemoryWinTimeout);
            this._updateMemoryWinTimeout = setTimeout(_.bind(this._updateMemoryWin, this), this._updateStatsRate);
        }
    }
897431
public function process()
    {
        parent::process();

        $flydown = $this->getCompositeWidget('action_flydown');
        $selected_id = $flydown->value;

        if (isset($this->action_items_by_id[$selected_id])) {
            $this->selected = $this->action_items_by_id[$selected_id];

            if ($this->selected->widget !== null) {
                $this->selected->widget->process();
            }
        } else {
            $this->selected = null;
        }
    }
786085
def prev_window(self, widget, data=None):
        
        self.path_window.hide()
        self.parent.open_window(widget, self.data)
1291983
private void initGUI() {

        Panel pQuery   = new Panel();
        Panel pCommand = new Panel();

        // define a Panel pCard which takes four different cards/views:
        // tree of tables, command SQL text area, result window and an editor/input form
        pCard      = new Panel();
        layoutCard = new CardLayout(2, 2);

        pCard.setLayout(layoutCard);

        // four buttons at the top to quickly switch between the four views
        butTree    = new Button("Tree");
        butCommand = new Button("Command");
        butResult  = new Button("Result");
        butEditor  = new Button("Editor");

        butTree.addActionListener(this);
        butCommand.addActionListener(this);
        butResult.addActionListener(this);
        butEditor.addActionListener(this);

        Panel pButtons = new Panel();

        pButtons.setLayout(new GridLayout(1, 4, 8, 8));
        pButtons.add(butTree);
        pButtons.add(butCommand);
        pButtons.add(butResult);
        pButtons.add(butEditor);

        pResult = new Panel();

        pQuery.setLayout(new BorderLayout());
        pCommand.setLayout(new BorderLayout());
        pResult.setLayout(new BorderLayout());

        Font fFont = new Font("Dialog", Font.PLAIN, 12);

        txtCommand = new TextArea(5, 40);

        txtCommand.addKeyListener(this);

        txtResult = new TextArea(20, 40);

        txtCommand.setFont(fFont);
        txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

        butExecute = new Button("Execute");

        butExecute.addActionListener(this);
        pCommand.add("South", butExecute);
        pCommand.add("Center", txtCommand);

        gResult = new Grid();

        setLayout(new BorderLayout());
        pResult.add("Center", gResult);

        tTree = new Tree();

        tTree.setMinimumSize(new Dimension(200, 100));
        gResult.setMinimumSize(new Dimension(200, 300));

        eEditor = new ZaurusEditor();

        pCard.add("tree", tTree);
        pCard.add("command", pCommand);
        pCard.add("result", pResult);
        pCard.add("editor", eEditor);
        fMain.add("Center", pCard);
        fMain.add("North", pButtons);
        doLayout();
        fMain.pack();
    }
169518
function() {
        if (process.platform !== 'win32') {
            return;
        }

        this._cpuConsole = child_process.spawn('typeperf', ['\\Processor(_Total)\\% Processor Time']);
        this._cpuConsole.stdout.on('data', _.bind(function(stdout) {

            stdout = stdout.toString();
            if (stdout && stdout.indexOf(',') === 0) {
                var cpu = parseFloat(stdout.substr(2, stdout.length - 3));
                this._cpuFrame(cpu);
            }
        }, this));
    }
686765
def iterchildren(self):
        
        handle = self.handle
        index = 0
        while 1:
            subkey = win32.RegEnumKey(handle, index)
            if subkey is None:
                break
            yield self.child(subkey)
            index += 1
184470
function () {
			if (this.settings.parentElement === false)
				return this.createErrorMessage("No parent element set!");
			// This is the container in
			// which the bar resides
			this.progressBar = $("<progress>").attr({
				"id": "progress-bar",
				"value": 0,
				"max": 100
			}).appendTo(this.settings.parentElement);
			this.progressLabel = $("<div>").attr({
				"class": "progress-bar-label"
			}).html("0%").appendTo(this.settings.parentElement);
			var div = $("<div>").html(this.settings.name).appendTo(this.settings.parentElement);
		}
547297
private void buildGui() {
		initWidget(UI_BINDER.createAndBindUi(this));
		zoomInElement.getElement().setInnerText("+");
		zoomOutElement.getElement().setInnerText("-");
		getElement().getStyle().setPosition(Position.ABSOLUTE);
		getElement().getStyle().setTop(5, Unit.PX);
		getElement().getStyle().setLeft(5, Unit.PX);

		if (Dom.isTouchSupported()) {
			initializeForTouchDevice();
		} else {
			initializeForDesktop();
		}
	}
71498
function () {
            var self = this,
                $el = self.element;
            // Use $el for the outer element.
            self.$outer = $el;
            // Use `body` for the inner element if the outer element is `window`. Otherwise, use the first child of `$el`.
            self.$inner = $.isWindow(self.element.get(0)) ? $('body') : $el.children(':first-child');
            self.$sausages = $('<div class="sausage-set"/>');
            self.sausages = self.$sausages.get(0);
            self.offsets = [];
            self.$sausages
                .appendTo(self.$inner)
                ;
            // Trigger the `create` event.
            self._trigger('create');
            return;
        }
39372
public function process()
    {
        parent::process();

        if ($this->show_check_all) {
            $this->check_all->process();
        }

        // this is part of the old selection API
        $item_name = $this->getCheckboxRendererId();
        if (isset($_POST[$item_name]) && is_array($_POST[$item_name])) {
            $this->items = $_POST[$item_name];
        }
    }
387216
def insertChild(self, index, item):
        
        super(XGanttWidgetItem, self).insertChild(index, item)
        item.sync()
705091
def __get_gui_handle(self, root_dir):
        
        gui_path = os.path.join(root_dir, '.gui')
        fh = open(gui_path, "w+")
        return (gui_path, fh)
769343
function() {

          if (common.isUndefined(SAVE_DIALOGUE)) {
            SAVE_DIALOGUE = new CenteredDiv();
            SAVE_DIALOGUE.domElement.innerHTML = saveDialogueContents;
          }

          if (this.parent) {
            throw new Error("You can only call remember on a top level GUI.");
          }

          var _this = this;

          common.each(Array.prototype.slice.call(arguments), function(object) {
            if (_this.__rememberedObjects.length == 0) {
              addSaveMenu(_this);
            }
            if (_this.__rememberedObjects.indexOf(object) == -1) {
              _this.__rememberedObjects.push(object);
            }
          });

          if (this.autoPlace) {
            // Set save row width
            setWidth(this, this.width);
          }

        }
1003304
def build_gui(self, container):
        
        vbox = Widgets.VBox()
        vbox.set_border_width(2)
        vbox.set_spacing(1)

        w = Viewers.GingaViewerWidget(viewer=self)
        vbox.add_widget(w, stretch=1)

        # set up to capture cursor movement for reading out coordinates

        # coordinates reported in base 1 or 0?
        self.pixel_base = 1.0

        self.readout = Widgets.Label("")
        vbox.add_widget(self.readout, stretch=0)

        #self.set_callback('none-move', self.motion_cb)
        self.set_callback('cursor-changed', self.motion_cb)

        # need to put this in an hbox with an expanding label or the
        # browser wants to resize the canvas, distorting it
        hbox = Widgets.HBox()
        hbox.add_widget(vbox, stretch=0)
        hbox.add_widget(Widgets.Label(''), stretch=1)

        container.set_widget(hbox)
674005
def attach_event_handler(canvas, handler=close_on_esc_or_middlemouse):
    
    if getattr(canvas, "_py_event_dispatcher_attached", None):
        return

    event_dispatcher = C.TPyDispatcherProcessedEvent(handler)
    canvas.Connect("ProcessedEvent(int,int,int,TObject*)",
                   "TPyDispatcherProcessedEvent", event_dispatcher,
                   "Dispatch(int,int,int,TObject*)")

    # Attach a handler only once to each canvas, and keep the dispatcher alive
    canvas._py_event_dispatcher_attached = event_dispatcher
359917
private void buildGui() {
		left = toInteger(getElement().getStyle().getLeft());
		top = toInteger(getElement().getStyle().getTop());
		zoomInElement.getElement().setInnerText("+");
		zoomOutElement.getElement().setInnerText("-");
		StopPropagationHandler preventWeirdBehaviourHandler = new StopPropagationHandler();

		// Calculate height:
		int y = 0;
		for (int i = 0; i < viewPort.getResolutionCount(); i++) {
			final int count = i;

			SimplePanel zoomStep = new SimplePanel();
			zoomStep.setSize(ZOOMBUTTON_SIZE + "px", (ZOOMSTEP_HEIGHT + 1) + "px");
			zoomStep.setStyleName(resource.css().zoomStepControlStep());
			zoomStep.addDomHandler(new ClickHandler() {

				public void onClick(ClickEvent event) {
					double scale = viewPort.getResolution(viewPort.getResolutionCount() - count - 1);
					viewPort.applyResolution(scale);
					event.stopPropagation();
				}
			}, ClickEvent.getType());
			zoomStep.addDomHandler(preventWeirdBehaviourHandler, MouseDownEvent.getType());
			zoomStep.addDomHandler(preventWeirdBehaviourHandler, MouseUpEvent.getType());
			zoomStep.addDomHandler(preventWeirdBehaviourHandler, ClickEvent.getType());
			zoomStep.addDomHandler(preventWeirdBehaviourHandler, DoubleClickEvent.getType());
			zoomStepsPanel.add(zoomStep, 0, y);
			y += ZOOMSTEP_HEIGHT;
		}
		zoomStepsPanel.setSize(ZOOMBUTTON_SIZE + "px", (y + 1) + "px");
		setSize(ZOOMBUTTON_SIZE + "px", (y + (ZOOMBUTTON_SIZE * 2) + 1) + "px");

		// Zoom in button:
		zoomInElement.addDomHandler(new ClickHandler() {

			public void onClick(ClickEvent event) {
				int index = viewPort.getResolutionIndex(viewPort.getResolution());
				if (index < viewPort.getResolutionCount() - 1) {
					viewPort.registerAnimation(NavigationAnimationFactory.createZoomIn(mapPresenter));
				}
				event.stopPropagation();
			}
		}, ClickEvent.getType());
		zoomInElement.addDomHandler(preventWeirdBehaviourHandler, MouseDownEvent.getType());
		zoomInElement.addDomHandler(preventWeirdBehaviourHandler, MouseUpEvent.getType());
		zoomInElement.addDomHandler(preventWeirdBehaviourHandler, ClickEvent.getType());
		zoomInElement.addDomHandler(preventWeirdBehaviourHandler, DoubleClickEvent.getType());

		// Zoom out button:
		zoomOutElement.addDomHandler(new ClickHandler() {

			public void onClick(ClickEvent event) {
				int index = viewPort.getResolutionIndex(viewPort.getResolution());
				if (index > 0) {
					viewPort.registerAnimation(NavigationAnimationFactory.createZoomOut(mapPresenter));
				}
				event.stopPropagation();
			}
		}, ClickEvent.getType());
		zoomOutElement.addDomHandler(preventWeirdBehaviourHandler, MouseDownEvent.getType());
		zoomOutElement.addDomHandler(preventWeirdBehaviourHandler, MouseUpEvent.getType());
		zoomOutElement.addDomHandler(preventWeirdBehaviourHandler, ClickEvent.getType());
		zoomOutElement.addDomHandler(preventWeirdBehaviourHandler, DoubleClickEvent.getType());

		// Add the zoom handle:
		ZoomStephandler zoomStepHandler = new ZoomStephandler();
		zoomStepHandler.setMinY(top + ZOOMBUTTON_SIZE);
		zoomStepHandler.setMaxY(top + ZOOMBUTTON_SIZE + (viewPort.getResolutionCount() - 1) * ZOOMSTEP_HEIGHT);
		zoomHandle.addDomHandler(zoomStepHandler, MouseDownEvent.getType());
		addDomHandler(zoomStepHandler, MouseUpEvent.getType());
		addDomHandler(zoomStepHandler, MouseMoveEvent.getType());
		addDomHandler(zoomStepHandler, MouseOutEvent.getType());

		// Apply correct positions for all widgets:
		applyPositions();
	}