automagically load views for a given timbit
433552
function loadViews(timbit) {
  timbit.views = [];
  
  var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
    , folder = path.join(config.home, 'views', timbit.viewBase);
    
  if (fs.existsSync(folder)) {
   var files = fs.readdirSync(folder);
   files.forEach(function(file) {
     timbit.views.push(file.replace(pattern, ''));
   });
  }
  
  // We will attempt the default view anyway and hope the timbit knows what it is doing.
  if (timbit.views.length === 0) timbit.views.push(timbit.defaultView);
}
511672
def register_view(self, view):
        """"""
        ExtendedController.register_view(self, view)  # no super to avoid sm based selection initialization
        view['name_text'].set_property('editable', True)
        view['value_text'].set_property('editable', True)
        view['type_text'].set_property('editable', True)

        self.tree_view.connect('key-press-event', self.tree_view_keypress_callback)
        self._apply_value_on_edited_and_focus_out(view['name_text'], self.apply_new_global_variable_name)
        self._apply_value_on_edited_and_focus_out(view['value_text'], self.apply_new_global_variable_value)
        self._apply_value_on_edited_and_focus_out(view['type_text'], self.apply_new_global_variable_type)
        view['new_global_variable_button'].connect('clicked', self.on_add)
        view['delete_global_variable_button'].connect('clicked', self.on_remove)
        view['lock_global_variable_button'].connect('clicked', self.on_lock)
        view['unlock_global_variable_button'].connect('clicked', self.on_unlock)
        self._tree_selection.set_mode(Gtk.SelectionMode.MULTIPLE)
1090812
def get_view(self, view_name, timestamp):
        """"""
        view = self._registered_views.get(view_name)
        if view is None:
            return None

        view_data_list = self._measure_to_view_data_list_map.get(
            view.measure.name)

        if not view_data_list:
            return None

        for view_data in view_data_list:
            if view_data.view.name == view_name:
                break
        else:
            return None

        return self.copy_and_finalize_view_data(view_data)
722337
function _loadViewState(e) {
        // file root is appended for each project
        var panes,
            promises = [],
            context = { location : { scope: "user",
                                     layer: "project" } },
            state = PreferencesManager.getViewState(PREFS_NAME, context);

        function convertViewState() {
            var context = { location : { scope: "user",
                                         layer: "project" } },
                files = PreferencesManager.getViewState(OLD_PREFS_NAME, context);

            if (!files) {
                // nothing to convert
                return;
            }

            var result = {
                orientation: null,
                activePaneId: FIRST_PANE,
                panes: {
                    "first-pane": []
                }
            };

            // Add all files to the workingset without verifying that
            // they still exist on disk (for faster project switching)
            files.forEach(function (value) {
                result.panes[FIRST_PANE].push(value);
            });

            return result;
        }

        if (!state) {
            // not converted yet
            state = convertViewState();
        }

        // reset
        _mergePanes();
        _mruList = [];
        ViewStateManager.reset();

        if (state) {

            panes = Object.keys(state.panes);
            _orientation = (panes.length > 1) ? state.orientation : null;

            _.forEach(state.panes, function (paneState, paneId) {
                _createPaneIfNecessary(paneId);
                promises.push(_panes[paneId].loadState(paneState));
            });

            AsyncUtils.waitForAll(promises).then(function (opensList) {

                // this will set the default layout of 50/50 or 100
                //  based on the number of panes
                _initialLayout();

                // More than 1 pane, then make it resizable
                //  and layout the panes from serialized state
                if (panes.length > 1) {
                    _makeFirstPaneResizable();

                    // If the split state was serialized correctly
                    //  then setup the splits according to was serialized
                    // Avoid a zero and negative split percentages
                    if ($.isNumeric(state.splitPercentage) && state.splitPercentage > 0) {
                        var prop;
                        if (_orientation === VERTICAL) {
                            prop = "width";
                        } else {
                            prop = "height";
                        }

                        _panes[FIRST_PANE].$el.css(prop, state.splitPercentage * 100 + "%");
                        _updateLayout();
                    }
                }

                if (_orientation) {
                    _$el.addClass("split-" + _orientation.toLowerCase());
                    exports.trigger("paneLayoutChange", _orientation);
                }

                _.forEach(_panes, function (pane) {
                    var fileList = pane.getViewList();

                    fileList.forEach(function (file) {
                        if (_findFileInMRUList(pane.id, file) !== -1) {
                            console.log(file.fullPath + " duplicated in mru list");
                        }
                        _mruList.push(_makeMRUListEntry(file, pane.id));
                    });
                    exports.trigger("workingSetAddList", fileList, pane.id);
                });

                promises = [];

                opensList.forEach(function (openData) {
                    if (openData) {
                        promises.push(CommandManager.execute(Commands.FILE_OPEN, openData));
                    }
                });

                // finally set the active pane
                AsyncUtils.waitForAll(promises).then(function () {
                    setActivePaneId(state.activePaneId);
                });
            });
        }
    }
505849
def register_view_for(cls, app, action, classview, attr):
        
        if 'view_for_endpoints' not in cls.__dict__:
            cls.view_for_endpoints = {}
        cls.view_for_endpoints.setdefault(app, {})[action] = (classview, attr)
88479
protected View loadView(String viewName, Locale locale) throws Exception {
		String suffix = getSuffix();
		if (".jsp".equals(suffix) || ".ftl".equals(suffix) || ".vm".equals(suffix)) {
			return null;
		} else {
			return super.loadView(viewName, locale);
		}
	}
119599
def run(self, tmp=None, task_vars=None):
        
        self._connection.on_action_run(
            task_vars=task_vars,
            delegate_to_hostname=self._task.delegate_to,
            loader_basedir=self._loader.get_basedir(),
        )
        return super(ActionModuleMixin, self).run(tmp, task_vars)
200936
def embed_snippet(views,
                  drop_defaults=True,
                  state=None,
                  indent=2,
                  embed_url=None,
                  requirejs=True,
                  cors=True
                 ):
    

    data = embed_data(views, drop_defaults=drop_defaults, state=state)

    widget_views = u'\n'.join(
        widget_view_template.format(view_spec=escape_script(json.dumps(view_spec)))
        for view_spec in data['view_specs']
    )

    if embed_url is None:
        embed_url = DEFAULT_EMBED_REQUIREJS_URL if requirejs else DEFAULT_EMBED_SCRIPT_URL

    load = load_requirejs_template if requirejs else load_template

    use_cors = ' crossorigin="anonymous"' if cors else ''
    values = {
        'load': load.format(embed_url=embed_url, use_cors=use_cors),
        'json_data': escape_script(json.dumps(data['manager_state'], indent=indent)),
        'widget_views': widget_views,
    }

    return snippet_template.format(**values)
198456
function View_load(path, cb) {
            var template = '';
            try {
                template = di.readFileSync(path);
            } catch (e) {
                logger.error('ViewLoader.load:', {
                    path: path,
                    cb: cb,
                    e: e
                });
            }
            return template;
        }
484698
function findView(app, name) {
    var keys = app.viewTypes.renderable;
    var len = keys.length;
    var i = -1;

    var res = null;
    while (++i < len) {
      res = app.find(name, keys[i]);
      if (res) {
        break;
      }
    }
    return res;
  }
927329
def from_memdb(buffer):
        """"""
        buffer = to_bytes(buffer)
        return View._from_ptr(rustcall(
            _lib.lsm_view_from_memdb,
            buffer, len(buffer)))
191121
function (id, callback) {
    this.loadViewModel(id, function (err, vm) {
      if (err) {
        return callback(err);
      }

      if (!vm || vm.actionOnCommit === 'create') {
        return callback(null, null);
      }

      callback(null, vm);
    });
  }
928409
def register_view(self, view):
        """"""
        super(StateMachinesEditorController, self).register_view(view)
        self.view['notebook'].connect('switch-page', self.on_switch_page)

        # Add all already open state machines
        for state_machine in self.model.state_machines.values():
            self.add_graphical_state_machine_editor(state_machine)
966493
def getAllViewsAsDict(self):
        """"""
        return {p: self._plugins[p].get_views() for p in self._plugins}
1314953
def simxLoadUI(clientID, uiPathAndName, options, operationMode):
    '''
    
    '''

    count = ct.c_int()
    uiHandles = ct.POINTER(ct.c_int)()
    if (sys.version_info[0] == 3) and (type(uiPathAndName) is str):
        uiPathAndName=uiPathAndName.encode('utf-8')
    ret = c_LoadUI(clientID, uiPathAndName, options, ct.byref(count), ct.byref(uiHandles), operationMode)
    
    handles = []
    if ret == 0:
        for i in range(count.value):
            handles.append(uiHandles[i])
        #free C buffers
        c_ReleaseBuffer(uiHandles)

    return ret, handles
159303
def register_view(self, view):
        """"""
        super(GraphicalEditorController, self).register_view(view)

        self.view.connect('meta_data_changed', self._meta_data_changed)
        self.focus_changed_handler_id = self.view.editor.connect('focus-changed', self._move_focused_item_into_viewport)
        self.view.editor.connect("drag-data-received", self.on_drag_data_received)
        self.drag_motion_handler_id = self.view.editor.connect("drag-motion", self.on_drag_motion)

        self.setup_canvas()
149720
def view_modifier(parser, token):
    
    try:
        tag_name, view_modifier = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError('view_modifier tag requires 1 argument (view_modifier), %s given' % (len(token.split_contents()) - 1))
    return ViewModifierNode(view_modifier)