Show InaSAFE Multi Exposure.
346248
def show_multi_exposure(self):
        """"""
        from safe.gui.tools.multi_exposure_dialog import MultiExposureDialog
        dialog = MultiExposureDialog(
            self.iface.mainWindow(), self.iface)
        dialog.exec_()
255598
def createNewTriples(Win):
    """"""

    win.help("Building list of exposures to look for triples")

    cols=('e.expnum', 'object',
      'mjdate',
      'uttime',
      'elongation',
      'filter',
      'obs_iq_refccd','qso_status' )
    header='%6s %-10s%-12s%10s%10s%10s%8s%10s' %  cols  


    pointings=getNewTriples()
    num_p=len(pointings)

    for pointing in pointings:
        pid=pointing[0]
	mjd=pointing[1]
        expnums=getExpnums(pointing=pid,night=mjd)
        num_p=num_p-1
        while (1):
            ### Loop over this pointing until keystroke gets us out

            win.help("Select (space)  members of triplets - %d remaining" % num_p )

            ## start with an empty list
            explist=[]
            choices=[]

            current_date=''
            for expnum in expnums:
                info=getExpInfo(expnum[0])
                row=()
                if not str(info['triple'])=='None' :
                       continue
                if str(info['obs_iq_refccd'])=='None':
                    info['obs_iq_refccd']=-1.0

                choices.append('%6d %10s %15s %10s %8.2f %10s %8.2f %10s' % (
                    int(info['e.expnum']),
                    str(info['object']),
                    str(info['mjdate']),
                    str(info['uttime']),
                    float(str(info['elongation'])),
                    str(info['filter']),
                    float(str(info['obs_iq_refccd'])),
                    str(info['qso_status'])
                    ))
                explist.append(expnum[0])

            if len(choices)<3:
                ### we need to provide at least 3 choices,
                ### otherwise this isn't a triple (is it)
                break

            ### win.list returns the user's choices as a list.
            choice_list=win.list(header,choices)

            ### zero length list implies were done.
            if choice_list==None:
                break

            ### is this actually a triple?
            if len(choice_list)!=3:
                win.help("Must have 3 members to make a tripple")
                continue

            ### Create a new line in the triple table
            sql = "INSERT INTO triples (id, pointing ) VALUES ( NULL, %s ) "
            cfeps.execute(sql, ( pid, ) )
	    sql = "SELECT id FROM triples WHERE pointing=%s order by id desc" 
	    cfeps.execute(sql, ( pid, ) )
	    ttt=cfeps.fetchall()
            triple= ttt[0][0]
	    win.help(str(triple))

            ### record the members of this new triple.
            sql = "INSERT INTO triple_members (triple, expnum) VALUES ( %s, %s)";
	    win.help(sql)

            for exp in choice_list:
                cfeps.execute(sql,(triple,explist[exp]))

    return(0)
1250432
function(item) {

			var counter = 0,
				img = item.img[0],
				mfpSetInterval = function(delay) {

					if(_imgInterval) {
						clearInterval(_imgInterval);
					}
					// decelerating interval that checks for size of an image
					_imgInterval = setInterval(function() {
						if(img.naturalWidth > 0) {
							mfp._onImageHasSize(item);
							return;
						}

						if(counter > 200) {
							clearInterval(_imgInterval);
						}

						counter++;
						if(counter === 3) {
							mfpSetInterval(10);
						} else if(counter === 40) {
							mfpSetInterval(50);
						} else if(counter === 100) {
							mfpSetInterval(500);
						}
					}, delay);
				};

			mfpSetInterval(1);
		}
113831
function detectSubsampling( img ) {
                var iw = img.naturalWidth,
                    ih = img.naturalHeight,
                    canvas, ctx;

                // subsampling may happen overmegapixel image
                if ( iw * ih > 1024 * 1024 ) {
                    canvas = document.createElement('canvas');
                    canvas.width = canvas.height = 1;
                    ctx = canvas.getContext('2d');
                    ctx.drawImage( img, -iw + 1, 0 );

                    // subsampled image becomes half smaller in rendering size.
                    // check alpha channel value to confirm image is covering
                    // edge pixel or not. if alpha value is 0
                    // image is not covering, hence subsampled.
                    return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0;
                } else {
                    return false;
                }
            }
361590
def cancel_button_clicked(self):
        """"""
        # Change mode
        self.mode = CHOOSE_MODE
        # Enable all edit buttons and combo boxes
        for i in range(len(self.exposures)):
            if i == self.special_case_index:
                self.exposure_edit_buttons[i].setEnabled(False)
                self.exposure_combo_boxes[i].setEnabled(False)
                continue
            if self.get_classification(self.exposure_combo_boxes[i]):
                self.exposure_edit_buttons[i].setEnabled(True)
            else:
                self.exposure_edit_buttons[i].setEnabled(False)
            # self.exposure_edit_buttons[i].setText(tr('Edit'))
            self.exposure_combo_boxes[i].setEnabled(True)

        # Clear right panel
        clear_layout(self.right_layout)
        # Show current state
        self.show_current_state()
        # Unset active exposure
        self.active_exposure = None

        self.parent.pbnNext.setEnabled(self.is_ready_to_next_step())
813236
function _fnProcessingDisplay ( settings, show )
	{
		if ( settings.oFeatures.bProcessing ) {
			$(settings.aanFeatures.r).css( 'visibility', show ? 'visible' : 'hidden' );
		}
	
		_fnCallbackFire( settings, null, 'processing', [settings, show] );
	}
1140635
def _create_show_definitions_action(self):
        """"""
        icon = resources_path('img', 'icons', 'show-inasafe-help.svg')
        self.action_show_definitions = QAction(
            QIcon(icon),
            self.tr('InaSAFE Help'),
            self.iface.mainWindow())
        self.action_show_definitions.setStatusTip(self.tr(
            'Show InaSAFE Help'))
        self.action_show_definitions.setWhatsThis(self.tr(
            'Use this to show a document describing all InaSAFE concepts.'))
        self.action_show_definitions.triggered.connect(
            self.show_definitions)
        self.add_action(
            self.action_show_definitions,
            add_to_toolbar=True)
661392
def set_widgets(self):
        """"""
        existing_inasafe_field = self.parent.get_existing_keyword(
            'inasafe_fields')
        # Remove old container and parameter
        if self.parameter_container:
            self.kwExtraKeywordsGridLayout.removeWidget(
                self.parameter_container)
        if self.parameters:
            self.parameters = []

        # Iterate through all inasafe fields
        for inasafe_field in self.inasafe_fields_for_the_layer():
            # Option for Not Available
            option_list = [no_field]
            for field in self.parent.layer.fields():
                # Check the field type
                if isinstance(inasafe_field['type'], list):
                    if field.type() in inasafe_field['type']:
                        field_name = field.name()
                        option_list.append('%s' % field_name)
                else:
                    if field.type() == inasafe_field['type']:
                        field_name = field.name()
                        option_list.append('%s' % field_name)

            # If there is no option, pass
            if option_list == [no_field]:
                continue

            # Create SelectParameter
            select_parameter = SelectParameter()
            select_parameter.guid = inasafe_field['key']
            select_parameter.name = inasafe_field['name']
            select_parameter.is_required = False
            select_parameter.description = inasafe_field['description']
            select_parameter.help_text = inasafe_field['help_text']
            select_parameter.element_type = str
            select_parameter.options_list = option_list
            select_parameter.value = no_field
            # Check if there is already value in the metadata.
            if existing_inasafe_field:
                existing_value = existing_inasafe_field.get(
                    inasafe_field['key'])
                if existing_value:
                    if existing_value in select_parameter.options_list:
                        select_parameter.value = existing_value

            self.parameters.append(select_parameter)

        # Create the parameter container and add to the wizard.
        self.parameter_container = ParameterContainer(self.parameters)
        self.parameter_container.setup_ui()
        self.kwExtraKeywordsGridLayout.addWidget(self.parameter_container)

        if not self.parameters:
            no_field_message = tr(
                'There is no available field that has match type for the '
                'InaSAFE fields. You can click next.')
            self.lblInaSAFEFields.setText(no_field_message)
971872
function show()
    {
        //---Mostrar la imagen dependiendo del tipo de archivo
        switch($this->type)
        {
            case IMAGETYPE_JPEG:
                imagejpeg($this->image);
                break;
            case IMAGETYPE_GIF:
                imagegif($this->image);
                break;
            case IMAGETYPE_PNG:
                imagepng($this->image);
                break;
        }
    }
1286260
def exposure_units(exposure):
    
    units = definition(exposure)['units']
    return sorted(units, key=lambda k: k['key'])
628430
def view_exposure_info(token, dstore):
    
    assetcol = dstore['assetcol/array'][:]
    taxonomies = sorted(set(dstore['assetcol'].taxonomies))
    cc = dstore['assetcol/cost_calculator']
    ra_flag = ['relative', 'absolute']
    data = [('#assets', len(assetcol)),
            ('#taxonomies', len(taxonomies)),
            ('deductibile', ra_flag[int(cc.deduct_abs)]),
            ('insurance_limit', ra_flag[int(cc.limit_abs)]),
            ]
    return rst_table(data) + '\n\n' + view_assets_by_site(token, dstore)
918065
def show_image(self, key):
        """"""
        data = self.model.get_data()
        data[key].show()
891990
def show(self):
        """"""

        # noinspection PyPackageRequirements
        from IPython.display import Image, display

        fname = self.render()
        display(Image(filename=fname))
1359943
public void onBindCell(int offset, int position, boolean showFromEnd) {
        if (!mIsExposed && serviceManager != null) {
            ExposureSupport exposureSupport = serviceManager.getService(ExposureSupport.class);
            if (exposureSupport != null) {
                mIsExposed = true;
                exposureSupport.onExposure(this, offset, position);
            }
        }
    }
76898
def save_state(self):
        
        state = {
            'hazard': self.hazard_layer_combo.currentText(),
            'exposure': self.exposure_layer_combo.currentText(),
            'aggregation': self.aggregation_layer_combo.currentText(),
            'report': self.results_webview.page().currentFrame().toHtml()}
        self.state = state
441398
def _get_exposures_requiring_pyephem_positions(
            self,
            concurrentSnapshots=10):
        
        self.log.info(
            'starting the ``_get_exposures_requiring_pyephem_positions`` method')

        if self.dev_flag == True:
            dev_flag = " and dev_flag = 1"
        else:
            dev_flag = ""

        sqlQuery = u"""
            select distinct pyephem_mjd from atlas_exposures where pyephem_positions = 0 and local_data = 1 %(dev_flag)s order by pyephem_mjd asc
        """ % locals()
        rows = readquery(
            log=self.log,
            sqlQuery=sqlQuery,
            dbConn=self.atlasMoversDBConn,
            quiet=False
        )

        snapshotsRequired = len(rows)

        if snapshotsRequired == 0:
            return [], [], 0

        nextMjds = []
        nextMjds[:] = [r["pyephem_mjd"] for r in rows[:concurrentSnapshots]]

        exposures = []
        for nextMjd in nextMjds:
            sqlQuery = u"""
                select * from atlas_exposures where pyephem_positions = 0 %(dev_flag)s and pyephem_mjd = %(nextMjd)s
            """ % locals()
            theseExps = readquery(
                log=self.log,
                sqlQuery=sqlQuery,
                dbConn=self.atlasMoversDBConn,
                quiet=False
            )
            exposures.append(list(theseExps))

        self.log.info(
            'completed the ``_get_exposures_requiring_pyephem_positions`` method')
        return nextMjds, exposures, snapshotsRequired
977226
def tvBrowserExposure_selection_changed(self):
        """"""
        (is_compatible, desc) = self.get_layer_description_from_browser(
            'exposure')
        self.lblDescribeBrowserExpLayer.setText(desc)
        self.parent.pbnNext.setEnabled(is_compatible)