GET /screenshots/compares
325588
def compares
      params[:sort] ||= "ui_changed_screenshots.url asc"
      @screenshots = UiChanged::Screenshot.search(params[:search]).not_in_ignored.where(:is_compare => true)
                                                                  .paginate(:page => params[:page],
                                                                            :per_page => params[:per_page],
                                                                            :order => params[:sort])
      @type = "Compare"
      render "ui_changed/screenshots/screenshots"
    end
1053112
def screenshot(self, filename=None):
        '''
        
        '''
        image = self.d.screenshot()
        if self.rotation:
            method = getattr(Image, 'ROTATE_{}'.format(self.rotation*90))
            image = image.transpose(method)
        if filename:
            image.save(filename)
        return image
967118
def comparison_image_list(self):
        

        if self._comparison_image_list is not None:
            return self._comparison_image_list

        ref_ra = self.reading.ra * units.degree
        ref_dec = self.reading.dec * units.degree
        radius = self.radius is not None and self.radius or config.read('CUTOUTS.SINGLETS.RADIUS') * units.arcminute
        print("Querying CADC for list of possible comparison images at RA: {}, DEC: {}, raidus: {}".format(ref_ra,
                                                                                                           ref_dec,
                                                                                                           radius))
        query_result = storage.cone_search(ref_ra, ref_dec, radius, radius)  # returns an astropy.table.table.Table
        print("Got {} possible images".format(len(query_result)))
        ans = raw_input("Do you want to lookup IQ? (y/n)")
        print("Building table for presentation and selection")
        if ans == "y":
            print("Including getting fwhm which is a bit slow.")
        comparison_image_list = []
        if len(query_result['collectionID']) > 0:  # are there any comparison images even available on that sky?
            index = -1
            for row in query_result:
                expnum = row['collectionID']
                if expnum in self._bad_comparison_images:
                    continue
                date = Time(row['mjdate'], format='mjd').mpc
                if Time(row['mjdate'], format='mjd') < Time('2013-01-01 00:00:00', format='iso'):
                    continue
                exptime = row['exptime']
                if float(exptime) < 250:
                    continue
                filter_name = row['filter']
                if 'U' in filter_name:
                    continue
                if filter_name.lower() in self.hdulist[-1].header['FILTER'].lower():
                    filter_name = "* {:8s}".format(filter_name)
                fwhm = -1.0
                if ans == 'y':
                    try:
                        fwhm = "{:5.2f}".format(float(storage.get_fwhm_tag(expnum, 22)))
                    except:
                        pass
                index += 1
                comparison_image_list.append([index, expnum, date, exptime, filter_name, fwhm, None])
        self._comparison_image_list = Table(data=numpy.array(comparison_image_list),
                                            names=["ID", "EXPNUM", "DATE-OBS", "EXPTIME", "FILTER", "FWHM", "REFERENCE"])
        return self._comparison_image_list
1204328
function captureScreenshot(url) {
    const serviceUrl = screenshotServiceUrl(url);

    console.log('Sending request to capture screenshot from %s', url);
    http.get(serviceUrl, (res) =>
        console.log('Screenshot from %s was captured with status %s', url, res.statusCode));
    console.log('Request to capture screenshot from %s was sent', url);
}
329963
def haveSnapshots(self):
		""""""
		return os.path.islink(self.latestLink) and os.path.isdir(self.latestLink)
251031
def screenshots_done(self, jobid):
        
        resp = self.session.get(os.path.join(self.api_url, '{0}.json'.format(jobid)))
        resp = self._process_response(resp)
        return True if resp.json()['state'] == 'done' else False
505378
function xScreenshots(compare, driver, JSONContent, HuxleyfileContainerPath, browserName) {
  return Promise.each(JSONContent, function(task) {
    var p = path.join(
      HuxleyfileContainerPath,
      consts.HUXLEY_FOLDER_NAME,
      task.name + consts.RECORD_FILE_SUFFIX
    );
    return loadJSON(p)
      .then(function(actions) {
        return replay(compare, driver, task, actions, browserName, HuxleyfileContainerPath);
      });
  });
}
48878
static Screenshot getScreenshot(File screenshot, File output) {
    String relativePath = createRelativeUri(screenshot, output);
    String caption = screenshot.getName();
    return new Screenshot(relativePath, caption);
  }
192087
function saveScreenshotIfExists(testResults) {
        var deferred = Q.defer();

        if (testResults.screenshotBuffer) {

            var screenshotFilePath = path.join(resultsDir, testResults.runId, resultScreenshotName);
            fs.writeFile(screenshotFilePath, testResults.screenshotBuffer);

            delete testResults.screenshotBuffer;

        } else {
            deferred.resolve();
        }

        return deferred;
    }
707221
function() {
        var that = this;

        // Save a screenshot.
        if ($$logging.get('screenshots').enabled) {
            var filename = $$logging.get('screenshots').filename.replace('{date}', moment().format('YYYYMMDDhhmmss'));
            logger.info('Saving screenshot to ' + filename);

            var winCmd = path.join(__dirname, '../tools', 'nircmd.exe');
            var winArgs = ['savescreenshotfull', filename];

            var macCmd = '/usr/sbin/screencapture';
            var macArgs = ['-x', '-t', 'jpg', '-C', filename];

            var cmd = process.platform === 'win32' ? winCmd : macCmd;
            var args = process.platform === 'win32' ? winArgs : macArgs;

            var screenshot = child_process.spawn(cmd, args);
            screenshot.on('close', function(code, signal) {
                logger.info('Screenshot saved, restarting.');
                restart();
            });
        } else {
            restart();
        }

        function restart() {
            var restartCount = that.get('restartCount');
            restartCount++;

            var logList = 'App went away: ' + restartCount + ' times\n\n';
            _.each($$logging.get('logCache'), function(log) {
                logList += log.time + ' ' + log.level + ': ' + log.msg + '\n';
            });
            logger.error(logList);

            that.trigger('crash');

            if (restartCount >= that.get('restartMachineAfter')) {
                logger.info('Already restarted app ' + that.get('restartMachineAfter') + ' times, rebooting machine.');
                that.restartMachine();
                return;
            }

            that.set('restartCount', restartCount);
            that._isStartingUp = false;
            that._isShuttingDown = false;
            that.restartApp();
        }
    }
1090331
public function getImages()
    {
        $images = array();
        $image = $this->getImage();
        if (!empty($image)) {
            $images[$image] = $image;
        }

        $screenshotsPath = $this->getFilePath().self::SCREENSHOT_PATH;
        $files = array();
        if (is_dir($screenshotsPath)) {
            $files = scandir($screenshotsPath);
        }

        foreach ($files as $file) {
            $ext = pathinfo($file, PATHINFO_EXTENSION);
            if ($ext === 'gif' || $ext === 'jpg' || $ext === 'png') {
                $images['/theme/images/screenshots/'.$file] = '/theme/images/screenshots/'.$file;
            }
        }


        return $images;
    }
450673
def compare(what, imt, calc_ids, files, samplesites=100, rtol=.1, atol=1E-4):
    
    sids, imtls, poes, arrays = getdata(what, calc_ids, samplesites)
    try:
        levels = imtls[imt]
    except KeyError:
        sys.exit(
            '%s not found. The available IMTs are %s' % (imt, list(imtls)))
    imt2idx = {imt: i for i, imt in enumerate(imtls)}
    head = ['site_id'] if files else ['site_id', 'calc_id']
    if what == 'hcurves':
        array_imt = arrays[:, :, imtls(imt)]
        header = head + ['%.5f' % lvl for lvl in levels]
    else:  # hmaps
        array_imt = arrays[:, :, imt2idx[imt]]
        header = head + [str(poe) for poe in poes]
    rows = collections.defaultdict(list)
    diff_idxs = get_diff_idxs(array_imt, rtol, atol)
    if len(diff_idxs) == 0:
        print('There are no differences within the tolerance of %d%%' %
              (rtol * 100))
        return
    arr = array_imt.transpose(1, 0, 2)  # shape (N, C, L)
    for sid, array in sorted(zip(sids[diff_idxs], arr[diff_idxs])):
        for calc_id, cols in zip(calc_ids, array):
            if files:
                rows[calc_id].append([sid] + list(cols))
            else:
                rows['all'].append([sid, calc_id] + list(cols))
    if files:
        fdict = {calc_id: open('%s.txt' % calc_id, 'w')
                 for calc_id in calc_ids}
        for calc_id, f in fdict.items():
            f.write(views.rst_table(rows[calc_id], header))
            print('Generated %s' % f.name)
    else:
        print(views.rst_table(rows['all'], header))
470355
def screenshot(self, *args):
        """"""
        from mss import mss
        if not os.path.exists("screenshots"):
            os.makedirs("screenshots")
        box = {
            "top": self.winfo_y(),
            "left": self.winfo_x(),
            "width": self.winfo_width(),
            "height": self.winfo_height()
        }
        screenshot = mss().grab(box)
        screenshot = Image.frombytes("RGB", screenshot.size, screenshot.rgb)
        screenshot.save("screenshots/{}.png".format(ttk.Style(self).theme_use()))
1243548
def get(self, host, files_count, path="/", ssl=False, external=None):
        
        theme = "https" if ssl else "http"
        url = host + path
        http_url = theme + "://" + url

        result = {}
        try:
            capture_path = os.getcwd() + '/'

            har_file_path = capture_path + "har/"

            # fc.load_page(self.driver, http_url)
            fc.switch_tab(self.driver)
            self.load_page(http_url)

            print "driver get: " + http_url

            time.sleep(2)

            # if url[-1] == "/":
            #     f_name = url.split('/')[-2]
            # else:
            #     f_name = url.split('/')[-1]

            # fc.save_html(self.driver, f_name, os.path.join(capture_path, "htmls/"))
            # fc.save_screenshot(self.driver, f_name, os.path.join(capture_path, "screenshots/"))

            result = self.wrap_results(url=http_url, files_count=files_count, fd=har_file_path)

            if external is not None:
                external[http_url] = result

        except Exception as e:
            result['error'] = e.message
            print e

        return result
530078
def screenshots(screenshots_data, module_name):
    
    shots = screenshots_data.get(module_name)
    if not shots:
        return ""

    out = []
    for shot in file_sort(shots):
        if not os.path.exists("../doc/screenshots/%s.png" % shot):
            continue
        out.append(u"\n.. image:: screenshots/{}.png\n\n".format(shot))
    return u"".join(out)
43010
def get_images(self, obj):
        """"""
        return {str(i.tag): i.image.url for i in obj.images.all()}
48561
def screenshot(self):
        
        b64data = self.http.get('/screenshot').value
        raw_data = base64.b64decode(b64data)
        from PIL import Image
        buff = io.BytesIO(raw_data)
        return Image.open(buff)