prompt
large_stringlengths
70
991k
completion
large_stringlengths
0
1.02k
<|file_name|>piglatin.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python2.7 import os import re import sys # some static resources vowels = set(('a','e','i','o','u','A','E','I','O','U')) #vowel_re consonant_re = re.compile(r'([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]+)([a-zA-Z]*)(.*)?') # input original = sys.stdin.read() # output piglatin = [] # loop over the words and change them to pig latin<|fim▁hole|> piglatin.append(word+'way') else: piglatin.append(consonant_re.sub(r'\2\1ay\3', word)) # output the translated text sys.stdout.write(' '.join(piglatin))<|fim▁end|>
for word in original.split(): # there are different rules if it starts with a vowel if word[0] in vowels:
<|file_name|>cli.go<|end_file_name|><|fim▁begin|>package cli import ( "errors" "fmt" "io" "os" "reflect" "strings" flag "github.com/get3w/get3w/pkg/mflag" ) // Cli represents a command line interface. type Cli struct { Stderr io.Writer handlers []Handler Usage func() } // Handler holds the different commands Cli will call // It should have methods with names starting with `Cmd` like: // func (h myHandler) CmdFoo(args ...string) error type Handler interface{} // Initializer can be optionally implemented by a Handler to // initialize before each call to one of its commands. type Initializer interface { Initialize() error } // New instantiates a ready-to-use Cli. func New(handlers ...Handler) *Cli { // make the generic Cli object the first cli handler // in order to handle `get3w help` appropriately cli := new(Cli) cli.handlers = append([]Handler{cli}, handlers...) return cli } // initErr is an error returned upon initialization of a handler implementing Initializer. type initErr struct{ error } func (err initErr) Error() string { return err.Error() } func (cli *Cli) command(args ...string) (func(...string) error, error) { for _, c := range cli.handlers { if c == nil { continue } camelArgs := make([]string, len(args)) for i, s := range args { if len(s) == 0 { return nil, errors.New("empty command") } camelArgs[i] = strings.ToUpper(s[:1]) + strings.ToLower(s[1:]) } methodName := "Cmd" + strings.Join(camelArgs, "") method := reflect.ValueOf(c).MethodByName(methodName) if method.IsValid() { if c, ok := c.(Initializer); ok { if err := c.Initialize(); err != nil { return nil, initErr{err} } } return method.Interface().(func(...string) error), nil } } return nil, errors.New("command not found") } // Run executes the specified command. func (cli *Cli) Run(args ...string) error { if len(args) > 1 { command, err := cli.command(args[:2]...) switch err := err.(type) { case nil: return command(args[2:]...) case initErr: return err.error } } if len(args) > 0 { command, err := cli.command(args[0]) switch err := err.(type) { case nil: return command(args[1:]...) case initErr: return err.error } cli.noSuchCommand(args[0]) } return cli.CmdHelp() } func (cli *Cli) noSuchCommand(command string) { if cli.Stderr == nil { cli.Stderr = os.Stderr } fmt.Fprintf(cli.Stderr, "get3w: '%s' is not a get3w command.\nSee 'get3w --help'.\n", command) os.Exit(1) } // CmdHelp displays information on a Get3W command. // // If more than one command is specified, information is only shown for the first command. // // Usage: get3w help COMMAND or get3w COMMAND --help func (cli *Cli) CmdHelp(args ...string) error { if len(args) > 1 { command, err := cli.command(args[:2]...) switch err := err.(type) { case nil:<|fim▁hole|> } } if len(args) > 0 { command, err := cli.command(args[0]) switch err := err.(type) { case nil: command("--help") return nil case initErr: return err.error } cli.noSuchCommand(args[0]) } if cli.Usage == nil { flag.Usage() } else { cli.Usage() } return nil } // Subcmd is a subcommand of the main "get3w" command. // A subcommand represents an action that can be performed // from the Get3W command line client. // // To see all available subcommands, run "get3w --help". func Subcmd(name string, synopses []string, description string, exitOnError bool) *flag.FlagSet { var errorHandling flag.ErrorHandling if exitOnError { errorHandling = flag.ExitOnError } else { errorHandling = flag.ContinueOnError } flags := flag.NewFlagSet(name, errorHandling) flags.Usage = func() { flags.ShortUsage() flags.PrintDefaults() } flags.ShortUsage = func() { options := "" if flags.FlagCountUndeprecated() > 0 { options = " [OPTIONS]" } if len(synopses) == 0 { synopses = []string{""} } // Allow for multiple command usage synopses. for i, synopsis := range synopses { lead := "\t" if i == 0 { // First line needs the word 'Usage'. lead = "Usage:\t" } if synopsis != "" { synopsis = " " + synopsis } fmt.Fprintf(flags.Out(), "\n%sget3w %s%s%s", lead, name, options, synopsis) } fmt.Fprintf(flags.Out(), "\n\n%s\n", description) } return flags } // An StatusError reports an unsuccessful exit by a command. type StatusError struct { Status string StatusCode int } func (e StatusError) Error() string { return fmt.Sprintf("Status: %s, Code: %d", e.Status, e.StatusCode) }<|fim▁end|>
command("--help") return nil case initErr: return err.error
<|file_name|>MemGenericConstantActionFactory.java<|end_file_name|><|fim▁begin|>/* * Copyright (c) 2012 - 2020 Splice Machine, Inc. * * This file is part of Splice Machine. * Splice Machine is free software: you can redistribute it and/or modify it under the terms of the * GNU Affero General Public License as published by the Free Software Foundation, either * version 3, or (at your option) any later version. * Splice Machine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License along with Splice Machine. * If not, see <http://www.gnu.org/licenses/>.<|fim▁hole|>import com.splicemachine.db.catalog.UUID; import com.splicemachine.db.iapi.sql.execute.ConstantAction; /** * @author Scott Fines * Date: 1/13/16 */ public class MemGenericConstantActionFactory extends SpliceGenericConstantActionFactory{ @Override public ConstantAction getDropIndexConstantAction(String fullIndexName, String indexName, String tableName, String schemaName, UUID tableId, long tableConglomerateId, UUID dbId){ return new MemDropIndexConstantOperation(fullIndexName, indexName, tableName, schemaName, tableId, tableConglomerateId, dbId); } }<|fim▁end|>
*/ package com.splicemachine.derby.impl.sql.execute;
<|file_name|>panel_resize_controller.cc<|end_file_name|><|fim▁begin|>// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/panels/panel_resize_controller.h" #include "base/logging.h" #include "chrome/browser/ui/panels/panel.h" #include "chrome/browser/ui/panels/panel_manager.h" namespace { static bool ResizingLeft(panel::ResizingSides sides) { return sides == panel::RESIZE_TOP_LEFT || sides == panel::RESIZE_LEFT || sides == panel::RESIZE_BOTTOM_LEFT; } static bool ResizingRight(panel::ResizingSides sides) { return sides == panel::RESIZE_TOP_RIGHT || sides == panel::RESIZE_RIGHT || sides == panel::RESIZE_BOTTOM_RIGHT; } static bool ResizingTop(panel::ResizingSides sides) { return sides == panel::RESIZE_TOP_LEFT || sides == panel::RESIZE_TOP || sides == panel::RESIZE_TOP_RIGHT; } static bool ResizingBottom(panel::ResizingSides sides) { return sides == panel::RESIZE_BOTTOM_RIGHT || sides == panel::RESIZE_BOTTOM || sides == panel::RESIZE_BOTTOM_LEFT; } } PanelResizeController::PanelResizeController(PanelManager* panel_manager) : panel_manager_(panel_manager), resizing_panel_(NULL), sides_resized_(panel::RESIZE_NONE) { } void PanelResizeController::StartResizing(Panel* panel, const gfx::Point& mouse_location, panel::ResizingSides sides) { DCHECK(!IsResizing()); DCHECK_NE(panel::RESIZE_NONE, sides); panel::Resizability resizability = panel->CanResizeByMouse(); DCHECK_NE(panel::NOT_RESIZABLE, resizability); panel::Resizability resizability_to_test; switch (sides) { case panel::RESIZE_TOP_LEFT: resizability_to_test = panel::RESIZABLE_TOP_LEFT; break; case panel::RESIZE_TOP: resizability_to_test = panel::RESIZABLE_TOP; break; case panel::RESIZE_TOP_RIGHT: resizability_to_test = panel::RESIZABLE_TOP_RIGHT; break; case panel::RESIZE_LEFT: resizability_to_test = panel::RESIZABLE_LEFT; break; case panel::RESIZE_RIGHT: resizability_to_test = panel::RESIZABLE_RIGHT; break; case panel::RESIZE_BOTTOM_LEFT: resizability_to_test = panel::RESIZABLE_BOTTOM_LEFT; break; case panel::RESIZE_BOTTOM: resizability_to_test = panel::RESIZABLE_BOTTOM; break; case panel::RESIZE_BOTTOM_RIGHT: resizability_to_test = panel::RESIZABLE_BOTTOM_RIGHT; break; default: resizability_to_test = panel::NOT_RESIZABLE; break; } if ((resizability & resizability_to_test) == 0) { DLOG(WARNING) << "Resizing not allowed. Is this a test?"; return; } mouse_location_at_start_ = mouse_location; bounds_at_start_ = panel->GetBounds(); sides_resized_ = sides; resizing_panel_ = panel; resizing_panel_->OnPanelStartUserResizing(); } void PanelResizeController::Resize(const gfx::Point& mouse_location) { DCHECK(IsResizing()); panel::Resizability resizability = resizing_panel_->CanResizeByMouse(); if (panel::NOT_RESIZABLE == resizability) { EndResizing(false); return; } gfx::Rect bounds = resizing_panel_->GetBounds(); if (ResizingRight(sides_resized_)) { bounds.set_width(std::max(bounds_at_start_.width() + mouse_location.x() - mouse_location_at_start_.x(), 0)); } if (ResizingBottom(sides_resized_)) { bounds.set_height(std::max(bounds_at_start_.height() + mouse_location.y() - mouse_location_at_start_.y(), 0)); } if (ResizingLeft(sides_resized_)) { bounds.set_width(std::max(bounds_at_start_.width() + mouse_location_at_start_.x() - mouse_location.x(), 0)); } if (ResizingTop(sides_resized_)) { int new_height = std::max(bounds_at_start_.height() + mouse_location_at_start_.y() - mouse_location.y(), 0); int new_y = bounds_at_start_.bottom() - new_height; // If the mouse is within the main screen area, make sure that the top // border of panel cannot go outside the work area. This is to prevent // panel's titlebar from being resized under the taskbar or OSX menu bar // that is aligned to top screen edge. int display_area_top_position = panel_manager_->display_area().y(); if (panel_manager_->display_settings_provider()-> GetPrimaryScreenArea().Contains(mouse_location) && new_y < display_area_top_position) { new_height -= display_area_top_position - new_y; } bounds.set_height(new_height); } resizing_panel_->IncreaseMaxSize(bounds.size()); // This effectively only clamps using the min size, since the max_size was // updated above. bounds.set_size(resizing_panel_->ClampSize(bounds.size())); if (ResizingLeft(sides_resized_)) bounds.set_x(bounds_at_start_.right() - bounds.width()); if (ResizingTop(sides_resized_)) bounds.set_y(bounds_at_start_.bottom() - bounds.height()); if (bounds != resizing_panel_->GetBounds()) resizing_panel_->OnWindowResizedByMouse(bounds); } Panel* PanelResizeController::EndResizing(bool cancelled) { DCHECK(IsResizing()); if (cancelled) resizing_panel_->OnWindowResizedByMouse(bounds_at_start_); // Do a thorough cleanup. resizing_panel_->OnPanelEndUserResizing(); Panel* resized_panel = resizing_panel_; resizing_panel_ = NULL; sides_resized_ = panel::RESIZE_NONE; bounds_at_start_ = gfx::Rect(); mouse_location_at_start_ = gfx::Point(); return resized_panel; }<|fim▁hole|> return; // If the resizing panel is closed, abort the resize operation. if (resizing_panel_ == panel) EndResizing(false); }<|fim▁end|>
void PanelResizeController::OnPanelClosed(Panel* panel) { if (!resizing_panel_)
<|file_name|>vorlon.IWebServerComponent.ts<|end_file_name|><|fim▁begin|>import express = require("express"); import http = require("http"); export module VORLON { export interface IWebServerComponent {<|fim▁hole|> } }<|fim▁end|>
addRoutes: (app: express.Express) => void; start: (httpServer: http.Server) => void;
<|file_name|>0016_heatcontrol_profile_end_null.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-12-27 09:40 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [<|fim▁hole|> migrations.AlterField( model_name='profile', name='end', field=models.TimeField(blank=True, null=True), ), ]<|fim▁end|>
('heatcontrol', '0015_heatcontrol_profile_add_holes'), ] operations = [
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>__author__ = 'dolacmeo'<|fim▁end|>
# -*- coding: utf-8 -*-#
<|file_name|>home.js<|end_file_name|><|fim▁begin|>define([ 'text!views/home/home.html' ], function (template) {<|fim▁hole|> var model = kendo.observable({ title: 'Home' }); var view = new kendo.View(template, { model: model }); return view; });<|fim▁end|>
<|file_name|>openvswitch_bridge.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python #coding: utf-8 -*- # (c) 2013, David Stygstra <[email protected]> # Portions copyright @ 2015 VMware, Inc. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} DOCUMENTATION = ''' --- module: openvswitch_bridge version_added: 1.4 author: "David Stygstra (@stygstra)" short_description: Manage Open vSwitch bridges requirements: [ ovs-vsctl ] description: - Manage Open vSwitch bridges options: bridge: required: true description: - Name of bridge or fake bridge to manage parent: version_added: "2.3" required: false default: None description: - Bridge parent of the fake bridge to manage vlan:<|fim▁hole|> required: false default: None description: - The VLAN id of the fake bridge to manage (must be between 0 and 4095). This parameter is required if I(parent) parameter is set. state: required: false default: "present" choices: [ present, absent ] description: - Whether the bridge should exist timeout: required: false default: 5 description: - How long to wait for ovs-vswitchd to respond external_ids: version_added: 2.0 required: false default: None description: - A dictionary of external-ids. Omitting this parameter is a No-op. To clear all external-ids pass an empty value. fail_mode: version_added: 2.0 default: None required: false choices : [secure, standalone] description: - Set bridge fail-mode. The default value (None) is a No-op. set: version_added: 2.3 required: false default: None description: - Run set command after bridge configuration. This parameter is non-idempotent, play will always return I(changed) state if present ''' EXAMPLES = ''' # Create a bridge named br-int - openvswitch_bridge: bridge: br-int state: present # Create a fake bridge named br-int within br-parent on the VLAN 405 - openvswitch_bridge: bridge: br-int parent: br-parent vlan: 405 state: present # Create an integration bridge - openvswitch_bridge: bridge: br-int state: present fail_mode: secure args: external_ids: bridge-id: br-int ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six import iteritems def _fail_mode_to_str(text): if not text: return None else: return text.strip() def _external_ids_to_dict(text): if not text: return None else: d = {} for l in text.splitlines(): if l: k, v = l.split('=') d[k] = v return d def map_obj_to_commands(want, have, module): commands = list() if module.params['state'] == 'absent': if have: templatized_command = ("%(ovs-vsctl)s -t %(timeout)s del-br" " %(bridge)s") command = templatized_command % module.params commands.append(command) else: if have: if want['fail_mode'] != have['fail_mode']: templatized_command = ("%(ovs-vsctl)s -t %(timeout)s" " set-fail-mode %(bridge)s" " %(fail_mode)s") command = templatized_command % module.params commands.append(command) if want['external_ids'] != have['external_ids']: templatized_command = ("%(ovs-vsctl)s -t %(timeout)s" " br-set-external-id %(bridge)s") command = templatized_command % module.params if want['external_ids']: for k, v in iteritems(want['external_ids']): if (k not in have['external_ids'] or want['external_ids'][k] != have['external_ids'][k]): command += " " + k + " " + v commands.append(command) else: templatized_command = ("%(ovs-vsctl)s -t %(timeout)s add-br" " %(bridge)s") command = templatized_command % module.params if want['parent']: templatized_command = "%(parent)s %(vlan)s" command += " " + templatized_command % module.params if want['set']: templatized_command = " -- set %(set)s" command += templatized_command % module.params commands.append(command) if want['fail_mode']: templatized_command = ("%(ovs-vsctl)s -t %(timeout)s" " set-fail-mode %(bridge)s" " %(fail_mode)s") command = templatized_command % module.params commands.append(command) if want['external_ids']: for k, v in iteritems(want['external_ids']): templatized_command = ("%(ovs-vsctl)s -t %(timeout)s" " br-set-external-id %(bridge)s") command = templatized_command % module.params command += " " + k + " " + v commands.append(command) return commands def map_config_to_obj(module): templatized_command = "%(ovs-vsctl)s -t %(timeout)s list-br" command = templatized_command % module.params rc, out, err = module.run_command(command, check_rc=True) if rc != 0: module.fail_json(msg=err) obj = {} if module.params['bridge'] in out.splitlines(): obj['bridge'] = module.params['bridge'] templatized_command = ("%(ovs-vsctl)s -t %(timeout)s br-to-parent" " %(bridge)s") command = templatized_command % module.params rc, out, err = module.run_command(command, check_rc=True) obj['parent'] = out.strip() templatized_command = ("%(ovs-vsctl)s -t %(timeout)s br-to-vlan" " %(bridge)s") command = templatized_command % module.params rc, out, err = module.run_command(command, check_rc=True) obj['vlan'] = out.strip() templatized_command = ("%(ovs-vsctl)s -t %(timeout)s get-fail-mode" " %(bridge)s") command = templatized_command % module.params rc, out, err = module.run_command(command, check_rc=True) obj['fail_mode'] = _fail_mode_to_str(out) templatized_command = ("%(ovs-vsctl)s -t %(timeout)s br-get-external-id" " %(bridge)s") command = templatized_command % module.params rc, out, err = module.run_command(command, check_rc=True) obj['external_ids'] = _external_ids_to_dict(out) return obj def map_params_to_obj(module): obj = { 'bridge': module.params['bridge'], 'parent': module.params['parent'], 'vlan': module.params['vlan'], 'fail_mode': module.params['fail_mode'], 'external_ids': module.params['external_ids'], 'set': module.params['set'] } return obj def main(): """ Entry point. """ argument_spec = { 'bridge': {'required': True}, 'parent': {'default': None}, 'vlan': {'default': None, 'type': 'int'}, 'state': {'default': 'present', 'choices': ['present', 'absent']}, 'timeout': {'default': 5, 'type': 'int'}, 'external_ids': {'default': None, 'type': 'dict'}, 'fail_mode': {'default': None}, 'set': {'required': False, 'default': None} } required_if = [('parent', not None, ('vlan',))] module = AnsibleModule(argument_spec=argument_spec, required_if=required_if, supports_check_mode=True) result = {'changed': False} # We add ovs-vsctl to module_params to later build up templatized commands module.params["ovs-vsctl"] = module.get_bin_path("ovs-vsctl", True) want = map_params_to_obj(module) have = map_config_to_obj(module) commands = map_obj_to_commands(want, have, module) result['commands'] = commands if commands: if not module.check_mode: for c in commands: module.run_command(c, check_rc=True) result['changed'] = True module.exit_json(**result) if __name__ == '__main__': main()<|fim▁end|>
version_added: "2.3"
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from openerp import models, fields, api, osv # We just create a new model class mother(models.Model): _name = 'test.inherit.mother' _columns = { # check interoperability of field inheritance with old-style fields 'name': osv.fields.char('Name', required=True), } surname = fields.Char(compute='_compute_surname') state = fields.Selection([('a', 'A'), ('b', 'B')]) @api.one @api.depends('name') def _compute_surname(self): self.surname = self.name or '' # We want to inherits from the parent model and we add some fields # in the child object class daughter(models.Model): _name = 'test.inherit.daughter' _inherits = {'test.inherit.mother': 'template_id'} template_id = fields.Many2one('test.inherit.mother', 'Template', required=True, ondelete='cascade') field_in_daughter = fields.Char('Field1') # We add a new field in the parent object. Because of a recent refactoring, # this feature was broken. # This test and these models try to show the bug and fix it. class mother(models.Model): _inherit = 'test.inherit.mother' field_in_mother = fields.Char() # extend the name field by adding a default value name = fields.Char(default='Unknown') # extend the selection of the state field state = fields.Selection(selection_add=[('c', 'C')]) # override the computed field, and extend its dependencies @api.one @api.depends('field_in_mother') def _compute_surname(self): if self.field_in_mother: self.surname = self.field_in_mother else: super(mother, self)._compute_surname() class mother(models.Model): _inherit = 'test.inherit.mother' # extend again the selection of the state field state = fields.Selection(selection_add=[('d', 'D')]) class daughter(models.Model): _inherit = 'test.inherit.daughter' # simply redeclare the field without adding any option<|fim▁hole|> # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:<|fim▁end|>
template_id = fields.Many2one()
<|file_name|>bitcoin_nl.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="nl"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="14"/> <source>About Paycoin</source> <translation>Over Paycoin</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="75"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Paycoin&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Paycoin&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="113"/> <source>Copyright © 2014 Paycoin Developers</source> <translation>Copyright © 2014 Paycoin Developers</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="120"/> <source>Copyright © 2011-2014 Paycoin Developers</source> <translation>Copyright © 2011-2014 Paycoin Developers</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="133"/> <source>Copyright © 2009-2014 Bitcoin Developers This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file license.txt or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source> <translation>Copyright © 2009-2014 Bitcoin ontwikkelaars Dit is experimentele code. Verspreiding onder de MIT/X11 software licentie, zie de meegeleverde bestand license.txt of http://www.opensource.org/licenses/mit-license.php. Dit product bevat code ontwikkeld door het OpenSSL project voor het gebruik in het OpenSSL raamwerk (http://www.openssl.org/) en cryptografische code geschreven door Eric Young ([email protected]) en UPnP code geschreven door Thomas Bernard.</translation> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="14"/> <source>Address Book</source> <translation>Adresboek</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="20"/> <source>These are your Paycoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>Dit zijn je Paycoin adressen om bedragen te ontvangen. Je kan een verschillend adres opgeven voor iedere geaddresseerde zodat je kan achterhalen wie jouw betaalt.</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="33"/> <source>Double-click to edit address or label</source> <translation>Dubbelklik om adres of label te wijzigen</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="57"/> <source>Create a new address</source> <translation>Maak een nieuw adres aan</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="60"/> <source>&amp;New Address...</source> <translation>&amp;Nieuw Adres...</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="71"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Kopieer het huidig geselecteerde adres naar het klembord</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="74"/> <source>&amp;Copy to Clipboard</source> <translation>&amp;Kopieer naar Klembord</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="85"/> <source>Show &amp;QR Code</source> <translation>Toon &amp;QR-Code</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="96"/> <source>Sign a message to prove you own this address</source> <translation>Onderteken een bericht om te bewijzen dat u dit adres bezit</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="99"/> <source>&amp;Sign Message</source> <translation>&amp;Onderteken Bericht</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="110"/> <source>Delete the currently selected address from the list. Only sending addresses can be deleted.</source> <translation>Verwijder het huidige geselecteerde adres van de lijst. Alleen verzend-adressen kunnen verwijderd worden, niet uw ontvangstadressen.</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="113"/> <source>&amp;Delete</source> <translation>&amp;Verwijder</translation> </message> <message> <location filename="../addressbookpage.cpp" line="65"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location filename="../addressbookpage.cpp" line="66"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location filename="../addressbookpage.cpp" line="67"/> <source>Edit</source> <translation>Bewerk</translation> </message> <message> <location filename="../addressbookpage.cpp" line="68"/> <source>Delete</source> <translation>Verwijder</translation> </message> <message> <location filename="../addressbookpage.cpp" line="273"/> <source>Export Address Book Data</source> <translation>Exporteer Gegevens van het Adresboek</translation> </message> <message> <location filename="../addressbookpage.cpp" line="274"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location filename="../addressbookpage.cpp" line="287"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location filename="../addressbookpage.cpp" line="287"/> <source>Could not write to file %1.</source> <translation>Kon niet schrijven naar bestand %1.</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="79"/> <source>Label</source> <translation>Label</translation> </message> <message> <location filename="../addresstablemodel.cpp" line="79"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../addresstablemodel.cpp" line="115"/> <source>(no label)</source> <translation>(geen label)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="26"/> <source>Dialog</source> <translation>Dialoog</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="94"/> <source>TextLabel</source> <translation>TekstLabel</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="47"/> <source>Enter passphrase</source> <translation>Huidige wachtwoordzin</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="61"/> <source>New passphrase</source> <translation>Nieuwe wachtwoordzin</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="75"/> <source>Repeat new passphrase</source> <translation>Herhaal wachtwoordzin</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="114"/> <source>Toggle Keyboard</source> <translation type="unfinished"></translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="37"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>Vul een nieuw wachtwoord in voor uw portemonnee. &lt;br/&gt; Gebruik een wachtwoord van &lt;b&gt;10 of meer lukrake karakters&lt;/b&gt;, of &lt;b&gt; acht of meer woorden&lt;/b&gt; . </translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="38"/> <source>Encrypt wallet</source> <translation>Versleutel portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="41"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Deze operatie vereist uw portemonnee wachtwoordzin om de portemonnee te openen.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="46"/> <source>Unlock wallet</source> <translation>Open portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="49"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Deze operatie vereist uw portemonnee wachtwoordzin om de portemonnee te ontsleutelen</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="54"/> <source>Decrypt wallet</source> <translation>Ontsleutel portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="57"/> <source>Change passphrase</source> <translation>Wijzig de wachtwoordzin</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="58"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Vul uw oude en nieuwe portemonnee wachtwoordzin in.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="106"/> <source>Confirm wallet encryption</source> <translation>Bevestig versleuteling van de portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="116"/> <location filename="../askpassphrasedialog.cpp" line="165"/> <source>Wallet encrypted</source> <translation>Portemonnee versleuteld</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="213"/> <location filename="../askpassphrasedialog.cpp" line="237"/> <source>Warning: The Caps Lock key is on.</source> <translation>Waarschuwing: De Caps-Lock-toets staat aan.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="122"/> <location filename="../askpassphrasedialog.cpp" line="129"/> <location filename="../askpassphrasedialog.cpp" line="171"/> <location filename="../askpassphrasedialog.cpp" line="177"/> <source>Wallet encryption failed</source> <translation>Portemonneeversleuteling mislukt</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="107"/> <source>WARNING: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR PEERCOINS&lt;/b&gt;! Are you sure you wish to encrypt your wallet?</source> <translation>WAARSCHUWING: Indien je de portemonnee versleutelt en je wachtwoordzin verliest, dan verlies je &lt;b&gt; AL JE PEERCOINS&lt;/b&gt;! Weet je zeker dat je de portemonee wilt versleutelen?</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="117"/> <source>Paycoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your Paycoins from being stolen by malware infecting your computer.</source> <translation>Paycoin sluit nu af om het versleutelings proces te beeindigen. Onthoud dat het versleutelen van de portemonnee je Paycoins niet volledig kan beschermen tegen schadelijke software op een geinfecteerde computer</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="123"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Portemonneeversleuteling mislukt door een interne fout. Uw portemonnee is niet versleuteld.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="130"/> <location filename="../askpassphrasedialog.cpp" line="178"/> <source>The supplied passphrases do not match.</source> <translation>De opgegeven wachtwoordzin is niet correct</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="141"/> <source>Wallet unlock failed</source> <translation>Portemonnee openen mislukt</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="142"/> <location filename="../askpassphrasedialog.cpp" line="153"/> <location filename="../askpassphrasedialog.cpp" line="172"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>De opgegeven wachtwoordzin voor de portemonnee-ontsleuteling is niet correct.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="152"/> <source>Wallet decryption failed</source> <translation>Portemonnee-ontsleuteling mislukt</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="166"/> <source>Wallet passphrase was succesfully changed.</source> <translation>Portemonnee wachtwoordzin is succesvol gewijzigd</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="191"/> <source>&amp;Overview</source> <translation>&amp;Overzicht</translation> </message> <message> <location filename="../bitcoingui.cpp" line="192"/> <source>Show general overview of wallet</source> <translation>Toon algemeen overzicht van de portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="197"/> <source>&amp;Transactions</source> <translation>&amp;Transacties</translation> </message> <message> <location filename="../bitcoingui.cpp" line="198"/> <source>Browse transaction history</source> <translation>Blader door transactieverleden</translation> </message> <message> <location filename="../bitcoingui.cpp" line="203"/> <source>&amp;Minting</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoingui.cpp" line="204"/> <source>Show your minting capacity</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoingui.cpp" line="209"/> <source>&amp;Address Book</source> <translation>&amp;Adresboek</translation> </message> <message> <location filename="../bitcoingui.cpp" line="210"/> <source>Edit the list of stored addresses and labels</source> <translation>Bewerk de lijst van opgeslagen adressen en labels</translation> </message> <message> <location filename="../bitcoingui.cpp" line="215"/> <source>&amp;Receive coins</source> <translation>&amp;Ontvang munten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="216"/> <source>Show the list of addresses for receiving payments</source> <translation>Toon lijst van betalingsadressen</translation> </message> <message> <location filename="../bitcoingui.cpp" line="221"/> <source>&amp;Send coins</source> <translation>&amp;Verstuur munten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="227"/> <source>Sign/Verify &amp;message</source> <translation>Onderteken/verifieer &amp;bericht</translation> </message> <message> <location filename="../bitcoingui.cpp" line="228"/> <source>Prove you control an address</source> <translation>Bewijs dat u een adres bezit</translation> </message> <message> <location filename="../bitcoingui.cpp" line="249"/> <source>E&amp;xit</source> <translation>&amp;Afsluiten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="250"/> <source>Quit application</source> <translation>Programma afsluiten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="254"/> <source>Show information about Paycoin</source> <translation>Toon informatie over Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="256"/> <source>About &amp;Qt</source> <translation>Over &amp;Qt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="257"/> <source>Show information about Qt</source> <translation>Toon informatie over Qt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="259"/> <source>&amp;Options...</source> <translation>&amp;Opties...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="264"/> <source>&amp;Export...</source> <translation>&amp;Exporteer...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="265"/> <source>Export the data in the current tab to a file</source> <translation>Exporteer de data in de huidige tab naar een bestand</translation> </message> <message> <location filename="../bitcoingui.cpp" line="266"/> <source>&amp;Encrypt Wallet</source> <translation>&amp;Versleutel Portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="267"/> <source>Encrypt or decrypt wallet</source> <translation>Versleutel of ontsleutel portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="269"/> <source>&amp;Unlock Wallet for Minting Only</source> <translation>&amp;Ontsleutel portemonnee alleen om te minten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="270"/> <source>Unlock wallet only for minting. Sending coins will still require the passphrase.</source> <translation>Ontsleutel portemonnee alleen om te minten. Voor het versturen van munten is nog een wachtwoordzin nodig</translation> </message> <message> <location filename="../bitcoingui.cpp" line="272"/> <source>&amp;Backup Wallet</source> <translation>Backup &amp;Portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="273"/> <source>Backup wallet to another location</source> <translation>&amp;Backup portemonnee naar een andere locatie</translation> </message> <message> <location filename="../bitcoingui.cpp" line="274"/> <source>&amp;Change Passphrase</source> <translation>&amp;Wijzig Wachtwoordzin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="275"/> <source>Change the passphrase used for wallet encryption</source> <translation>Wijzig de wachtwoordzin voor uw portemonneversleuteling</translation> </message> <message> <location filename="../bitcoingui.cpp" line="276"/> <source>&amp;Debug window</source> <translation>&amp;Debug scherm</translation> </message> <message> <location filename="../bitcoingui.cpp" line="277"/> <source>Open debugging and diagnostic console</source> <translation>Open debugging en diagnostische console</translation> </message> <message> <location filename="../bitcoingui.cpp" line="301"/> <source>&amp;File</source> <translation>&amp;Bestand</translation> </message> <message> <location filename="../bitcoingui.cpp" line="310"/> <source>&amp;Settings</source> <translation>&amp;Instellingen</translation> </message> <message> <location filename="../bitcoingui.cpp" line="317"/> <source>&amp;Help</source> <translation>&amp;Hulp</translation> </message> <message> <location filename="../bitcoingui.cpp" line="326"/> <source>Tabs toolbar</source> <translation>Tab-werkbalk</translation> </message> <message> <location filename="../bitcoingui.cpp" line="338"/> <source>Actions toolbar</source> <translation>Actie-werkbalk</translation> </message> <message> <location filename="../bitcoingui.cpp" line="350"/> <source>[testnet]</source> <translation>[testnetwerk]</translation> </message> <message> <location filename="../bitcoingui.cpp" line="658"/> <source>This transaction is over the size limit. You can still send it for a fee of %1. Do you want to pay the fee?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoingui.cpp" line="76"/> <source>Paycoin Wallet</source> <translation>Paycoin portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="222"/> <source>Send coins to a Paycoin address</source> <translation>Zend munten naar een Paycoin adres</translation> </message> <message> <location filename="../bitcoingui.cpp" line="253"/> <source>&amp;About Paycoin</source> <translation>Over Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="260"/> <source>Modify configuration options for Paycoin</source> <translation>Wijzig configuratie opties voor Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="262"/> <source>Show/Hide &amp;Paycoin</source> <translation>Toon/Verberg &amp;Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="263"/> <source>Show or hide the Paycoin window</source> <translation>Toon of verberg het Paycoin scherm</translation> </message> <message> <location filename="../bitcoingui.cpp" line="415"/> <source>Paycoin client</source> <translation>Paycoin client</translation> </message> <message> <location filename="../bitcoingui.cpp" line="443"/> <source>p-qt</source> <translation>p-qt</translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="507"/> <source>%n active connection(s) to Paycoin network</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location filename="../bitcoingui.cpp" line="531"/> <source>Synchronizing with network...</source> <translation>Synchroniseren met netwerk...</translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="533"/> <source>~%n block(s) remaining</source> <translation type="unfinished"> <numerusform>Nog ~%n blok te gaan</numerusform> <numerusform>Nog ~%n blokken te gaan</numerusform> </translation> </message> <message> <location filename="../bitcoingui.cpp" line="544"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation>Binnengehaald %1 van %2 blokken met transactie geschiedenis (%3% binnen).</translation> </message> <message> <location filename="../bitcoingui.cpp" line="556"/> <source>Downloaded %1 blocks of transaction history.</source> <translation>%1 blokken van transactiehistorie opgehaald.</translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="571"/> <source>%n second(s) ago</source> <translation type="unfinished"> <numerusform>%n seconde geleden</numerusform> <numerusform>%n seconden geleden</numerusform> </translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="575"/> <source>%n minute(s) ago</source> <translation type="unfinished"> <numerusform>%n minuut geleden</numerusform> <numerusform>%n minuten geleden</numerusform> </translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="579"/> <source>%n hour(s) ago</source> <translation type="unfinished"> <numerusform>%n uur geleden</numerusform> <numerusform>%n uur geleden</numerusform> </translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="583"/> <source>%n day(s) ago</source> <translation type="unfinished"> <numerusform>%n dag geleden</numerusform> <numerusform>%n dagen geleden</numerusform> </translation> </message> <message> <location filename="../bitcoingui.cpp" line="589"/> <source>Up to date</source> <translation>Bijgewerkt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="594"/> <source>Catching up...</source> <translation>Aan het bijwerken...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="602"/> <source>Last received block was generated %1.</source> <translation>Laatst ontvangen blok is %1 gegenereerd.</translation> </message> <message> <location filename="../bitcoingui.cpp" line="661"/> <source>Sending...</source> <translation>Versturen...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="688"/> <source>Sent transaction</source> <translation>Verzonden transactie</translation> </message> <message> <location filename="../bitcoingui.cpp" line="689"/> <source>Incoming transaction</source> <translation>Binnenkomende transactie</translation> </message> <message> <location filename="../bitcoingui.cpp" line="690"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>Datum: %1 Bedrag: %2 Type: %3 Adres: %4 </translation> </message> <message> <location filename="../bitcoingui.cpp" line="821"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked for block minting only&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;geopend om blokken te minten&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoingui.cpp" line="821"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;geopend&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoingui.cpp" line="831"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;gesloten&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoingui.cpp" line="888"/> <source>Backup Wallet</source> <translation>Backup Portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="888"/> <source>Wallet Data (*.dat)</source> <translation>Portemonnee-data (*.dat)</translation> </message> <message> <location filename="../bitcoingui.cpp" line="891"/> <source>Backup Failed</source> <translation>Backup Mislukt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="891"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation>Er is een fout opgetreden bij het wegschrijven van de portemonnee-data naar de nieuwe locatie.</translation> </message> <message> <location filename="../bitcoin.cpp" line="128"/> <source>A fatal error occured. Paycoin can no longer continue safely and will quit.</source> <translation>Een fatale fout heeft plaatsgevonden. Paycoin kan niet langer veilig doorgaan en zal afsluiten.</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="14"/> <source>Coin Control</source> <translation>Munt Controle</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="45"/> <source>Quantity:</source> <translation>Aantal:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="64"/> <location filename="../forms/coincontroldialog.ui" line="96"/> <source>0</source> <translation>0</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="77"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="125"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="144"/> <location filename="../forms/coincontroldialog.ui" line="224"/> <location filename="../forms/coincontroldialog.ui" line="310"/> <location filename="../forms/coincontroldialog.ui" line="348"/> <source>0.00 BTC</source> <translation>123.456 BTC {0.00 ?}</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="157"/> <source>Priority:</source> <translation>Prioriteit:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="205"/> <source>Fee:</source> <translation>Transactiekosten:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="240"/> <source>Low Output:</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="262"/> <location filename="../coincontroldialog.cpp" line="572"/> <source>no</source> <translation>nee</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="291"/> <source>After Fee:</source> <translation>Na aftrek kosten:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="326"/> <source>Change:</source> <translation>Teruggave:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="395"/> <source>(un)select all</source> <translation>Alles (de)selecteren</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="408"/> <source>Tree mode</source> <translation>Toon boomstructuur</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="424"/> <source>List mode</source> <translation>Lijst modus</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="469"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="479"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="484"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="489"/> <source>Confirmations</source> <translation>Bevestigingen</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="492"/> <source>Confirmed</source> <translation>Bevestigd</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="497"/> <source>Coin days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="502"/> <source>Priority</source> <translation>Prioriteit</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="36"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="37"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="38"/> <location filename="../coincontroldialog.cpp" line="64"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="39"/> <source>Copy transaction ID</source> <translation>Kopieer transactie ID</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="63"/> <source>Copy quantity</source> <translation>Kopieer aantal</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="65"/> <source>Copy fee</source> <translation>Kopieer kosten</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="66"/> <source>Copy after fee</source> <translation>Kopieer na kosten</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="67"/> <source>Copy bytes</source> <translation>Kopieer bytes</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="68"/> <source>Copy priority</source> <translation>Kopieer prioriteit</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="69"/> <source>Copy low output</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="70"/> <source>Copy change</source> <translation>Kopieer teruggave</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="388"/> <source>highest</source> <translation>hoogste</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="389"/> <source>high</source> <translation>Hoogste</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="390"/> <source>medium-high</source> <translation>medium-hoog</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="391"/> <source>medium</source> <translation>medium</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="395"/> <source>low-medium</source> <translation>laag-medium</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="396"/> <source>low</source> <translation>laag</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="397"/> <source>lowest</source> <translation>laagste</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="572"/> <source>DUST</source> <translation>STOF</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="572"/> <source>yes</source> <translation>ja</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="582"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation>Dit label kleurt rood, indien de transactie groter is dan 10000 bytes Dit betekent transactie kosten van minstens %1 per kb. Dit kan varieren met +/- 1 byte per invoer</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="583"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation>Transacties met hogere prioriteit komen met grotere waarschijnlijkheid in een blok. Dit label kleurt rood als de prioriteit kleiner dan gemiddeld is. Dit betekent dat de kosten minimaal %1 per kb bedragen.</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="584"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation>Dit label kleurt rood, indien de verandering kleiner is dan %1. Dit betekent dat de kosten minimaal %2 zijn. Bedragen kleiner dan 0.546 keer de minimum kosten worden weergegeven als STOF.</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="585"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation>Dit label kleurt rood, indien de verandering kleiner is dan %1. Dit betekent dat de kosten minimaal %2 zijn. Bedragen kleiner dan 0.546 keer de minimum vergoeding worden weergegeven als STOF</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="622"/> <location filename="../coincontroldialog.cpp" line="688"/> <source>(no label)</source> <translation>(geen label)</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="679"/> <source>change from %1 (%2)</source> <translation>gewijzigd van %1 (%2)</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="680"/> <source>(change)</source> <translation>(wijzig)</translation> </message> </context> <context> <name>DisplayOptionsPage</name> <message> <location filename="../optionsdialog.cpp" line="275"/> <source>&amp;Unit to show amounts in: </source> <translation>&amp;Eenheid om bedrag in te tonen:</translation> </message> <message> <location filename="../optionsdialog.cpp" line="279"/> <source>Choose the default subdivision unit to show in the interface, and when sending coins</source> <translation>Kies de standaard onderverdelingseenheid om weer te geven in uw programma, en voor het versturen van munten</translation> </message> <message> <location filename="../optionsdialog.cpp" line="286"/> <source>&amp;Display addresses in transaction list</source> <translation>Toon adressen in transactielijst</translation> </message> <message> <location filename="../optionsdialog.cpp" line="287"/> <source>Whether to show Paycoin addresses in the transaction list</source> <translation>Toon Paycoinadressen in transactielijst</translation> </message> <message> <location filename="../optionsdialog.cpp" line="290"/> <source>Display coin control features (experts only!)</source> <translation>Laat muntcontrole functies zien (alleen voor experts!)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="291"/> <source>Whether to show coin control features or not</source> <translation>Munt controle mogelijkheden of niet</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="14"/> <source>Edit Address</source> <translation>Bewerk Adres</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="25"/> <source>&amp;Label</source> <translation>&amp;Label</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="35"/> <source>The label associated with this address book entry</source> <translation>Het label dat geassocieerd is met dit adres</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="42"/> <source>&amp;Address</source> <translation>&amp;Adres</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="52"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation>Het adres dat geassocieerd is met deze adresboek-opgave. Dit kan alleen worden veranderd voor zend-adressen.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="20"/> <source>New receiving address</source> <translation>Nieuw ontvangstadres</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="24"/> <source>New sending address</source> <translation>Nieuw adres om naar te versturen</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="27"/> <source>Edit receiving address</source> <translation>Bewerk ontvangstadres</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="31"/> <source>Edit sending address</source> <translation>Bewerk verzendadres</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="91"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>Het opgegeven adres &quot;%1&quot; bestaat al in uw adresboek.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="96"/> <source>The entered address &quot;%1&quot; is not a valid Paycoin address.</source> <translation>Het ingevoerde adres &quot;%1&quot; is geen geldig Paycoin adres.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="101"/> <source>Could not unlock wallet.</source> <translation>Kon de portemonnee niet openen.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="106"/> <source>New key generation failed.</source> <translation>Genereren nieuwe sleutel mislukt.</translation> </message> </context> <context> <name>MainOptionsPage</name> <message> <location filename="../optionsdialog.cpp" line="177"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Minimaliseer naar het systeemvak in plaats van de taakbalk</translation> </message> <message> <location filename="../optionsdialog.cpp" line="178"/> <source>Show only a tray icon after minimizing the window</source> <translation>Laat alleen een systeemvak-icoon zien wanneer het venster geminimaliseerd is</translation> </message> <message> <location filename="../optionsdialog.cpp" line="186"/> <source>Map port using &amp;UPnP</source> <translation>Poort mapping via &amp;UPnP</translation> </message> <message> <location filename="../optionsdialog.cpp" line="181"/> <source>M&amp;inimize on close</source> <translation>Minimaliseer bij &amp;sluiten van het venster</translation> </message> <message> <location filename="../optionsdialog.cpp" line="182"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>Minimaliseer het venster in de plaats van de applicatie af te sluiten als het venster gesloten wordt. Wanneer deze optie aan staan, kan de applicatie alleen worden afgesloten door Afsluiten te kiezen in het menu.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="187"/> <source>Automatically open the Paycoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>Open automatisch de Paycoin client poort op de router. Dit werkt alleen indien je router PnP ondersteund en het geactiveerd is.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="190"/> <source>&amp;Connect through SOCKS4 proxy:</source> <translation>&amp;Verbind via SOCKS4 proxy: </translation> </message> <message> <location filename="../optionsdialog.cpp" line="191"/> <source>Connect to the Bitcon network through a SOCKS4 proxy (e.g. when connecting through Tor)</source> <translation>Verbind met het Paycoin-netwerk door een SOCKS4 proxy (bijv. wanneer Tor gebruikt wordt)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="196"/> <source>Proxy &amp;IP: </source> <translation>Proxy &amp;IP:</translation> </message> <message> <location filename="../optionsdialog.cpp" line="202"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation>IP-adres van de proxy (bijv. 127.0.0.1)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="205"/> <source>&amp;Port: </source> <translation>&amp;Poort:</translation> </message> <message> <location filename="../optionsdialog.cpp" line="211"/> <source>Port of the proxy (e.g. 1234)</source> <translation>Poort waarop de proxy luistert (bijv. 1234)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="217"/> <source>Mandatory network transaction fee per kB transferred. Most transactions are 1 kB and incur a 0.01 PPC fee. Note: transfer size may increase depending on the number of input transactions required to be added together to fund the payment.</source> <translation>Verplichte network transactie kosten per verstuurde kB. De meeste transacties zijn 1kB en kosten 0.01 PPC. Opm. Het aantal verstuurde kB neemt toe afhankelijk van het aantal ingebrachte transacties benodigd om de betaling te kunnen bekostigen.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="223"/> <source>Additional network &amp;fee:</source> <translation>Extra netwerk &amp;kosten</translation> </message> <message> <location filename="../optionsdialog.cpp" line="234"/> <source>Detach databases at shutdown</source> <translation>Ontkoppel database tijdens afsluiten</translation> </message> <message> <location filename="../optionsdialog.cpp" line="235"/> <source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source> <translation>Ontkoppel blok en adres database tijdens afsluiten. Dit betekent dat ze kunnen worden verplaatst naar een andere bestandslokatie, maar het afsluiten is daardoor langzamer. De portomonnee is altijd ontkoppeld.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="172"/> <source>&amp;Start Paycoin on window system startup</source> <translation>Start Paycoin als windows wordt geladen</translation> </message> <message> <location filename="../optionsdialog.cpp" line="173"/> <source>Automatically start Paycoin after the computer is turned on</source> <translation>Start Paycoin automatisch nadat de computer is ingeschakeld</translation> </message> </context> <context> <name>MintingTableModel</name> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Transaction</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Age</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Balance</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>CoinDay</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>MintProbability</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="284"/> <source>minutes</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="291"/> <source>hours</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="295"/> <source>days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="298"/> <source>You have %1 chance to find a POS block if you mint %2 %3 at current difficulty.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="418"/> <source>Destination address of the output.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="420"/> <source>Original transaction id.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="422"/> <source>Age of the transaction in days.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="424"/> <source>Balance of the output.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="426"/> <source>Coin age in the output.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="428"/> <source>Chance to mint a block within given time interval.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MintingView</name> <message> <location filename="../mintingview.cpp" line="33"/> <source>transaction is too young</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="40"/> <source>transaction is mature</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="47"/> <source>transaction has reached maximum probability</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="60"/> <source>Display minting probability within : </source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="62"/> <source>10 min</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="63"/> <source>24 hours</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="64"/> <source>30 days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="65"/> <source>90 days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="162"/> <source>Export Minting Data</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="163"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location filename="../mintingview.cpp" line="171"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../mintingview.cpp" line="172"/> <source>Transaction</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="173"/> <source>Age</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="174"/> <source>CoinDay</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="175"/> <source>Balance</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="176"/> <source>MintingProbability</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="180"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location filename="../mintingview.cpp" line="180"/> <source>Could not write to file %1.</source> <translation>Kon niet schrijven naar bestand %1.</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../optionsdialog.cpp" line="81"/> <source>Main</source> <translation>Algemeen</translation> </message> <message> <location filename="../optionsdialog.cpp" line="86"/> <source>Display</source> <translation>Beeldscherm</translation> </message> <message> <location filename="../optionsdialog.cpp" line="106"/> <source>Options</source> <translation>Opties</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="14"/> <source>Form</source> <translation>Vorm</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="40"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="54"/> <source>Number of transactions:</source> <translation>Aantal transacties:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="61"/> <source>0</source> <translation>0</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="68"/> <source>Unconfirmed:</source> <translation>Onbevestigd:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="82"/> <source>Stake:</source> <translation>Inzet:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="102"/> <source>Wallet</source> <translation>Portemonnee</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="138"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Recente transacties&lt;/b&gt;</translation> </message> <message> <location filename="../overviewpage.cpp" line="104"/> <source>Your current balance</source> <translation>Uw huidige saldo</translation> </message> <message> <location filename="../overviewpage.cpp" line="109"/> <source>Your current stake</source> <translation>Huidige inzet</translation> </message> <message> <location filename="../overviewpage.cpp" line="114"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation>Totaal aantal transacties dat nog moet worden bevestigd, en nog niet is meegeteld in uw huidige saldo </translation> </message> <message> <location filename="../overviewpage.cpp" line="117"/> <source>Total number of transactions in wallet</source> <translation>Totaal aantal transacties in uw portemonnee</translation> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="14"/> <source>Dialog</source> <translation>Dialoog</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="32"/> <source>QR Code</source> <translation>QR-code</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="55"/> <source>Request Payment</source> <translation>Vraag betaling aan</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="70"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="105"/> <source>PPC</source> <translation>PPC</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="121"/> <source>Label:</source> <translation>Label:</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="144"/> <source>Message:</source> <translation>Bericht:</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="186"/> <source>&amp;Save As...</source> <translation>&amp;Opslaan Als...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="46"/> <source>Error encoding URI into QR Code.</source> <translation>Fout in codering URI naar QR-code</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="64"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>Resultaat URI te lang, probeer de tekst in te korten.</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="121"/> <source>Save Image...</source> <translation>Afbeelding Opslaan...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="121"/> <source>PNG Images (*.png)</source> <translation>PNG-Afbeeldingen (*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="14"/> <source>Paycoin (Paycoin) debug window</source> <translation>Paycoin (PPcoin) debug scherm</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="24"/> <source>Information</source> <translation>Informatie</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="33"/> <source>Client name</source> <translation>Client naam</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="40"/> <location filename="../forms/rpcconsole.ui" line="60"/> <location filename="../forms/rpcconsole.ui" line="106"/> <location filename="../forms/rpcconsole.ui" line="156"/> <location filename="../forms/rpcconsole.ui" line="176"/> <location filename="../forms/rpcconsole.ui" line="196"/> <location filename="../forms/rpcconsole.ui" line="229"/> <location filename="../rpcconsole.cpp" line="338"/> <source>N/A</source> <translation>N.v.t.</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="53"/> <source>Client version</source> <translation>Client versie</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="79"/> <source>Version</source> <translation>Versie</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="92"/> <source>Network</source> <translation>Netwerk</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="99"/> <source>Number of connections</source> <translation>Aantal connecties</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="119"/> <source>On testnet</source> <translation>Op testnetwerk</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="142"/> <source>Block chain</source> <translation>Blokkenketen</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="149"/> <source>Current number of blocks</source> <translation>Huidig aantal blokken</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="169"/> <source>Estimated total blocks</source> <translation>Geschat aantal blokken</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="189"/> <source>Last block time</source> <translation>Laaste bloktijd</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="222"/> <source>Build date</source> <translation>Bouwdatum</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="237"/> <source>Console</source> <translation>Console</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="270"/> <source>&gt;</source> <translation>&gt;</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="286"/> <source>Clear console</source> <translation>Console opschonen</translation> </message> <message> <location filename="../rpcconsole.cpp" line="306"/> <source>Welcome to the Paycoin RPC console.&lt;br&gt;Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.&lt;br&gt;Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Welkom bij de Paycoin RPC console. &lt;br&gt;Gebruik pijltjes naar boven en naar beneden om de geschiedenis te navigeren, en &lt;b&gt;Ctrl-L&lt;/b&gt; om het scherm te wissen.&lt;br&gt;Typ &lt;b&gt;help&lt;/b&gt; voor een overzicht met commandos.</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="14"/> <location filename="../sendcoinsdialog.cpp" line="176"/> <location filename="../sendcoinsdialog.cpp" line="181"/> <location filename="../sendcoinsdialog.cpp" line="186"/> <location filename="../sendcoinsdialog.cpp" line="191"/> <location filename="../sendcoinsdialog.cpp" line="197"/> <location filename="../sendcoinsdialog.cpp" line="202"/> <location filename="../sendcoinsdialog.cpp" line="207"/> <source>Send Coins</source> <translation>Verstuur munten</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="90"/> <source>Coin Control Features</source> <translation>Munt controle opties</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="110"/> <source>Inputs...</source> <translation>Toevoer...</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="117"/> <source>automatically selected</source> <translation>automatisch geselecteerd</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="136"/> <source>Insufficient funds!</source> <translation>Onvoldoende fondsen!</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="213"/> <source>Quantity:</source> <translation>Aantal:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="235"/> <location filename="../forms/sendcoinsdialog.ui" line="270"/> <source>0</source> <translation>0</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="251"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="302"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="324"/> <location filename="../forms/sendcoinsdialog.ui" line="410"/> <location filename="../forms/sendcoinsdialog.ui" line="496"/> <location filename="../forms/sendcoinsdialog.ui" line="528"/> <source>0.00 BTC</source> <translation>123.456 BTC {0.00 ?}</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="337"/> <source>Priority:</source> <translation>Prioriteit:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="356"/> <source>medium</source> <translation>medium</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="388"/> <source>Fee:</source> <translation>Transactiekosten:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="423"/> <source>Low Output:</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="442"/> <source>no</source> <translation>nee</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="474"/> <source>After Fee:</source> <translation>Na aftrek kosten:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="509"/> <source>Change</source> <translation>Teruggave</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="559"/> <source>custom change address</source> <translation>zelfopgegeven teruggaveadres</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="665"/> <source>Send to multiple recipients at once</source> <translation>Verstuur aan verschillende ontvangers tegelijkertijd</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="668"/> <source>&amp;Add recipient...</source> <translation>Voeg &amp;ontvanger toe...</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="685"/> <source>Remove all transaction fields</source> <translation>Verwijder alle transactievelden</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="688"/> <source>Clear all</source> <translation>Verwijder alles</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="707"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="714"/> <source>123.456 BTC</source> <translation>123.456 BTC</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="745"/> <source>Confirm the send action</source> <translation>Bevestig de verstuuractie</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="748"/> <source>&amp;Send</source> <translation>&amp;Verstuur</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="51"/> <source>Copy quantity</source> <translation>Kopieer aantal</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="52"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="53"/> <source>Copy fee</source> <translation>Kopieer kosten</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="54"/> <source>Copy after fee</source> <translation>Kopieer na kosten</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="55"/> <source>Copy bytes</source> <translation>Kopieer bytes</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="56"/> <source>Copy priority</source> <translation>Kopieer prioriteit</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="57"/> <source>Copy low output</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="58"/> <source>Copy change</source> <translation>Kopieer teruggave</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="144"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>&lt;b&gt;%1&lt;/b&gt; aan %2 (%3)</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="149"/> <source>Confirm send coins</source> <translation>Bevestig versturen munten</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="150"/> <source>Are you sure you want to send %1?</source> <translation>Weet u zeker dat u %1 wil versturen?</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="150"/> <source> and </source> <translation> en </translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="182"/> <source>The amount to pay must be at least one cent (0.01).</source> <translation>Het te betalen bedrag moet minimaal een cent zijn (0.01).</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="457"/> <source>Warning: Invalid Bitcoin address</source> <translation>Waarschuwing: Ongeldig Paycoin adres</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="466"/> <source>Warning: Unknown change address</source> <translation>Waarschuwing: onbekend teruggave adres</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="477"/> <source>(no label)</source> <translation>(geen label)</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="187"/> <source>Amount exceeds your balance</source> <translation>Bedrag overschrijdt uw huidige saldo</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="36"/> <source>Enter a Paycoin address</source> <translation>Voer een Paycoin adres in</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="177"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="192"/> <source>Total exceeds your balance when the %1 transaction fee is included</source> <translation>Totaal overschrijdt uw huidige saldo wanneer de %1 transactiekosten worden meegerekend</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="198"/> <source>Duplicate address found, can only send to each address once in one send operation</source> <translation>Dubbel adres gevonden, u kunt slechts eenmaal per verzendtransactie naar een bepaald adres versturen</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="203"/> <source>Error: Transaction creation failed </source> <translation>Fout: Aanmaak transactie mislukt</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="208"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>Fout: De transactie was afgewezen. Dit kan gebeuren als u eerder uitgegeven munten opnieuw wilt versturen, zoals wanneer u een kopie van uw wallet.dat heeft gebruikt en in de kopie deze munten zijn gemarkeerd als uitgegeven, maar in de huidige nog niet.</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="14"/> <source>Form</source> <translation>Vorm</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="29"/> <source>A&amp;mount:</source> <translation>Bedra&amp;g:</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="42"/> <source>Pay &amp;To:</source> <translation>Betaal &amp;Aan:</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="66"/> <location filename="../sendcoinsentry.cpp" line="26"/> <source>Enter a label for this address to add it to your address book</source> <translation>Vul een label in voor dit adres om het toe te voegen aan uw adresboek</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="75"/> <source>&amp;Label:</source> <translation>&amp;Label:</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="93"/> <source>The address to send the payment to</source> <translation>Het verzendadres voor de betaling</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="103"/> <source>Choose address from address book</source> <translation>Kies adres uit adresboek</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="113"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="120"/> <source>Paste address from clipboard</source> <translation>Plak adres vanuit klembord</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="130"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="137"/> <source>Remove this recipient</source> <translation>Verwijder deze ontvanger</translation> </message> <message> <location filename="../sendcoinsentry.cpp" line="25"/> <source>Enter a Paycoin address</source> <translation>Voer een Paycoin adres in</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="14"/> <source>Signatures - Sign / Verify a Message</source> <translation>Ondertekeningen - Onderteken / verifieer een bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="24"/> <source>&amp;Sign Message</source> <translation>&amp;Onderteken Bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="30"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>U kunt berichten ondertekenen met een van uw adressen om te bewijzen dat u dit adres bezit. Pas op dat u geen onduidelijke dingen ondertekent, want phishingaanvallen zouden u voor de gek kunnen houden om zo uw identiteit te stelen. Onderteken alleen berichten waarmee u het volledig eens bent.</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="48"/> <source>The address to sign the message with</source> <translation>Het ondertekenings adres voor het bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="55"/> <location filename="../forms/signverifymessagedialog.ui" line="265"/> <source>Choose previously used address</source> <translation>Kies eerder gebruikt adres</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="65"/> <location filename="../forms/signverifymessagedialog.ui" line="275"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="75"/> <source>Paste address from clipboard</source> <translation>Plak adres vanuit klembord</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="85"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="97"/> <source>Enter the message you want to sign here</source> <translation>Typ hier het bericht dat u wilt ondertekenen</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="104"/> <source>Signature</source> <translation>Ondertekening</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="131"/> <source>Copy the current signature to the system clipboard</source> <translation>Kopieer de huidige onderteking naar het systeem klembord</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="152"/> <source>Sign the message to prove you own this Paycoin address</source> <translation>Bewijs dat je dit Paycoin adres bezit door het te ondertekenen </translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="155"/> <source>Sign &amp;Message</source> <translation>Onderteken &amp;Bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="169"/> <source>Reset all sign message fields</source> <translation>Herinitialiseer alle ondertekende bericht velden</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="172"/> <location filename="../forms/signverifymessagedialog.ui" line="315"/> <source>Clear &amp;All</source> <translation>&amp;Alles wissen</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="231"/> <source>&amp;Verify Message</source> <translation>&amp;Verifieer bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="237"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Voer hieronder het ondertekeningsadres in, het bericht (vergeet niet precies alle regelafbrekingen, spaties, tabulaties, etc. in te voeren) en ondertekening om het bericht te verifieren. Wees voorzichtig om verder te lezen waar de tekst niet deel uitmaakt van het ondertekende bericht, dit om te voorkomen dat je verleid wordt door een man-in-het-midden aanval.</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="258"/> <source>The address the message was signed with</source> <translation>Het adres waarmee het bericht getekend was</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="295"/> <source>Verify the message to ensure it was signed with the specified Paycoin address</source> <translation>Verifieer het bericht om vast te stellen dat het bericht ondertekend was met het gespecificeerde Paycoin adres</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="298"/> <source>Verify &amp;Message</source> <translation>&amp;Verifieer bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="312"/> <source>Reset all verify message fields</source> <translation>Herinitialiseer alle geverifieerde bericht velden</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="29"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>Klik &apos;Onderteken bericht&apos; om te ondertekenen</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="30"/> <source>Enter the signature of the message</source> <translation>Voer de ondertekening in voor het bericht</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="31"/> <location filename="../signverifymessagedialog.cpp" line="32"/> <source>Enter a Paycoin address</source> <translation>Voer een Paycoin adres in</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="115"/> <location filename="../signverifymessagedialog.cpp" line="195"/> <source>The entered address is invalid.</source> <translation>Het ingevoerde adres is onjuist</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="115"/> <location filename="../signverifymessagedialog.cpp" line="123"/> <location filename="../signverifymessagedialog.cpp" line="195"/> <location filename="../signverifymessagedialog.cpp" line="203"/> <source>Please check the address and try again.</source> <translation>Controleer het adres and probeer opnieuw.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="123"/> <location filename="../signverifymessagedialog.cpp" line="203"/> <source>The entered address does not refer to a key.</source> <translation>Het ingevoerde adres refereert niet naar een sleutel</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="131"/> <source>Wallet unlock was cancelled.</source> <translation>Portemonnee ontsleuteling is afgebroken.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="139"/> <source>Private key for the entered address is not available.</source> <translation>Geheime sleutel voor het ingevoerde adres is niet beschikbaar.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="151"/> <source>Message signing failed.</source> <translation>Bericht ondertekening mislukt.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="156"/> <source>Message signed.</source> <translation>Bericht ontedertekend.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="214"/> <source>The signature could not be decoded.</source> <translation>De ondertekeing kan niet worden ontcijferd.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="214"/> <location filename="../signverifymessagedialog.cpp" line="227"/> <source>Please check the signature and try again.</source> <translation>Controleer de ondertekening and probeer opnieuw.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="227"/> <source>The signature did not match the message digest.</source> <translation>De ondertekening komt niet overeen met de bericht samenvatting.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="234"/> <source>Message verification failed.</source> <translation>Bericht verficatie mislukt.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="239"/> <source>Message verified.</source> <translation>Bericht geverifieerd.</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="21"/> <source>Open for %1 blocks</source> <translation>Openen voor %1 blokken</translation> </message> <message> <location filename="../transactiondesc.cpp" line="23"/> <source>Open until %1</source> <translation>Open tot %1</translation> </message> <message> <location filename="../transactiondesc.cpp" line="29"/> <source>%1/offline?</source> <translation>%1/niet verbonden?</translation> </message> <message> <location filename="../transactiondesc.cpp" line="31"/> <source>%1/unconfirmed</source> <translation>%1/onbevestigd</translation> </message> <message> <location filename="../transactiondesc.cpp" line="33"/> <source>%1 confirmations</source> <translation>%1 bevestigingen</translation> </message> <message> <location filename="../transactiondesc.cpp" line="51"/> <source>&lt;b&gt;Status:&lt;/b&gt; </source> <translation>&lt;b&gt;Status:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="56"/> <source>, has not been successfully broadcast yet</source> <translation>, is nog niet succesvol uitgezonden</translation> </message> <message> <location filename="../transactiondesc.cpp" line="58"/> <source>, broadcast through %1 node</source> <translation>, uitgezonden naar %1 node</translation> </message> <message> <location filename="../transactiondesc.cpp" line="60"/> <source>, broadcast through %1 nodes</source> <translation>, uitgezonden naar %1 nodes</translation> </message> <message> <location filename="../transactiondesc.cpp" line="64"/> <source>&lt;b&gt;Date:&lt;/b&gt; </source> <translation>&lt;b&gt;Datum:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="71"/> <source>&lt;b&gt;Source:&lt;/b&gt; Generated&lt;br&gt;</source> <translation>&lt;b&gt;Bron:&lt;/b&gt;Gegenereerd&lt;br&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="77"/> <location filename="../transactiondesc.cpp" line="94"/> <source>&lt;b&gt;From:&lt;/b&gt; </source> <translation>&lt;b&gt;Van:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="94"/> <source>unknown</source> <translation>onbekend</translation> </message> <message> <location filename="../transactiondesc.cpp" line="95"/> <location filename="../transactiondesc.cpp" line="118"/> <location filename="../transactiondesc.cpp" line="178"/> <source>&lt;b&gt;To:&lt;/b&gt; </source> <translation>&lt;b&gt; Aan:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="98"/> <source> (yours, label: </source> <translation>(Uw adres, label:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="100"/> <source> (yours)</source> <translation>(uw)</translation> </message> <message> <location filename="../transactiondesc.cpp" line="136"/> <location filename="../transactiondesc.cpp" line="150"/> <location filename="../transactiondesc.cpp" line="195"/> <location filename="../transactiondesc.cpp" line="212"/> <source>&lt;b&gt;Credit:&lt;/b&gt; </source> <translation>&lt;b&gt;Bij:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="138"/> <source>(%1 matures in %2 more blocks)</source> <translation>(%1 komt beschikbaar na %2 blokken)</translation> </message> <message> <location filename="../transactiondesc.cpp" line="142"/> <source>(not accepted)</source> <translation>(niet geaccepteerd)</translation> </message> <message> <location filename="../transactiondesc.cpp" line="186"/> <location filename="../transactiondesc.cpp" line="194"/> <location filename="../transactiondesc.cpp" line="209"/> <source>&lt;b&gt;Debit:&lt;/b&gt; </source> <translation>&lt;b&gt;Af:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="200"/> <source>&lt;b&gt;Transaction fee:&lt;/b&gt; </source> <translation>&lt;b&gt;Transactiekosten:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="218"/> <source>&lt;b&gt;Net amount:&lt;/b&gt; </source> <translation>&lt;b&gt;Netto bedrag:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="220"/> <source>&lt;b&gt;Retained amount:&lt;/b&gt; %1 until %2 more blocks&lt;br&gt;</source> <translation>&lt;b&gt;Vastgehouden bedrag: &lt;/b&gt; %1 totdat %2 meer blokken&lt;br&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="227"/> <source>Message:</source> <translation>Bericht:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="229"/> <source>Comment:</source> <translation>Opmerking:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="231"/> <source>Transaction ID:</source> <translation>Transactie-ID:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="234"/> <source>Generated coins must wait 520 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to &quot;not accepted&quot; and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>Gegeneerde munten moeten 120 blokken wachten voor ze kunnen worden uitgegeven. Uw net gegenereerde blok is uitgezonden aan het netwerk om te worden toegevoegd aan de blokkenketen. Als het niet wordt geaccepteerd in de keten, zal het blok als &quot;ongeldig&quot; worden aangemerkt en kan het niet worden uitgegeven. Dit kan soms gebeuren als een andere node net iets sneller een blok heeft gegenereerd; een paar seconden voor het uwe. {520 ?}</translation> </message> <message> <location filename="../transactiondesc.cpp" line="236"/> <source>Staked coins must wait 520 blocks before they can return to balance and be spent. When you generated this proof-of-stake block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to &quot;not accepted&quot; and not be a valid stake. This may occasionally happen if another node generates a proof-of-stake block within a few seconds of yours.</source> <translation>Gegenereerde munten moeten 520 blokken wachten voor ze kunnen worden uitgegeven. Uw net gegenereerde blok is uitgezonden aan het netwerk om te worden toegevoegd aan de blokkenketen. Als het niet wordt geaccepteerd in de keten, zal het blok als &quot;ongeldig&quot; worden aangemerkt en kan het niet worden uitgegeven. Dit kan soms gebeuren als een andere node net iets sneller een blok heeft gegenereerd; een paar seconden voor het uwe.</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="14"/> <source>Transaction details</source> <translation>Transactiedetails</translation> </message> <message> <location filename="../forms/transactiondescdialog.ui" line="20"/> <source>This pane shows a detailed description of the transaction</source> <translation>Dit venster laat een uitgebreide beschrijving van de transactie zien</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Type</source> <translation>Type</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message numerus="yes"> <location filename="../transactiontablemodel.cpp" line="281"/> <source>Open for %n block(s)</source> <translation> <numerusform>Open gedurende %n blok</numerusform> <numerusform>Open gedurende %n blokken</numerusform> </translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="284"/> <source>Open until %1</source> <translation>Open tot %1</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="287"/> <source>Offline (%1 confirmations)</source> <translation>Niet verbonden (%1 bevestigingen)</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="290"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation>Onbevestigd (%1 van %2 bevestigd)</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="293"/> <source>Confirmed (%1 confirmations)</source> <translation>Bevestigd (%1 bevestigingen)</translation> </message> <message numerus="yes"> <location filename="../transactiontablemodel.cpp" line="301"/> <source>Mined balance will be available in %n more blocks</source> <translation> <numerusform>Ontgonnen saldo komt beschikbaar na %n blok</numerusform> <numerusform>Ontgonnen saldo komt beschikbaar na %n blokken</numerusform> </translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="307"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>Dit blok is niet ontvangen bij andere nodes en zal waarschijnlijk niet worden geaccepteerd!</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="310"/> <source>Generated but not accepted</source> <translation>Gegenereerd maar niet geaccepteerd</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="353"/> <source>Received with</source> <translation>Ontvangen met</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="355"/> <source>Received from</source> <translation>Ontvangen van</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="358"/> <source>Sent to</source> <translation>Verzonden aan</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="360"/> <source>Payment to yourself</source> <translation>Betaling aan uzelf</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="362"/> <source>Mined</source> <translation>Ontgonnen</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="364"/> <source>Mint by stake</source> <translation>Minten met inzet</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="403"/> <source>(n/a)</source> <translation>(nvt)</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="603"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Transactiestatus. Houd de muiscursor boven dit veld om het aantal bevestigingen te laten zien.</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="605"/> <source>Date and time that the transaction was received.</source> <translation>Datum en tijd waarop deze transactie is ontvangen.</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="607"/> <source>Type of transaction.</source> <translation>Type transactie.</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="609"/> <source>Destination address of transaction.</source> <translation>Ontvangend adres van transactie</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="611"/> <source>Amount removed from or added to balance.</source> <translation>Bedrag verwijderd van of toegevoegd aan saldo</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="55"/> <location filename="../transactionview.cpp" line="71"/> <source>All</source> <translation>Alles</translation> </message> <message> <location filename="../transactionview.cpp" line="56"/> <source>Today</source> <translation>Vandaag</translation> </message> <message> <location filename="../transactionview.cpp" line="57"/> <source>This week</source> <translation>Deze week</translation> </message> <message> <location filename="../transactionview.cpp" line="58"/> <source>This month</source> <translation>Deze maand</translation> </message> <message> <location filename="../transactionview.cpp" line="59"/> <source>Last month</source> <translation>Vorige maand</translation> </message> <message> <location filename="../transactionview.cpp" line="60"/> <source>This year</source> <translation>Dit jaar</translation> </message> <message> <location filename="../transactionview.cpp" line="61"/> <source>Range...</source> <translation>Bereik...</translation> </message> <message> <location filename="../transactionview.cpp" line="72"/> <source>Received with</source> <translation>Ontvangen met</translation> </message> <message> <location filename="../transactionview.cpp" line="74"/> <source>Sent to</source> <translation>Verzonden aan</translation> </message> <message> <location filename="../transactionview.cpp" line="76"/> <source>To yourself</source> <translation>Aan uzelf</translation> </message> <message> <location filename="../transactionview.cpp" line="77"/> <source>Mined</source> <translation>Ontgonnen</translation> </message> <message> <location filename="../transactionview.cpp" line="78"/> <source>Mint by stake</source> <translation>Minten met inzet</translation> </message> <message> <location filename="../transactionview.cpp" line="79"/> <source>Other</source> <translation>Anders</translation> </message> <message> <location filename="../transactionview.cpp" line="85"/> <source>Enter address or label to search</source> <translation>Vul adres of label in om te zoeken</translation> </message> <message> <location filename="../transactionview.cpp" line="91"/> <source>Min amount</source> <translation>Min. bedrag</translation> </message> <message> <location filename="../transactionview.cpp" line="125"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location filename="../transactionview.cpp" line="126"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location filename="../transactionview.cpp" line="127"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location filename="../transactionview.cpp" line="128"/> <source>Edit label</source> <translation>Bewerk label</translation> </message> <message> <location filename="../transactionview.cpp" line="129"/> <source>Show details...</source> <translation>Toon details...</translation> </message> <message> <location filename="../transactionview.cpp" line="130"/> <source>Clear orphans</source> <translation type="unfinished"></translation> </message> <message> <location filename="../transactionview.cpp" line="273"/> <source>Export Transaction Data</source> <translation>Exporteer transactiegegevens</translation> </message> <message> <location filename="../transactionview.cpp" line="274"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location filename="../transactionview.cpp" line="282"/> <source>Confirmed</source> <translation>Bevestigd</translation> </message> <message> <location filename="../transactionview.cpp" line="283"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location filename="../transactionview.cpp" line="284"/> <source>Type</source> <translation>Type</translation> </message> <message> <location filename="../transactionview.cpp" line="285"/> <source>Label</source> <translation>Label</translation> </message> <message> <location filename="../transactionview.cpp" line="286"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../transactionview.cpp" line="287"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location filename="../transactionview.cpp" line="288"/> <source>ID</source> <translation>ID</translation> </message> <message> <location filename="../transactionview.cpp" line="292"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location filename="../transactionview.cpp" line="292"/> <source>Could not write to file %1.</source> <translation>Kon niet schrijven naar bestand %1.</translation> </message> <message> <location filename="../transactionview.cpp" line="400"/> <source>Range:</source> <translation>Bereik:</translation> </message> <message> <location filename="../transactionview.cpp" line="408"/> <source>to</source> <translation>naar</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="164"/> <source>Sending...</source> <translation>Versturen...</translation> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="11"/> <source>Warning: Disk space is low </source> <translation>Waarschuwing: Weinig schijfruimte over </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="13"/> <source>Usage:</source> <translation>Gebruik:</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="8"/> <source>Unable to bind to port %d on this computer. Paycoin is probably already running.</source> <translation>Onmogelijk om poort %d te verbinden op deze computer. Paycoin is mogelijk al eerder opgestart.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="12"/> <source>Paycoin version</source> <translation>Paycoin versie</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="14"/> <source>Send command to -server or paycoind</source> <translation>Zend commando naar -server of paycoind</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="15"/> <source>List commands</source> <translation>List van commando&apos;s </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="16"/> <source>Get help for a command</source> <translation>Toon hulp voor een commando </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="17"/> <source>Options:</source> <translation>Opties: </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="18"/> <source>Specify configuration file (default: paycoin.conf)</source> <translation>Configuratiebestand specificeren (standaard: paycoin.conf)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="19"/> <source>Specify pid file (default: paycoind.pid)</source> <translation>Specifieer pid-bestand (standaard: paycoind.pid) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="20"/> <source>Generate coins</source> <translation>Genereer munten </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="21"/> <source>Don&apos;t generate coins</source> <translation>Genereer geen munten</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="22"/> <source>Start minimized</source> <translation>Geminimaliseerd starten </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="23"/> <source>Show splash screen on startup (default: 1)</source> <translation>Toon welkom scherm bij het opstarten (standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="24"/> <source>Specify data directory</source> <translation>Stel datamap in </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="25"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Database cache instellen in Mb (standaard: 25)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="26"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation>Database logbestandgrootte instellen in Mb (standaard: 100)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="27"/> <source>Specify connection timeout (in milliseconds)</source> <translation>Specificeer de time-out tijd (in milliseconden) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="28"/> <source>Connect through socks4 proxy</source> <translation>Verbind via socks4 proxy </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="29"/> <source>Allow DNS lookups for addnode and connect</source> <translation>Sta DNS-naslag toe voor addnode en connect </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="30"/> <source>Listen for connections on &lt;port&gt; (default: 9901 or testnet: 9903)</source> <translation>Luister voor verbindingen op &lt;port&gt; (standaard:9901 of testnet: 9903)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="31"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Onderhoud maximaal &lt;n&gt; verbindingen naar peers (standaard: 125)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="32"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Maak connectie met een node en houd deze open</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="33"/> <source>Connect only to the specified node</source> <translation>Verbind alleen met deze node </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="34"/> <source>Find peers using internet relay chat (default: 0)</source> <translation>Zoek anderen via internet chat (standaard: 0)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="35"/> <source>Accept connections from outside (default: 1)</source> <translation>Connecties van buiten accepteren (standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="36"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>Taal instellen, bijv &quot;de_DE&quot; (standaard: system locale)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="37"/> <source>Find peers using DNS lookup (default: 1)</source> <translation>Zoek anderen via DNS (standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="38"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Drempel om verbinding te verbreken naar zich misdragende peers (standaard: 100)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="39"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Aantal seconden dat zich misdragende peers niet opnieuw mogen verbinden (standaard: 86400)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="42"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 10000)</source> <translation>Maximale ontvangstbuffer per connectie, &lt;n&gt;*1000 bytes (standaard: 10000)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="43"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 10000)</source> <translation>Maximale zendbuffer per connectie, &lt;n&gt;*1000 bytes (standaard: 10000)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="44"/> <source>Use Universal Plug and Play to map the listening port (default: 1)</source> <translation>Gebruik uPNP om de netwerk poort in te delen (standaard 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="45"/> <source>Use Universal Plug and Play to map the listening port (default: 0)</source> <translation>Gebruik uPNP om de netwerkpoort in te delen (standaard 0)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="46"/> <source>Fee per KB to add to transactions you send</source> <translation>Kosten per kB voor te versturen transacties</translation> </message><|fim▁hole|></translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="48"/> <source>Run in the background as a daemon and accept commands</source> <translation>Draai in de achtergrond als daemon en aanvaard commando&apos;s </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="49"/> <source>Use the test network</source> <translation>Gebruik het testnetwerk </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="50"/> <source>Output extra debugging information</source> <translation>Toon extra debuggingsinformatie</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="51"/> <source>Prepend debug output with timestamp</source> <translation>Voorzie de debuggingsuitvoer van een tijdsaanduiding</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="52"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Stuur opsporing/debug-info naar de console in plaats van het debug.log bestand</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="53"/> <source>Send trace/debug info to debugger</source> <translation>Stuur opsporings/debug-info naar debugger</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="54"/> <source>Username for JSON-RPC connections</source> <translation>Gebruikersnaam voor JSON-RPC verbindingen </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="55"/> <source>Password for JSON-RPC connections</source> <translation>Wachtwoord voor JSON-RPC verbindingen </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="56"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 9902)</source> <translation>Luister voor JSON-RPC verbindingen op &lt;port&gt; (standaard: 9902) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="57"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Sta JSON-RPC verbindingen van opgegeven IP adres toe </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="58"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Verstuur commando&apos;s naar proces dat op &lt;ip&gt; draait (standaard: 127.0.0.1) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="59"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Voer commando uit indien het hoogste blok verandert (%s in cmd is herplaats met blok hash)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="62"/> <source>Upgrade wallet to latest format</source> <translation>Opwaardeer portemonnee naar laatste formaat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="63"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Stel sleutelpoelgrootte in op &lt;n&gt; (standaard: 100) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="64"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Doorzoek de blokkenketen op ontbrekende portemonnee-transacties</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="65"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation>Aantal blokken bij opstarten controleren (standaard: 2500, 0 = alle)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="66"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation>Grondigheid blok verificatie (0-6, standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="67"/> <source> SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation>SSL opties: (zie de Bitcoin wiki voor SSL installatie instructies)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="70"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Gebruik OpenSSL (https) voor JSON-RPC verbindingen </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="71"/> <source>Server certificate file (default: server.cert)</source> <translation>Certificaat-bestand voor server (standaard: server.cert) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="72"/> <source>Server private key (default: server.pem)</source> <translation>Geheime sleutel voor server (standaard: server.pem) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="73"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>Aanvaardbare sleuteltypen (standaard: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="76"/> <source>This help message</source> <translation>Dit hulpbericht</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="77"/> <source>Usage</source> <translation>Gebruik</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="78"/> <source>Cannot obtain a lock on data directory %s. Paycoin is probably already running.</source> <translation>Blokkeren van data folder %s is niet gelukt. Paycoin is mogelijk al opgestart.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="81"/> <source>Paycoin</source> <translation>Paycoin</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="88"/> <source>Error loading wallet.dat: Wallet requires newer version of Paycoin</source> <translation>Fout geconstateerd bij het laden van wallet.dat: Portemonnee vereist een nieuwere versie van Paycoin</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="89"/> <source>Wallet needed to be rewritten: restart Paycoin to complete</source> <translation>Portemonnee dient opnieuw bewerkt te worden: start Paycoin opnieuw op om te voltooien</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="103"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=paycoinrpc rpcpassword=%s (you do not need to remember this password) If the file does not exist, create it with owner-readable-only file permissions. </source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="119"/> <source>Warning: Please check that your computer&apos;s date and time are correct. If your clock is wrong Paycoin will not work properly.</source> <translation>Waarschuwing: controleer of de datum en tijd op uw computer correct zijn. Indien uw klok verkeerd staat, zal Paycoin niet goed werken</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="82"/> <source>Loading addresses...</source> <translation>Adressen aan het laden...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="83"/> <source>Error loading addr.dat</source> <translation>Fout bij laden addr.dat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="84"/> <source>Loading block index...</source> <translation>Blokindex aan het laden...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="85"/> <source>Error loading blkindex.dat</source> <translation>Fout bij laden blkindex.dat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="86"/> <source>Loading wallet...</source> <translation>Portemonnee aan het laden...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="87"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Fout bij laden wallet.dat: Portemonnee corrupt</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="90"/> <source>Error loading wallet.dat</source> <translation>Fout bij laden wallet.dat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="91"/> <source>Cannot downgrade wallet</source> <translation>Kan portemonnee niet degraderen</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="92"/> <source>Cannot initialize keypool</source> <translation>Kan sleutelpoel niet initaliseren</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="93"/> <source>Cannot write default address</source> <translation>Kan niet schrijven naar standaard adres</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="94"/> <source>Rescanning...</source> <translation>Opnieuw aan het scannen ...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="95"/> <source>Done loading</source> <translation>Klaar met laden</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="96"/> <source>Invalid -proxy address</source> <translation>Foutief -proxy adres</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="97"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;</source> <translation>Ongeldig bedrag voor -paytxfee=&lt;amount&gt;</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="98"/> <source>Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction.</source> <translation>Waarschuwing: -paytxfee is zeer hoog ingesteld. Dit zijn de transactiekosten die u betaalt bij het versturen van een transactie.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="101"/> <source>Error: CreateThread(StartNode) failed</source> <translation>Fout: CreateThread(StartNode) is mislukt</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="102"/> <source>To use the %s option</source> <translation>Gebruik de %s optie</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="112"/> <source>Error</source> <translation>Fout</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="113"/> <source>An error occured while setting up the RPC port %i for listening: %s</source> <translation>Een fout geconstateerd met het opzetten van RPC port %i om te luisteren: %s</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="114"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>Je moet rpcpassword=&lt;password&gt; in het configuratie bestand instellen: %s Indien het bestand niet bestaat, maak het aan met alleen gebruikers leesrechten op het bestand.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="122"/> <source>Error: Wallet locked, unable to create transaction </source> <translation>Fout: Portemonnee is gesloten, kan geen nieuwe transactie aanmaken</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="123"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation>Fout: Deze transactie vereist minstens %s transactie kosten vanwege het bedrag, moeilijkheid, of recent ontvangen fondsen</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="126"/> <source>Error: Transaction creation failed </source> <translation>Fout: Aanmaak transactie mislukt</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="127"/> <source>Sending...</source> <translation>Versturen...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="128"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>Fout: De transactie was afgewezen. Dit kan gebeuren als u eerder uitgegeven munten opnieuw wilt versturen, zoals wanneer u een kopie van uw wallet.dat heeft gebruikt en in de kopie deze munten zijn gemarkeerd als uitgegeven, maar in de huidige nog niet.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="132"/> <source>Invalid amount</source> <translation>Onjuist bedrag</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="133"/> <source>Insufficient funds</source> <translation>Onvoldoende fondsen</translation> </message> </context> </TS><|fim▁end|>
<message> <location filename="../bitcoinstrings.cpp" line="47"/> <source>Accept command line and JSON-RPC commands</source> <translation>Aanvaard commandoregel en JSON-RPC commando&apos;s
<|file_name|>Download.java<|end_file_name|><|fim▁begin|>package net.argius.stew.command; import static java.sql.Types.*; import java.io.*; import java.sql.*; import net.argius.stew.*; /** * The Download command used to save selected data to files. */ public final class Download extends Command { private static final Logger log = Logger.getLogger(Download.class); @Override public void execute(Connection conn, Parameter parameter) throws CommandException { if (!parameter.has(2)) { throw new UsageException(getUsage()); } final String root = parameter.at(1); final String sql = parameter.after(2); if (log.isDebugEnabled()) { log.debug("root: " + root); log.debug("SQL: " + sql); } try { Statement stmt = prepareStatement(conn, parameter.asString()); try { ResultSet rs = executeQuery(stmt, sql); try { download(rs, root); } finally { rs.close(); } } finally { stmt.close(); }<|fim▁hole|> throw new CommandException(ex); } } private void download(ResultSet rs, String root) throws IOException, SQLException { final int targetColumn = 1; ResultSetMetaData meta = rs.getMetaData(); final int columnCount = meta.getColumnCount(); assert columnCount >= 1; final int columnType = meta.getColumnType(targetColumn); final boolean isBinary; switch (columnType) { case TINYINT: case SMALLINT: case INTEGER: case BIGINT: case FLOAT: case REAL: case DOUBLE: case NUMERIC: case DECIMAL: // numeric to string isBinary = false; break; case BOOLEAN: case BIT: case DATE: case TIME: case TIMESTAMP: // object to string isBinary = false; break; case BINARY: case VARBINARY: case LONGVARBINARY: case BLOB: // binary to stream isBinary = true; break; case CHAR: case VARCHAR: case LONGVARCHAR: case CLOB: // char to binary-stream isBinary = true; break; case OTHER: // ? to binary-stream (experimental) // (e.g.: XML) isBinary = true; break; case DATALINK: case JAVA_OBJECT: case DISTINCT: case STRUCT: case ARRAY: case REF: default: throw new CommandException(String.format("unsupported type: %d", columnType)); } byte[] buffer = new byte[(isBinary) ? 0x10000 : 0]; int count = 0; while (rs.next()) { ++count; StringBuilder fileName = new StringBuilder(); for (int i = 2; i <= columnCount; i++) { fileName.append(rs.getString(i)); } final File path = resolvePath(root); final File file = (columnCount == 1) ? path : new File(path, fileName.toString()); if (file.exists()) { throw new IOException(getMessage("e.file-already-exists", file.getAbsolutePath())); } if (isBinary) { InputStream is = rs.getBinaryStream(targetColumn); if (is == null) { mkdirs(file); if (!file.createNewFile()) { throw new IOException(getMessage("e.failed-create-new-file", file.getAbsolutePath())); } } else { try { mkdirs(file); OutputStream os = new FileOutputStream(file); try { while (true) { int readLength = is.read(buffer); if (readLength <= 0) { break; } os.write(buffer, 0, readLength); } } finally { os.close(); } } finally { is.close(); } } } else { mkdirs(file); PrintWriter out = new PrintWriter(file); try { out.print(rs.getObject(targetColumn)); } finally { out.close(); } } outputMessage("i.downloaded", getSizeString(file.length()), file); } outputMessage("i.selected", count); } private void mkdirs(File file) throws IOException { final File dir = file.getParentFile(); if (!dir.isDirectory()) { if (log.isDebugEnabled()) { log.debug(String.format("mkdir [%s]", dir.getAbsolutePath())); } if (dir.mkdirs()) { outputMessage("i.did-mkdir", dir); } else { throw new IOException(getMessage("e.failed-mkdir-filedir", file)); } } } static String getSizeString(long size) { if (size >= 512) { final double convertedSize; final String unit; if (size >= 536870912) { convertedSize = size * 1f / 1073741824f; unit = "GB"; } else if (size >= 524288) { convertedSize = size * 1f / 1048576f; unit = "MB"; } else { convertedSize = size * 1f / 1024f; unit = "KB"; } return String.format("%.3f", convertedSize).replaceFirst("\\.?0+$", "") + unit; } return String.format("%dbyte%s", size, size < 2 ? "" : "s"); } }<|fim▁end|>
} catch (IOException ex) { throw new CommandException(ex); } catch (SQLException ex) {
<|file_name|>E0199.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(optin_builtin_traits)] struct Foo; trait Bar { } unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199] fn main() { }<|fim▁end|>
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. //
<|file_name|>resource.ts<|end_file_name|><|fim▁begin|>export class Resource { sn: string code: string name: string psn?: string type: string // /** 权限ID */ // private String privilegeId; // /** 权限编码 */ // private String privilegeCode; // /** 权限名称 */ // private String privilegeName; // /** 父ID */ // private String parentId; // /** 类型(1:操作,2:表单,3:服务,4:菜单) */ // private String type; // /** 权限字符串 */ // private String permExpr; constructor(options: { sn: string name: string type: string psn?: string code?: string }) { this.sn = options.sn this.name = options.name this.psn = options.psn<|fim▁hole|><|fim▁end|>
this.type = options.type this.code = options.code } }
<|file_name|>builder.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: utf-8 -*- # # module builder script # import os, sys, shutil, tempfile, subprocess, platform template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename)) support_dir = os.path.join(template_dir, 'support') sdk_dir = os.path.dirname(template_dir) android_support_dir = os.path.join(sdk_dir, 'android') sys.path.extend([sdk_dir, support_dir, android_support_dir]) from androidsdk import AndroidSDK from manifest import Manifest import traceback, uuid, time, thread, string, markdown from os.path import join, splitext, split, exists def run_pipe(args, cwd=None): return subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, cwd=cwd) def print_emulator_line(line): if line: s = line.strip() if s!='': if s.startswith("["): print s else: print "[DEBUG] %s" % s sys.stdout.flush() def run_python(args, cwd=None): args.insert(0, sys.executable) return run(args, cwd=cwd) def run(args, cwd=None): proc = run_pipe(args, cwd) rc = None while True: print_emulator_line(proc.stdout.readline()) rc = proc.poll() if rc!=None: break return rc def run_ant(project_dir): build_xml = os.path.join(project_dir, 'build.xml') ant = 'ant' if 'ANT_HOME' in os.environ: ant = os.path.join(os.environ['ANT_HOME'], 'bin', 'ant') if platform.system() == 'Windows': ant += '.bat' ant_args = [ant, '-f', build_xml] if platform.system() == 'Windows': ant_args = ['cmd.exe', '/C'] + ant_args else: # wrap with /bin/sh in Unix, in some cases the script itself isn't executable ant_args = ['/bin/sh'] + ant_args run(ant_args, cwd=project_dir) ignoreFiles = ['.gitignore', '.cvsignore', '.DS_Store']; ignoreDirs = ['.git','.svn','_svn','CVS']; android_sdk = None def copy_resources(source, target): if not os.path.exists(os.path.expanduser(target)): os.makedirs(os.path.expanduser(target)) for root, dirs, files in os.walk(source): for name in ignoreDirs: if name in dirs: dirs.remove(name) # don't visit ignored directories for file in files: if file in ignoreFiles: continue from_ = os.path.join(root, file) to_ = os.path.expanduser(from_.replace(source, target, 1)) to_directory = os.path.expanduser(split(to_)[0]) if not exists(to_directory): os.makedirs(to_directory) shutil.copyfile(from_, to_) def is_ios(platform): return platform == 'iphone' or platform == 'ipad' or platform == 'ios' def is_android(platform): return platform == 'android' def stage(platform, project_dir, manifest, callback): dont_delete = True dir = tempfile.mkdtemp('ti','m') print '[DEBUG] Staging module project at %s' % dir try:<|fim▁hole|> moduleid = manifest.moduleid version = manifest.version script = os.path.join(template_dir,'..','project.py') # create a temporary proj create_project_args = [script, name, moduleid, dir, platform] if is_android(platform): create_project_args.append(android_sdk.get_android_sdk()) run_python(create_project_args) gen_project_dir = os.path.join(dir, name) gen_resources_dir = os.path.join(gen_project_dir, 'Resources') # copy in our example source copy_resources(os.path.join(project_dir,'example'), gen_resources_dir) # patch in our tiapp.xml tiapp = os.path.join(gen_project_dir, 'tiapp.xml') xml = open(tiapp).read() tiappf = open(tiapp,'w') xml = xml.replace('<guid/>','<guid></guid>') xml = xml.replace('</guid>','</guid>\n<modules>\n<module version="%s">%s</module>\n</modules>\n' % (version,moduleid)) # generate a guid since this is currently done by developer guid = str(uuid.uuid4()) xml = xml.replace('<guid></guid>','<guid>%s</guid>' % guid) tiappf.write(xml) tiappf.close() module_dir = os.path.join(gen_project_dir,'modules',platform) if not os.path.exists(module_dir): os.makedirs(module_dir) module_zip_name = '%s-%s-%s.zip' % (moduleid.lower(), platform, version) module_zip = os.path.join(project_dir, 'dist', module_zip_name) if is_ios(platform): module_zip = os.path.join(project_dir, module_zip_name) script = os.path.join(project_dir,'build.py') run_python([script]) elif is_android(platform): run_ant(project_dir) shutil.copy(module_zip, gen_project_dir) callback(gen_project_dir) except: dont_delete = True traceback.print_exc(file=sys.stderr) sys.exit(1) finally: if not dont_delete: shutil.rmtree(dir) def docgen(module_dir, dest_dir): if not os.path.exists(dest_dir): print "Creating dir: %s" % dest_dir os.makedirs(dest_dir) doc_dir = os.path.join(module_dir, 'documentation') if not os.path.exists(doc_dir): print "Couldn't find documentation file at: %s" % doc_dir return for file in os.listdir(doc_dir): if file in ignoreFiles or os.path.isdir(os.path.join(doc_dir, file)): continue md = open(os.path.join(doc_dir, file), 'r').read() html = markdown.markdown(md) filename = string.replace(file, '.md', '.html') filepath = os.path.join(dest_dir, filename) print 'Generating %s' % filepath open(filepath, 'w+').write(html) # a simplified .properties file parser def read_properties(file): properties = {} for line in file.read().splitlines(): line = line.strip() if len(line) > 0 and line[0] == '#': continue if len(line) == 0 or '=' not in line: continue key, value = line.split('=', 1) properties[key.strip()] = value.strip().replace('\\\\', '\\') return properties def main(args): global android_sdk # command platform project_dir command = args[1] platform = args[2] project_dir = os.path.expanduser(args[3]) manifest = Manifest(os.path.join(project_dir, 'manifest')) error = False if is_android(platform): build_properties = read_properties(open(os.path.join(project_dir, 'build.properties'))) android_sdk_path = os.path.dirname(os.path.dirname(build_properties['android.platform'])) android_sdk = AndroidSDK(android_sdk_path) if command == 'run': def run_callback(gen_project_dir): script = os.path.abspath(os.path.join(template_dir,'..',platform,'builder.py')) script_args = [script, 'run', gen_project_dir] if is_android(platform): script_args.append(android_sdk.get_android_sdk()) rc = run_python(script_args) # run the project if rc==1: if is_ios(platform): error = os.path.join(gen_project_dir,'build','iphone','build','build.log') print "[ERROR] Build Failed. See: %s" % os.path.abspath(error) else: print "[ERROR] Build Failed." stage(platform, project_dir, manifest, run_callback) elif command == 'run-emulator': if is_android(platform): def run_emulator_callback(gen_project_dir): script = os.path.abspath(os.path.join(template_dir, '..', platform, 'builder.py')) run_python([script, 'run-emulator', gen_project_dir, android_sdk.get_android_sdk()]) stage(platform, project_dir, manifest, run_emulator_callback) elif command == 'docgen': if is_android(platform): dest_dir = args[4] docgen(project_dir, dest_dir) if error: sys.exit(1) else: sys.exit(0) if __name__ == "__main__": main(sys.argv)<|fim▁end|>
name = manifest.name
<|file_name|>search.component.ts<|end_file_name|><|fim▁begin|>import { Component } from '@angular/core'; import { Movie } from '../../classes/movie' import{ MovieService } from '../../services/movie.service' @Component({ selector: 'my-movie-search', templateUrl: './search.component.html' })<|fim▁hole|> searchString : String; movies: Movie[]; constructor(private movieService:MovieService){ } searchMovie(){ this.movieService.searchMovie(this.searchString) .subscribe(dat =>this.movies=dat.results); } }<|fim▁end|>
export class SearchComponent {
<|file_name|>update_largethumbnail.py<|end_file_name|><|fim▁begin|>""" This sample shows how to update the large thumbnail of an item Python 2.x ArcREST 3.0.1 """ import arcrest from arcresthelper import securityhandlerhelper from arcresthelper import common def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe()) # script name + line number line = tbinfo.split(", ")[1] # Get Python syntax error # synerror = traceback.format_exc().splitlines()[-1] return line, filename, synerror def main(): proxy_port = None proxy_url = None securityinfo = {} securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI securityinfo['username'] = ""#<UserName> securityinfo['password'] = ""#<Password> securityinfo['org_url'] = "http://www.arcgis.com" securityinfo['proxy_url'] = proxy_url securityinfo['proxy_port'] = proxy_port securityinfo['referer_url'] = None securityinfo['token_url'] = None securityinfo['certificatefile'] = None securityinfo['keyfile'] = None securityinfo['client_id'] = None securityinfo['secret_id'] = None itemId = "" #Item ID<|fim▁hole|> pathToImage = r"" #Path to image try: shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: print shh.message else: admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) content = admin.content item = content.getItem(itemId) itemParams = arcrest.manageorg.ItemParameter() itemParams.largeThumbnail = pathToImage print item.userItem.updateItem(itemParameters=itemParams) except (common.ArcRestHelperError),e: print "error in function: %s" % e[0]['function'] print "error on line: %s" % e[0]['line'] print "error in file name: %s" % e[0]['filename'] print "with error message: %s" % e[0]['synerror'] if 'arcpyError' in e[0]: print "with arcpy message: %s" % e[0]['arcpyError'] except: line, filename, synerror = trace() print "error on line: %s" % line print "error in file name: %s" % filename print "with error message: %s" % synerror if __name__ == "__main__": main()<|fim▁end|>
<|file_name|>aufgabe-addierer.py<|end_file_name|><|fim▁begin|># Addierer mit += 1 # Eingaben erhalten a = input("Dies ist ein Addierer!\nGeben Sie a ein: ") b = input("Geben Sie b ein: ") # Zeichenketten in Zahlen umwandeln a = int(a) b = int(b) # neue Variable verwenden, Eingaben nicht verändern result = a i = 0 if b > 0: # wenn b größer Null<|fim▁hole|> while i < b: # dann Schleife positiv durchlaufen result += 1 i += 1 elif b < 0: # wenn b kleiner Null while i > b: # dann Schleife negativ durchlaufen result -= 1 i -= 1 print("\nDas Ergebnis ist: " + str(result))<|fim▁end|>
<|file_name|>collection-guard.ts<|end_file_name|><|fim▁begin|>import { Injectable } from '@angular/core'; import { CanActivate, Router } from '@angular/router'; import { Capabilities } from '../../shared/services/capabilities.service'; import { CurrentUser } from '../../shared/services/current-user.model'; import { ErrorActions } from '../../shared/services/error.service'; @Injectable() export class CollectionGuard implements CanActivate {<|fim▁hole|> constructor( private userCan: Capabilities, private currentUser: CurrentUser, private router: Router, private error: ErrorActions) { } canActivate() { if (this.currentUser.loggedIn() && this.userCan.viewCollections()) { return true; } else { if (this.currentUser.loggedIn() && !this.userCan.viewCollections()) { this.error.handle({status: 403}); } else { this.error.handle({status: 401}); } return false; } } }<|fim▁end|>
<|file_name|>live_snapshot.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from generic.tests import file_transfer def run(test, params, env): """ live_snapshot test: 1). Create live snapshot during big file creating 2). Create live snapshot when guest reboot 3). Check if live snapshot is created 4). Shutdown guest :param test: Kvm test object :param params: Dictionary with the test parameters :param env: Dictionary with test environment. """ @error.context_aware def create_snapshot(vm): """ Create live snapshot: 1). Check which monitor is used 2). Get device info 3). Create snapshot """ error.context("Creating live snapshot ...", logging.info) block_info = vm.monitor.info("block") if vm.monitor.protocol == 'qmp': device = block_info[0]["device"] else: device = "".join(block_info).split(":")[0] snapshot_name = params.get("snapshot_name") format = params.get("snapshot_format", "qcow2") vm.monitor.live_snapshot(device, snapshot_name, format) logging.info("Check snapshot is created ...") snapshot_info = str(vm.monitor.info("block")) if snapshot_name not in snapshot_info: logging.error(snapshot_info) raise error.TestFail("Snapshot doesn't exist") vm = env.get_vm(params["main_vm"]) vm.verify_alive() timeout = int(params.get("login_timeout", 360)) dd_timeout = int(params.get("dd_timeout", 900)) session = vm.wait_for_login(timeout=timeout) def runtime_test(): try: clean_cmd = params.get("clean_cmd") file_create = params.get("file_create") clean_cmd += " %s" % file_create logging.info("Clean file before creation") session.cmd(clean_cmd) logging.info("Creating big file...") create_cmd = params.get("create_cmd") % file_create args = (create_cmd, dd_timeout) bg = utils_test.BackgroundTest(session.cmd_output, args) bg.start() time.sleep(5) create_snapshot(vm) if bg.is_alive(): try: bg.join() except Exception: raise finally: session.close() def reboot_test(): try: bg = utils_test.BackgroundTest(vm.reboot, (session,)) logging.info("Rebooting guest ...") bg.start() sleep_time = int(params.get("sleep_time")) time.sleep(sleep_time) create_snapshot(vm) finally: bg.join() def file_transfer_test(): try: bg_cmd = file_transfer.run_file_transfer args = (test, params, env) bg = utils_test.BackgroundTest(bg_cmd, args) bg.start() sleep_time = int(params.get("sleep_time")) time.sleep(sleep_time) create_snapshot(vm) if bg.is_alive(): try: bg.join() except Exception: raise finally: session.close() subcommand = params.get("subcommand") eval("%s_test()" % subcommand)<|fim▁end|>
import time import logging from autotest.client.shared import error from virttest import utils_test
<|file_name|>ng2now.ts<|end_file_name|><|fim▁begin|>// Polyfill Object.assign, if necessary, such as in IE11 if (typeof Object.assign != 'function') { Object.assign = function (target) { 'use strict'; if (target == null) { throw new TypeError('Cannot convert undefined or null to object'); } target = Object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source != null) { for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } } return target; }; } // Fake exports for CDN users and manual loaders //if (typeof exports === 'undefined') var exports = {}; const SERVICE_PREFIX = 'service'; const ANNOTATION = '$$ng2now'; const common = { moduleName: '', angularModule: angular.module, serviceId: 0, controllerAs: 'vm', uiRouterTemplate: '<div ui-view=""></div>' }; // Add an $$ng2now object to the target, which will hold all custom annotations function decorate(target, options) { target[ANNOTATION] = target[ANNOTATION] || {}; if (!options) return target[ANNOTATION]; target[ANNOTATION] = Object.assign({}, target[ANNOTATION] || {}, options); } function camelCase(s) { return s.replace(/-(.)/g, (a, b) => b.toUpperCase()); } function options(options) { if (!options) return Object.assign({}, common); if (options.hasOwnProperty('controllerAs')) common.controllerAs = options.controllerAs; if (options.uiRouterTemplate) common.uiRouterTemplate = options.uiRouterTemplate; } /** SetModule(module:String, dependencies: String[]) SetModule() is a function that must be used instead of angular.module() before any ng2now decorators are used. It is functionally equivalent to angular.module(). Please see the documentation for angular.module() for more details. If used without any arguments, SetModule() will return a reference to the last set angular module. That is, if you did this `SetModule('app')`, then `SetModule()` will return `angular.module('app')`. @param module : String @param dependencies : String[] Example: import { SetModule } from 'ng2now'; SetModule('app', ['ui.router']); */ function SetModule(...args) { if (args.length===0) return angular.module(common.moduleName) common.moduleName = args[0] // console.log('@SetModule', args[0]); return angular.module.apply(angular, args); } /** @Component(options) @Component(selector, options) Creates an AngularJS component in the module set with the last call to SetModule(). Internally, angular.module().component() is called to create the component described with this decorator. The `options` argument is a literal object that can have the following parameters, in addition to those accepted by the AngularJS component() method. @param selector The kebab-cased name of the element as you will use it in your html. ex: "my-app" or "home-page". Selector can also be specified separately as the first argument to<|fim▁hole|>@param inject (alias for providers) An array of service class names or strings, whose singleton objects will be injected into the component's constructor. Please see the doco for `@Inject` parameter `providers` for more details. @param inputs An array of strings that represent the attribute names, whose passed values will be assigned to your component's controller (this). `inputs` can be used in place of `bindings` and assumes one-directional "<" input binding. The input can be supplied in two ways: as the name and also as the name with an annotation. If only the name is supplied then the annotation is assumed to be "<". For example: "xxx" or "xxx:&" or "xxx:@" or "xxx:<" or "xxx:=?" or "xxx:<yyy". See AngularJS documentation for component(), section on bindings for more information. @param stateConfig @param routerConfig (alias for stateConfig) For details please see the documentation for @State. @param module This is the name of an angular module that you want to create this component in. In most cases you don't want to specify this, because it is already specified using SetModule(), but if you need to then this is where you do it. It is your responsibility to ensure that this module exists. Create an angular module like this: `angular.module('your-module-name', [])`. For other parameters that you can specify, please refer to the AngularJS documentation for component() for further details. ** Note that controllerAs is set to "vm" by ng2now. You can change this by using ng2now.options(). See options() documentation for details. Examples: @Component */ function Component(selector, options = {}) { // Allow selector to be passed as string before the options or as part of the options if (typeof selector === 'object') { options = Object.assign({}, selector); selector = options.selector; } // console.log('@Component: ', selector); return function (target, name) { options.providers = options.providers || options.inject; if (options.providers && options.providers instanceof Array) { target = Inject(options.providers)(target); } options.stateConfig = options.stateConfig || options.routerConfig; if (options.stateConfig && options.stateConfig instanceof Object) { target = State(options.stateConfig)(target); } // The name used when creating the component must be camelCased let componentName = camelCase(selector || '') + ''; decorate(target, { selector, componentName, moduleName: options.module || common.moduleName, // If bootstrap==true, it means that @State should create a default // template `<div ui-view></div>` instead of using the selector as the template. bootstrap: options.bootstrap || options.root, template: options.template, templateUrl: options.templateUrl, inputs: options.inputs }); // `inputs` replaces `bindings` and assumes "<" one directional input binding // The input can be supplied in two ways: as the name and also as the name with an annotation. // If only the name is supplied then the annotation is assumed to be "<". // For example: "xxx" or "xxx:&" or "xxx:@" or "xxx:<" or "xxx:=?" or "xxx:<yyy" if (options.inputs && options.inputs instanceof Array) { options.bindings = options.bindings || {}; options.inputs.forEach(input=>options.bindings[input.split(':')[0]] = input.split(':')[1] || '<') //console.log('@Component: bindings: ', selector, options.bindings) } //console.log('@ Component: ', selector, options) common.angularModule(options.module || common.moduleName).component( componentName, angular.extend({ controller: target, controllerAs: common.controllerAs, template: '' }, options) ); return target; } } /** @Directive( selector: string, options : Object) @Directive( options : Object) @Directive only creates directives and never components. If you want to make a component then use the @Component decorator. Examples: // This simple input validator returns true (input is valid) // if the input value is "ABC" @Directive({ selector: 'valid', require: { ngModel: 'ngModel' }}) class Valid { $onInit() { this.ngModel.$validators.valid = val => val==='ABC'; } } // The auto-focus directive is used to make an input receive focus // when the page loads. @Directive({ selector: 'auto-focus', providers: [ '$element' ]}) class AutoFocus { constructor(el) { el[[0].focus(); } } */ function Directive(selector, options = {}) { // Allow selector to be passed as string before the options or as part of the options if (typeof selector === 'object') { options = Object.assign({}, selector); selector = options.selector; } return function DirectiveTarget(target) { let isClass = false; let directiveName; // Selector name may be prefixed with a '.', in which case "restrict: 'C'" will be used if (selector[0] === '.') { isClass = true; selector = selector.slice(1); } // The name used when creating the directive must be camelCased directiveName = camelCase(selector || '') + ''; //console.log('@Directive: ', directiveName, options.selector, selector); // Add optional injections if (options.providers && options.providers instanceof Array) { target = Inject(options.providers)(target); } // `inputs` replaces `bindings` and assumes "<" one directional input binding // The input can be supplied in two ways: as the name and also as the name with an annotation. // If only the name is supplied then the annotation is assumed to be "<". // For example: "xxx" or "xxx:&" or "xxx:@" or "xxx:<" or "xxx:=?" or "xxx:<yyy" if (options.inputs && options.inputs instanceof Array) { options.bindings = options.bindings || {}; options.inputs.forEach(input=>options.bindings[input.split(':')[0]] = input.split(':')[1] || '<') } decorate(target, { selector, directiveName, moduleName: options.module || common.moduleName }); // Create the angular directive const ddo = { // Don't set controllerAs on directive, as it should inherit from the parent controllerAs: options.controllerAs, // Always bind to controller bindToController: options.bindings || true, restrict: isClass ? 'C' : 'A', scope: options.hasOwnProperty('scope') ? true : undefined, controller: target, require: options.require, // template: options.template, // templateUrl: options.templateUrl, // replace: options.replace, // link: options.link, // transclude: options.transclude }; // console.log('@Directive: ddo: ', directiveName, Object.assign({}, ddo)); try { common.angularModule(options.module || common.moduleName).directive(directiveName, function () { return ddo }); } catch (er) { throw new Error('Does module "' + (options.module || common.moduleName) + '" exist? You may need to use SetModule("youModuleName").'); } return target; }; } /** Injectable(options) Service(options) @Injectable marks a class as an injectable service. This is Angular2 syntax. In ng2now it is not necessary to decorate services with @Injectable. Any class, or literal object, can be injected using any `providers` array or using @Inject. For example: @Injectable() // this is optional @Inject( '$scope' } class AppService { todos = []; constructor(private $scope) {} } @Component({ selector: 'todo-list', providers: [ AppService ] }) class TodoList { constructor(private app) { } } const AppConfig = { title: 'Todos', version: '0.0.1' } // Here we inject a literal object @Component({ selector: 'nav-bar', providers: [ AppConfig ] }) class NavBar { constructor(private config) {} } */ function Injectable(name, options = {}) { if (typeof name === 'object') { options = Object.assign({}, name); name = options.name; } name = name || (options.module || common.moduleName) + '_' + SERVICE_PREFIX + '_' + common.serviceId++; return function (target) { decorate(target, { serviceName: name }); target.serviceName = name; // Add optional injections if (options.providers && options.providers instanceof Array) { target = Inject(options.providers)(target); } if (typeof target === 'function') common.angularModule(options.module || common.moduleName).service( name, target ); else common.angularModule(options.module || common.moduleName).value( name, target ); return target } } const Service = Injectable /** @Inject(providers) Annotates the class with the names of services that are to be injected into the class's constructor. @param providers (also known as services) An array (or argument list) of literal objects, class names or strings, whose singleton objects will be injected into the component's constructor. Your literal objects or ES6 classes can be injected without prior decoration with @Injectable(). Classes injected in this way will be assigned a generated unique name that will be resolved automatically everywhere tah you inject that class or object using @Inject() or the providers array parameter. For more details see documentation for @Injectable and @Component. Examples: class MyService { abc = 1234 } // We inject the class object explicitly @Inject(MyService) class AppService { constructor(my) { console.log(my.abc) // --> 123 } } // We could use `@Inject`, but `providers` does the same job @Component({ providers: [ MyService ] }) class App { constructor(my) { console.log(my.abc) // --> 123 } } */ function Inject(...args) { let deps; if (args[0] instanceof Array) { deps = args[0]; } else { deps = args; } if (deps.length === 0) { throw new Error('@Inject: No dependencies passed in'); } return function InjectTarget(target, name, descriptor) { if (descriptor) { throw new TypeError('@Inject can only be used with classes or class methods.'); } let injectable = target; const existingInjects = injectable.$inject; injectable.$inject = []; deps.forEach(dep => { // Lookup angularjs service name if an object was passed in if (typeof dep === 'function' || typeof dep === 'object') { let serviceName = decorate(dep).serviceName; // If the object passed in is a class that was not decorated // with @Injectable, then we decorate it here. So, plain classes // can also be injected without any prior annotation - good for testing. if (!serviceName) { dep = Injectable()(dep); serviceName = decorate(dep).serviceName; } dep = serviceName; } // Only push unique service names if (injectable.$inject.indexOf(dep) === -1) { injectable.$inject.push(dep); } }); if (existingInjects) { injectable.$inject = injectable.$inject.concat(existingInjects); } // console.log('@Inject: 3: $inject: ', injectable.$inject); return target; }; } /** @Pipe(name, options) @Filter(name, options) Filter is an alias for Pipe. The functionality is exactly the same. @param name The name (string) of the pipe or te filter. @param providers An array of service class names or strings, whose singleton objects will be injected into the component's constructor. Please see the doco for `@Inject` parameter `providers` for more details. In Angular2 pipes are pure functions that take arguments and return a value. No mutations are allowed and no side effects. So, injections are not very useful, because they could potentially cause side effects. @Pipe({ name: 'filt'}) class Filt { transform(value, args) { return `Hello ${value} and welcome ${JSON.stringify(args)}.` } } However, for those who want to inject services into their filters, that can be easily accomplished as shown below. @Pipe({ name: 'filt', providers: ['$rootScope'] }) class Filt { constructor(private $rootScope) { return (value, args) => { return `Hello ${value} and welcome ${JSON.stringify(args)}.` } } } `Filter` is a synonym for the Angular2 decorator `Pipe`. Filter exists just for Angular1 nostalgic reasons. */ function Pipe(options = {}) { if (typeof options === 'string') { options = { name: options }; } return function (target) { decorate(target, { moduleName: options.module || common.moduleName, pipeName: options.name }); if (options.providers && options.providers instanceof Array) { target = Inject(options.providers)(target); } common.angularModule(options.module || common.moduleName).filter( options.name, target.prototype.transform ? function () { return target.prototype.transform } : target ); return target } } const Filter = Pipe /** @State(options: Object) @RouterConfig(options: Object) State depends on ui-router 1.x, which has specific support for routing AngularJS 1.x components. It will not work with earlier versions of ui-router. State can be used to annotate either a component or a class to - configuring html5mode and requireBase parameters - assign a ui-router state to it - specify the default route - provide default inputs that will be assigned to the component's inputs The `options` literal object is used to provide the following standard $stateProvider configuration parameters. Please see the ui-router 1.x documentation for details of these standard parameters. When used to annotate a @Component(): name, url, redirectTo, params, abstract, resolve, onEnter, onExit, parent, data When annotating a class that will be used as a controller, but not annotated with @Component, the following parameters can also be specified: template, templateUrl, templateProvider, controller, controllerAs In addition to standard ui-router parameters, the following parameters can be supplied to configure your States/Routes: @param ?otherwise : Boolean | String @param ?defaultRoute : Boolean | String (DEPRECATED) truthy = .otherwise(url) string = .otherwise(defaultRoute) @param ?html5Mode : Boolean See $locationProvider AngularJS documentation @param ?requireBase : Boolean See $locationProvider AngularJS documentation If a class is annotated, which is not also annotated with @Component, then it is assumed to be the controller. Examples: **HTML** <body> <app></app> </body> **JavaScript** import { Component, SetModule, State, bootstrap, Inject } from 'ng2now'; // or, if using a CDN then use the line below and comment out the line above // let { Component, SetModule, State, bootstrap, Inject } = ng2now; SetModule('app', ['ui.router']); let AppState = { config: { version: '1.0' }, homepage: { stuff: 42 }, feature: { things: [1, 2, 3, 4, 5] } } // Just configure the html5Mode using @State @State({ html5Mode: true, requireBase: false }) @Component({ selector: 'app', template: ` <h1>App <small>version {{ vm.app.config.version }}</h1> <a ui-sref="home">Home</a> <a ui-sref="feature">Feature</a> <hr> <ui-view></ui-view> `, providers: [ AppState ] }) class App { // Using TypeScript `private` argument syntax, which automatically // puts the argument `app` onto `this`. So, we don't have to code // `this.app = app;` constructor(private app) {} } // Here we configure the route for the home page. Home page is // the default route that we want to display when the app starts. // We also prepare an input, using resolve, that the component will // receive when ui-router instantiates it. This is a feature of // ui-router 1.x. So, do look at ui-router 1.x documentation for // more details on this new feature. // Another way to look at what the resolve is doing is like so: // <home-page state="vm.app.homepage"></home-page> // The above assumes the host component's controller contains // a reference to app, of course. @State({ name: 'home', url: '/home', otherwise: '/home', resolve: { state: Inject(AppState)(app=>app.homepage) } }) @Component({ selector: 'home-page', inputs: ['state'], template: 'Home Page<hr><p>Home state: {{ vm.state | json }}' }) class HomePage {} // The feature component has its own route and we also prepare // an input using resolve. This is a feature of ui-router 1.x. @State({ name: 'feature', url: '/feature', resolve: { state: Inject(AppState)(app=>app.feature) } }) @Component({ selector: 'feature', inputs: ['state'], template: 'Feature Page<hr><p>Feature state: {{ vm.state | json }}', providers: ['$rootScope', '$timeout'] }) class FeaturePage { constructor(private $rootScope, $timeout) { this.cancelSub = $timeout(()=>$rootScope.$emit('my-event'), 2000) } $onInit() { // do stuff with the injected $rootScope, for example this.$rootScope.$on('my-event', ()=>console.log('DOING stuff')) } $onDestroy() { this.cancelSub(); } } bootstrap(App); */ function State(options = {}) { if (options.name === undefined && options.hasOwnProperty('html5Mode') === false && options.hasOwnProperty('html5mode') === false) { throw new Error('@State: valid options are: name, url, defaultRoute, otherwise, template, templateUrl, templateProvider, resolve, abstract, parent, data.'); } return function StateTarget(target) { // Configure the state common.angularModule(common.moduleName) .config(['$urlRouterProvider', '$stateProvider', '$locationProvider', function ($urlRouterProvider, $stateProvider, $locationProvider) { // Activate this state, if options.defaultRoute = true. // If you don't want this then don't set options.defaultRoute to true // and, instead, use $state.go inside the constructor to active a state. // You can also pass a string to defaultRoute, which will become the default route. options.defaultRoute = options.defaultRoute || options.otherwise || undefined if (options.defaultRoute) { $urlRouterProvider.otherwise((typeof options.defaultRoute === 'string') ? options.defaultRoute : options.url); } // Optionally configure html5Mode if (options.hasOwnProperty('html5Mode') || options.hasOwnProperty('html5mode')) { $locationProvider.html5Mode({ enabled: options.html5Mode || options.html5mode, requireBase: options.requireBase }); } // If options.name is not supplied then we return, having possibly // set other options, such as `otherwise` and `html5Mode`. if (!options.name) return // Construct sdo.resolve object based on `options.inputs` // or its alias `options.inject`. Also, accept any initial resolve object // passed in by the user. let resolves = options.resolve || {}; let inputs = options.inputs || options.inject; // Match injected dependencies to aliases specified in the inputs array. if (inputs instanceof Array) { // Extract just the alias portion of each input, the part before a ":" (if present) let aliases = (decorate(target).inputs || []).map(input=>input.split(':')[0]); // Create "resolve" functions inputs.forEach((o, i) => { let n = aliases[i]; let s = typeof o === 'function' || typeof o === 'object' ? o.serviceName : o; let inj = s.split(':')[0]; // the service to inject let expr = s.slice(inj.length + 1) || inj; // the optional expression. if absent it's set to the service name resolves[n] = [inj, Function(inj, 'return ' + expr)]; // console.log('@State: inputs: ', inj, expr, resolves[n][1].toString()); }) } // This is the state definition object const sdo = { redirectTo: options.redirectTo, url: options.url, // Default values for URL parameters can be configured here. // ALso, parameters that do not appear in the URL can be configured here. params: options.params, // The State applied to a bootstrap component can be abstract, // if you don't want that state to be able to activate. abstract: options.abstract, // Do we need to resolve stuff? // Or perhaps inject providers using resolve resolve: options.resolve || resolves || undefined, // onEnter and onExit events onEnter: options.onEnter, onExit: options.onExit, // Custom parent State parent: options.parent, // Custom data data: options.data }; // Template is always required, but only allowed when component is not specified. // So, if the target has a selector then it is assumed to be a component, otherwise // it is assumed to be a state controller class, which needs an empty string template. if (decorate(target).selector) { if (decorate(target).bootstrap) sdo.template = common.uiRouterTemplate; else sdo.component = camelCase(decorate(target).selector); } else { // We are probably decorating a class and not a component, so, a template // must be supplied through options or otherwise a default one // will be provided. // The sdo's default "<div ui-view></div>" template can be overridden with `options.uiRouterTemplate` sdo.template = options.template || common.uiRouterTemplate || ''; sdo.templateUrl = options.templateUrl; // The option for dynamically setting a template based on local values // or injectable services sdo.templateProvider = options.templateProvider; // The user can supply a controller through `options.controller`. We can also // annotate State on a class without a Component annotation, in which case // the class itself is the controller. sdo.controller = options.controller || (!(decorate(target)).selector ? target : undefined); // `controllerAs` always defaults to `common.controllerAs`, but can be overridden // through `options.controllerAs`. This is useful, for example, when we annotate // State on a class that has no Component annotation. Relates to controller, above. sdo.controllerAs = options.controllerAs || common.controllerAs; } // Providing Template as well as either templateUrl or templateProvider is not allowed. if (options.templateUrl || options.templateProvider && sdo.template) { delete sdo.template; } // Create the state $stateProvider.state(options.name, sdo); } ]); return target; }; } const RouterConfig = State /** bootstrap(options) Bootstraps the Angular 1.x app. @param ?target = undefined | "string" | ClassName undefined: Bootstraps on document and the current angular module, as set by the last call to SetModule() "string": Will use document.querySelector to find the element by this string and bootstrap on it. ClassName: Bootstraps on the component defined on this class. The module name must be the same as the selector. @param ?config The angular.bootstrap() config object, see AngularJS documentation. Examples of how to bootstrap ng2now: SetModule('my-app', []); @Component({ selector: 'my-app', ... }) class MyApp {} // Use the selector name, which must match the module name. bootstrap(MyApp) // Or use the element name, which must match the module name. bootstrap('my-app') // Or bootstrap on document.body and the last module name set with // SetModule will be assumed. bootstrap() */ function bootstrap(target, config) { let bootOnDocument = false; // console.log('@Bootstrap: target: ', decorate(target).selector, decorate(target).moduleName) // Take care of bootstrapping on a class without a Component annotation if (!target || (target && !decorate(target).selector && typeof target === 'function')) { target = decorate(target || {}, {selector: common.moduleName}); bootOnDocument = true; } // Allow string shortcut for decorate(target).selector. Can be the name of any HTML tag. if (typeof target === 'string') { target = { selector: target }; } // Mark this class as a bootstrap component. This allows @State // to handle it correctly. decorate(target, {bootstrap: true}); const bootModule = decorate(target).selector || common.moduleName; // console.log('@Bootstrap: bootModule: ', bootModule, decorate(target).selector) if (bootModule !== common.moduleName) { common.angularModule(bootModule); } if (!config) { config = { strictDi: false }; } common.isCordova = typeof cordova !== 'undefined'; if (common.isCordova) { angular.element(document).on('deviceready', onReady); } else { angular.element(document).ready(onReady); } function onReady() { let el; if (!bootOnDocument) { // Find the component's element el = document.querySelector(decorate(target).selector); } else { // Or use document, if user passed no arguments el = document.body; } angular.bootstrap(el, [bootModule], config); } } const ng2now = { options, SetModule, Component, Directive, Inject, Injectable, Pipe, State, bootstrap, Service, Filter, RouterConfig }; // Node.js style if (typeof module !== 'undefined' && module.exports) { module.exports = ng2now; exports['def'+'ault'] = ng2now; } else if (typeof define !== 'undefined' && define.amd) { define('ng2now', [], function () { return ng2now; }); } else if (typeof window !== 'undefined') window.ng2now = ng2now;<|fim▁end|>
@Component(), followed by the options object itself. @param providers
<|file_name|>system.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- class System(object): """ This is the father class for all different systems. """ def __init__(self, *args, **kwargs): pass<|fim▁hole|> def update(self, dt): raise NotImplementedError<|fim▁end|>
<|file_name|>FontLineShapeRenderer.js<|end_file_name|><|fim▁begin|>Clazz.declarePackage ("org.jmol.render"); Clazz.load (["org.jmol.render.ShapeRenderer", "org.jmol.util.Point3f", "$.Point3i", "$.Vector3f"], "org.jmol.render.FontLineShapeRenderer", ["java.lang.Float", "org.jmol.constant.EnumAxesMode", "org.jmol.util.TextFormat"], function () { c$ = Clazz.decorateAsClass (function () { this.imageFontScaling = 0; this.atomA = null; this.atomB = null; this.atomC = null; this.atomD = null; this.font3d = null; this.pt0 = null; this.pt1 = null; this.pt2 = null; this.pointT = null; this.pointT2 = null; this.pointT3 = null; this.vectorT = null; this.vectorT2 = null; this.vectorT3 = null; this.tickInfo = null; this.draw000 = true; this.endcap = 3; Clazz.instantialize (this, arguments); }, org.jmol.render, "FontLineShapeRenderer", org.jmol.render.ShapeRenderer); Clazz.prepareFields (c$, function () { this.pt0 = new org.jmol.util.Point3i (); this.pt1 = new org.jmol.util.Point3i (); this.pt2 = new org.jmol.util.Point3i (); this.pointT = new org.jmol.util.Point3f (); this.pointT2 = new org.jmol.util.Point3f (); this.pointT3 = new org.jmol.util.Point3f (); this.vectorT = new org.jmol.util.Vector3f (); this.vectorT2 = new org.jmol.util.Vector3f (); this.vectorT3 = new org.jmol.util.Vector3f (); }); Clazz.defineMethod (c$, "getDiameter", function (z, madOrPixels) { var diameter; var isMad = (madOrPixels > 20); switch (this.exportType) { case 1: diameter = (isMad ? madOrPixels : Clazz.doubleToInt (Math.floor (this.viewer.unscaleToScreen (z, madOrPixels * 2) * 1000))); break; default: if (isMad) { diameter = this.viewer.scaleToScreen (z, madOrPixels); } else { if (this.g3d.isAntialiased ()) madOrPixels += madOrPixels; diameter = madOrPixels; }} return diameter; }, "~N,~N"); Clazz.defineMethod (c$, "renderLine", function (p0, p1, diameter, pt0, pt1, drawTicks) { pt0.set (Clazz.doubleToInt (Math.floor (p0.x)), Clazz.doubleToInt (Math.floor (p0.y)), Clazz.doubleToInt (Math.floor (p0.z))); pt1.set (Clazz.doubleToInt (Math.floor (p1.x)), Clazz.doubleToInt (Math.floor (p1.y)), Clazz.doubleToInt (Math.floor (p1.z))); if (diameter < 0) this.g3d.drawDottedLine (pt0, pt1); else this.g3d.fillCylinder (this.endcap, diameter, pt0, pt1); if (!drawTicks || this.tickInfo == null) return; this.atomA.screenX = pt0.x; this.atomA.screenY = pt0.y; this.atomA.screenZ = pt0.z; this.atomB.screenX = pt1.x; this.atomB.screenY = pt1.y; this.atomB.screenZ = pt1.z; this.drawTicks (this.atomA, this.atomB, diameter, true); }, "org.jmol.util.Point3f,org.jmol.util.Point3f,~N,org.jmol.util.Point3i,org.jmol.util.Point3i,~B"); Clazz.defineMethod (c$, "drawTicks", function (pt1, pt2, diameter, withLabels) { if (Float.isNaN (this.tickInfo.first)) this.tickInfo.first = 0; this.drawTicks (pt1, pt2, this.tickInfo.ticks.x, 8, diameter, (!withLabels ? null : this.tickInfo.tickLabelFormats == null ? ["%0.2f"] : this.tickInfo.tickLabelFormats)); this.drawTicks (pt1, pt2, this.tickInfo.ticks.y, 4, diameter, null); this.drawTicks (pt1, pt2, this.tickInfo.ticks.z, 2, diameter, null); }, "org.jmol.util.Point3fi,org.jmol.util.Point3fi,~N,~B"); Clazz.defineMethod (c$, "drawTicks", ($fz = function (ptA, ptB, dx, length, diameter, formats) { if (dx == 0) return; if (this.g3d.isAntialiased ()) length *= 2; this.vectorT2.set (ptB.screenX, ptB.screenY, 0); this.vectorT.set (ptA.screenX, ptA.screenY, 0);<|fim▁hole|>this.vectorT2.sub (this.vectorT); if (this.vectorT2.length () < 50) return; var signFactor = this.tickInfo.signFactor; this.vectorT.setT (ptB); this.vectorT.sub (ptA); var d0 = this.vectorT.length (); if (this.tickInfo.scale != null) { if (Float.isNaN (this.tickInfo.scale.x)) { var a = this.viewer.getUnitCellInfo (0); if (!Float.isNaN (a)) this.vectorT.set (this.vectorT.x / a, this.vectorT.y / this.viewer.getUnitCellInfo (1), this.vectorT.z / this.viewer.getUnitCellInfo (2)); } else { this.vectorT.set (this.vectorT.x * this.tickInfo.scale.x, this.vectorT.y * this.tickInfo.scale.y, this.vectorT.z * this.tickInfo.scale.z); }}var d = this.vectorT.length () + 0.0001 * dx; if (d < dx) return; var f = dx / d * d0 / d; this.vectorT.scale (f); var dz = (ptB.screenZ - ptA.screenZ) / (d / dx); d += this.tickInfo.first; var p = (Clazz.doubleToInt (Math.floor (this.tickInfo.first / dx))) * dx - this.tickInfo.first; this.pointT.scaleAdd2 (p / dx, this.vectorT, ptA); p += this.tickInfo.first; var z = ptA.screenZ; if (diameter < 0) diameter = 1; this.vectorT2.set (-this.vectorT2.y, this.vectorT2.x, 0); this.vectorT2.scale (length / this.vectorT2.length ()); var ptRef = this.tickInfo.reference; if (ptRef == null) { this.pointT3.setT (this.viewer.getBoundBoxCenter ()); if (this.viewer.getAxesMode () === org.jmol.constant.EnumAxesMode.BOUNDBOX) { this.pointT3.x += 1.0; this.pointT3.y += 1.0; this.pointT3.z += 1.0; }} else { this.pointT3.setT (ptRef); }this.viewer.transformPtScr (this.pointT3, this.pt2); var horizontal = (Math.abs (this.vectorT2.x / this.vectorT2.y) < 0.2); var centerX = horizontal; var centerY = !horizontal; var rightJustify = !centerX && (this.vectorT2.x < 0); var drawLabel = (formats != null && formats.length > 0); var x; var y; var val = new Array (1); var i = (this.draw000 ? 0 : -1); while (p < d) { if (p >= this.tickInfo.first) { this.pointT2.setT (this.pointT); this.viewer.transformPt3f (this.pointT2, this.pointT2); this.drawLine (Clazz.doubleToInt (Math.floor (this.pointT2.x)), Clazz.doubleToInt (Math.floor (this.pointT2.y)), Clazz.floatToInt (z), (x = Clazz.doubleToInt (Math.floor (this.pointT2.x + this.vectorT2.x))), (y = Clazz.doubleToInt (Math.floor (this.pointT2.y + this.vectorT2.y))), Clazz.floatToInt (z), diameter); if (drawLabel && (this.draw000 || p != 0)) { val[0] = new Float ((p == 0 ? 0 : p * signFactor)); var s = org.jmol.util.TextFormat.sprintf (formats[i % formats.length], "f", val); this.drawString (x, y, Clazz.floatToInt (z), 4, rightJustify, centerX, centerY, Clazz.doubleToInt (Math.floor (this.pointT2.y)), s); }}this.pointT.add (this.vectorT); p += dx; z += dz; i++; } }, $fz.isPrivate = true, $fz), "org.jmol.util.Point3fi,org.jmol.util.Point3fi,~N,~N,~N,~A"); Clazz.defineMethod (c$, "drawLine", function (x1, y1, z1, x2, y2, z2, diameter) { this.pt0.set (x1, y1, z1); this.pt1.set (x2, y2, z2); if (diameter < 0) { this.g3d.drawDashedLine (4, 2, this.pt0, this.pt1); return 1; }this.g3d.fillCylinder (2, diameter, this.pt0, this.pt1); return Clazz.doubleToInt ((diameter + 1) / 2); }, "~N,~N,~N,~N,~N,~N,~N"); Clazz.defineMethod (c$, "drawString", function (x, y, z, radius, rightJustify, centerX, centerY, yRef, sVal) { if (sVal == null) return; var width = this.font3d.stringWidth (sVal); var height = this.font3d.getAscent (); var xT = x; if (rightJustify) xT -= Clazz.doubleToInt (radius / 2) + 2 + width; else if (centerX) xT -= Clazz.doubleToInt (radius / 2) + 2 + Clazz.doubleToInt (width / 2); else xT += Clazz.doubleToInt (radius / 2) + 2; var yT = y; if (centerY) yT += Clazz.doubleToInt (height / 2); else if (yRef == 0 || yRef < y) yT += height; else yT -= Clazz.doubleToInt (radius / 2); var zT = z - radius - 2; if (zT < 1) zT = 1; this.g3d.drawString (sVal, this.font3d, xT, yT, zT, zT, 0); }, "~N,~N,~N,~N,~B,~B,~B,~N,~S"); });<|fim▁end|>
<|file_name|>platform_video_frame_pool.cc<|end_file_name|><|fim▁begin|>// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "media/gpu/chromeos/platform_video_frame_pool.h" #include <utility> #include "base/logging.h" #include "base/optional.h" #include "base/task/post_task.h" #include "media/gpu/chromeos/gpu_buffer_layout.h" #include "media/gpu/chromeos/platform_video_frame_utils.h" #include "media/gpu/macros.h" namespace media { namespace { // The default method to create frames. scoped_refptr<VideoFrame> DefaultCreateFrame( gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, VideoPixelFormat format, const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, base::TimeDelta timestamp) { return CreatePlatformVideoFrame(gpu_memory_buffer_factory, format, coded_size, visible_rect, natural_size, timestamp, gfx::BufferUsage::SCANOUT_VDA_WRITE); } } // namespace PlatformVideoFramePool::PlatformVideoFramePool( gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) : create_frame_cb_(base::BindRepeating(&DefaultCreateFrame)), gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { DVLOGF(4); weak_this_ = weak_this_factory_.GetWeakPtr(); } PlatformVideoFramePool::~PlatformVideoFramePool() { if (parent_task_runner_) DCHECK(parent_task_runner_->RunsTasksInCurrentSequence()); DVLOGF(4); base::AutoLock auto_lock(lock_); frames_in_use_.clear(); free_frames_.clear(); weak_this_factory_.InvalidateWeakPtrs(); } scoped_refptr<VideoFrame> PlatformVideoFramePool::GetFrame() { DCHECK(parent_task_runner_->RunsTasksInCurrentSequence()); DVLOGF(4); base::AutoLock auto_lock(lock_); if (!frame_layout_) { VLOGF(1) << "Please call Initialize() first."; return nullptr; } VideoPixelFormat format = frame_layout_->fourcc().ToVideoPixelFormat(); const gfx::Size& coded_size = frame_layout_->size(); if (free_frames_.empty()) { if (GetTotalNumFrames_Locked() >= max_num_frames_) return nullptr; // VideoFrame::WrapVideoFrame() will check whether the updated visible_rect // is sub rect of the original visible_rect. Therefore we set visible_rect // as large as coded_size to guarantee this condition. scoped_refptr<VideoFrame> new_frame = create_frame_cb_.Run( gpu_memory_buffer_factory_, format, coded_size, gfx::Rect(coded_size), coded_size, base::TimeDelta()); if (!new_frame) return nullptr; InsertFreeFrame_Locked(std::move(new_frame)); } DCHECK(!free_frames_.empty()); scoped_refptr<VideoFrame> origin_frame = std::move(free_frames_.back()); free_frames_.pop_back(); DCHECK_EQ(origin_frame->format(), format); DCHECK_EQ(origin_frame->coded_size(), coded_size); scoped_refptr<VideoFrame> wrapped_frame = VideoFrame::WrapVideoFrame( origin_frame, format, visible_rect_, natural_size_); DCHECK(wrapped_frame); frames_in_use_.emplace(GetDmabufId(*wrapped_frame), origin_frame.get()); wrapped_frame->AddDestructionObserver( base::BindOnce(&PlatformVideoFramePool::OnFrameReleasedThunk, weak_this_, parent_task_runner_, std::move(origin_frame))); // Clear all metadata before returning to client, in case origin frame has any // unrelated metadata. wrapped_frame->metadata()->Clear(); return wrapped_frame; } base::Optional<GpuBufferLayout> PlatformVideoFramePool::Initialize( const Fourcc& fourcc, const gfx::Size& coded_size, const gfx::Rect& visible_rect, const gfx::Size& natural_size, size_t max_num_frames) { DVLOGF(4); base::AutoLock auto_lock(lock_); visible_rect_ = visible_rect; natural_size_ = natural_size; max_num_frames_ = max_num_frames; // Only support the Fourcc that could map to VideoPixelFormat. VideoPixelFormat format = fourcc.ToVideoPixelFormat(); if (format == PIXEL_FORMAT_UNKNOWN) { VLOGF(1) << "Unsupported fourcc: " << fourcc.ToString(); return base::nullopt; } // If the frame layout changed we need to allocate new frames so we will clear // the pool here. If only the visible or natural size changed we don't need to // allocate new frames, but will just update the properties of wrapped frames // returned by GetFrame(). // NOTE: It is assumed layout is determined by |format| and |coded_size|. if (!IsSameFormat_Locked(format, coded_size)) { DVLOGF(4) << "The video frame format is changed. Clearing the pool."; free_frames_.clear(); // Create a temporary frame in order to know VideoFrameLayout that // VideoFrame that will be allocated in GetFrame() has. auto frame = create_frame_cb_.Run(gpu_memory_buffer_factory_, format, coded_size, visible_rect_, natural_size_, base::TimeDelta()); if (!frame) { VLOGF(1) << "Failed to create video frame"; return base::nullopt; } frame_layout_ = GpuBufferLayout::Create(fourcc, frame->coded_size(), frame->layout().planes()); } // The pool might become available because of |max_num_frames_| increased. // Notify the client if so. if (frame_available_cb_ && !IsExhausted_Locked()) std::move(frame_available_cb_).Run(); return frame_layout_; } bool PlatformVideoFramePool::IsExhausted() { DVLOGF(4); base::AutoLock auto_lock(lock_); return IsExhausted_Locked(); } bool PlatformVideoFramePool::IsExhausted_Locked() { DVLOGF(4); lock_.AssertAcquired(); return free_frames_.empty() && GetTotalNumFrames_Locked() >= max_num_frames_; } VideoFrame* PlatformVideoFramePool::UnwrapFrame( const VideoFrame& wrapped_frame) { DVLOGF(4); base::AutoLock auto_lock(lock_); auto it = frames_in_use_.find(GetDmabufId(wrapped_frame)); return (it == frames_in_use_.end()) ? nullptr : it->second; } void PlatformVideoFramePool::NotifyWhenFrameAvailable(base::OnceClosure cb) { DVLOGF(4); base::AutoLock auto_lock(lock_); if (!IsExhausted_Locked()) { parent_task_runner_->PostTask(FROM_HERE, std::move(cb)); return; } frame_available_cb_ = std::move(cb); } // static void PlatformVideoFramePool::OnFrameReleasedThunk( base::Optional<base::WeakPtr<PlatformVideoFramePool>> pool, scoped_refptr<base::SequencedTaskRunner> task_runner, scoped_refptr<VideoFrame> origin_frame) { DCHECK(pool); DVLOGF(4); task_runner->PostTask( FROM_HERE, base::BindOnce(&PlatformVideoFramePool::OnFrameReleased, *pool, std::move(origin_frame))); } void PlatformVideoFramePool::OnFrameReleased( scoped_refptr<VideoFrame> origin_frame) { DCHECK(parent_task_runner_->RunsTasksInCurrentSequence()); DVLOGF(4); base::AutoLock auto_lock(lock_); DmabufId frame_id = GetDmabufId(*origin_frame); auto it = frames_in_use_.find(frame_id); DCHECK(it != frames_in_use_.end()); frames_in_use_.erase(it); if (IsSameFormat_Locked(origin_frame->format(), origin_frame->coded_size())) InsertFreeFrame_Locked(std::move(origin_frame)); if (frame_available_cb_ && !IsExhausted_Locked()) std::move(frame_available_cb_).Run(); } void PlatformVideoFramePool::InsertFreeFrame_Locked( scoped_refptr<VideoFrame> frame) { DCHECK(frame); DVLOGF(4); lock_.AssertAcquired(); if (GetTotalNumFrames_Locked() < max_num_frames_) free_frames_.push_back(std::move(frame)); } size_t PlatformVideoFramePool::GetTotalNumFrames_Locked() const { DVLOGF(4); lock_.AssertAcquired(); return free_frames_.size() + frames_in_use_.size(); } bool PlatformVideoFramePool::IsSameFormat_Locked( VideoPixelFormat format, const gfx::Size& coded_size) const { DVLOGF(4); lock_.AssertAcquired(); return frame_layout_ && frame_layout_->fourcc().ToVideoPixelFormat() == format && frame_layout_->size() == coded_size; } size_t PlatformVideoFramePool::GetPoolSizeForTesting() { DVLOGF(4); base::AutoLock auto_lock(lock_); return free_frames_.size();<|fim▁hole|><|fim▁end|>
} } // namespace media
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals import datetime from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible # Create your models here. @python_2_unicode_compatible # only if you need to support Python 2 class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') <|fim▁hole|> return self.question_text def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1) @python_2_unicode_compatible # only if you need to support Python 2 class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text<|fim▁end|>
def __str__(self):
<|file_name|>JoinRuleDropdown.tsx<|end_file_name|><|fim▁begin|>/* Copyright 2021 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import React from 'react'; import { JoinRule } from 'matrix-js-sdk/src/@types/partials'; import Dropdown from "./Dropdown"; interface IProps { value: JoinRule; label: string; width?: number; labelInvite: string; labelPublic: string;<|fim▁hole|>const JoinRuleDropdown = ({ label, labelInvite, labelPublic, labelRestricted, value, width = 448, onChange, }: IProps) => { const options = [ <div key={JoinRule.Invite} className="mx_JoinRuleDropdown_invite"> { labelInvite } </div>, <div key={JoinRule.Public} className="mx_JoinRuleDropdown_public"> { labelPublic } </div>, ]; if (labelRestricted) { options.unshift(<div key={JoinRule.Restricted} className="mx_JoinRuleDropdown_restricted"> { labelRestricted } </div>); } return <Dropdown id="mx_JoinRuleDropdown" className="mx_JoinRuleDropdown" onOptionChange={onChange} menuWidth={width} value={value} label={label} > { options } </Dropdown>; }; export default JoinRuleDropdown;<|fim▁end|>
labelRestricted?: string; // if omitted then this option will be hidden, e.g if unsupported onChange(value: JoinRule): void; }
<|file_name|>IMsg.java<|end_file_name|><|fim▁begin|>/******************************************************************************* * Copyright (c) 2012 Scott Ross. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Scott Ross - initial API and implementation ******************************************************************************/ package org.alms.messages; import org.alms.beans.*; import javax.ws.rs.core.HttpHeaders; public interface IMsg { public void setHeader(HttpHeaders msgHeaders); public void setIncomingMessage(String incomingMessage); public Boolean checkMessageVocubulary(); public RelatedParty getMsgDestination(); public RelatedParty getMsgSending(); public String getMsgId(); public String getUserName(); public String getPassword(); public String getXSDLocation(); public String getIncomingMessage(); public String receiverTransmissionType(); <|fim▁hole|><|fim▁end|>
}
<|file_name|>Particle.js<|end_file_name|><|fim▁begin|>"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ShapeType_1 = require("../Enums/ShapeType"); var Updater_1 = require("./Particle/Updater"); var Utils_1 = require("../Utils/Utils"); var PolygonMaskType_1 = require("../Enums/PolygonMaskType"); var RotateDirection_1 = require("../Enums/RotateDirection"); var ColorUtils_1 = require("../Utils/ColorUtils"); var Particles_1 = require("../Options/Classes/Particles/Particles"); var SizeAnimationStatus_1 = require("../Enums/SizeAnimationStatus"); var OpacityAnimationStatus_1 = require("../Enums/OpacityAnimationStatus"); var Shape_1 = require("../Options/Classes/Particles/Shape/Shape"); var StartValueType_1 = require("../Enums/StartValueType"); var CanvasUtils_1 = require("../Utils/CanvasUtils"); var Particle = (function () { function Particle(container, position, overrideOptions) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; this.container = container; this.fill = true; this.close = true; this.links = []; this.lastNoiseTime = 0; this.destroyed = false; var options = container.options; var particlesOptions = new Particles_1.Particles(); particlesOptions.load(options.particles); if ((overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.shape) !== undefined) { var shapeType = (_a = overrideOptions.shape.type) !== null && _a !== void 0 ? _a : particlesOptions.shape.type; this.shape = shapeType instanceof Array ? Utils_1.Utils.itemFromArray(shapeType) : shapeType; var shapeOptions = new Shape_1.Shape(); shapeOptions.load(overrideOptions.shape); if (this.shape !== undefined) { var shapeData = shapeOptions.options[this.shape]; if (shapeData !== undefined) { this.shapeData = Utils_1.Utils.deepExtend({}, shapeData instanceof Array ? Utils_1.Utils.itemFromArray(shapeData) : shapeData); this.fill = (_c = (_b = this.shapeData) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this.fill; this.close = (_e = (_d = this.shapeData) === null || _d === void 0 ? void 0 : _d.close) !== null && _e !== void 0 ? _e : this.close; } } } else { var shapeType = particlesOptions.shape.type; this.shape = shapeType instanceof Array ? Utils_1.Utils.itemFromArray(shapeType) : shapeType; var shapeData = particlesOptions.shape.options[this.shape]; if (shapeData) { this.shapeData = Utils_1.Utils.deepExtend({}, shapeData instanceof Array ? Utils_1.Utils.itemFromArray(shapeData) : shapeData); this.fill = (_g = (_f = this.shapeData) === null || _f === void 0 ? void 0 : _f.fill) !== null && _g !== void 0 ? _g : this.fill; this.close = (_j = (_h = this.shapeData) === null || _h === void 0 ? void 0 : _h.close) !== null && _j !== void 0 ? _j : this.close; } } if (overrideOptions !== undefined) { particlesOptions.load(overrideOptions); } this.particlesOptions = particlesOptions; var noiseDelay = this.particlesOptions.move.noise.delay; this.noiseDelay = (noiseDelay.random.enable ? Utils_1.Utils.randomInRange(noiseDelay.random.minimumValue, noiseDelay.value) : noiseDelay.value) * 1000; container.retina.initParticle(this); var color = this.particlesOptions.color; var sizeValue = ((_k = this.sizeValue) !== null && _k !== void 0 ? _k : container.retina.sizeValue); var randomSize = typeof this.particlesOptions.size.random === "boolean" ? this.particlesOptions.size.random : this.particlesOptions.size.random.enable; this.size = { value: randomSize && this.randomMinimumSize !== undefined ? Utils_1.Utils.randomInRange(this.randomMinimumSize, sizeValue) : sizeValue, }; this.direction = this.particlesOptions.move.direction; this.bubble = {}; this.angle = this.particlesOptions.rotate.random ? Math.random() * 360 : this.particlesOptions.rotate.value; if (this.particlesOptions.rotate.direction == RotateDirection_1.RotateDirection.random) { var index = Math.floor(Math.random() * 2); if (index > 0) { this.rotateDirection = RotateDirection_1.RotateDirection.counterClockwise; } else { this.rotateDirection = RotateDirection_1.RotateDirection.clockwise; } } else { this.rotateDirection = this.particlesOptions.rotate.direction; } if (this.particlesOptions.size.animation.enable) { switch (this.particlesOptions.size.animation.startValue) { case StartValueType_1.StartValueType.min: if (!randomSize) { var pxRatio = container.retina.pixelRatio; this.size.value = this.particlesOptions.size.animation.minimumValue * pxRatio; } break; } this.size.status = SizeAnimationStatus_1.SizeAnimationStatus.increasing; this.size.velocity = ((_l = this.sizeAnimationSpeed) !== null && _l !== void 0 ? _l : container.retina.sizeAnimationSpeed) / 100; if (!this.particlesOptions.size.animation.sync) { this.size.velocity = this.size.velocity * Math.random(); } } if (this.particlesOptions.rotate.animation.enable) { if (!this.particlesOptions.rotate.animation.sync) { this.angle = Math.random() * 360; } } this.position = this.calcPosition(this.container, position); if (options.polygon.enable && options.polygon.type === PolygonMaskType_1.PolygonMaskType.inline) { this.initialPosition = { x: this.position.x, y: this.position.y, }; } this.offset = { x: 0, y: 0, }; if (this.particlesOptions.collisions.enable) { this.checkOverlap(position); } if (color instanceof Array) { this.color = ColorUtils_1.ColorUtils.colorToRgb(Utils_1.Utils.itemFromArray(color)); } else { this.color = ColorUtils_1.ColorUtils.colorToRgb(color); } var randomOpacity = this.particlesOptions.opacity.random; var opacityValue = this.particlesOptions.opacity.value; this.opacity = { value: randomOpacity.enable ? Utils_1.Utils.randomInRange(randomOpacity.minimumValue, opacityValue) : opacityValue, }; if (this.particlesOptions.opacity.animation.enable) { this.opacity.status = OpacityAnimationStatus_1.OpacityAnimationStatus.increasing; this.opacity.velocity = this.particlesOptions.opacity.animation.speed / 100; if (!this.particlesOptions.opacity.animation.sync) { this.opacity.velocity *= Math.random(); } } this.initialVelocity = this.calculateVelocity(); this.velocity = { horizontal: this.initialVelocity.horizontal, vertical: this.initialVelocity.vertical, }; var drawer = container.drawers[this.shape]; if (!drawer) { drawer = CanvasUtils_1.CanvasUtils.getShapeDrawer(this.shape); container.drawers[this.shape] = drawer; } if (this.shape === ShapeType_1.ShapeType.image || this.shape === ShapeType_1.ShapeType.images) { var shape = this.particlesOptions.shape; var imageDrawer = drawer; var imagesOptions = shape.options[this.shape]; var images = imageDrawer.getImages(container).images; var index = Utils_1.Utils.arrayRandomIndex(images); var image_1 = images[index]; var optionsImage = (imagesOptions instanceof Array ? imagesOptions.filter(function (t) { return t.src === image_1.source; })[0] : imagesOptions); this.image = { data: image_1, ratio: optionsImage.width / optionsImage.height, replaceColor: (_m = optionsImage.replaceColor) !== null && _m !== void 0 ? _m : optionsImage.replace_color, source: optionsImage.src, }; if (!this.image.ratio) { this.image.ratio = 1; } this.fill = (_o = optionsImage.fill) !== null && _o !== void 0 ? _o : this.fill; this.close = (_p = optionsImage.close) !== null && _p !== void 0 ? _p : this.close; } this.stroke = this.particlesOptions.stroke instanceof Array ? Utils_1.Utils.itemFromArray(this.particlesOptions.stroke) : this.particlesOptions.stroke; this.strokeColor = typeof this.stroke.color === "string" ? ColorUtils_1.ColorUtils.stringToRgb(this.stroke.color) : ColorUtils_1.ColorUtils.colorToRgb(this.stroke.color); this.shadowColor = typeof this.particlesOptions.shadow.color === "string" ? ColorUtils_1.ColorUtils.stringToRgb(this.particlesOptions.shadow.color) : ColorUtils_1.ColorUtils.colorToRgb(this.particlesOptions.shadow.color); this.updater = new Updater_1.Updater(this.container, this); } Particle.prototype.update = function (index, delta) { this.links = []; this.updater.update(delta); }; Particle.prototype.draw = function (delta) { this.container.canvas.drawParticle(this, delta); }; Particle.prototype.isOverlapping = function () { var container = this.container; var p = this; var collisionFound = false; var iterations = 0; for (var _i = 0, _a = container.particles.array.filter(function (t) { return t != p; }); _i < _a.length; _i++) { var p2 = _a[_i]; iterations++; var pos1 = { x: p.position.x + p.offset.x, y: p.position.y + p.offset.y }; var pos2 = { x: p2.position.x + p2.offset.x, y: p2.position.y + p2.offset.y }; var dist = Utils_1.Utils.getDistanceBetweenCoordinates(pos1, pos2); if (dist <= p.size.value + p2.size.value) { collisionFound = true; break; } } return { collisionFound: collisionFound, iterations: iterations, }; }; Particle.prototype.checkOverlap = function (position) { var container = this.container; var p = this; var overlapResult = p.isOverlapping(); if (overlapResult.iterations >= container.particles.count) { container.particles.remove(this); } else if (overlapResult.collisionFound) { p.position.x = position ? position.x : Math.random() * container.canvas.size.width; p.position.y = position ? position.y : Math.random() * container.canvas.size.height; p.checkOverlap(); } }; Particle.prototype.startInfection = function (stage) { var container = this.container; var options = container.options; var stages = options.infection.stages; var stagesCount = stages.length; if (stage > stagesCount || stage < 0) { return; } this.infectionDelay = 0; this.infectionDelayStage = stage; }; Particle.prototype.updateInfectionStage = function (stage) { var container = this.container; var options = container.options; var stagesCount = options.infection.stages.length; if (stage > stagesCount || stage < 0 || (this.infectionStage !== undefined && this.infectionStage > stage)) { return; } if (this.infectionTimeout !== undefined) { window.clearTimeout(this.infectionTimeout); } this.infectionStage = stage; this.infectionTime = 0; }; Particle.prototype.updateInfection = function (delta) { var container = this.container; var options = container.options; var infection = options.infection; var stages = options.infection.stages; var stagesCount = stages.length; if (this.infectionDelay !== undefined && this.infectionDelayStage !== undefined) { var stage = this.infectionDelayStage; if (stage > stagesCount || stage < 0) { return; } if (this.infectionDelay > infection.delay * 1000) { this.infectionStage = stage; this.infectionTime = 0; delete this.infectionDelay;<|fim▁hole|> this.infectionDelay += delta; } } else { delete this.infectionDelay; delete this.infectionDelayStage; } if (this.infectionStage !== undefined && this.infectionTime !== undefined) { var infectionStage = stages[this.infectionStage]; if (infectionStage.duration !== undefined && infectionStage.duration >= 0) { if (this.infectionTime > infectionStage.duration * 1000) { this.nextInfectionStage(); } else { this.infectionTime += delta; } } else { this.infectionTime += delta; } } else { delete this.infectionStage; delete this.infectionTime; } }; Particle.prototype.nextInfectionStage = function () { var container = this.container; var options = container.options; var stagesCount = options.infection.stages.length; if (stagesCount <= 0 || this.infectionStage === undefined) { return; } this.infectionTime = 0; if (stagesCount <= ++this.infectionStage) { if (options.infection.cure) { delete this.infectionStage; delete this.infectionTime; return; } else { this.infectionStage = 0; this.infectionTime = 0; } } }; Particle.prototype.destroy = function () { this.destroyed = true; }; Particle.prototype.calcPosition = function (container, position) { for (var _i = 0, _a = container.plugins; _i < _a.length; _i++) { var plugin = _a[_i]; var pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position) : undefined; if (pluginPos !== undefined) { return pluginPos; } } var pos = { x: 0, y: 0 }; pos.x = position ? position.x : Math.random() * container.canvas.size.width; pos.y = position ? position.y : Math.random() * container.canvas.size.height; if (pos.x > container.canvas.size.width - this.size.value * 2) { pos.x -= this.size.value; } else if (pos.x < this.size.value * 2) { pos.x += this.size.value; } if (pos.y > container.canvas.size.height - this.size.value * 2) { pos.y -= this.size.value; } else if (pos.y < this.size.value * 2) { pos.y += this.size.value; } return pos; }; Particle.prototype.calculateVelocity = function () { var baseVelocity = Utils_1.Utils.getParticleBaseVelocity(this); var res = { horizontal: 0, vertical: 0, }; if (this.particlesOptions.move.straight) { res.horizontal = baseVelocity.x; res.vertical = baseVelocity.y; if (this.particlesOptions.move.random) { res.horizontal *= Math.random(); res.vertical *= Math.random(); } } else { res.horizontal = baseVelocity.x + Math.random() - 0.5; res.vertical = baseVelocity.y + Math.random() - 0.5; } return res; }; return Particle; }()); exports.Particle = Particle;<|fim▁end|>
delete this.infectionDelayStage; } else {
<|file_name|>ReinterpretNode.java<|end_file_name|><|fim▁begin|>/* * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.oracle.graal.nodes.calc; import java.nio.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*;<|fim▁hole|>import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; /** * The {@code ReinterpretNode} class represents a reinterpreting conversion that changes the stamp * of a primitive value to some other incompatible stamp. The new stamp must have the same width as * the old stamp. */ @NodeInfo public final class ReinterpretNode extends UnaryNode implements ArithmeticLIRLowerable { public static final NodeClass<ReinterpretNode> TYPE = NodeClass.create(ReinterpretNode.class); public ReinterpretNode(Kind to, ValueNode value) { this(StampFactory.forKind(to), value); } public ReinterpretNode(Stamp to, ValueNode value) { super(TYPE, to, value); assert to instanceof ArithmeticStamp; } private SerializableConstant evalConst(SerializableConstant c) { /* * We don't care about byte order here. Either would produce the correct result. */ ByteBuffer buffer = ByteBuffer.wrap(new byte[c.getSerializedSize()]).order(ByteOrder.nativeOrder()); c.serialize(buffer); buffer.rewind(); SerializableConstant ret = ((ArithmeticStamp) stamp()).deserialize(buffer); assert !buffer.hasRemaining(); return ret; } @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) { if (forValue.isConstant()) { return ConstantNode.forConstant(stamp(), evalConst((SerializableConstant) forValue.asConstant()), null); } if (stamp().isCompatible(forValue.stamp())) { return forValue; } if (forValue instanceof ReinterpretNode) { ReinterpretNode reinterpret = (ReinterpretNode) forValue; return new ReinterpretNode(stamp(), reinterpret.getValue()); } return this; } @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { LIRKind kind = gen.getLIRKind(stamp()); builder.setResult(this, gen.emitReinterpret(kind, builder.operand(getValue()))); } public static ValueNode reinterpret(Kind toKind, ValueNode value) { return value.graph().unique(new ReinterpretNode(toKind, value)); } @NodeIntrinsic public static native float reinterpret(@ConstantNodeParameter Kind kind, int value); @NodeIntrinsic public static native int reinterpret(@ConstantNodeParameter Kind kind, float value); @NodeIntrinsic public static native double reinterpret(@ConstantNodeParameter Kind kind, long value); @NodeIntrinsic public static native long reinterpret(@ConstantNodeParameter Kind kind, double value); }<|fim▁end|>
import com.oracle.graal.nodeinfo.*;
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub use child_process_terminator::ChildProcessTerminator; use std::env; use std::process::Command; use std::thread::sleep; use std::time::Duration; mod child_process_terminator; fn rostopic_listing_succeeds() -> bool { return Command::new("rostopic") .arg("list") .output() .unwrap() .status .success(); } fn await_roscore() { while !rostopic_listing_succeeds() { sleep(Duration::from_millis(100)); } } fn run_roscore(port: u32) -> ChildProcessTerminator { env::set_var("ROS_MASTER_URI", format!("http://localhost:{}", port)); let roscore = ChildProcessTerminator::spawn(<|fim▁hole|> ); await_roscore(); roscore } pub fn run_roscore_for(feature: Feature) -> ChildProcessTerminator { run_roscore(generate_port(feature)) } #[allow(dead_code)] #[repr(u32)] pub enum Feature { TimestampStatusTest = 1, FrequencyStatusTest = 2, } fn generate_port(feature: Feature) -> u32 { 14000 + feature as u32 }<|fim▁end|>
&mut Command::new("roscore").arg("-p").arg(format!("{}", port)),
<|file_name|>orchestrators_test.go<|end_file_name|><|fim▁begin|>package api import ( "testing" "github.com/Azure/acs-engine/pkg/api/common" "github.com/Masterminds/semver" . "github.com/onsi/gomega" ) func TestInvalidVersion(t *testing.T) { RegisterTestingT(t) invalid := []string{ "invalid number", "invalid.number", "a4.b7.c3", "31.29.", ".17.02", "43.156.89.", "1.2.a"} for _, v := range invalid { _, e := semver.NewVersion(v) Expect(e).NotTo(BeNil()) } } func TestVersionCompare(t *testing.T) { RegisterTestingT(t) type record struct { v1, v2 string isGreater bool } records := []record{ {"37.48.59", "37.48.59", false}, {"17.4.5", "3.1.1", true}, {"9.6.5", "9.45.5", false}, {"2.3.8", "2.3.24", false}} for _, r := range records { ver, e := semver.NewVersion(r.v1) Expect(e).To(BeNil()) constraint, e := semver.NewConstraint(">" + r.v2) Expect(e).To(BeNil()) Expect(r.isGreater).To(Equal(constraint.Check(ver))) } } func TestOrchestratorUpgradeInfo(t *testing.T) { RegisterTestingT(t) // 1.5.3 is upgradable to 1.6.x csOrch := &OrchestratorProfile{ OrchestratorType: Kubernetes, OrchestratorVersion: "1.5.3", } orch, e := GetOrchestratorVersionProfile(csOrch) Expect(e).To(BeNil()) // 1.5.7, 1.5.8, 1.6.6, 1.6.9, 1.6.11, 1.6.12 Expect(len(orch.Upgrades)).To(Equal(6)) // 1.6.8 is upgradable to 1.6.x and 1.7.x csOrch = &OrchestratorProfile{ OrchestratorType: Kubernetes, OrchestratorVersion: "1.6.8", } orch, e = GetOrchestratorVersionProfile(csOrch) Expect(e).To(BeNil()) // 1.6.9, 1.6.11, 1.6.12, 1.7.0, 1.7.1, 1.7.2, 1.7.4, 1.7.5, 1.7.7, 1.7.9, 1.7.10 Expect(len(orch.Upgrades)).To(Equal(11)) // 1.7.0 is upgradable to 1.7.x and 1.8.x csOrch = &OrchestratorProfile{ OrchestratorType: Kubernetes, OrchestratorVersion: "1.7.0", } orch, e = GetOrchestratorVersionProfile(csOrch) Expect(e).To(BeNil()) // 1.7.1, 1.7.2, 1.7.4, 1.7.5, 1.7.7, 1.7.9, 1.7.10, 1.8.0, 1.8.1, 1.8.2 Expect(len(orch.Upgrades)).To(Equal(10)) // 1.7.10 is upgradable to 1.8.x csOrch = &OrchestratorProfile{ OrchestratorType: Kubernetes, OrchestratorVersion: "1.7.10", } orch, e = GetOrchestratorVersionProfile(csOrch)<|fim▁hole|> Expect(len(orch.Upgrades)).To(Equal(3)) // 1.8.2 is not upgradable csOrch = &OrchestratorProfile{ OrchestratorType: Kubernetes, OrchestratorVersion: common.KubernetesVersion1Dot8Dot2, } orch, e = GetOrchestratorVersionProfile(csOrch) Expect(e).To(BeNil()) Expect(len(orch.Upgrades)).To(Equal(0)) // v20170930 - all orchestrators list, e := GetOrchestratorVersionProfileListV20170930("", "") Expect(e).To(BeNil()) Expect(len(list.Properties.Orchestrators)).To(Equal(22)) // v20170930 - kubernetes only list, e = GetOrchestratorVersionProfileListV20170930(common.Kubernetes, "") Expect(e).To(BeNil()) Expect(len(list.Properties.Orchestrators)).To(Equal(17)) }<|fim▁end|>
Expect(e).To(BeNil()) // 1.8.0, 1.8.1, 1.8.2
<|file_name|>repeat_str.rs<|end_file_name|><|fim▁begin|>// http://rosettacode.org/wiki/Repeat_a_string #[cfg(not(test))] fn main() { println!("{}", "ha".repeat(5).as_slice()); } #[test] fn check_repeat() { assert!("ha".repeat(5).as_slice() == "hahahahaha");<|fim▁hole|><|fim▁end|>
}
<|file_name|>musicBarInputComponent.js<|end_file_name|><|fim▁begin|>'use strict'; (function (scope) { /** * Bar input component * * @class MusicBarInputComponent * @extends AbstractMusicInputComponent * @constructor */ function MusicBarInputComponent() { this.type = 'bar'; this.value = new scope.MusicBarInput(); } /** * Inheritance property */<|fim▁hole|> /** * Constructor property */ MusicBarInputComponent.prototype.constructor = MusicBarInputComponent; /** * Get bar input component value * * @method getValue * @returns {MusicBarInput} */ MusicBarInputComponent.prototype.getValue = function () { return this.value; }; /** * Set bar input component value * * @method setValue * @param {MusicBarInput} value */ MusicBarInputComponent.prototype.setValue = function (value) { this.value = value; }; // Export scope.MusicBarInputComponent = MusicBarInputComponent; })(MyScript);<|fim▁end|>
MusicBarInputComponent.prototype = new scope.AbstractMusicInputComponent();
<|file_name|>LogisticsConsignOrderCreateandsendResponse.java<|end_file_name|><|fim▁begin|>package com.taobao.api.response; import com.taobao.api.TaobaoResponse;<|fim▁hole|> * * @author auto create * @since 1.0, null */ public class LogisticsConsignOrderCreateandsendResponse extends TaobaoResponse { private static final long serialVersionUID = 2877278252382584596L; /** * 是否成功 */ @ApiField("is_success") private Boolean isSuccess; /** * 订单ID */ @ApiField("order_id") private Long orderId; /** * 结果描述 */ @ApiField("result_desc") private String resultDesc; public Boolean getIsSuccess() { return this.isSuccess; } public Long getOrderId() { return this.orderId; } public String getResultDesc() { return this.resultDesc; } public void setIsSuccess(Boolean isSuccess) { this.isSuccess = isSuccess; } public void setOrderId(Long orderId) { this.orderId = orderId; } public void setResultDesc(String resultDesc) { this.resultDesc = resultDesc; } }<|fim▁end|>
import com.taobao.api.internal.mapping.ApiField; /** * TOP API: taobao.logistics.consign.order.createandsend response.
<|file_name|>index.js<|end_file_name|><|fim▁begin|>var models = require('../models'); var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { console.log(req.session);<|fim▁hole|><|fim▁end|>
res.render('layout'); }); module.exports = router;
<|file_name|>control_flow.py<|end_file_name|><|fim▁begin|># Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Control flow statements: loops, conditionals, etc.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.autograph.operators import py_builtins from tensorflow.python.autograph.operators import special_values from tensorflow.python.autograph.pyct import errors from tensorflow.python.autograph.utils import ag_logging from tensorflow.python.data.ops import dataset_ops from tensorflow.python.framework import constant_op from tensorflow.python.framework import func_graph from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_util from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import gen_math_ops LIMIT_PYTHON_ITERATIONS = True PYTHON_MAX_ITERATIONS = 100000000 # Fails in about one minute for empty loops. WARN_INEFFICIENT_UNROLL = True INEFFICIENT_UNROLL_MIN_ITERATIONS = 3000 INEFFICIENT_UNROLL_MIN_OPS = 1 def for_stmt(iter_, extra_test, body, init_state): """Functional form of a for statement. The loop operates on a state, which includes all symbols that are variant across loop iterations, excluding the iterate as well as the variables local to the loop. For example, given the loop below that calculates the geometric and arithmetic means or some numbers: geo_mean = 1 arith_mean = 0 for i in range(n): a = numbers[i] geo_mean *= a arith_mean += a The state is represented by the variables geo_mean and arith_mean. The argument for initial_state may contain the tuple (1, 0), the body will include the arguments geo_mean and arith_mean and will return a tuple representing the new values for geo_mean and respectively arith_mean. Args: iter_: The entity being iterated over. extra_test: Callable with the state as arguments, and boolean return type. An additional loop condition. body: Callable with the iterate and the state as arguments, and state as return type. The actual loop body. init_state: Tuple containing the initial state. Returns: Tuple containing the final state. """ if tensor_util.is_tensor(iter_): return _known_len_tf_for_stmt(iter_, extra_test, body, init_state) elif isinstance(iter_, dataset_ops.DatasetV2): # Check for undefined symbols and report an error. This prevents the error # from propagating into the TF runtime. We have more information here and # can provide a clearer error message. undefined = tuple(filter(special_values.is_undefined, init_state)) if undefined: raise ValueError( 'TensorFlow requires that the following symbols must be defined' ' before the loop: {}'.format( tuple(s.symbol_name for s in undefined))) return _dataset_for_stmt(iter_, extra_test, body, init_state) else: return _py_for_stmt(iter_, extra_test, body, init_state) def _py_for_stmt(iter_, extra_test, body, init_state): """Overload of for_stmt that executes a Python for loop.""" state = init_state for target in iter_: if extra_test is not None and not extra_test(*state): break state = body(target, *state) return state def _known_len_tf_for_stmt(iter_, extra_test, body, init_state): """Overload of for_stmt that iterates over objects that admit a length.""" n = py_builtins.len_(iter_) def while_body(iterate_index, *state): iterate = iter_[iterate_index] new_state = body(iterate, *state) state = (iterate_index + 1,) if new_state: state += new_state return state def while_cond(iterate_index, *state): if extra_test is not None: return gen_math_ops.logical_and(iterate_index < n, extra_test(*state)) return iterate_index < n results = _tf_while_stmt( while_cond, while_body, init_state=(0,) + init_state, opts=dict(maximum_iterations=n)) # Dropping the iteration index because it's not syntactically visible. # TODO(mdan): Don't. if isinstance(results, (tuple, list)): assert len(results) >= 1 # Has at least the iterate. if len(results) > 1: results = results[1:] else: results = () return results def _dataset_for_stmt(ds, extra_test, body, init_state): """Overload of for_stmt that iterates over TF Datasets.""" if extra_test is not None: raise NotImplementedError( 'break and return statements are not yet supported in ' 'for/Dataset loops.') def reduce_body(state, iterate): new_state = body(iterate, *state) return new_state if init_state: return ds.reduce(init_state, reduce_body) # Workaround for Datset.reduce not allowing empty state tensors - create # a dummy state variable that remains unused. def reduce_body_with_dummy_state(state, iterate): reduce_body((), iterate) return state ds.reduce((constant_op.constant(0),), reduce_body_with_dummy_state) return () def while_stmt(test, body, init_state, opts=None): """Functional form of a while statement. The loop operates on a so-called state, which includes all symbols that are variant across loop iterations. In what follows we refer to state as either a tuple of entities that represent an actual state, or a list of arguments of the corresponding types. Args: test: Callable with the state as arguments, and boolean return type. The loop condition. body: Callable with the state as arguments, and state as return type. The actual loop body. init_state: Tuple containing the initial state. opts: Optional dict of extra loop parameters. Returns: Tuple containing the final state. """ # Evaluate the initial test once in order to do the dispatch. The evaluation # is isolated to minimize unwanted side effects. # TODO(mdan): Do a full iteration - some state types might lower to Tensor. with func_graph.FuncGraph('tmp').as_default(): init_test = test(*init_state) # TensorFlow: Multiple evaluations are acceptable in this case, so we're fine # with the re-evaluation of `test` that `_tf_while_stmt` will make. if tensor_util.is_tensor(init_test): return _tf_while_stmt(test, body, init_state, opts) # Normal Python: We already consumed one evaluation of `test`; consistently, # unroll one iteration before dispatching to a normal loop. # TODO(mdan): Push the "init_test" value via opts into _py_while_stmt? if not init_test: return init_state init_state = body(*init_state) return _py_while_stmt(test, body, init_state, opts) def _tf_while_stmt(test, body, init_state, opts): """Overload of while_stmt that stages a TF while_stmt.""" if opts is None: opts = {} undefined = tuple(filter(special_values.is_undefined, init_state)) if undefined: raise ValueError( 'TensorFlow requires that the following symbols must be initialized ' 'to a Tensor, Variable or TensorArray before the loop: {}'.format( tuple(s.symbol_name for s in undefined))) # Non-v2 while_loop unpacks the results when there is only one return value. # This enforces consistency across versions. opts['return_same_structure'] = True retval = control_flow_ops.while_loop(test, body, init_state, **opts) return retval class _PythonLoopChecker(object): """Verifies Python loops for TF-specific limits.""" def __init__(self): self.iterations = 0 self.check_inefficient_unroll = WARN_INEFFICIENT_UNROLL # Triggered when we decided to test the op counts. self.check_op_count_after_iteration = False def _get_ops(self): return ops.get_default_graph().get_operations() def _check_unroll_limits(self): if LIMIT_PYTHON_ITERATIONS and self.iterations > PYTHON_MAX_ITERATIONS: raise errors.ExecutionError('Python', 'iteration limit exceeded') def _stop_checking_inefficient_unroll(self): self.check_inefficient_unroll = False self.ops_before_iteration = None def _verify_ineffcient_unroll(self): """Checks for possibly-inefficient creation of ops in a Python loop.""" assert self.ops_before_iteration is not None ops_after_iteration = self._get_ops() new_ops = tuple( op for op in ops_after_iteration if op not in self.ops_before_iteration) if len(new_ops) < INEFFICIENT_UNROLL_MIN_OPS: return False # TODO(mdan): Add location information. ag_logging.warn( 'TensorFlow ops are being created in a Python loop with large number' ' of iterations. This can lead to slow startup. Did you mean to use a' ' TensorFlow loop? For example, `while True:` is a Python loop, and' ' `while tf.constant(True):` is a TensorFlow loop. The following' ' ops were created after iteration %s: %s', self.iterations, new_ops) return True def before_iteration(self): """Called before each iteration in a Python loop.""" if (self.check_inefficient_unroll and self.iterations > INEFFICIENT_UNROLL_MIN_ITERATIONS): self.ops_before_iteration = self._get_ops() self.check_op_count_after_iteration = True def after_iteration(self): """Called after each iteration in a Python loop.""" self.iterations += 1 self._check_unroll_limits() if self.check_inefficient_unroll and self.check_op_count_after_iteration: did_warn = self._verify_ineffcient_unroll() if did_warn: self._stop_checking_inefficient_unroll() # Only warn once. elif self.iterations > INEFFICIENT_UNROLL_MIN_ITERATIONS + 3: # Once deciding to check the op counts, only do it for a few iterations. self._stop_checking_inefficient_unroll() def _py_while_stmt(test, body, init_state, opts): """Overload of while_stmt that executes a Python while loop.""" del opts if __debug__: checker = _PythonLoopChecker() state = init_state while test(*state): if __debug__: checker.before_iteration() state = body(*state) if __debug__: checker.after_iteration() return state def if_stmt(cond, body, orelse, get_state, set_state): """Functional form of an if statement. Args: cond: Boolean. body: Callable with no arguments, and outputs of the positive (if) branch as return type. orelse: Callable with no arguments, and outputs of the negative (else) branch as return type. get_state: Function that returns a tuple containing the values of all composite symbols modified within the conditional. This allows access to state that branches may mutate through side effects. This function is not needed and should not be called when dispatching to code matching Python's default semantics. This is useful for checkpointing to avoid unintended side-effects when staging requires evaluating all code-paths. set_state: Function to set the values of all composite symbols modified within the conditional. This is the complement to get_state, used to restore checkpointed values. The single argument a tuple containing values for each composite symbol that may be modified in a branch of the conditional. The is usually the result of a call to get_state. Returns: Tuple containing the statement outputs. """ if tensor_util.is_tensor(cond): return tf_if_stmt(cond, body, orelse, get_state, set_state) else: return _py_if_stmt(cond, body, orelse) def tf_if_stmt(cond, body, orelse, get_state, set_state): """Overload of if_stmt that stages a TF cond.""" body = _disallow_undefs(body, branch_name='if') orelse = _disallow_undefs(orelse, branch_name='else') body = _isolate_state(body, get_state, set_state) orelse = _isolate_state(orelse, get_state, set_state) # `state` currently includes the values of any composite symbols (e.g. `a.b`) # composites modified by the loop. `outputs` includes the values of basic # symbols (e.g. `a`) which cannot be passed by reference and must be returned. # See _isolate_state. # TODO(mdan): We should minimize calls to get/set_state. outputs, final_state = control_flow_ops.cond(cond, body, orelse) set_state(final_state) return outputs def _isolate_state(func, get_state, set_state): """Wraps func to (best-effort) isolate state mutations that func may do. The simplest example of state mutation is mutation of variables (via e.g. attributes), or modification of globals. This allows us to more safely execute this function without worrying about side effects when the function wasn't normally expected to execute. For example, staging requires that the function is executed ahead of time, and we need to ensure its effects are not observed during normal execution. Args: func: () -> Any get_state: () -> Any, returns the current state set_state: (Any) -> None, resets the state to the specified values. Typically the result of an earlier call to `get_state`. Returns: Tuple[Any, Any], where the first element is the return value of `func`, and the second is the final state values. """ def wrapper(): init_state = get_state() outputs = func() # TODO(mdan): These should be copies, lest set_state might affect them. final_state = get_state()<|fim▁hole|> return wrapper def _disallow_undefs(func, branch_name): """Wraps function to raise useful error when it returns undefined symbols.""" def wrapper(): """Calls function and raises an error if undefined symbols are returned.""" results = func() if isinstance(results, tuple): results_tuple = results else: results_tuple = results, undefined = tuple(filter(special_values.is_undefined, results_tuple)) if undefined: raise ValueError( 'The following symbols must also be initialized in the {} branch: {}.' ' Alternatively, you may initialize them before the if' ' statement.'.format(branch_name, tuple(s.symbol_name for s in undefined))) return results return wrapper def _py_if_stmt(cond, body, orelse): """Overload of if_stmt that executes a Python if statement.""" return body() if cond else orelse()<|fim▁end|>
set_state(init_state) return outputs, final_state
<|file_name|>impl_numeric.rs<|end_file_name|><|fim▁begin|>// Copyright 2014-2016 bluss and ndarray developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::ops::Add; use libnum::{self, Zero, Float}; use itertools::free::enumerate; use imp_prelude::*; use numeric_util; use { LinalgScalar, }; <|fim▁hole|>/// Numerical methods for arrays. impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension, { /// Return the sum of all elements in the array. /// /// ``` /// use ndarray::arr2; /// /// let a = arr2(&[[1., 2.], /// [3., 4.]]); /// assert_eq!(a.scalar_sum(), 10.); /// ``` pub fn scalar_sum(&self) -> A where A: Clone + Add<Output=A> + libnum::Zero, { if let Some(slc) = self.as_slice_memory_order() { return numeric_util::unrolled_sum(slc); } let mut sum = A::zero(); for row in self.inner_iter() { if let Some(slc) = row.as_slice() { sum = sum + numeric_util::unrolled_sum(slc); } else { sum = sum + row.iter().fold(A::zero(), |acc, elt| acc + elt.clone()); } } sum } /// Return sum along `axis`. /// /// ``` /// use ndarray::{aview0, aview1, arr2, Axis}; /// /// let a = arr2(&[[1., 2.], /// [3., 4.]]); /// assert!( /// a.sum(Axis(0)) == aview1(&[4., 6.]) && /// a.sum(Axis(1)) == aview1(&[3., 7.]) && /// /// a.sum(Axis(0)).sum(Axis(0)) == aview0(&10.) /// ); /// ``` /// /// **Panics** if `axis` is out of bounds. pub fn sum(&self, axis: Axis) -> Array<A, <D as RemoveAxis>::Smaller> where A: Clone + Zero + Add<Output=A>, D: RemoveAxis, { let n = self.shape().axis(axis); let mut res = self.subview(axis, 0).to_owned(); let stride = self.strides()[axis.index()]; if self.ndim() == 2 && stride == 1 { // contiguous along the axis we are summing let ax = axis.index(); for (i, elt) in enumerate(&mut res) { *elt = self.subview(Axis(1 - ax), i).scalar_sum(); } } else { for i in 1..n { let view = self.subview(axis, i); res = res + &view; } } res } /// Return mean along `axis`. /// /// **Panics** if `axis` is out of bounds. /// /// ``` /// use ndarray::{aview1, arr2, Axis}; /// /// let a = arr2(&[[1., 2.], /// [3., 4.]]); /// assert!( /// a.mean(Axis(0)) == aview1(&[2.0, 3.0]) && /// a.mean(Axis(1)) == aview1(&[1.5, 3.5]) /// ); /// ``` pub fn mean(&self, axis: Axis) -> Array<A, <D as RemoveAxis>::Smaller> where A: LinalgScalar, D: RemoveAxis, { let n = self.shape().axis(axis); let sum = self.sum(axis); let mut cnt = A::one(); for _ in 1..n { cnt = cnt + A::one(); } sum / &aview0(&cnt) } /// Return `true` if the arrays' elementwise differences are all within /// the given absolute tolerance, `false` otherwise. /// /// If their shapes disagree, `rhs` is broadcast to the shape of `self`. /// /// **Panics** if broadcasting to the same shape isn’t possible. pub fn all_close<S2, E>(&self, rhs: &ArrayBase<S2, E>, tol: A) -> bool where A: Float, S2: Data<Elem=A>, E: Dimension, { let rhs_broadcast = rhs.broadcast_unwrap(self.raw_dim()); self.iter().zip(rhs_broadcast.iter()).all(|(x, y)| (*x - *y).abs() <= tol) } }<|fim▁end|>
<|file_name|>MapDao.java<|end_file_name|><|fim▁begin|>package org.zarroboogs.weibo.dao; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.zarroboogs.util.net.HttpUtility; import org.zarroboogs.util.net.WeiboException; import org.zarroboogs.util.net.HttpUtility.HttpMethod; import org.zarroboogs.utils.ImageUtility; import org.zarroboogs.utils.WeiBoURLs; import org.zarroboogs.utils.file.FileLocationMethod; import org.zarroboogs.utils.file.FileManager; import org.zarroboogs.weibo.support.asyncdrawable.TaskCache; import android.graphics.Bitmap; import android.text.TextUtils; import java.util.HashMap; import java.util.Map; public class MapDao { public Bitmap getMap() throws WeiboException { <|fim▁hole|> map.put("access_token", access_token); String coordinates = String.valueOf(lat) + "," + String.valueOf(lan); map.put("center_coordinate", coordinates); map.put("zoom", "14"); map.put("size", "600x380"); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map); String mapUrl = ""; try { JSONObject jsonObject = new JSONObject(jsonData); JSONArray array = jsonObject.optJSONArray("map"); jsonObject = array.getJSONObject(0); mapUrl = jsonObject.getString("image_url"); } catch (JSONException e) { } if (TextUtils.isEmpty(mapUrl)) { return null; } String filePath = FileManager.getFilePathFromUrl(mapUrl, FileLocationMethod.map); boolean downloaded = TaskCache.waitForPictureDownload(mapUrl, null, filePath, FileLocationMethod.map); if (!downloaded) { return null; } Bitmap bitmap = ImageUtility.readNormalPic(FileManager.getFilePathFromUrl(mapUrl, FileLocationMethod.map), -1, -1); return bitmap; } public MapDao(String token, double lan, double lat) { this.access_token = token; this.lan = lan; this.lat = lat; } private String access_token; private double lan; private double lat; }<|fim▁end|>
String url = WeiBoURLs.STATIC_MAP; Map<String, String> map = new HashMap<String, String>();
<|file_name|>viewer.cpp<|end_file_name|><|fim▁begin|>// Copyright (c) 2011 Hewlett-Packard Development Company, L.P. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <QDir> #include <QDoubleSpinBox> #include <QFileDialog> #include <QFileInfo> #include <QLabel> #include <QList> #include <QPlainTextEdit> #include <QPushButton> #include <QStringBuilder> #include <QTableWidget> #include <QTableWidgetItem> #include <QUrl> #include <QWebSettings> #include <QtGlobal> #include <webvfx/effects.h> #include <webvfx/image.h> #include <webvfx/parameters.h> #include <webvfx/webvfx.h> #include <webvfx/qml_content.h> #include <webvfx/web_content.h> #include "image_color.h" #include "render_dialog.h" #include "viewer.h" // Expose parameter name/value pairs from the table to the page content class ViewerParameters : public WebVfx::Parameters { public: ViewerParameters(QTableWidget* tableWidget) : tableWidget(tableWidget) {} double getNumberParameter(const QString& name) { QString value = findValue(name); return value.toDouble(); } QString getStringParameter(const QString& name) { return findValue(name); } private: QString findValue(const QString& name) { QList<QTableWidgetItem*> itemList = tableWidget->findItems(name, Qt::MatchFixedString|Qt::MatchCaseSensitive); foreach (const QTableWidgetItem* item, itemList) { // If the string matches column 0 (Name), then return column 1 (Value) if (item->column() == 0) { QTableWidgetItem* valueItem = tableWidget->item(item->row(), 1); if (valueItem) return valueItem->text(); } } return QString(); } QTableWidget* tableWidget; }; ///////////////// class ViewerLogger : public WebVfx::Logger { public: ViewerLogger(QPlainTextEdit* logText) : logText(logText) {} void log(const QString& msg) { logText->appendPlainText(msg); } private: QPlainTextEdit* logText; }; ///////////////// Viewer::Viewer() : QMainWindow(0) , sizeLabel(0) , timeSpinBox(0) , content(0) { setupUi(this); WebVfx::setLogger(new ViewerLogger(logTextEdit)); // Time display timeSpinBox = new QDoubleSpinBox(statusBar()); timeSpinBox->setDecimals(4); timeSpinBox->setSingleStep(0.01); timeSpinBox->setMaximum(1.0); timeSpinBox->setValue(sliderTimeValue(timeSlider->value())); statusBar()->addPermanentWidget(timeSpinBox); connect(timeSpinBox, SIGNAL(valueChanged(double)), SLOT(onTimeSpinBoxValueChanged(double))); // Size display sizeLabel = new QLabel(statusBar()); statusBar()->addPermanentWidget(sizeLabel); setContentUIEnabled(false); handleResize(); } void Viewer::setContentUIEnabled(bool enable) { timeSpinBox->setEnabled(enable); timeSlider->setEnabled(enable); actionReload->setEnabled(enable); actionRenderImage->setEnabled(enable); } void Viewer::onContentLoadFinished(bool result) { if (result) { setupImages(scrollArea->widget()->size()); content->renderContent(timeSpinBox->value(), 0); } else { statusBar()->showMessage(tr("Load failed"), 2000); setWindowFilePath(""); } setContentUIEnabled(result); } void Viewer::on_actionOpen_triggered(bool) { QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), QString(), tr("WebVfx Files (*.html *.htm *.qml)")); loadFile(fileName); } void Viewer::on_actionReload_triggered(bool) { content->reload(); } void Viewer::on_actionRenderImage_triggered(bool) { QImage image(scrollArea->widget()->size(), QImage::Format_RGB888); WebVfx::Image renderImage(image.bits(), image.width(), image.height(), image.byteCount()); content->renderContent(timeSpinBox->value(), &renderImage); RenderDialog* dialog = new RenderDialog(this); dialog->setImage(image); dialog->show(); } void Viewer::on_resizeButton_clicked() { handleResize(); } void Viewer::loadFile(const QString& fileName) { if (fileName.isNull())<|fim▁hole|> setWindowFilePath(fileName); } void Viewer::handleResize() { int width = widthSpinBox->value(); int height = heightSpinBox->value(); scrollArea->widget()->resize(width, height); if (content) content->setContentSize(QSize(width, height)); sizeLabel->setText(QString::number(width) % QLatin1Literal("x") % QString::number(height)); // Iterate over ImageColor widgets in table and change their sizes QSize size(width, height); int rowCount = imagesTable->rowCount(); for (int i = 0; i < rowCount; i++) { ImageColor* imageColor = static_cast<ImageColor*>(imagesTable->cellWidget(i, 1)); if (imageColor) imageColor->setImageSize(size); } } void Viewer::setImagesOnContent() { if (!content) return; int rowCount = imagesTable->rowCount(); for (int i = 0; i < rowCount; i++) { ImageColor* imageColor = static_cast<ImageColor*>(imagesTable->cellWidget(i, 1)); if (imageColor) { WebVfx::Image image(imageColor->getImage()); content->setImage(imageColor->objectName(), &image); } } } void Viewer::on_timeSlider_valueChanged(int value) { timeSpinBox->setValue(sliderTimeValue(value)); } void Viewer::onTimeSpinBoxValueChanged(double time) { if (content) { setImagesOnContent(); content->renderContent(time, 0); } timeSlider->blockSignals(true); timeSlider->setValue(time * timeSlider->maximum()); timeSlider->blockSignals(false); } void Viewer::on_addParameterButton_clicked() { int row = parametersTable->currentRow(); parametersTable->insertRow(row >= 0 ? row : 0); } void Viewer::on_deleteParameterButton_clicked() { int row = parametersTable->currentRow(); if (row >= 0) parametersTable->removeRow(row); } double Viewer::sliderTimeValue(int value) { return value / (double)timeSlider->maximum(); } void Viewer::createContent(const QString& fileName) { if (fileName.endsWith(".qml", Qt::CaseInsensitive)) { WebVfx::QmlContent* qmlContent = new WebVfx::QmlContent(scrollArea->widget()->size(), new ViewerParameters(parametersTable)); content = qmlContent; connect(qmlContent, SIGNAL(contentLoadFinished(bool)), SLOT(onContentLoadFinished(bool))); } else if (fileName.endsWith(".html", Qt::CaseInsensitive) || fileName.endsWith(".htm", Qt::CaseInsensitive)){ WebVfx::WebContent* webContent = new WebVfx::WebContent(scrollArea->widget()->size(), new ViewerParameters(parametersTable)); // User can right-click to open WebInspector on the page webContent->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); content = webContent; connect(webContent, SIGNAL(contentLoadFinished(bool)), SLOT(onContentLoadFinished(bool))); } QWidget* view = content->createView(scrollArea); view->resize(scrollArea->widget()->size()); // Set content as direct widget of QScrollArea, // otherwise it creates an intermediate QWidget which messes up resizing. // setWidget will destroy the old view. scrollArea->setWidget(view); logTextEdit->clear(); setContentUIEnabled(true); content->loadContent(QUrl::fromLocalFile(QFileInfo(fileName).absoluteFilePath())); } void Viewer::setupImages(const QSize& size) { imagesTable->setRowCount(0); int row = 0; WebVfx::Effects::ImageTypeMapIterator it(content->getImageTypeMap()); while (it.hasNext()) { it.next(); imagesTable->insertRow(row); QString imageName(it.key()); // Image name in column 0 QTableWidgetItem* item = new QTableWidgetItem(imageName); item->setFlags(Qt::NoItemFlags); imagesTable->setItem(row, 0, item); // Image color swatch in column 1 ImageColor* imageColor = new ImageColor(); imageColor->setImageSize(size); imageColor->setObjectName(imageName); connect(imageColor, SIGNAL(imageChanged(QString,WebVfx::Image)), SLOT(onImageChanged(QString,WebVfx::Image))); // Set color here so signal fires imageColor->setImageColor(QColor::fromHsv(qrand() % 360, 200, 230)); imagesTable->setCellWidget(row, 1, imageColor); // Type name in column 2 QString typeName; switch (it.value()) { case WebVfx::Effects::SourceImageType: typeName = tr("Source"); break; case WebVfx::Effects::TargetImageType: typeName = tr("Target"); break; case WebVfx::Effects::ExtraImageType: typeName = tr("Extra"); break; } item = new QTableWidgetItem(typeName); item->setFlags(Qt::NoItemFlags); imagesTable->setItem(row, 2, item); row++; } } void Viewer::onImageChanged(const QString& name, WebVfx::Image image) { if (!content) return; content->setImage(name, &image); }<|fim▁end|>
return; createContent(fileName);
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Licensed under a 3-clause BSD style license - see LICENSE.rst """ An extensible ASCII table reader and writer. """ from .core import (InconsistentTableError, ParameterError, NoType, StrType, NumType, FloatType, IntType, AllType, Column, BaseInputter, ContinuationLinesInputter,<|fim▁hole|> BaseSplitter, DefaultSplitter, WhitespaceSplitter, convert_numpy, masked ) from .basic import (Basic, BasicHeader, BasicData, Rdb, Csv, Tab, NoHeader, CommentedHeader) from .fastbasic import (FastBasic, FastCsv, FastTab, FastNoHeader, FastCommentedHeader, FastRdb) from .cds import Cds from .ecsv import Ecsv from .latex import Latex, AASTex, latexdicts from .html import HTML from .ipac import Ipac from .daophot import Daophot from .sextractor import SExtractor from .fixedwidth import (FixedWidth, FixedWidthNoHeader, FixedWidthTwoLine, FixedWidthSplitter, FixedWidthHeader, FixedWidthData) from .rst import RST from .ui import (set_guess, get_reader, read, get_writer, write, get_read_trace) from . import connect<|fim▁end|>
BaseHeader, BaseData, BaseOutputter, TableOutputter, BaseReader,
<|file_name|>youtrack.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import import re import six import requests from jinja2 import Template from bugwarrior.config import asbool, die from bugwarrior.services import IssueService, Issue, ServiceClient import logging log = logging.getLogger(__name__) class YoutrackIssue(Issue): ISSUE = 'youtrackissue' SUMMARY = 'youtracksummary' URL = 'youtrackurl' PROJECT = 'youtrackproject' NUMBER = 'youtracknumber' UDAS = { ISSUE: { 'type': 'string', 'label': 'YouTrack Issue' }, SUMMARY: { 'type': 'string', 'label': 'YouTrack Summary', }, URL: { 'type': 'string', 'label': 'YouTrack URL', }, PROJECT: { 'type': 'string', 'label': 'YouTrack Project' }, NUMBER: { 'type': 'string', 'label': 'YouTrack Project Issue Number' }, } UNIQUE_KEY = (URL,) def _get_record_field(self, field_name): for field in self.record['field']: if field['name'] == field_name: return field def _get_record_field_value(self, field_name, field_value='value'): field = self._get_record_field(field_name) if field: return field[field_value] def to_taskwarrior(self): return { 'project': self.get_project(), 'priority': self.get_priority(), 'tags': self.get_tags(), self.ISSUE: self.get_issue(), self.SUMMARY: self.get_issue_summary(), self.URL: self.get_issue_url(), self.PROJECT: self.get_project(), self.NUMBER: self.get_number_in_project(), } def get_issue(self): return self.record['id'] def get_issue_summary(self): return self._get_record_field_value('summary') def get_issue_url(self): return "%s/issue/%s" % ( self.origin['base_url'], self.get_issue() ) def get_project(self): return self._get_record_field_value('projectShortName') def get_number_in_project(self): return int(self._get_record_field_value('numberInProject')) def get_default_description(self): return self.build_default_description( title=self.get_issue_summary(), url=self.get_processed_url(self.get_issue_url()), number=self.get_issue(), cls='issue', ) def get_tags(self): tags = [] if not self.origin['import_tags']: return tags context = self.record.copy() tag_template = Template(self.origin['tag_template']) for tag_dict in self.record.get('tag', []): context.update({ 'tag': re.sub(r'[^a-zA-Z0-9]', '_', tag_dict['value']) }) tags.append( tag_template.render(context) ) return tags class YoutrackService(IssueService, ServiceClient): ISSUE_CLASS = YoutrackIssue CONFIG_PREFIX = 'youtrack' def __init__(self, *args, **kw): super(YoutrackService, self).__init__(*args, **kw) self.host = self.config_get('host') if self.config_get_default('use_https', default=True, to_type=asbool): self.scheme = 'https' self.port = '443' else: self.scheme = 'http' self.port = '80' self.port = self.config_get_default('port', self.port) self.base_url = '%s://%s:%s' % (self.scheme, self.host, self.port) self.rest_url = self.base_url + '/rest' self.session = requests.Session() self.session.headers['Accept'] = 'application/json' self.verify_ssl = self.config_get_default('verify_ssl', default=True, to_type=asbool) if not self.verify_ssl: requests.packages.urllib3.disable_warnings() self.session.verify = False login = self.config_get('login') password = self.config_get_password('password', login) if not self.config_get_default('anonymous', False): self._login(login, password) self.query = self.config_get_default('query', default='for:me #Unresolved') self.query_limit = self.config_get_default('query_limit', default="100") self.import_tags = self.config_get_default( 'import_tags', default=True, to_type=asbool ) self.tag_template = self.config_get_default( 'tag_template', default='{{tag|lower}}', to_type=six.text_type ) def _login(self, login, password): resp = self.session.post(self.rest_url + "/user/login", {'login': login, 'password': password}) if resp.status_code != 200: raise RuntimeError("YouTrack responded with %s" % resp)<|fim▁hole|> def get_keyring_service(cls, config, section): host = config.get(section, cls._get_key('host')) login = config.get(section, cls._get_key('login')) return "youtrack://%s@%s" % (login, host) def get_service_metadata(self): return { 'base_url': self.base_url, 'import_tags': self.import_tags, 'tag_template': self.tag_template, } @classmethod def validate_config(cls, config, target): for k in ('youtrack.login', 'youtrack.password', 'youtrack.host'): if not config.has_option(target, k): die("[%s] has no '%s'" % (target, k)) IssueService.validate_config(config, target) def issues(self): resp = self.session.get(self.rest_url + '/issue', params={'filter': self.query, 'max': self.query_limit}) issues = self.json_response(resp)['issue'] log.debug(" Found %i total.", len(issues)) for issue in issues: yield self.get_issue_for_record(issue)<|fim▁end|>
self.session.headers['Cookie'] = resp.headers['set-cookie'] @classmethod
<|file_name|>event_definition.pb.go<|end_file_name|><|fim▁begin|>// Copyright 2020 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0-devel // protoc v3.12.3 // source: proto/google/fhir/proto/r5/core/resources/event_definition.proto package event_definition_go_proto import ( any "github.com/golang/protobuf/ptypes/any" _ "github.com/google/fhir/go/proto/google/fhir/proto/annotations_go_proto" codes_go_proto "github.com/google/fhir/go/proto/google/fhir/proto/r5/core/codes_go_proto" datatypes_go_proto "github.com/google/fhir/go/proto/google/fhir/proto/r5/core/datatypes_go_proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) // Auto-generated from StructureDefinition for EventDefinition, last updated // 2019-12-31T21:03:40.621+11:00. A description of when an event can occur. See // http://hl7.org/fhir/StructureDefinition/EventDefinition type EventDefinition struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Logical id of this artifact Id *datatypes_go_proto.Id `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Metadata about the resource Meta *datatypes_go_proto.Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` // A set of rules under which this content was created ImplicitRules *datatypes_go_proto.Uri `protobuf:"bytes,3,opt,name=implicit_rules,json=implicitRules,proto3" json:"implicit_rules,omitempty"` // Language of the resource content Language *datatypes_go_proto.Code `protobuf:"bytes,4,opt,name=language,proto3" json:"language,omitempty"` // Text summary of the resource, for human interpretation Text *datatypes_go_proto.Narrative `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"` // Contained, inline Resources Contained []*any.Any `protobuf:"bytes,6,rep,name=contained,proto3" json:"contained,omitempty"` // Additional content defined by implementations Extension []*datatypes_go_proto.Extension `protobuf:"bytes,8,rep,name=extension,proto3" json:"extension,omitempty"` // Extensions that cannot be ignored ModifierExtension []*datatypes_go_proto.Extension `protobuf:"bytes,9,rep,name=modifier_extension,json=modifierExtension,proto3" json:"modifier_extension,omitempty"` // Canonical identifier for this event definition, represented as a URI // (globally unique) Url *datatypes_go_proto.Uri `protobuf:"bytes,10,opt,name=url,proto3" json:"url,omitempty"` // Additional identifier for the event definition Identifier []*datatypes_go_proto.Identifier `protobuf:"bytes,11,rep,name=identifier,proto3" json:"identifier,omitempty"` // Business version of the event definition Version *datatypes_go_proto.String `protobuf:"bytes,12,opt,name=version,proto3" json:"version,omitempty"` // Name for this event definition (computer friendly) Name *datatypes_go_proto.String `protobuf:"bytes,13,opt,name=name,proto3" json:"name,omitempty"` // Name for this event definition (human friendly) Title *datatypes_go_proto.String `protobuf:"bytes,14,opt,name=title,proto3" json:"title,omitempty"` // Subordinate title of the event definition Subtitle *datatypes_go_proto.String `protobuf:"bytes,15,opt,name=subtitle,proto3" json:"subtitle,omitempty"` Status *EventDefinition_StatusCode `protobuf:"bytes,16,opt,name=status,proto3" json:"status,omitempty"` // For testing purposes, not real usage Experimental *datatypes_go_proto.Boolean `protobuf:"bytes,17,opt,name=experimental,proto3" json:"experimental,omitempty"` Subject *EventDefinition_SubjectX `protobuf:"bytes,18,opt,name=subject,proto3" json:"subject,omitempty"` // Date last changed Date *datatypes_go_proto.DateTime `protobuf:"bytes,19,opt,name=date,proto3" json:"date,omitempty"` // Name of the publisher (organization or individual) Publisher *datatypes_go_proto.String `protobuf:"bytes,20,opt,name=publisher,proto3" json:"publisher,omitempty"` // Contact details for the publisher Contact []*datatypes_go_proto.ContactDetail `protobuf:"bytes,21,rep,name=contact,proto3" json:"contact,omitempty"` // Natural language description of the event definition Description *datatypes_go_proto.Markdown `protobuf:"bytes,22,opt,name=description,proto3" json:"description,omitempty"` // The context that the content is intended to support UseContext []*datatypes_go_proto.UsageContext `protobuf:"bytes,23,rep,name=use_context,json=useContext,proto3" json:"use_context,omitempty"` // Intended jurisdiction for event definition (if applicable) Jurisdiction []*datatypes_go_proto.CodeableConcept `protobuf:"bytes,24,rep,name=jurisdiction,proto3" json:"jurisdiction,omitempty"` // Why this event definition is defined Purpose *datatypes_go_proto.Markdown `protobuf:"bytes,25,opt,name=purpose,proto3" json:"purpose,omitempty"` // Describes the clinical usage of the event definition Usage *datatypes_go_proto.String `protobuf:"bytes,26,opt,name=usage,proto3" json:"usage,omitempty"` // Use and/or publishing restrictions Copyright *datatypes_go_proto.Markdown `protobuf:"bytes,27,opt,name=copyright,proto3" json:"copyright,omitempty"` // When the event definition was approved by publisher ApprovalDate *datatypes_go_proto.Date `protobuf:"bytes,28,opt,name=approval_date,json=approvalDate,proto3" json:"approval_date,omitempty"` // When the event definition was last reviewed LastReviewDate *datatypes_go_proto.Date `protobuf:"bytes,29,opt,name=last_review_date,json=lastReviewDate,proto3" json:"last_review_date,omitempty"` // When the event definition is expected to be used EffectivePeriod *datatypes_go_proto.Period `protobuf:"bytes,30,opt,name=effective_period,json=effectivePeriod,proto3" json:"effective_period,omitempty"` // E.g. Education, Treatment, Assessment, etc. Topic []*datatypes_go_proto.CodeableConcept `protobuf:"bytes,31,rep,name=topic,proto3" json:"topic,omitempty"` // Who authored the content Author []*datatypes_go_proto.ContactDetail `protobuf:"bytes,32,rep,name=author,proto3" json:"author,omitempty"` // Who edited the content Editor []*datatypes_go_proto.ContactDetail `protobuf:"bytes,33,rep,name=editor,proto3" json:"editor,omitempty"` // Who reviewed the content Reviewer []*datatypes_go_proto.ContactDetail `protobuf:"bytes,34,rep,name=reviewer,proto3" json:"reviewer,omitempty"` // Who endorsed the content Endorser []*datatypes_go_proto.ContactDetail `protobuf:"bytes,35,rep,name=endorser,proto3" json:"endorser,omitempty"` // Additional documentation, citations, etc. RelatedArtifact []*datatypes_go_proto.RelatedArtifact `protobuf:"bytes,36,rep,name=related_artifact,json=relatedArtifact,proto3" json:"related_artifact,omitempty"` // "when" the event occurs (multiple = 'or') Trigger []*datatypes_go_proto.TriggerDefinition `protobuf:"bytes,37,rep,name=trigger,proto3" json:"trigger,omitempty"` } func (x *EventDefinition) Reset() { *x = EventDefinition{} if protoimpl.UnsafeEnabled { mi := &file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *EventDefinition) String() string { return protoimpl.X.MessageStringOf(x) } func (*EventDefinition) ProtoMessage() {} func (x *EventDefinition) ProtoReflect() protoreflect.Message { mi := &file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use EventDefinition.ProtoReflect.Descriptor instead. func (*EventDefinition) Descriptor() ([]byte, []int) { return file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescGZIP(), []int{0} } func (x *EventDefinition) GetId() *datatypes_go_proto.Id { if x != nil { return x.Id } return nil } func (x *EventDefinition) GetMeta() *datatypes_go_proto.Meta { if x != nil { return x.Meta } return nil } func (x *EventDefinition) GetImplicitRules() *datatypes_go_proto.Uri { if x != nil { return x.ImplicitRules } return nil } func (x *EventDefinition) GetLanguage() *datatypes_go_proto.Code { if x != nil { return x.Language } return nil } func (x *EventDefinition) GetText() *datatypes_go_proto.Narrative { if x != nil { return x.Text } return nil } func (x *EventDefinition) GetContained() []*any.Any { if x != nil { return x.Contained } return nil } func (x *EventDefinition) GetExtension() []*datatypes_go_proto.Extension { if x != nil { return x.Extension } return nil } func (x *EventDefinition) GetModifierExtension() []*datatypes_go_proto.Extension { if x != nil { return x.ModifierExtension } return nil } func (x *EventDefinition) GetUrl() *datatypes_go_proto.Uri { if x != nil { return x.Url } return nil } func (x *EventDefinition) GetIdentifier() []*datatypes_go_proto.Identifier { if x != nil { return x.Identifier } return nil } func (x *EventDefinition) GetVersion() *datatypes_go_proto.String { if x != nil { return x.Version } return nil } func (x *EventDefinition) GetName() *datatypes_go_proto.String { if x != nil { return x.Name } return nil } func (x *EventDefinition) GetTitle() *datatypes_go_proto.String { if x != nil { return x.Title } return nil } func (x *EventDefinition) GetSubtitle() *datatypes_go_proto.String { if x != nil { return x.Subtitle } return nil } func (x *EventDefinition) GetStatus() *EventDefinition_StatusCode { if x != nil { return x.Status } return nil } func (x *EventDefinition) GetExperimental() *datatypes_go_proto.Boolean { if x != nil { return x.Experimental } return nil } func (x *EventDefinition) GetSubject() *EventDefinition_SubjectX { if x != nil { return x.Subject } return nil } func (x *EventDefinition) GetDate() *datatypes_go_proto.DateTime { if x != nil { return x.Date } return nil } func (x *EventDefinition) GetPublisher() *datatypes_go_proto.String { if x != nil { return x.Publisher } return nil } func (x *EventDefinition) GetContact() []*datatypes_go_proto.ContactDetail { if x != nil { return x.Contact } return nil } func (x *EventDefinition) GetDescription() *datatypes_go_proto.Markdown { if x != nil { return x.Description } return nil } func (x *EventDefinition) GetUseContext() []*datatypes_go_proto.UsageContext { if x != nil { return x.UseContext } return nil } func (x *EventDefinition) GetJurisdiction() []*datatypes_go_proto.CodeableConcept { if x != nil { return x.Jurisdiction } return nil } func (x *EventDefinition) GetPurpose() *datatypes_go_proto.Markdown { if x != nil { return x.Purpose } return nil } func (x *EventDefinition) GetUsage() *datatypes_go_proto.String { if x != nil { return x.Usage } return nil } func (x *EventDefinition) GetCopyright() *datatypes_go_proto.Markdown { if x != nil { return x.Copyright } return nil } func (x *EventDefinition) GetApprovalDate() *datatypes_go_proto.Date { if x != nil { return x.ApprovalDate } return nil } func (x *EventDefinition) GetLastReviewDate() *datatypes_go_proto.Date { if x != nil { return x.LastReviewDate } return nil } func (x *EventDefinition) GetEffectivePeriod() *datatypes_go_proto.Period { if x != nil { return x.EffectivePeriod } return nil } func (x *EventDefinition) GetTopic() []*datatypes_go_proto.CodeableConcept { if x != nil { return x.Topic } return nil } func (x *EventDefinition) GetAuthor() []*datatypes_go_proto.ContactDetail { if x != nil { return x.Author } return nil } func (x *EventDefinition) GetEditor() []*datatypes_go_proto.ContactDetail { if x != nil { return x.Editor } return nil } func (x *EventDefinition) GetReviewer() []*datatypes_go_proto.ContactDetail { if x != nil { return x.Reviewer } return nil } func (x *EventDefinition) GetEndorser() []*datatypes_go_proto.ContactDetail { if x != nil { return x.Endorser } return nil } func (x *EventDefinition) GetRelatedArtifact() []*datatypes_go_proto.RelatedArtifact { if x != nil { return x.RelatedArtifact } return nil } func (x *EventDefinition) GetTrigger() []*datatypes_go_proto.TriggerDefinition { if x != nil { return x.Trigger } return nil } // draft | active | retired | unknown type EventDefinition_StatusCode struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Value codes_go_proto.PublicationStatusCode_Value `protobuf:"varint,1,opt,name=value,proto3,enum=google.fhir.r5.core.PublicationStatusCode_Value" json:"value,omitempty"` Id *datatypes_go_proto.String `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` Extension []*datatypes_go_proto.Extension `protobuf:"bytes,3,rep,name=extension,proto3" json:"extension,omitempty"` } func (x *EventDefinition_StatusCode) Reset() { *x = EventDefinition_StatusCode{} if protoimpl.UnsafeEnabled { mi := &file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *EventDefinition_StatusCode) String() string { return protoimpl.X.MessageStringOf(x) } func (*EventDefinition_StatusCode) ProtoMessage() {} func (x *EventDefinition_StatusCode) ProtoReflect() protoreflect.Message { mi := &file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use EventDefinition_StatusCode.ProtoReflect.Descriptor instead. func (*EventDefinition_StatusCode) Descriptor() ([]byte, []int) { return file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescGZIP(), []int{0, 0} } func (x *EventDefinition_StatusCode) GetValue() codes_go_proto.PublicationStatusCode_Value { if x != nil { return x.Value } return codes_go_proto.PublicationStatusCode_INVALID_UNINITIALIZED } func (x *EventDefinition_StatusCode) GetId() *datatypes_go_proto.String { if x != nil { return x.Id } return nil } func (x *EventDefinition_StatusCode) GetExtension() []*datatypes_go_proto.Extension { if x != nil { return x.Extension } return nil } // Type of individual the event definition is focused on type EventDefinition_SubjectX struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Choice: // *EventDefinition_SubjectX_CodeableConcept // *EventDefinition_SubjectX_Reference Choice isEventDefinition_SubjectX_Choice `protobuf_oneof:"choice"` } func (x *EventDefinition_SubjectX) Reset() { *x = EventDefinition_SubjectX{} if protoimpl.UnsafeEnabled { mi := &file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *EventDefinition_SubjectX) String() string { return protoimpl.X.MessageStringOf(x) } func (*EventDefinition_SubjectX) ProtoMessage() {} func (x *EventDefinition_SubjectX) ProtoReflect() protoreflect.Message { mi := &file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use EventDefinition_SubjectX.ProtoReflect.Descriptor instead. func (*EventDefinition_SubjectX) Descriptor() ([]byte, []int) { return file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescGZIP(), []int{0, 1} } func (m *EventDefinition_SubjectX) GetChoice() isEventDefinition_SubjectX_Choice { if m != nil { return m.Choice } return nil } func (x *EventDefinition_SubjectX) GetCodeableConcept() *datatypes_go_proto.CodeableConcept { if x, ok := x.GetChoice().(*EventDefinition_SubjectX_CodeableConcept); ok { return x.CodeableConcept } return nil } func (x *EventDefinition_SubjectX) GetReference() *datatypes_go_proto.Reference { if x, ok := x.GetChoice().(*EventDefinition_SubjectX_Reference); ok { return x.Reference } return nil } type isEventDefinition_SubjectX_Choice interface { isEventDefinition_SubjectX_Choice() } type EventDefinition_SubjectX_CodeableConcept struct { CodeableConcept *datatypes_go_proto.CodeableConcept `protobuf:"bytes,1,opt,name=codeable_concept,json=codeableConcept,proto3,oneof"` } type EventDefinition_SubjectX_Reference struct { Reference *datatypes_go_proto.Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` } func (*EventDefinition_SubjectX_CodeableConcept) isEventDefinition_SubjectX_Choice() {} func (*EventDefinition_SubjectX_Reference) isEventDefinition_SubjectX_Choice() {} var File_proto_google_fhir_proto_r5_core_resources_event_definition_proto protoreflect.FileDescriptor var file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDesc = []byte{ 0x0a, 0x40, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x35, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x35, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x35, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x16, 0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x0e, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x72, 0x69, 0x52, 0x0d, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x12,<|fim▁hole|> 0x6f, 0x72, 0x65, 0x2e, 0x4e, 0x61, 0x72, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x32, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4d, 0x0a, 0x12, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x72, 0x69, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x3f, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x4f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x06, 0xf0, 0xd0, 0x87, 0xeb, 0x04, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x40, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12, 0x47, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x58, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x48, 0x0a, 0x0c, 0x6a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x70, 0x74, 0x52, 0x0c, 0x6a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x07, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x07, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x09, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x09, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x6c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x44, 0x61, 0x74, 0x65, 0x12, 0x46, 0x0a, 0x10, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x0f, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x3a, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x70, 0x74, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x3a, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x20, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x3a, 0x0a, 0x06, 0x65, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x21, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x65, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x18, 0x22, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x72, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x10, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x18, 0x24, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x0f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x48, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x25, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0xf0, 0xd0, 0x87, 0xeb, 0x04, 0x01, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x1a, 0xae, 0x02, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x46, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2b, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x6d, 0xc0, 0x9f, 0xe3, 0xb6, 0x05, 0x01, 0x8a, 0xf9, 0x83, 0xb2, 0x05, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x68, 0x6c, 0x37, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x9a, 0xb5, 0x8e, 0x93, 0x06, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x68, 0x6c, 0x37, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x1a, 0xbc, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x58, 0x12, 0x51, 0x0a, 0x10, 0x63, 0x6f, 0x64, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x65, 0x70, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x70, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x63, 0x6f, 0x64, 0x65, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x63, 0x65, 0x70, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x0b, 0xf2, 0xff, 0xfc, 0xc2, 0x06, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x3a, 0x06, 0xa0, 0x83, 0x83, 0xe8, 0x06, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x3a, 0x73, 0xc0, 0x9f, 0xe3, 0xb6, 0x05, 0x03, 0xb2, 0xfe, 0xe4, 0x97, 0x06, 0x37, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x68, 0x6c, 0x37, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x9a, 0x86, 0x93, 0xa0, 0x08, 0x2a, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x28, 0x27, 0x5b, 0x41, 0x2d, 0x5a, 0x5d, 0x28, 0x5b, 0x41, 0x2d, 0x5a, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x29, 0x7b, 0x30, 0x2c, 0x32, 0x35, 0x34, 0x7d, 0x27, 0x29, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x42, 0x80, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x50, 0x01, 0x5a, 0x5d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x66, 0x68, 0x69, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x35, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x67, 0x6f, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x98, 0xc6, 0xb0, 0xb5, 0x07, 0x05, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescOnce sync.Once file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescData = file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDesc ) func file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescGZIP() []byte { file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescOnce.Do(func() { file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescData) }) return file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDescData } var file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_goTypes = []interface{}{ (*EventDefinition)(nil), // 0: google.fhir.r5.core.EventDefinition (*EventDefinition_StatusCode)(nil), // 1: google.fhir.r5.core.EventDefinition.StatusCode (*EventDefinition_SubjectX)(nil), // 2: google.fhir.r5.core.EventDefinition.SubjectX (*datatypes_go_proto.Id)(nil), // 3: google.fhir.r5.core.Id (*datatypes_go_proto.Meta)(nil), // 4: google.fhir.r5.core.Meta (*datatypes_go_proto.Uri)(nil), // 5: google.fhir.r5.core.Uri (*datatypes_go_proto.Code)(nil), // 6: google.fhir.r5.core.Code (*datatypes_go_proto.Narrative)(nil), // 7: google.fhir.r5.core.Narrative (*any.Any)(nil), // 8: google.protobuf.Any (*datatypes_go_proto.Extension)(nil), // 9: google.fhir.r5.core.Extension (*datatypes_go_proto.Identifier)(nil), // 10: google.fhir.r5.core.Identifier (*datatypes_go_proto.String)(nil), // 11: google.fhir.r5.core.String (*datatypes_go_proto.Boolean)(nil), // 12: google.fhir.r5.core.Boolean (*datatypes_go_proto.DateTime)(nil), // 13: google.fhir.r5.core.DateTime (*datatypes_go_proto.ContactDetail)(nil), // 14: google.fhir.r5.core.ContactDetail (*datatypes_go_proto.Markdown)(nil), // 15: google.fhir.r5.core.Markdown (*datatypes_go_proto.UsageContext)(nil), // 16: google.fhir.r5.core.UsageContext (*datatypes_go_proto.CodeableConcept)(nil), // 17: google.fhir.r5.core.CodeableConcept (*datatypes_go_proto.Date)(nil), // 18: google.fhir.r5.core.Date (*datatypes_go_proto.Period)(nil), // 19: google.fhir.r5.core.Period (*datatypes_go_proto.RelatedArtifact)(nil), // 20: google.fhir.r5.core.RelatedArtifact (*datatypes_go_proto.TriggerDefinition)(nil), // 21: google.fhir.r5.core.TriggerDefinition (codes_go_proto.PublicationStatusCode_Value)(0), // 22: google.fhir.r5.core.PublicationStatusCode.Value (*datatypes_go_proto.Reference)(nil), // 23: google.fhir.r5.core.Reference } var file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_depIdxs = []int32{ 3, // 0: google.fhir.r5.core.EventDefinition.id:type_name -> google.fhir.r5.core.Id 4, // 1: google.fhir.r5.core.EventDefinition.meta:type_name -> google.fhir.r5.core.Meta 5, // 2: google.fhir.r5.core.EventDefinition.implicit_rules:type_name -> google.fhir.r5.core.Uri 6, // 3: google.fhir.r5.core.EventDefinition.language:type_name -> google.fhir.r5.core.Code 7, // 4: google.fhir.r5.core.EventDefinition.text:type_name -> google.fhir.r5.core.Narrative 8, // 5: google.fhir.r5.core.EventDefinition.contained:type_name -> google.protobuf.Any 9, // 6: google.fhir.r5.core.EventDefinition.extension:type_name -> google.fhir.r5.core.Extension 9, // 7: google.fhir.r5.core.EventDefinition.modifier_extension:type_name -> google.fhir.r5.core.Extension 5, // 8: google.fhir.r5.core.EventDefinition.url:type_name -> google.fhir.r5.core.Uri 10, // 9: google.fhir.r5.core.EventDefinition.identifier:type_name -> google.fhir.r5.core.Identifier 11, // 10: google.fhir.r5.core.EventDefinition.version:type_name -> google.fhir.r5.core.String 11, // 11: google.fhir.r5.core.EventDefinition.name:type_name -> google.fhir.r5.core.String 11, // 12: google.fhir.r5.core.EventDefinition.title:type_name -> google.fhir.r5.core.String 11, // 13: google.fhir.r5.core.EventDefinition.subtitle:type_name -> google.fhir.r5.core.String 1, // 14: google.fhir.r5.core.EventDefinition.status:type_name -> google.fhir.r5.core.EventDefinition.StatusCode 12, // 15: google.fhir.r5.core.EventDefinition.experimental:type_name -> google.fhir.r5.core.Boolean 2, // 16: google.fhir.r5.core.EventDefinition.subject:type_name -> google.fhir.r5.core.EventDefinition.SubjectX 13, // 17: google.fhir.r5.core.EventDefinition.date:type_name -> google.fhir.r5.core.DateTime 11, // 18: google.fhir.r5.core.EventDefinition.publisher:type_name -> google.fhir.r5.core.String 14, // 19: google.fhir.r5.core.EventDefinition.contact:type_name -> google.fhir.r5.core.ContactDetail 15, // 20: google.fhir.r5.core.EventDefinition.description:type_name -> google.fhir.r5.core.Markdown 16, // 21: google.fhir.r5.core.EventDefinition.use_context:type_name -> google.fhir.r5.core.UsageContext 17, // 22: google.fhir.r5.core.EventDefinition.jurisdiction:type_name -> google.fhir.r5.core.CodeableConcept 15, // 23: google.fhir.r5.core.EventDefinition.purpose:type_name -> google.fhir.r5.core.Markdown 11, // 24: google.fhir.r5.core.EventDefinition.usage:type_name -> google.fhir.r5.core.String 15, // 25: google.fhir.r5.core.EventDefinition.copyright:type_name -> google.fhir.r5.core.Markdown 18, // 26: google.fhir.r5.core.EventDefinition.approval_date:type_name -> google.fhir.r5.core.Date 18, // 27: google.fhir.r5.core.EventDefinition.last_review_date:type_name -> google.fhir.r5.core.Date 19, // 28: google.fhir.r5.core.EventDefinition.effective_period:type_name -> google.fhir.r5.core.Period 17, // 29: google.fhir.r5.core.EventDefinition.topic:type_name -> google.fhir.r5.core.CodeableConcept 14, // 30: google.fhir.r5.core.EventDefinition.author:type_name -> google.fhir.r5.core.ContactDetail 14, // 31: google.fhir.r5.core.EventDefinition.editor:type_name -> google.fhir.r5.core.ContactDetail 14, // 32: google.fhir.r5.core.EventDefinition.reviewer:type_name -> google.fhir.r5.core.ContactDetail 14, // 33: google.fhir.r5.core.EventDefinition.endorser:type_name -> google.fhir.r5.core.ContactDetail 20, // 34: google.fhir.r5.core.EventDefinition.related_artifact:type_name -> google.fhir.r5.core.RelatedArtifact 21, // 35: google.fhir.r5.core.EventDefinition.trigger:type_name -> google.fhir.r5.core.TriggerDefinition 22, // 36: google.fhir.r5.core.EventDefinition.StatusCode.value:type_name -> google.fhir.r5.core.PublicationStatusCode.Value 11, // 37: google.fhir.r5.core.EventDefinition.StatusCode.id:type_name -> google.fhir.r5.core.String 9, // 38: google.fhir.r5.core.EventDefinition.StatusCode.extension:type_name -> google.fhir.r5.core.Extension 17, // 39: google.fhir.r5.core.EventDefinition.SubjectX.codeable_concept:type_name -> google.fhir.r5.core.CodeableConcept 23, // 40: google.fhir.r5.core.EventDefinition.SubjectX.reference:type_name -> google.fhir.r5.core.Reference 41, // [41:41] is the sub-list for method output_type 41, // [41:41] is the sub-list for method input_type 41, // [41:41] is the sub-list for extension type_name 41, // [41:41] is the sub-list for extension extendee 0, // [0:41] is the sub-list for field type_name } func init() { file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_init() } func file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_init() { if File_proto_google_fhir_proto_r5_core_resources_event_definition_proto != nil { return } if !protoimpl.UnsafeEnabled { file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventDefinition); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventDefinition_StatusCode); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventDefinition_SubjectX); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes[2].OneofWrappers = []interface{}{ (*EventDefinition_SubjectX_CodeableConcept)(nil), (*EventDefinition_SubjectX_Reference)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, GoTypes: file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_goTypes, DependencyIndexes: file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_depIdxs, MessageInfos: file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_msgTypes, }.Build() File_proto_google_fhir_proto_r5_core_resources_event_definition_proto = out.File file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_rawDesc = nil file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_goTypes = nil file_proto_google_fhir_proto_r5_core_resources_event_definition_proto_depIdxs = nil }<|fim▁end|>
0x32, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x66, 0x68, 0x69, 0x72, 0x2e, 0x72, 0x35, 0x2e, 0x63,
<|file_name|>capsule.rs<|end_file_name|><|fim▁begin|>/* diosix capsule management * * (c) Chris Williams, 2019-2021. * * See LICENSE for usage and copying. */ use core::sync::atomic::{AtomicUsize, Ordering}; use super::lock::Mutex; use hashbrown::hash_map::HashMap; use hashbrown::hash_map::Entry::{Occupied, Vacant}; use hashbrown::hash_set::HashSet; use alloc::vec::Vec; use alloc::string::{String, ToString}; use platform::cpu::{Entry, CPUcount}; use platform::physmem::PhysMemBase; use super::error::Cause; use super::physmem; use super::virtmem::Mapping; use super::vcore::{self, Priority, VirtualCoreID}; use super::service::{self, ServiceType, SelectService}; use super::pcore; use super::hardware; use super::debug; pub type CapsuleID = usize; /* arbitrarily allow up to CAPSULES_MAX capsules in a system at any one time */ const CAPSULES_MAX: usize = 1000000; /* needed to assign system-wide unique capsule ID numbers */ lazy_static! { static ref CAPSULE_ID_NEXT: AtomicUsize = AtomicUsize::new(0); } /* maintain a shared table of capsules and linked data */ lazy_static! { /* acquire CAPSULES lock before accessing any capsules */ static ref CAPSULES: Mutex<HashMap<CapsuleID, Capsule>> = Mutex::new("capsule ID table", HashMap::new()); /* set of capsules to restart */ static ref TO_RESTART: Mutex<HashSet<CapsuleID>> = Mutex::new("capsule restart list", HashSet::new()); /* maintain collective input and output system console buffers for capsules. the console system service capsule (ServiceConsole) will read from STDOUT to display capsules' text, and will write to STDIN to inject characters into capsules */ static ref STDIN: Mutex<HashMap<CapsuleID, Vec<char>>> = Mutex::new("capsule STDIN table", HashMap::new()); static ref STDOUT: Mutex<HashMap<CapsuleID, Vec<char>>> = Mutex::new("capsule STDOUT table", HashMap::new()); } /* perform housekeeping duties on idle physical CPU cores */ macro_rules! capsulehousekeeper { () => ($crate::capsule::restart_awaiting()); } /* empty the waiting list of capsules to restart and recreate their vcores */ pub fn restart_awaiting() { for cid in TO_RESTART.lock().drain() { if let Some(c) = CAPSULES.lock().get_mut(&cid) { /* capsule is ready to roll again, call this before injecting virtual cores into the scheduling queues */ c.set_state_valid(); /* TODO: if the capsule is corrupt, it'll crash again. support a hard reset if the capsule can't start */ for (vid, params) in c.iter_init() { if let Err(_e) = add_vcore(cid, *vid, params.entry, params.dtb, params.prio) { hvalert!("Failed to restart capsule {} vcore {}: {:?}", cid, vid, _e); } } } } } #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum CapsuleState { Valid, /* ok to run */ Dying, /* remove vcores and kill when there are none left */ Restarting /* remove vcores and recreate vcores with initial params */ } /* record the initialization parameters for a virtual core so it can be recreated and restarted */ pub struct VcoreInit { entry: Entry, dtb: PhysMemBase, prio: Priority } #[derive(PartialEq, Eq, Hash, Debug)] pub enum CapsuleProperty { AutoCrashRestart, /* restart this capsule when it crashes */ ServiceConsole, /* allow capsule to handle abstracted system console */ ConsoleWrite, /* allow capsule to write out to the console */ ConsoleRead, /* allow capsule to read the console */ HvLogRead /* allow capsule to read the hypervisor's debug log */ } impl CapsuleProperty { /* return true if this property allows the capsule to run the given service type */ pub fn match_service(&self, stype: ServiceType) -> bool { match (self, stype) { (CapsuleProperty::ServiceConsole, ServiceType::ConsoleInterface) => true, (_, _) => false } } /* convert a property string into an CapsuleProperty, or None if not possible */ pub fn string_to_property(property: &String) -> Option<CapsuleProperty> { /* restart the capsule if it crashes (as opposed to exits cleanly) */ if property.eq_ignore_ascii_case("auto_crash_restart") { return Some(CapsuleProperty::AutoCrashRestart); } /* console related properties */ if property.eq_ignore_ascii_case("service_console") { return Some(CapsuleProperty::ServiceConsole); } if property.eq_ignore_ascii_case("console_write") { return Some(CapsuleProperty::ConsoleWrite); } if property.eq_ignore_ascii_case("console_read") { return Some(CapsuleProperty::ConsoleRead); } if property.eq_ignore_ascii_case("hv_log_read") { return Some(CapsuleProperty::HvLogRead); } None } } struct Capsule { state: CapsuleState, /* define whether this capsule is alive, dying or restarting */ properties: HashSet<CapsuleProperty>, /* set of properties and rights assigned to this capsule */ max_vpcus: CPUcount, vcores: HashSet<VirtualCoreID>, /* set of virtual core IDs assigned to this capsule */ init: HashMap<VirtualCoreID, VcoreInit>, /* map of vcore IDs to vcore initialization paramters */ memory: Vec<Mapping>, /* map capsule supervisor virtual addresses to host physical addresses */ } impl Capsule { /* create a new empty capsule using the current capsule on this physical CPU core. => properties = properties granted to this capsules, or None max_vpcus = maximum virtual CPU cores for this capsule <= capsule object, or error code */ pub fn new(property_strings: Option<Vec<String>>, max_vpcus: CPUcount) -> Result<Capsule, Cause> { /* turn a possible list of property strings into list of official properties */ let mut properties = HashSet::new(); if let Some(property_strings) = property_strings { for string in property_strings { if let Some(prop) = CapsuleProperty::string_to_property(&string) { properties.insert(prop); } } } Ok(Capsule { state: CapsuleState::Valid, properties, max_vpcus, vcores: HashSet::new(), init: HashMap::new(), memory: Vec::new() }) } /* add a mapping to this capsule */ pub fn set_memory_mapping(&mut self, to_add: Mapping) { self.memory.push(to_add); } /* get a copy of the capsule's memory mappings */ pub fn get_memory_mappings(&self) -> Vec<Mapping> { self.memory.clone() } /* returns true if property is present for this capsule, or false if not */ pub fn has_property(&self, property: CapsuleProperty) -> bool { self.properties.contains(&property) } /* return the maximum number of virtual cores allowed by this capsule */ pub fn get_max_vcores(&self) -> CPUcount { self.max_vpcus } /* add a virtual core ID to the capsule. Return error code on failure */ pub fn add_vcore(&mut self, id: VirtualCoreID) -> Result<(), Cause> { if self.vcores.len() < self.max_vpcus { self.vcores.insert(id); return Ok(()); } Err(Cause::CapsuleMaxVCores) } /* add a virtual core's initialization parameters to the capsule */ pub fn add_init(&mut self, vid: VirtualCoreID, entry: Entry, dtb: PhysMemBase, prio: Priority) { self.init.insert(vid, VcoreInit { entry, dtb, prio }); } pub fn iter_init(&self) -> hashbrown::hash_map::Iter<'_, VirtualCoreID, VcoreInit> { self.init.iter() } /* remove a virtual core ID from the capsule's list */ pub fn remove_vcore(&mut self, id: VirtualCoreID) { self.vcores.remove(&id); } /* return number of registered virtual cores */ pub fn count_vcores(&self) -> usize { self.vcores.len() } /* check whether this capsule is allowed to register the given service <= true if allowed, false if not */ pub fn can_offer_service(&self, stype: ServiceType) -> bool { for property in &self.properties { if property.match_service(stype) == true { return true; } } false } /* return this capsule's state */ pub fn get_state(&self) -> &CapsuleState { &self.state } /* mark this capsule as dying. returns true if this is possible. only valid or dying capsules can die */ pub fn set_state_dying(&mut self) -> bool { match self.state { CapsuleState::Dying => (), CapsuleState::Valid => self.state = CapsuleState::Dying, _ => return false } true } /* mark this capsule as restarting. returns true if this is possible. only valid or restarting capsules can restart */ pub fn set_state_restarting(&mut self) -> bool { match self.state { CapsuleState::Restarting => (), CapsuleState::Valid => self.state = CapsuleState::Restarting, _ => return false } true } /* mark the capsule's state as valid */ pub fn set_state_valid(&mut self) { self.state = CapsuleState::Valid; } } /* handle the destruction of a capsule */ impl Drop for Capsule { fn drop(&mut self) { /* free up memory... */ for mapping in self.memory.clone() { if let Some(r) = mapping.get_physical() { match physmem::dealloc_region(r) { Err(e) => hvalert!("Error during capsule {:p} teardown: {:?}", &self, e), Ok(_) => () }; } } } } /* create a virtual core and add it to the given capsule => cid = capsule ID vid = virtual core ID entry = starting address for execution of this virtual core dtb = physical address of the device tree blob describing the virtual hardware environment prio = priority to run this virtual core <= return Ok for success, or error code */ pub fn add_vcore(cid: CapsuleID, vid: VirtualCoreID, entry: Entry, dtb: PhysMemBase, prio: Priority) -> Result<(), Cause> { match CAPSULES.lock().get_mut(&cid) { Some(c) => { vcore::VirtualCore::create(cid, vid, entry, dtb, prio)?; /* register the vcore ID and stash its init params */ c.add_vcore(vid)?; c.add_init(vid, entry, dtb, prio); }, None => return Err(Cause::CapsuleBadID) }; Ok(()) } /* create a new blank capsule Once created, it needs to be given a supervisor image, at least. then it is ready to be scheduled by assigning it virtual CPU cores. => properties = array of properties to apply to this capsule, or None max_vcores = maximum number virtual cores in this capsule <= CapsuleID for this new capsule, or an error code */ pub fn create(properties: Option<Vec<String>>, max_vcores: CPUcount) -> Result<CapsuleID, Cause> { /* repeatedly try to generate an available ID */ loop { /* bail out if we're at the limit */ let mut capsules = CAPSULES.lock(); if capsules.len() > CAPSULES_MAX { return Err(Cause::CapsuleIDExhaustion); } /* get next ID and check to see if this capsule already exists */ let new_id = CAPSULE_ID_NEXT.fetch_add(1, Ordering::SeqCst); match capsules.entry(new_id) { Vacant(_) => { /* insert our new capsule */ capsules.insert(new_id, Capsule::new(properties, max_vcores)?); /* we're all done here */ return Ok(new_id); }, _ => () /* try again */ }; } } /* destroy the given virtualcore within the given capsule. when the capsule is out of vcores, destroy it. see destroy_current() for more details */ fn destroy(cid: CapsuleID, vid: VirtualCoreID) -> Result<(), Cause> { /* make sure this capsule is dying */ let mut lock = CAPSULES.lock(); if let Some(victim) = CAPSULES.lock().get_mut(&cid) { match victim.set_state_dying() { true => { /* remove this current vcore ID from the capsule's hash table. also mark the vcore as doomed, meaning it will be dropped when it's context switched out */ victim.remove_vcore(vid); pcore::PhysicalCore::this().doom_vcore(); /* are there any vcores remaining? */ if victim.count_vcores() == 0 { /* if not then deregister any and all services belonging to this capsule */ service::deregister(SelectService::AllServices, cid)?; /* next, remove this capsule from the global hash table, which should trigger the final teardown via drop */ lock.remove(&cid); hvdebug!("Completed termination of capsule {}", cid); } return Ok(()); }, false => return Err(Cause::CapsuleCantDie) } } else { Err(Cause::CapsuleBadID) } } /* mark the currently running capsule as dying, or continue to kill off the capsule. each vcore should call this when it realizes the capsule is dying so that the current vcore can be removed. it can be called multiple times per vcore. when there are no vcores left, its RAM and any other resources will be deallocated. when the vcore count drops to zero, it will drop. it's on the caller of destroy_capsule() to reschedule another vcore to run. <= Ok for success, or an error code */ pub fn destroy_current() -> Result<(), Cause> { let (cid, vid) = match pcore::PhysicalCore::this().get_virtualcore_id() { Some(id) => (id.capsuleid, id.vcoreid), None => { hvalert!("BUG: Can't find currently running capsule to destroy"); return Err(Cause::CapsuleBadID); } }; destroy(cid, vid) } /* remove the given virtual core from the capsule and mark it as restarting. see restart_current() for more details */ fn restart(cid: CapsuleID, vid: VirtualCoreID) -> Result<(), Cause> { /* make sure this capsule is restarting */ let mut lock = CAPSULES.lock(); if let Some(victim) = lock.get_mut(&cid) { match victim.set_state_restarting() { true => { /* remove this current vcore ID from the capsule's hash table. also mark the vcore as doomed, meaning it will be dropped when it's context switched out */ victim.remove_vcore(vid); pcore::PhysicalCore::this().doom_vcore(); /* are there any vcores remaining? */ if victim.count_vcores() == 0 { /* no vcores left so add this capsule to the restart set */ TO_RESTART.lock().insert(cid); } return Ok(()); }, false => return Err(Cause::CapsuleCantRestart) } } else { Err(Cause::CapsuleBadID) } } /* recreate and restart the currently running capsule, if possible. it can be called multiple times per vcore. each vcore should call this within the capsule when it realizes the capsule is restarting. when all vcores have call this function, the capsule will restart proper. it's on the caller of restart_current() to reschedule another vcore to run. <= Ok for success, or an error code */ pub fn restart_current() -> Result<(), Cause> { let (cid, vid) = match pcore::PhysicalCore::this().get_virtualcore_id() { Some(id) => (id.capsuleid, id.vcoreid), None => { hvalert!("BUG: Can't find currently running capsule to restart"); return Err(Cause::CapsuleBadID); } }; restart(cid, vid) } /* return the given capsule's maximum number of virtual cores, identified by ID, or None for not found */ pub fn get_max_vcores(cid: CapsuleID) -> Result<CPUcount, Cause> { match CAPSULES.lock().entry(cid) { Occupied(capsule) => Ok(capsule.get().get_max_vcores()), Vacant(_) => Err(Cause::CapsuleBadID) } } /* return the state of the given capsule, identified by ID, or None for not found */ pub fn get_state(cid: CapsuleID) -> Option<CapsuleState> { match CAPSULES.lock().entry(cid) { Occupied(capsule) => Some(capsule.get().state), Vacant(_) => None } } /* get the current capsule's state, or None if no running capsule */ pub fn get_current_state() -> Option<CapsuleState> { if let Some(cid) = pcore::PhysicalCore::get_capsule_id() { return get_state(cid); } None } /* if the currently running capsule has the given property then return its capsule ID. If not, return an error code. this can be used to gate permissions. only gain the ID of a capsule to use/manipulate if it has the given property */ pub fn get_capsule_id_if_property(property: CapsuleProperty) -> Result<CapsuleID, Cause> { let cid = match pcore::PhysicalCore::get_capsule_id() { Some(id) => id, None => return Err(Cause::CapsuleBadID) }; match CAPSULES.lock().entry(cid) { Occupied(capsule) => match capsule.get().has_property(property) { true => Ok(cid), false => Err(Cause::CapsulePropertyNotFound) }, Vacant(_) => Err(Cause::CapsuleBadID) } } /* return Ok() if currently running capsule has the given property, or an error code. useful for gating access by calling current_has_property(...)?; beforehand */ pub fn current_has_property(property: CapsuleProperty) -> Result<(), Cause> { /* discard cid */ match get_capsule_id_if_property(property) { Ok(_) => Ok(()), Err(e) => Err(e) } } /* return Some(true) if capsule currently running on this physical core is allowed to restart if it's crashed. Some(false) if not, or None if this physical core isn't running a capsule */ pub fn is_current_autorestart() -> Option<bool> { match get_capsule_id_if_property(CapsuleProperty::AutoCrashRestart) { Ok(_) => Some(true), Err(Cause::CapsulePropertyNotFound) => Some(false), Err(_) => None } } /* check whether a capsule is allowed to run the given service => cid = capsule ID to check stype = service to check <= Some true if the capsule exists and is allowed, or Some false if the capsule exists and is not allowed, or None if the capsule doesn't exist */ pub fn is_service_allowed(cid: CapsuleID, stype: ServiceType) -> Result<bool, Cause> { match CAPSULES.lock().entry(cid) { Occupied(c) => Ok(c.get().can_offer_service(stype)), Vacant(_) => Err(Cause::CapsuleBadID) } } /* write a character to the user as the currently running capsule. this will either be buffered and accessed later by the user interface to display to the user, or this is the user interface capsule and we'll pass its output onto the hardware */ pub fn putc(character: char) -> Result<(), Cause> { let cid = match pcore::PhysicalCore::get_capsule_id() { Some(c) => c,<|fim▁hole|> }; /* find the capsule we're going to write into */ match CAPSULES.lock().get_mut(&cid) { Some(capsule) => { /* if this capsule can write straight to the hardware, then use that */ if (*capsule).has_property(CapsuleProperty::ConsoleWrite) { if hardware::write_debug_string(character.to_string().as_str()) == false { return Err(Cause::CapsuleBufferWriteFailed); } } else { /* either add to the capsule's output buffer, or create a new buffer */ let mut stdout = STDOUT.lock(); match stdout.get_mut(&cid) { Some(entry) => entry.push(character), None => { let mut v = Vec::new(); v.push(character); stdout.insert(cid, v); } } } }, None => return Err(Cause::CapsuleBadID) } Ok(()) } /* read a character from the user for the currently running capsule. this will either read from the capsule's buffer that's filled by the user interface capsule, or this is the user interface capsule and we'll read the input from the hardware. this call does not block <= returns read character or an error code */ pub fn getc() -> Result<char, Cause> { let cid = match pcore::PhysicalCore::get_capsule_id() { Some(c) => c, None => return Err(Cause::CapsuleBadID) }; /* find the capsule we're trying to read from */ match CAPSULES.lock().get_mut(&cid) { Some(capsule) => { /* if this capsule can read direct from the hardware, then let it */ if capsule.has_property(CapsuleProperty::ConsoleRead) { return match hardware::read_debug_char() { Some(c) => Ok(c), None => Err(Cause::CapsuleBufferEmpty) }; } else { /* read from the capsule's buffer, or give up */ let mut stdin = STDIN.lock(); if let Occupied(mut entry) = stdin.entry(cid) { let buffer = entry.get_mut(); if buffer.len() > 0 { return Ok(buffer.remove(0)); } } return Err(Cause::CapsuleBufferEmpty); } }, None => return Err(Cause::CapsuleBadID) } } /* write the given character to the given capsule's input buffer. *** the currently running capsule must have the console_write property *** */ pub fn console_putc(character: char, cid: CapsuleID) -> Result<(), Cause> { current_has_property(CapsuleProperty::ConsoleWrite)?; /* make sure the target capsule exists */ match CAPSULES.lock().entry(cid) { Occupied(_) => { /* insert character into capsule's stdin buffer */ let mut stdin = STDIN.lock(); match stdin.entry(cid) { Occupied(mut array) => array.get_mut().push(character), Vacant(fresh) => { let mut array = Vec::new(); array.push(character); fresh.insert(array); } } Ok(()) }, Vacant(_) => Err(Cause::CapsuleBadID) } } /* get the next available character from the capsules' output buffers *** the currently running capsule must have the console_read property *** <= the capsule ID and character read from its buffer, or an error */ pub fn console_getc() -> Result<(char, CapsuleID), Cause> { current_has_property(CapsuleProperty::ConsoleRead)?; /* loop through capsule IDs in stdout hast table in search of a character */ for (cid, array) in STDOUT.lock().iter_mut() { if array.len() > 0 { return Ok((array.remove(0), *cid)); } } Err(Cause::CapsuleBufferEmpty) } /* return a character from the hypervisor's log output, or an error. *** the currently running capsule must have the hv_log_read property *** */ pub fn hypervisor_getc() -> Result<char, Cause> { current_has_property(CapsuleProperty::HvLogRead)?; match debug::get_log_char() { Some(c) => Ok(c), None => Err(Cause::CapsuleBufferEmpty) } } /* add a memory mapping to a capsule cid = ID of capsule to add the mapping to to_map = memory mapping object to add Ok for success, or an error code */ pub fn map_memory(cid: CapsuleID, to_map: Mapping) -> Result<(), Cause> { if let Occupied(mut c) = CAPSULES.lock().entry(cid) { c.get_mut().set_memory_mapping(to_map); return Ok(()); } else { return Err(Cause::CapsuleBadID); } } /* enforce hardware security restrictions for the given capsule. supervisor-level code will only be able to access the physical RAM covered by that assigned to the given capsule. call this when switching to a capsule, so that the previous enforcement is replaced by enforcement of this capsule. => id = capsule to enforce <= true for success, or fail for failure */ pub fn enforce(id: CapsuleID) -> bool { /* this is a filthy hardcode hack that I hate but it's needed for now */ let mut index = 0; match CAPSULES.lock().entry(id) { Occupied(c) => { for mapping in c.get().get_memory_mappings() { if let Some(r) = mapping.get_physical() { if index == 0 { r.grant_access(); } else { hvalert!("BUG: Capsule {} has more than one physical RAM region", id); } index = index + 1; } } return true }, _ => false } }<|fim▁end|>
None => return Err(Cause::CapsuleBadID)
<|file_name|>actions.py<|end_file_name|><|fim▁begin|>def init_actions_(service, args): """ this needs to returns an array of actions representing the depencies between actions. Looks at ACTION_DEPS in this module for an example of what is expected """ # some default logic for simple actions return { 'test': ['install'] } def test(job): """ Tests parsing of a bp with/without default values """ import sys RESULT_OK = 'OK : %s' RESULT_FAILED = 'FAILED : %s' RESULT_ERROR = 'ERROR : %s %%s' % job.service.name model = job.service.model model.data.result = RESULT_OK % job.service.name test_repo_path = j.sal.fs.joinPaths(j.dirs.varDir, 'tmp', 'test_validate_model') sample_bp_path = j.sal.fs.joinPaths('/opt/code/github/jumpscale/jumpscale_core8/tests/samples/test_validate_delete_model_sample.yaml') try: if j.sal.fs.exists(test_repo_path): j.sal.fs.removeDirTree(test_repo_path) test_repo = j.atyourservice.repoCreate(test_repo_path, '[email protected]:0-complexity/ays_automatic_cockpit_based_testing.git') bp_path = j.sal.fs.joinPaths(test_repo.path, 'blueprints', 'test_validate_delete_model_sample.yaml') j.sal.fs.copyFile(j.sal.fs.joinPaths(sample_bp_path), j.sal.fs.joinPaths(test_repo.path, 'blueprints')) test_repo.blueprintExecute(bp_path) action = 'install' role = 'sshkey' instance = 'main' for service in test_repo.servicesFind(actor="%s.*" % role, name=instance): service.scheduleAction(action=action, period=None, log=True, force=False) run = test_repo.runCreate(profile=False, debug=False) run.execute() test_repo.destroy()<|fim▁hole|> model.data.result = RESULT_FAILED % ('Services directory is not deleted') if j.sal.fs.exists(j.sal.fs.joinPaths(test_repo.path, "recipes")): model.data.result = RESULT_FAILED % ('Recipes directory is not deleted') if test_repo.actors: model.data.result = RESULT_FAILED % ('Actors model is not removed') if test_repo.services: model.data.result = RESULT_FAILED % ('Services model is not removed') if not j.core.jobcontroller.db.runs.find(repo=test_repo.model.key): model.data.result = RESULT_FAILED % ('Jobs are deleted after repository destroy') except: model.data.result = RESULT_ERROR % str(sys.exc_info()[:2]) finally: job.service.save()<|fim▁end|>
if j.sal.fs.exists(j.sal.fs.joinPaths(test_repo.path, "actors")): model.data.result = RESULT_FAILED % ('Actors directory is not deleted') if j.sal.fs.exists(j.sal.fs.joinPaths(test_repo.path, "services")):
<|file_name|>snoop.rs<|end_file_name|><|fim▁begin|>//! Snoop plugin that exposes metrics on a local socket. use errors::*; use plugin::*; use metric::*; use std::collections::HashMap; use std::sync::{Mutex, Arc}; use std::net::SocketAddr; use tokio_io::{io, AsyncRead}; use tokio_core::net;<|fim▁hole|>use std::fmt; use serde_json; #[derive(Deserialize, Debug)] struct SnoopInputConfig { bind: Option<SocketAddr>, } #[derive(Debug)] struct SnoopOutput {} fn report_and_discard<E: fmt::Display>(e: E) -> () { info!("An error occured: {}", e); } type Sender = sync::mpsc::UnboundedSender<Message>; impl Output for SnoopOutput { fn setup(&self, ctx: PluginContext) -> Result<Box<OutputInstance>> { let config: SnoopInputConfig = ctx.decode_config()?; let ref mut core = ctx.core.try_borrow_mut()?; let default_addr = "127.0.0.1:8080".parse::<SocketAddr>().map_err(|e| { ErrorKind::Message(e.to_string()) })?; let addr = config.bind.unwrap_or(default_addr); let handle = core.handle(); let socket = net::TcpListener::bind(&addr, &handle)?; let connections: Arc<Mutex<HashMap<SocketAddr, Sender>>> = Arc::new(Mutex::new(HashMap::new())); let hello_connections = connections.clone(); let accept = socket.incoming().map_err(report_and_discard).for_each( move |(socket, addr)| { info!("connect: {}", addr); let (tx, rx) = sync::mpsc::unbounded(); let (reader, writer) = socket.split(); hello_connections .lock() .map_err(report_and_discard)? .insert(addr, tx); let socket_writer = rx.fold(writer, |writer, msg| { let amt = io::write_all(writer, msg); amt.map(|(writer, _m)| writer).map_err(report_and_discard) }).map(|_| ()); let bye_connections = hello_connections.clone(); // read one byte, bur more importantly the future will be notified on disconnects. // TODO: this has the side-effect that anything written by the client will cause it // to be immediately disconnected. let reader = io::read_exact(reader, vec![0; 1]).map(|_| ()).map_err( report_and_discard, ); let conn = reader.select(socket_writer); handle.spawn(conn.then(move |_| { info!("disconnect: {}", addr); bye_connections.lock().map_err(report_and_discard)?.remove( &addr, ); Ok(()) })); Ok(()) }, ); core.handle().spawn(accept); Ok(Box::new(SnoopOutputInstance { id: ctx.id.clone(), connections: connections.clone(), })) } } struct SnoopOutputInstance { id: String, connections: Arc<Mutex<HashMap<SocketAddr, Sender>>>, } #[derive(Serialize)] struct SerializedOutput<'a> { plugin_id: &'a String, metric_id: &'a MetricId, value: &'a f64, } impl OutputInstance for SnoopOutputInstance { fn feed(&self, sample: &Sample) -> Result<()> { let mut c = self.connections.lock()?; // serialize a single output message let bytes = { let serialized = SerializedOutput { plugin_id: &self.id, metric_id: &sample.metric_id, value: &sample.value, }; let mut bytes: Vec<u8> = serde_json::to_string(&serialized)?.into_bytes(); bytes.push('\n' as u8); bytes }; // put in ref-counted data structure to avoid copying to all connections. let out = Message(Arc::new(bytes.into_boxed_slice())); for (_addr, tx) in c.iter_mut() { let _r = tx.unbounded_send(out.clone()).map_err(|_| { ErrorKind::Message("failed to feed".to_owned()) })?; } Ok(()) } } pub fn output() -> Result<Box<Output>> { Ok(Box::new(SnoopOutput {})) } #[derive(Clone)] pub struct Message(Arc<Box<[u8]>>); impl AsRef<[u8]> for Message { fn as_ref(&self) -> &[u8] { let &Message(ref a) = self; &a } }<|fim▁end|>
use futures::{sync, Future}; use futures::stream::Stream; use std::convert::AsRef;
<|file_name|>random_ops.py<|end_file_name|><|fim▁begin|># Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #<|fim▁hole|># distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Datasets for random number generators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.data.ops import dataset_ops from tensorflow.python.data.util import random_seed from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.ops import gen_dataset_ops from tensorflow.python.util.tf_export import tf_export @tf_export("data.experimental.RandomDataset") class RandomDataset(dataset_ops.DatasetSource): """A `Dataset` of pseudorandom values.""" def __init__(self, seed=None): """A `Dataset` of pseudorandom values.""" super(RandomDataset, self).__init__() self._seed, self._seed2 = random_seed.get_seed(seed) def _as_variant_tensor(self): return gen_dataset_ops.random_dataset( seed=self._seed, seed2=self._seed2, **dataset_ops.flat_structure(self)) @property def output_classes(self): return ops.Tensor @property def output_shapes(self): return tensor_shape.scalar() @property def output_types(self): return dtypes.int64<|fim▁end|>
# Unless required by applicable law or agreed to in writing, software
<|file_name|>test_range_filter.py<|end_file_name|><|fim▁begin|># Copyright 2014-2016 Morgan Delahaye-Prat. All Rights Reserved. # # Licensed under the Simplified BSD License (the "License"); # you may not use this file except in compliance with the License. import pytest from hypr.helpers.mini_dsl import Range @pytest.mark.populate(10) class TestIntervalTypes: models = 'SQLiteModel', # interval notation def test_closed_interval(self, model): """Test explicit bound interval.""" ref = [model.one(i) for i in range(2, 7) if model.one(i)] rv = sorted(model.get(id=Range(2, 7))) assert rv == ref def test_right_open(self, model):<|fim▁hole|> rv = sorted(model.get(id=Range(start=7))) assert rv == ref def test_left_open(self, model): """Interval with a maximum value only.""" ref = [model.one(i) for i in range(0, 3) if model.one(i)] rv = sorted(model.get(id=Range(stop=3))) assert rv == ref def test_negation(self, model): """Test negation of an interval.""" ref = sorted(model.get(id=Range(stop=2)) + model.get(id=Range(start=7))) rv = sorted(model.get(id=(False, Range(2, 7)))) assert rv == ref A = Range(10, 20) B = Range(15, 25) A_and_B = Range(15, 20) A_or_B = Range(10, 25) @pytest.mark.populate(30) class TestIntervalCombination: """Test logical operators.""" models = 'SQLiteModel', def test_false(self, model): """Test an interval always false.""" assert model.get(id=(False, Range(0, 100))) == [] def test_true(self, model): """Test an interval always true.""" ref = sorted(model.get()) rv = sorted(model.get(id=Range(0, 100))) assert rv == ref def test_conjunction(self, model): """A ∧ B.""" ref = model.get(id=A_and_B) rv = model.get(id=((True, A, 0), (True, B, 1))) assert sorted(rv) == sorted(ref) def test_disjunction(self, model): """A ∨ B.""" ref = model.get(id=A_or_B) rv = model.get(id=(A, B)) assert sorted(rv) == sorted(ref) def test_nand(self, model): """A ⊼ B encoded as ¬A ∨ ¬B.""" ref = model.get(id=(False, A_and_B)) rv = model.get(id=((False, A), (False, B))) assert sorted(rv) == sorted(ref) def test_nor(self, model): """A ⊽ B encoded as ¬A ∧ ¬B.""" ref = model.get(id=(False, A_or_B)) rv = model.get(id=( (False, A, 0), (False, B, 1) )) assert sorted(rv) == sorted(ref) def test_implication(self, model): """A → B encoded as ¬A ∨ B.""" ref = model.get(id=(False, Range(10, 15))) rv = model.get(id=((False, A), B)) assert sorted(rv) == sorted(ref) def test_converse_implication(self, model): """A ← B encoded as A ∨ ¬B.""" ref = model.get(id=(False, Range(20, 25))) rv = model.get(id=(A, (False, B))) assert sorted(rv) == sorted(ref) def test_xor(self, model): """A ⊕ B encoded as (¬A ∨ ¬B) ∧ (A ∨ B).""" ref = model.get(id=Range(10, 15)) + model.get(id=Range(20, 25)) rv = model.get(id=( (False, A, 0), (False, B, 0), (True, A, 1), (True, B, 1), )) assert sorted(rv) == sorted(ref) def test_biconditional(self, model): """A ↔ B encoded as (¬A ∨ B) ∧ (A ∨ ¬B).""" ref = model.get(id=(False, A_or_B)) + model.get(id=A_and_B) rv = model.get(id=( (False, A, 0), (True, B, 0), (True, A, 1), (False, B, 1), )) assert sorted(rv) == sorted(ref) def test_non_implication(self, model): """A ↛ B encoded as A ∨ ¬B.""" ref = model.get(id=Range(10, 15)) rv = model.get(id=( (True, A, 0), (False, B, 1) )) assert sorted(rv) == sorted(ref) def test_converse_non_implication(self, model): """A ↚ B encoded as ¬A ∨ B.""" ref = model.get(id=Range(20, 25)) rv = model.get(id=( (False, A, 0), (True, B, 1) )) assert sorted(rv) == sorted(ref) @pytest.mark.populate(10) class TestIntervalIntersection: """Test some intersections.""" models = 'SQLiteModel', def test_empty_intersection(self, model): """Empty intersection.""" rv = model.get(id=((True, Range(2, 4), 0), (True, Range(7, 9), 1))) assert sorted(rv) == [] def test_union_without_intersection(self, model): """Union without intersection.""" ref = model.get(id=Range(2, 4)) + model.get(id=Range(7, 9)) rv = model.get(id=(Range(2, 4), Range(7, 9))) assert sorted(rv) == sorted(ref)<|fim▁end|>
"""Interval with a minimum value only.""" ref = [model.one(i) for i in range(7, 100) if model.one(i)]
<|file_name|>imagelookup.go<|end_file_name|><|fim▁begin|>package app import ( "fmt" "sort" "strings" "github.com/fsouza/go-dockerclient" kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" utilerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors" "github.com/golang/glog" "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/dockerregistry" imageapi "github.com/openshift/origin/pkg/image/api" ) type DockerClientResolver struct { Client *docker.Client // Optional, will delegate resolution to the registry if no local // exact matches are found. RegistryResolver Resolver } func (r DockerClientResolver) Resolve(value string) (*ComponentMatch, error) { ref, err := imageapi.ParseDockerImageReference(value) if err != nil { return nil, err } glog.V(4).Infof("checking local Docker daemon for %q", ref.String()) images, err := r.Client.ListImages(docker.ListImagesOptions{}) if err != nil { return nil, err } matches := ScoredComponentMatches{} for _, image := range images { if tags := matchTag(image, value, ref.Registry, ref.Namespace, ref.Name, ref.Tag); len(tags) > 0 { matches = append(matches, tags...) } } sort.Sort(matches) if exact := matches.Exact(); len(exact) > 0 { matches = exact } else { if r.RegistryResolver != nil { match, err := r.RegistryResolver.Resolve(value) switch err.(type) { case nil: return match, nil case ErrNoMatch: // show our partial matches case ErrMultipleMatches: return nil, err default: return nil, err } } } errs := []error{} for i, match := range matches { if match.Image != nil { continue } updated, err := r.lookup(match.Value) if err != nil { errs = append(errs, err) continue } updated.Score = match.Score updated.ImageTag = ref.Tag matches[i] = updated } if len(errs) != 0 { if len(errs) == 1 { err := errs[0] if err == docker.ErrNoSuchImage { return nil, ErrNoMatch{value: value} } return nil, err } return nil, utilerrors.NewAggregate(errs) } switch len(matches) { case 0: return nil, ErrNoMatch{value: value} case 1: return matches[0], nil default: return nil, ErrMultipleMatches{Image: value, Matches: matches} } } func (r DockerClientResolver) lookup(value string) (*ComponentMatch, error) { image, err := r.Client.InspectImage(value) if err != nil { return nil, err } dockerImage := &imageapi.DockerImage{} if err := kapi.Scheme.Convert(image, dockerImage); err != nil { return nil, err } return &ComponentMatch{ Value: value, Argument: fmt.Sprintf("--docker-image=%q", value), Name: value, Description: descriptionFor(dockerImage, value, "local Docker"), Builder: IsBuilderImage(dockerImage), Score: 0.0, Image: dockerImage, }, nil } type DockerRegistryResolver struct { Client dockerregistry.Client AllowInsecure bool } func (r DockerRegistryResolver) Resolve(value string) (*ComponentMatch, error) { ref, err := imageapi.ParseDockerImageReference(value) if err != nil { return nil, err } glog.V(4).Infof("checking Docker registry for %q", ref.String()) connection, err := r.Client.Connect(ref.Registry, r.AllowInsecure) if err != nil { if dockerregistry.IsRegistryNotFound(err) { return nil, ErrNoMatch{value: value} } return nil, ErrNoMatch{value: value, qualifier: fmt.Sprintf("can't connect to %q: %v", ref.Registry, err)} } image, err := connection.ImageByTag(ref.Namespace, ref.Name, ref.Tag) if err != nil { if dockerregistry.IsNotFound(err) { return nil, ErrNoMatch{value: value, qualifier: err.Error()} } return nil, ErrNoMatch{value: value, qualifier: fmt.Sprintf("can't connect to %q: %v", ref.Registry, err)} } if len(ref.Tag) == 0 { ref.Tag = imageapi.DefaultImageTag } glog.V(4).Infof("found image: %#v", image) dockerImage := &imageapi.DockerImage{} if err = kapi.Scheme.Convert(image, dockerImage); err != nil { return nil, err } from := ref.Registry if len(ref.Registry) == 0 { ref.Registry = "Docker Hub" } return &ComponentMatch{ Value: value, Argument: fmt.Sprintf("--docker-image=%q", value), Name: value, Description: descriptionFor(dockerImage, value, from), Builder: IsBuilderImage(dockerImage), Score: 0, Image: dockerImage, ImageTag: ref.Tag, }, nil } func descriptionFor(image *imageapi.DockerImage, value, from string) string { shortID := image.ID if len(shortID) > 7 { shortID = shortID[:7] } parts := []string{fmt.Sprintf("Docker image %q", value), shortID, fmt.Sprintf("from %s", from)} if image.Size > 0 { mb := float64(image.Size) / float64(1024*1024) parts = append(parts, fmt.Sprintf("%f", mb)) } if len(image.Author) > 0 { parts = append(parts, fmt.Sprintf("author %s", image.Author)) } if len(image.Comment) > 0 { parts = append(parts, image.Comment) } return strings.Join(parts, ", ") } func partialScorer(a, b string, prefix bool, partial, none float32) (bool, float32) { switch { case len(a) == 0 && len(b) != 0, len(a) != 0 && len(b) == 0: return true, partial case a != b: if prefix { if strings.HasPrefix(a, b) || strings.HasPrefix(b, a) { return true, partial } } return false, none default: return true, 0.0 } } func matchTag(image docker.APIImages, value, registry, namespace, name, tag string) []*ComponentMatch { if len(tag) == 0 { tag = imageapi.DefaultImageTag } matches := []*ComponentMatch{}<|fim▁hole|> for _, s := range image.RepoTags { if value == s { matches = append(matches, &ComponentMatch{ Value: s, Score: 0.0, }) continue } iRef, err := imageapi.ParseDockerImageReference(s) if err != nil { continue } if len(iRef.Tag) == 0 { iRef.Tag = imageapi.DefaultImageTag } match := &ComponentMatch{} ok, score := partialScorer(name, iRef.Name, true, 0.5, 1.0) if !ok { continue } match.Score += score _, score = partialScorer(namespace, iRef.Namespace, false, 0.5, 1.0) match.Score += score _, score = partialScorer(registry, iRef.Registry, false, 0.5, 1.0) match.Score += score _, score = partialScorer(tag, iRef.Tag, false, 0.5, 1.0) match.Score += score if match.Score >= 4.0 { continue } match.Score = match.Score / 4.0 glog.V(4).Infof("partial match on %q with %f", s, match.Score) match.Value = s matches = append(matches, match) } return matches } type ImageStreamResolver struct { Client client.ImageStreamsNamespacer ImageStreamImages client.ImageStreamImagesNamespacer Namespaces []string } func (r ImageStreamResolver) Resolve(value string) (*ComponentMatch, error) { ref, err := imageapi.ParseDockerImageReference(value) if err != nil || len(ref.Registry) != 0 { return nil, fmt.Errorf("image repositories must be of the form [<namespace>/]<name>[:<tag>|@<digest>]") } namespaces := r.Namespaces if len(ref.Namespace) != 0 { namespaces = []string{ref.Namespace} } for _, namespace := range namespaces { glog.V(4).Infof("checking image stream %s/%s with ref %q", namespace, ref.Name, ref.Tag) repo, err := r.Client.ImageStreams(namespace).Get(ref.Name) if err != nil { if errors.IsNotFound(err) || errors.IsForbidden(err) { continue } return nil, err } ref.Namespace = namespace searchTag := ref.Tag if len(searchTag) == 0 { searchTag = imageapi.DefaultImageTag } latest := imageapi.LatestTaggedImage(repo, searchTag) if latest == nil { return nil, ErrNoMatch{value: value, qualifier: fmt.Sprintf("no image recorded for %s/%s:%s", repo.Namespace, repo.Name, searchTag)} } imageData, err := r.ImageStreamImages.ImageStreamImages(namespace).Get(ref.Name, latest.Image) if err != nil { if errors.IsNotFound(err) { return nil, ErrNoMatch{value: value, qualifier: fmt.Sprintf("tag %q is set, but image %q has been removed", searchTag, latest.Image)} } return nil, err } ref.Registry = "" return &ComponentMatch{ Value: ref.String(), Argument: fmt.Sprintf("--image=%q", ref.String()), Name: ref.Name, Description: fmt.Sprintf("Image repository %s (tag %q) in project %s, tracks %q", repo.Name, searchTag, repo.Namespace, repo.Status.DockerImageRepository), Builder: IsBuilderImage(&imageData.DockerImageMetadata), Score: 0, ImageStream: repo, Image: &imageData.DockerImageMetadata, ImageTag: searchTag, }, nil } return nil, ErrNoMatch{value: value} } type Searcher interface { Search(terms []string) ([]*ComponentMatch, error) } // InputImageFromMatch returns an image reference from a component match. // The component match will either be an image stream or an image. func InputImageFromMatch(match *ComponentMatch) (*ImageRef, error) { g := NewImageRefGenerator() switch { case match.ImageStream != nil: input, err := g.FromStream(match.ImageStream, match.ImageTag) if err != nil { return nil, err } input.AsImageStream = true input.Info = match.Image return input, nil case match.Image != nil: input, err := g.FromName(match.Value) if err != nil { return nil, err } input.AsImageStream = false input.Info = match.Image return input, nil default: return nil, fmt.Errorf("no image or image stream, can't setup a build") } }<|fim▁end|>
<|file_name|>CWE762_Mismatched_Memory_Management_Routines__new_free_long_84_goodB2G.cpp<|end_file_name|><|fim▁begin|>/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__new_free_long_84_goodB2G.cpp Label Definition File: CWE762_Mismatched_Memory_Management_Routines__new_free.label.xml Template File: sources-sinks-84_goodB2G.tmpl.cpp */ /* * @description * CWE: 762 Mismatched Memory Management Routines * BadSource: Allocate data using new * GoodSource: Allocate data using malloc() * Sinks: * GoodSink: Deallocate data using delete * BadSink : Deallocate data using free() * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use * * */ #ifndef OMITGOOD #include "std_testcase.h" #include "CWE762_Mismatched_Memory_Management_Routines__new_free_long_84.h" namespace CWE762_Mismatched_Memory_Management_Routines__new_free_long_84 { CWE762_Mismatched_Memory_Management_Routines__new_free_long_84_goodB2G::CWE762_Mismatched_Memory_Management_Routines__new_free_long_84_goodB2G(long * dataCopy) { data = dataCopy; /* POTENTIAL FLAW: Allocate memory with a function that requires delete to free the memory */ <|fim▁hole|>} CWE762_Mismatched_Memory_Management_Routines__new_free_long_84_goodB2G::~CWE762_Mismatched_Memory_Management_Routines__new_free_long_84_goodB2G() { /* FIX: Deallocate the memory using delete */ delete data; } } #endif /* OMITGOOD */<|fim▁end|>
data = new long;
<|file_name|>SessionHandler.java<|end_file_name|><|fim▁begin|>package org.apache.xmlrpc; <|fim▁hole|> void checkSession(Integer SessionId, Integer UserId) throws InvalidSessionException; }<|fim▁end|>
public interface SessionHandler {
<|file_name|>shell.go<|end_file_name|><|fim▁begin|>package gospace import ( "errors" "fmt" "os" "os/exec" "strings" ) var ( // fallback shell path SHELL_DEFAULT string = "/bin/sh" // environment variable to read the shell path SHELL_ENV string = "SHELL" // environment variable to read for binary lookups PATH_ENV string = "PATH" // shell resolver error resolveError error = errors.New("Unable to find any suitable shell") ) // command + arguments type Shell struct { Path string Args []string } type builder struct { artifact string } // execute the shell. the shell will be invoked with the internal // commandline arguments. the environment is enhanced with various // go related variables. stdin, stdout and stderr are attached to // the sub-process. // func (s *Shell) Launch(workspace *Workspace, simulate bool) error { var shell *exec.Cmd = exec.Command(s.Path, s.Args...) if err := os.Setenv(PATH_ENV, workspace.GeneratePATH()); nil != err { return err } shell.Dir = workspace.Root shell.Stdin = os.Stdin shell.Stdout = os.Stdout shell.Stderr = os.Stderr shell.Env = append(os.Environ(), workspace.EnvGOPATH(), workspace.EnvGOBIN()) return shell.Run() } func (s *Shell) String() string { argv := "" if 0 < len(s.Args) { argv = " " + strings.Join(s.Args, " ") } return fmt.Sprintf("Shell(%s%s)", s.Path, argv) } func (b *builder) hasArtifact() bool { return 0 < len(b.artifact) } func (b *builder) use(path string) (self *builder) { self = b T("attempting to resolve shell", path) if b.hasArtifact() { D("shell already found; skipping lookup") return } else if 0 == len(path) { D("no shell path provided for lookup") return } else if abs, ok := SearchPathEnvironment(PATH_ENV, path); false == ok { D("shell lookup via PATH failed") return } else if DirExists(abs) { I("shell path is a directory") return } else { // TODO: check permission bits for executable flag b.artifact = abs<|fim▁hole|>} func (b *builder) build() (string, error) { if b.hasArtifact() { return b.artifact, nil } return "", resolveError } // resolve the path against various sources. the first match is used. // if the path is empty, the shell specified in the environment as // _SHELL_, otherwise the fallback value **/bin/sh** is used. // if the path is not absolute it is resolved against the PATH // directories. if all lookups yield no usable result, an error // is returned. func ResolveShell(path string, args []string) (*Shell, error) { builder := builder{""} osshell := os.Getenv(SHELL_ENV) builder. use(path). use(osshell). use(SHELL_DEFAULT) if binary, err := builder.build(); nil == err { D("using shell", binary) return &Shell{binary, args}, nil } else { return nil, err } }<|fim▁end|>
return }
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from pypwrctrl.pypwrctrl import Plug, PlugDevice, PlugMaster<|fim▁end|>
<|file_name|>input_test.js<|end_file_name|><|fim▁begin|>// Licensed to the Software Freedom Conservancy (SFC) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The SFC licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. 'use strict'; const assert = require('assert'); const sinon = require('sinon'); const command = require('../../lib/command'); const error = require('../../lib/error'); const input = require('../../lib/input'); const {WebElement} = require('../../lib/webdriver'); describe('input.Actions', function() { class StubExecutor { constructor(...responses) { this.responses = responses; this.commands = []; } execute(command) { const name = command.getName(); const parameters = command.getParameters(); this.commands.push({name, parameters}); return this.responses.shift() || Promise.reject( new Error('unexpected command: ' + command.getName())); } } describe('perform()', function() { it('omits idle devices', async function() { let executor = new StubExecutor( Promise.resolve(), Promise.resolve(), Promise.resolve(), Promise.resolve()); await new input.Actions(executor).perform(); assert.deepEqual(executor.commands, []); await new input.Actions(executor).pause().perform(); assert.deepEqual(executor.commands, []); await new input.Actions(executor).pause(1).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [{type: 'pause', duration: 1}], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [{type: 'pause', duration: 1}], }, ], } }]); executor.commands.length = 0; let actions = new input.Actions(executor); await actions.pause(1, actions.keyboard()).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [{type: 'pause', duration: 1}], }], } }]); }); it('can be called multiple times', async function() { const executor = new StubExecutor(Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor).keyDown(input.Key.SHIFT); const expected = { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [{type: 'keyDown', value: input.Key.SHIFT}], }]} }; await actions.perform(); assert.deepEqual(executor.commands, [expected]); await actions.perform(); assert.deepEqual(executor.commands, [expected, expected]); }); }); describe('pause()', function() { it('defaults to all devices', async function() { const executor = new StubExecutor(Promise.resolve()); await new input.Actions(executor).pause(3).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [{type: 'pause', duration: 3}], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [{type: 'pause', duration: 3}], }, ], } }]); }); it('duration defaults to 0', async function() { const executor = new StubExecutor(Promise.resolve()); await new input.Actions(executor)<|fim▁hole|> assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [ {type: 'pause', duration: 0}, {type: 'pause', duration: 3}, ], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pause', duration: 0}, {type: 'pause', duration: 3}, ], }, ], } }]); }); it('single device w/ synchronization', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions .pause(100, actions.keyboard()) .pause(100, actions.mouse()) .perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [ {type: 'pause', duration: 100}, {type: 'pause', duration: 0}, ], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pause', duration: 0}, {type: 'pause', duration: 100}, ], }, ], } }]); }); it('single device w/o synchronization', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor, {async: true}); await actions .pause(100, actions.keyboard()) .pause(100, actions.mouse()) .perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [ {type: 'pause', duration: 100}, ], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pause', duration: 100}, ], }, ], } }]); }); it('pause a single device multiple times by specifying it multiple times', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions .pause(100, actions.keyboard(), actions.keyboard()) .perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [ {type: 'pause', duration: 100}, {type: 'pause', duration: 100}, ], }], } }]); }); }); describe('keyDown()', function() { it('sends normalized code point', async function() { let executor = new StubExecutor(Promise.resolve()); await new input.Actions(executor).keyDown('\u0041\u030a').perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [{type: 'keyDown', value: '\u00c5'}], }], } }]); }); it('rejects keys that are not a single code point', function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); assert.throws( () => actions.keyDown('\u1E9B\u0323'), error.InvalidArgumentError); }); }); describe('keyUp()', function() { it('sends normalized code point', async function() { let executor = new StubExecutor(Promise.resolve()); await new input.Actions(executor).keyUp('\u0041\u030a').perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [{type: 'keyUp', value: '\u00c5'}], }], } }]); }); it('rejects keys that are not a single code point', function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); assert.throws( () => actions.keyUp('\u1E9B\u0323'), error.InvalidArgumentError); }); }); describe('sendKeys()', function() { it('sends down/up for single key', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions.sendKeys('a').perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [ {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, ], }], } }]); }); it('sends down/up for vararg keys', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions.sendKeys('a', 'b').perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [ {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, {type: 'keyDown', value: 'b'}, {type: 'keyUp', value: 'b'}, ], }], } }]); }); it('sends down/up for multichar strings in varargs', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions.sendKeys('a', 'bc', 'd').perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [ {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, {type: 'keyDown', value: 'b'}, {type: 'keyUp', value: 'b'}, {type: 'keyDown', value: 'c'}, {type: 'keyUp', value: 'c'}, {type: 'keyDown', value: 'd'}, {type: 'keyUp', value: 'd'}, ], }], } }]); }); it('synchronizes with other devices', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions.sendKeys('ab').pause(100, actions.mouse()).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [ {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, {type: 'keyDown', value: 'b'}, {type: 'keyUp', value: 'b'}, {type: 'pause', duration: 0}, ], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pause', duration: 0}, {type: 'pause', duration: 0}, {type: 'pause', duration: 0}, {type: 'pause', duration: 0}, {type: 'pause', duration: 100}, ], }, ], } }]); }); it('without device synchronization', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor, {async: true}); await actions.sendKeys('ab').pause(100, actions.mouse()).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [ { id: 'default keyboard', type: 'key', actions: [ {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, {type: 'keyDown', value: 'b'}, {type: 'keyUp', value: 'b'}, ], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [{type: 'pause', duration: 100}], }, ], } }]); }); }); describe('click()', function() { it('clicks immediately if no element provided', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); await actions.click().perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], }, }]); }); it('moves to target element before clicking', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); const fakeElement = {}; await actions.click(fakeElement).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', origin: fakeElement, duration: 100, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], }, }]); }); it('synchronizes with other devices', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); const fakeElement = {}; await actions.click(fakeElement).sendKeys('a').perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [ {type: 'pause', duration: 0}, {type: 'pause', duration: 0}, {type: 'pause', duration: 0}, {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, ], }, { id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', origin: fakeElement, duration: 100, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pause', duration: 0}, {type: 'pause', duration: 0}, ], }], }, }]); }); }); describe('dragAndDrop', function() { it('dragAndDrop(fromEl, toEl)', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); const e1 = new WebElement(null, 'abc123'); const e2 = new WebElement(null, 'def456'); await actions.dragAndDrop(e1, e2).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', duration: 100, origin: e1, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, { type: 'pointerMove', duration: 100, origin: e2, x: 0, y: 0, }, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }]); }); it('dragAndDrop(el, offset)', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); const e1 = new WebElement(null, 'abc123'); await actions.dragAndDrop(e1, {x: 30, y: 40}).perform(); assert.deepEqual(executor.commands, [{ name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', duration: 100, origin: e1, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, { type: 'pointerMove', duration: 100, origin: input.Origin.POINTER, x: 30, y: 40, }, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }]); }); it('throws if target is invalid', async function() { const executor = new StubExecutor(Promise.resolve()); const actions = new input.Actions(executor); const e = new WebElement(null, 'abc123'); assert.throws( () => actions.dragAndDrop(e), error.InvalidArgumentError); assert.throws( () => actions.dragAndDrop(e, null), error.InvalidArgumentError); assert.throws( () => actions.dragAndDrop(e, {}), error.InvalidArgumentError); assert.throws( () => actions.dragAndDrop(e, {x:0}), error.InvalidArgumentError); assert.throws( () => actions.dragAndDrop(e, {y:0}), error.InvalidArgumentError); assert.throws( () => actions.dragAndDrop(e, {x:0, y:'a'}), error.InvalidArgumentError); assert.throws( () => actions.dragAndDrop(e, {x:'a', y:0}), error.InvalidArgumentError); }); }); describe('bridge mode', function() { it('cannot enable async and bridge at the same time', function() { let exe = new StubExecutor; assert.throws( () => new input.Actions(exe, {async: true, bridge: true}), error.InvalidArgumentError); }); it('behaves as normal if first command succeeds', async function() { const actions = new input.Actions(new StubExecutor(Promise.resolve())); await actions.click().sendKeys('a').perform(); }); it('handles pauses locally', async function() { const start = Date.now(); const actions = new input.Actions( new StubExecutor( Promise.reject(new error.UnknownCommandError)), {bridge: true}); await actions.pause(100).perform(); const elapsed = Date.now() - start; assert.ok(elapsed >= 100, elapsed); }); it('requires non-modifier keys to be used in keydown/up sequences', async function() { const actions = new input.Actions( new StubExecutor( Promise.reject(new error.UnknownCommandError)), {bridge: true}); try { await actions.keyDown(input.Key.SHIFT).keyDown('a').perform(); return Promise.reject(Error('should have failed!')); } catch (err) { if (!(err instanceof error.UnsupportedOperationError) || !err.message.endsWith('must be followed by a keyup for the same key')) { throw err; } } }); it('key sequence', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve('shift down'), Promise.resolve(), Promise.resolve(), Promise.resolve(), Promise.resolve('shift up')); const actions = new input.Actions(executor, {bridge: true}); await actions .keyDown(input.Key.SHIFT) .sendKeys('abc') .keyUp(input.Key.SHIFT) .sendKeys('de') .perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default keyboard', type: 'key', actions: [ {type: 'keyDown', value: input.Key.SHIFT}, {type: 'keyDown', value: 'a'}, {type: 'keyUp', value: 'a'}, {type: 'keyDown', value: 'b'}, {type: 'keyUp', value: 'b'}, {type: 'keyDown', value: 'c'}, {type: 'keyUp', value: 'c'}, {type: 'keyUp', value: input.Key.SHIFT}, {type: 'keyDown', value: 'd'}, {type: 'keyUp', value: 'd'}, {type: 'keyDown', value: 'e'}, {type: 'keyUp', value: 'e'}, ], }], } }, { name: command.Name.LEGACY_ACTION_SEND_KEYS, parameters: {value: [input.Key.SHIFT]} }, { name: command.Name.LEGACY_ACTION_SEND_KEYS, parameters: {value: ['a', 'b', 'c']} }, { name: command.Name.LEGACY_ACTION_SEND_KEYS, parameters: {value: [input.Key.SHIFT]} }, { name: command.Name.LEGACY_ACTION_SEND_KEYS, parameters: {value: ['d', 'e']} }, ]); }); it('mouse movements cannot be relative to the viewport', async function() { const actions = new input.Actions( new StubExecutor( Promise.reject(new error.UnknownCommandError)), {bridge: true}); try { await actions.move({x: 10, y: 15}).perform(); return Promise.reject(Error('should have failed!')); } catch (err) { if (!(err instanceof error.UnsupportedOperationError) || !err.message.startsWith('pointer movements relative to viewport')) { throw err; } } }); describe('detects clicks', function() { it('press/release for same button is a click', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions .press(input.Button.LEFT) .release(input.Button.LEFT) .perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); it('not a click if release is a different button', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve(), Promise.resolve(), Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions .press(input.Button.LEFT) .press(input.Button.RIGHT) .release(input.Button.LEFT) .release(input.Button.RIGHT) .perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerDown', button: input.Button.RIGHT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.RIGHT}, ], }], } }, { name: command.Name.LEGACY_ACTION_MOUSE_DOWN, parameters: {button: input.Button.LEFT}, }, { name: command.Name.LEGACY_ACTION_MOUSE_DOWN, parameters: {button: input.Button.RIGHT}, }, { name: command.Name.LEGACY_ACTION_MOUSE_UP, parameters: {button: input.Button.LEFT}, }, { name: command.Name.LEGACY_ACTION_MOUSE_UP, parameters: {button: input.Button.RIGHT}, }, ]); }); it('click() shortcut', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions.click().perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); it('detects context-clicks', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions .press(input.Button.RIGHT) .release(input.Button.RIGHT) .perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.RIGHT}, {type: 'pointerUp', button: input.Button.RIGHT}, ], }], } }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.RIGHT}, }, ]); }); it('contextClick() shortcut', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions.contextClick().perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.RIGHT}, {type: 'pointerUp', button: input.Button.RIGHT}, ], }], } }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.RIGHT}, }, ]); }); it('click(element)', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve([0, 0]), Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions.click(element).perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', duration: 100, origin: element, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.EXECUTE_SCRIPT, parameters: { script: input.INTERNAL_COMPUTE_OFFSET_SCRIPT, args: [element], }, }, { name: command.Name.LEGACY_ACTION_MOUSE_MOVE, parameters: { element: 'abc123', xoffset: 0, yoffset: 0, }, }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); }); describe('detects double-clicks', function() { it('press/release x2 for same button is a double-click', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions .press(input.Button.LEFT) .release(input.Button.LEFT) .press(input.Button.LEFT) .release(input.Button.LEFT) .perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.LEGACY_ACTION_DOUBLE_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); it('doubleClick() shortcut', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); await actions.doubleClick().perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.LEGACY_ACTION_DOUBLE_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); it('not a double-click if second click is another button', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); await actions.click().contextClick().perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pointerDown', button: input.Button.RIGHT}, {type: 'pointerUp', button: input.Button.RIGHT}, ], }], } }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.LEFT}, }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.RIGHT}, }, ]); }); it('doubleClick(element)', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve([7, 10]), Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions.doubleClick(element).perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', duration: 100, origin: element, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.EXECUTE_SCRIPT, parameters: { script: input.INTERNAL_COMPUTE_OFFSET_SCRIPT, args: [element], }, }, { name: command.Name.LEGACY_ACTION_MOUSE_MOVE, parameters: { element: 'abc123', xoffset: 7, yoffset: 10, }, }, { name: command.Name.LEGACY_ACTION_DOUBLE_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); }); it('mouse sequence', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve([-6, 9]), Promise.resolve(), Promise.resolve(), Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const element = new WebElement(null, 'abc123'); await actions .move({x: 5, y: 5, origin: element}) .click() .move({x: 10, y: 15, origin: input.Origin.POINTER}) .doubleClick() .perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', duration: 100, origin: element, x: 5, y: 5, }, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, { type: 'pointerMove', duration: 100, origin: input.Origin.POINTER, x: 10, y: 15, }, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, {type: 'pointerDown', button: input.Button.LEFT}, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.EXECUTE_SCRIPT, parameters: { script: input.INTERNAL_COMPUTE_OFFSET_SCRIPT, args: [element], }, }, { name: command.Name.LEGACY_ACTION_MOUSE_MOVE, parameters: { element: 'abc123', xoffset: -1, yoffset: 14, }, }, { name: command.Name.LEGACY_ACTION_CLICK, parameters: {button: input.Button.LEFT}, }, { name: command.Name.LEGACY_ACTION_MOUSE_MOVE, parameters: {xoffset: 10, yoffset: 15}, }, { name: command.Name.LEGACY_ACTION_DOUBLE_CLICK, parameters: {button: input.Button.LEFT}, }, ]); }); it('dragAndDrop', async function() { const executor = new StubExecutor( Promise.reject(new error.UnknownCommandError), Promise.resolve([15, 20]), Promise.resolve(), Promise.resolve(), Promise.resolve([25, 30]), Promise.resolve(), Promise.resolve()); const actions = new input.Actions(executor, {bridge: true}); const e1 = new WebElement(null, 'abc123'); const e2 = new WebElement(null, 'def456'); await actions.dragAndDrop(e1, e2).perform(); assert.deepEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { actions: [{ id: 'default mouse', type: 'pointer', parameters: {pointerType: 'mouse'}, actions: [ { type: 'pointerMove', duration: 100, origin: e1, x: 0, y: 0, }, {type: 'pointerDown', button: input.Button.LEFT}, { type: 'pointerMove', duration: 100, origin: e2, x: 0, y: 0, }, {type: 'pointerUp', button: input.Button.LEFT}, ], }], } }, { name: command.Name.EXECUTE_SCRIPT, parameters: { script: input.INTERNAL_COMPUTE_OFFSET_SCRIPT, args: [e1], }, }, { name: command.Name.LEGACY_ACTION_MOUSE_MOVE, parameters: { element: 'abc123', xoffset: 15, yoffset: 20, }, }, { name: command.Name.LEGACY_ACTION_MOUSE_DOWN, parameters: {button: input.Button.LEFT}, }, { name: command.Name.EXECUTE_SCRIPT, parameters: { script: input.INTERNAL_COMPUTE_OFFSET_SCRIPT, args: [e2], }, }, { name: command.Name.LEGACY_ACTION_MOUSE_MOVE, parameters: { element: 'def456', xoffset: 25, yoffset: 30, }, }, { name: command.Name.LEGACY_ACTION_MOUSE_UP, parameters: {button: input.Button.LEFT}, }, ]); }); }); });<|fim▁end|>
.pause() .pause(3) .perform();
<|file_name|>advent-day-6-2.py<|end_file_name|><|fim▁begin|># Advent of Code Solutions: Day 6, part 2 # https://github.com/emddudley/advent-of-code-solutions import re def twinkle_lights(instruction, lights): tokens = re.split(r'(\d+)', instruction) operation = tokens[0].strip()<|fim▁hole|> twinkle = lambda x: max(x - 1, 0) elif operation == 'toggle': twinkle = lambda x: x + 2 else: twinkle = lambda x: x coord_1 = [ int(tokens[1]), int(tokens[3]) ] coord_2 = [ int(tokens[5]), int(tokens[7]) ] for x in range(coord_1[0], coord_2[0] + 1): for y in range(coord_1[1], coord_2[1] + 1): lights[x][y] = twinkle(lights[x][y]) lights = [ [ 0 ] * 1000 for n in range(1000) ] with open('input', 'r') as input: for instruction in input: twinkle_lights(instruction, lights) print(sum(map(sum, lights)))<|fim▁end|>
if operation == 'turn on': twinkle = lambda x: x + 1 elif operation == 'turn off':
<|file_name|>test_sqlitecachedbhandler_torrents.py<|end_file_name|><|fim▁begin|>import os import struct from binascii import unhexlify from shutil import copy as copyfile from twisted.internet.defer import inlineCallbacks from Tribler.Core.CacheDB.SqliteCacheDBHandler import TorrentDBHandler, MyPreferenceDBHandler, ChannelCastDBHandler from Tribler.Core.CacheDB.sqlitecachedb import str2bin from Tribler.Core.Category.Category import Category from Tribler.Core.TorrentDef import TorrentDef from Tribler.Core.leveldbstore import LevelDbStore from Tribler.Test.Core.test_sqlitecachedbhandler import AbstractDB from Tribler.Test.common import TESTS_DATA_DIR S_TORRENT_PATH_BACKUP = os.path.join(TESTS_DATA_DIR, 'bak_single.torrent') M_TORRENT_PATH_BACKUP = os.path.join(TESTS_DATA_DIR, 'bak_multiple.torrent') class TestTorrentFullSessionDBHandler(AbstractDB): def setUpPreSession(self): super(TestTorrentFullSessionDBHandler, self).setUpPreSession() self.config.set_megacache_enabled(True) @inlineCallbacks def setUp(self): yield super(TestTorrentFullSessionDBHandler, self).setUp() self.tdb = TorrentDBHandler(self.session) def test_initialize(self): self.tdb.initialize() self.assertIsNone(self.tdb.mypref_db) self.assertIsNone(self.tdb.votecast_db) self.assertIsNone(self.tdb.channelcast_db) class TestTorrentDBHandler(AbstractDB): def addTorrent(self): old_size = self.tdb.size() old_tracker_size = self.tdb._db.size('TrackerInfo') s_infohash = unhexlify('44865489ac16e2f34ea0cd3043cfd970cc24ec09') m_infohash = unhexlify('ed81da94d21ad1b305133f2726cdaec5a57fed98') single_torrent_file_path = os.path.join(self.getStateDir(), 'single.torrent') multiple_torrent_file_path = os.path.join(self.getStateDir(), 'multiple.torrent') copyfile(S_TORRENT_PATH_BACKUP, single_torrent_file_path) copyfile(M_TORRENT_PATH_BACKUP, multiple_torrent_file_path) single_tdef = TorrentDef.load(single_torrent_file_path) self.assertEqual(s_infohash, single_tdef.get_infohash()) multiple_tdef = TorrentDef.load(multiple_torrent_file_path) self.assertEqual(m_infohash, multiple_tdef.get_infohash()) self.tdb.addExternalTorrent(single_tdef) self.tdb.addExternalTorrent(multiple_tdef) single_torrent_id = self.tdb.getTorrentID(s_infohash) multiple_torrent_id = self.tdb.getTorrentID(m_infohash) self.assertEqual(self.tdb.getInfohash(single_torrent_id), s_infohash) single_name = 'Tribler_4.1.7_src.zip' multiple_name = 'Tribler_4.1.7_src' self.assertEqual(self.tdb.size(), old_size + 2) new_tracker_table_size = self.tdb._db.size('TrackerInfo') self.assertLess(old_tracker_size, new_tracker_table_size) sname = self.tdb.getOne('name', torrent_id=single_torrent_id) self.assertEqual(sname, single_name) mname = self.tdb.getOne('name', torrent_id=multiple_torrent_id) self.assertEqual(mname, multiple_name) s_size = self.tdb.getOne('length', torrent_id=single_torrent_id) self.assertEqual(s_size, 1583233) m_size = self.tdb.getOne('length', torrent_id=multiple_torrent_id) self.assertEqual(m_size, 5358560) cat = self.tdb.getOne('category', torrent_id=multiple_torrent_id) self.assertEqual(cat, u'xxx') s_status = self.tdb.getOne('status', torrent_id=single_torrent_id) self.assertEqual(s_status, u'unknown') m_comment = self.tdb.getOne('comment', torrent_id=multiple_torrent_id) comments = 'www.tribler.org' self.assertGreater(m_comment.find(comments), -1) comments = 'something not inside' self.assertEqual(m_comment.find(comments), -1) m_trackers = self.tdb.getTrackerListByInfohash(m_infohash) self.assertEqual(len(m_trackers), 8) self.assertIn('http://tpb.tracker.thepiratebay.org/announce', m_trackers) s_torrent = self.tdb.getTorrent(s_infohash) m_torrent = self.tdb.getTorrent(m_infohash) self.assertEqual(s_torrent['name'], 'Tribler_4.1.7_src.zip') self.assertEqual(m_torrent['name'], 'Tribler_4.1.7_src') self.assertEqual(m_torrent['last_tracker_check'], 0) def updateTorrent(self): m_infohash = unhexlify('ed81da94d21ad1b305133f2726cdaec5a57fed98') self.tdb.updateTorrent(m_infohash, relevance=3.1415926, category=u'Videoclips', status=u'good', seeder=123, leecher=321, last_tracker_check=1234567, other_key1='abcd', other_key2=123) multiple_torrent_id = self.tdb.getTorrentID(m_infohash) category = self.tdb.getOne('category', torrent_id=multiple_torrent_id) self.assertEqual(category, u'Videoclips') status = self.tdb.getOne('status', torrent_id=multiple_torrent_id) self.assertEqual(status, u'good') seeder = self.tdb.getOne('num_seeders', torrent_id=multiple_torrent_id) self.assertEqual(seeder, 123) leecher = self.tdb.getOne('num_leechers', torrent_id=multiple_torrent_id) self.assertEqual(leecher, 321) last_tracker_check = self.tdb.getOne('last_tracker_check', torrent_id=multiple_torrent_id) self.assertEqual(last_tracker_check, 1234567) def setUpPreSession(self): super(TestTorrentDBHandler, self).setUpPreSession() self.config.set_megacache_enabled(True) self.config.set_torrent_store_enabled(True) @inlineCallbacks def setUp(self): yield super(TestTorrentDBHandler, self).setUp() from Tribler.Core.APIImplementation.LaunchManyCore import TriblerLaunchMany from Tribler.Core.Modules.tracker_manager import TrackerManager self.session.lm = TriblerLaunchMany() self.session.lm.tracker_manager = TrackerManager(self.session) self.tdb = TorrentDBHandler(self.session) self.tdb.torrent_dir = TESTS_DATA_DIR self.tdb.category = Category() self.tdb.mypref_db = MyPreferenceDBHandler(self.session) @inlineCallbacks def tearDown(self): self.tdb.mypref_db.close() self.tdb.mypref_db = None self.tdb.close() self.tdb = None yield super(TestTorrentDBHandler, self).tearDown() def test_hasTorrent(self): infohash_str = 'AA8cTG7ZuPsyblbRE7CyxsrKUCg=' infohash = str2bin(infohash_str) self.assertTrue(self.tdb.hasTorrent(infohash)) self.assertTrue(self.tdb.hasTorrent(infohash)) # cache will trigger fake_infohash = 'fake_infohash_100000' self.assertFalse(self.tdb.hasTorrent(fake_infohash)) def test_get_infohash(self): self.assertTrue(self.tdb.getInfohash(1)) self.assertFalse(self.tdb.getInfohash(1234567)) def test_add_update_torrent(self): self.addTorrent() self.updateTorrent() def test_update_torrent_from_metainfo(self): # Add torrent first infohash = unhexlify('ed81da94d21ad1b305133f2726cdaec5a57fed98') # Only infohash is added to the database self.tdb.addOrGetTorrentID(infohash) # Then update the torrent with metainfo metainfo = {'info': {'files': [{'path': ['Something.something.pdf'], 'length': 123456789}, {'path': ['Another-thing.jpg'], 'length': 100000000}], 'piece length': 2097152, 'name': '\xc3Something awesome (2015)', 'pieces': ''}, 'seeders': 0, 'initial peers': [], 'leechers': 36, 'download_exists': False, 'nodes': []} self.tdb.update_torrent_with_metainfo(infohash, metainfo) # Check updates are correct torrent_id = self.tdb.getTorrentID(infohash) name = self.tdb.getOne('name', torrent_id=torrent_id) self.assertEqual(name, u'\xc3Something awesome (2015)') num_files = self.tdb.getOne('num_files', torrent_id=torrent_id) self.assertEqual(num_files, 2) length = self.tdb.getOne('length', torrent_id=torrent_id) self.assertEqual(length, 223456789) def test_add_external_torrent_no_def_existing(self): infohash = str2bin('AA8cTG7ZuPsyblbRE7CyxsrKUCg=') self.tdb.addExternalTorrentNoDef(infohash, "test torrent", [], [], 1234) self.assertTrue(self.tdb.hasTorrent(infohash)) def test_add_external_torrent_no_def_no_files(self): infohash = unhexlify('48865489ac16e2f34ea0cd3043cfd970cc24ec09') self.tdb.addExternalTorrentNoDef(infohash, "test torrent", [], [], 1234) self.assertFalse(self.tdb.hasTorrent(infohash)) def test_add_external_torrent_no_def_one_file(self): infohash = unhexlify('49865489ac16e2f34ea0cd3043cfd970cc24ec09') self.tdb.addExternalTorrentNoDef(infohash, "test torrent", [("file1", 42)], ['http://localhost/announce'], 1234) self.assertTrue(self.tdb.getTorrentID(infohash)) def test_add_external_torrent_no_def_more_files(self): infohash = unhexlify('50865489ac16e2f34ea0cd3043cfd970cc24ec09') self.tdb.addExternalTorrentNoDef(infohash, "test torrent", [("file1", 42), ("file2", 43)], [], 1234, extra_info={"seeder": 2, "leecher": 3}) self.assertTrue(self.tdb.getTorrentID(infohash)) def test_add_external_torrent_no_def_invalid(self): infohash = unhexlify('50865489ac16e2f34ea0cd3043cfd970cc24ec09') self.tdb.addExternalTorrentNoDef(infohash, "test torrent", [("file1", {}), ("file2", 43)], [], 1234) self.assertFalse(self.tdb.getTorrentID(infohash)) def test_add_get_torrent_id(self): infohash = str2bin('AA8cTG7ZuPsyblbRE7CyxsrKUCg=') self.assertEqual(self.tdb.addOrGetTorrentID(infohash), 1) new_infohash = unhexlify('50865489ac16e2f34ea0cd3043cfd970cc24ec09') self.assertEqual(self.tdb.addOrGetTorrentID(new_infohash), 4859) def test_add_get_torrent_ids_return(self): infohash = str2bin('AA8cTG7ZuPsyblbRE7CyxsrKUCg=') new_infohash = unhexlify('50865489ac16e2f34ea0cd3043cfd970cc24ec09') tids, inserted = self.tdb.addOrGetTorrentIDSReturn([infohash, new_infohash]) self.assertEqual(tids, [1, 4859]) self.assertEqual(len(inserted), 1) def test_index_torrent_existing(self): self.tdb._indexTorrent(1, "test", []) def test_getCollectedTorrentHashes(self): res = self.tdb.getNumberCollectedTorrents() self.assertEqual(res, 4847) def test_freeSpace(self): # Manually set the torrent store because register is not called. self.session.lm.torrent_store = LevelDbStore(self.session.config.get_torrent_store_dir()) old_res = self.tdb.getNumberCollectedTorrents() self.tdb.freeSpace(20) res = self.tdb.getNumberCollectedTorrents() self.session.lm.torrent_store.close() self.assertEqual(res, old_res-20) def test_get_search_suggestions(self): self.assertEqual(self.tdb.getSearchSuggestion(["content", "cont"]), ["content 1"]) def test_get_autocomplete_terms(self): self.assertEqual(len(self.tdb.getAutoCompleteTerms("content", 100)), 0) def test_get_recently_randomly_collected_torrents(self): self.assertEqual(len(self.tdb.getRecentlyCollectedTorrents(limit=10)), 10) self.assertEqual(len(self.tdb.getRandomlyCollectedTorrents(100000000, limit=10)), 3) def test_get_recently_checked_torrents(self): self.assertEqual(len(self.tdb.getRecentlyCheckedTorrents(limit=5)), 5) def test_select_torrents_to_collect(self): infohash = str2bin('AA8cTG7ZuPsyblbRE7CyxsrKUCg=') self.assertEqual(len(self.tdb.select_torrents_to_collect(infohash)), 0) def test_get_torrents_stats(self): self.assertEqual(self.tdb.getTorrentsStats(), (4847, 6519179841442, 187195)) def test_get_library_torrents(self): self.assertEqual(len(self.tdb.getLibraryTorrents(['infohash'])), 12) def test_search_names_no_sort(self):<|fim▁hole|> self.tdb.channelcast_db = ChannelCastDBHandler(self.session) self.assertEqual(len(self.tdb.searchNames(['content'], keys=columns, doSort=False)), 4849) self.assertEqual(len(self.tdb.searchNames(['content', '1'], keys=columns, doSort=False)), 1) def test_search_names_sort(self): """ Test whether the right amount of sorted torrents are returned when searching for torrents in db """ columns = ['T.torrent_id', 'infohash', 'status', 'num_seeders'] self.tdb.channelcast_db = ChannelCastDBHandler(self.session) results = self.tdb.searchNames(['content'], keys=columns) self.assertEqual(len(results), 4849) self.assertEqual(results[0][3], 493785) def test_search_local_torrents(self): """ Test the search procedure in the local database when searching for torrents """ results = self.tdb.search_in_local_torrents_db('content', ['infohash', 'num_seeders']) self.assertEqual(len(results), 4849) self.assertNotEqual(results[0][-1], 0.0) # Relevance score of result should not be zero results = self.tdb.search_in_local_torrents_db('fdsafasfds', ['infohash']) self.assertEqual(len(results), 0) def test_rel_score_remote_torrent(self): self.tdb.latest_matchinfo_torrent = struct.pack("I" * 12, *([1] * 12)), "torrent" self.assertNotEqual(self.tdb.relevance_score_remote_torrent("my-torrent.iso"), 0.0)<|fim▁end|>
""" Test whether the right amount of torrents are returned when searching for torrents in db """ columns = ['T.torrent_id', 'infohash', 'status', 'num_seeders']
<|file_name|>test_module.cpp<|end_file_name|><|fim▁begin|>/* test_messagehandler.cpp Copyright 2016 fyrelab */ /* Test cases dont have to be as extensive as the module class is mostly a summary of the methods from the messagehandler and the configloader */ #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> #include <string> #include <exception> #include <utility> #include <map> #include "lib_module/module.h" #include "lib_module/messagehandler.h" #include "testing/test_util/test_logger.h" #include "testing/test_util/test_logger.h" using lib_module::MessageHandler; using lib_module::Message; using lib_module::MessageType; BOOST_AUTO_TEST_SUITE(Test_Module) // ==================================================================================================================== // Constructor test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(contructorTest) { TestLogger logger = TestLogger("Test_Module:Constructor test"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; // Create a new test module BOOST_WARN_THROW(TestModule module = TestModule("test_in_queue", "test_out_queue"), std::exception); } // ==================================================================================================================== // Get Module Name Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(getModuleNameTest) { TestLogger logger = TestLogger("Test_Module:getModuleNameTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("module_test", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule("test_in_queue", "test_out_queue"); BOOST_CHECK_EQUAL(module.getModuleName(), "module_test"); } // ==================================================================================================================== // Get Config Loader Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(getConfigLoaderTest) { TestLogger logger = TestLogger("Test_Module:getConfigLoaderTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); // Check whether the config_loader actually works and returns the right value BOOST_WARN_THROW(lib_module::ConfigLoaderJ loader = module.getConfigLoader(), std::exception); lib_module::ConfigLoaderJ loader = module.getConfigLoader(); BOOST_CHECK(&loader); } // ==================================================================================================================== // Receive Message Blocking Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(receiveMessageBlockingTest) { TestLogger logger = TestLogger("Test_Module:receiveMessageBlockingTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); MessageHandler *test_sender = MessageHandler::open("test_out_queue", logger); lib_module::Message send_message; lib_module::Message test_message; std::map<std::string, std::string> test_map; send_message.type = lib_module::MSG_SYS; test_sender->sendMessage(send_message); BOOST_WARN_THROW(module.receiveMessageBlocking(&test_message, 3000, &test_map), std::exception); BOOST_CHECK_EQUAL(test_message.type, lib_module::MSG_SYS); delete test_sender; } // ==================================================================================================================== // Receive Discard Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(receiveDiscardTest) { TestLogger logger = TestLogger("Test_Module:receiveDiscardTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); MessageHandler *test_sender = MessageHandler::open("test_out_queue", logger); lib_module::Message send_message; send_message.type = lib_module::MSG_SYS; test_sender->sendMessage(send_message); BOOST_CHECK_EQUAL(module.receiveDiscard(), true); BOOST_CHECK_EQUAL(module.receiveDiscard(), false); delete test_sender; } // ==================================================================================================================== // Acknowledge Event Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(ackowledgeEventTest) { TestLogger logger = TestLogger("Test_Module:ackowledgeEventTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); MessageHandler *test_receiver = MessageHandler::open("test_in_queue", logger); Message m; std::map<std::string, std::string> test_map; BOOST_WARN_THROW(module.acknowledgeEvent(43), std::exception); BOOST_CHECK_EQUAL(test_receiver->receiveMessageBlocking(&m, 3000, &test_map), true); BOOST_CHECK_EQUAL(m.type, lib_module::MSG_ACKAC); BOOST_CHECK_EQUAL(m.body.ack.event_id, 43); delete test_receiver; } // ==================================================================================================================== // Send Event Message Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(sendEventMessageTest) { TestLogger logger = TestLogger("Test_Module:ackowledgeEventTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); MessageHandler *test_receiver = MessageHandler::open("test_in_queue", logger); Message m; BOOST_WARN_THROW(module.sendEventMessage(42, "stringwithvars!"), std::exception); BOOST_WARN_THROW(test_receiver->receiveMessageNonBlocking(&m), std::exception); BOOST_CHECK_EQUAL(m.type, lib_module::MSG_EVENT); BOOST_CHECK_EQUAL(m.body.event.rule_id, 42); BOOST_CHECK_EQUAL(m.body.event.vars, "stringwithvars!"); delete test_receiver; } <|fim▁hole|>// Set Hearbeat Interval Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(setHeartbeatIntervalTest) { TestLogger logger = TestLogger("Test_Module:setHeartbeatIntervalTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); BOOST_CHECK_EQUAL(module.setHeartbeatInterval(14500), 14500); } // ==================================================================================================================== // Send Hearbeat Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(setHearbeatTest) { TestLogger logger = TestLogger("Test_Module:setHearbeatTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); BOOST_CHECK_EQUAL(module.sendHeartbeat(), true); } // ==================================================================================================================== // Write Hook Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(writeHookTest) { TestLogger logger = TestLogger("Test_Module:systemMessageTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); BOOST_CHECK_EQUAL(module.writeHook("This is a test string"), false); } // ==================================================================================================================== // Log Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(logTest) { TestLogger logger = TestLogger("Test_Module:logTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); BOOST_CHECK_EQUAL(module.log(lib_module::INFO, "This is a test string"), true); } // ==================================================================================================================== // Replace Vars Test // ==================================================================================================================== BOOST_AUTO_TEST_CASE(replaceVarsTest) { TestLogger logger = TestLogger("Test_Module:replaceVarsTest"); MessageHandler::create("test_in_queue", logger); MessageHandler::create("test_out_queue", logger); class TestModule : public lib_module::Module { public: TestModule(const std::string &sending_queue, const std::string &receiving_queue) : lib_module::Module("test_module", sending_queue, receiving_queue) {}; ~TestModule(){}; }; TestModule module = TestModule( "test_in_queue", "test_out_queue"); std::map<std::string, std::string> test_map; test_map.insert(std::pair<std::string, std::string>("replace1", "value1")); test_map.insert(std::pair<std::string, std::string>("replace2", "")); test_map.insert(std::pair<std::string, std::string>("replace3", "===")); test_map.insert(std::pair<std::string, std::string>("replace4", "%")); BOOST_CHECK_EQUAL(module.replaceVars("%replace1, %replace2, %replace3, %replace4", test_map),"value1, , ===, %"); } BOOST_AUTO_TEST_SUITE_END()<|fim▁end|>
// ====================================================================================================================
<|file_name|>basic.py<|end_file_name|><|fim▁begin|># Licensed under a 3-clause BSD style license - see LICENSE.rst """An extensible ASCII table reader and writer. basic.py: Basic table read / write functionality for simple character delimited files with various options for column header definition. :Copyright: Smithsonian Astrophysical Observatory (2011) :Author: Tom Aldcroft ([email protected]) """ from __future__ import absolute_import, division, print_function import re from . import core from ...extern.six.moves import zip class BasicHeader(core.BaseHeader): """ Basic table Header Reader Set a few defaults for common ascii table formats (start at line 0, comments begin with ``#`` and possibly white space) """ start_line = 0 comment = r'\s*#' write_comment = '# ' class BasicData(core.BaseData): """ Basic table Data Reader<|fim▁hole|> Set a few defaults for common ascii table formats (start at line 1, comments begin with ``#`` and possibly white space) """ start_line = 1 comment = r'\s*#' write_comment = '# ' class Basic(core.BaseReader): r""" Read a character-delimited table with a single header line at the top followed by data lines to the end of the table. Lines beginning with # as the first non-whitespace character are comments. This reader is highly configurable. :: rdr = ascii.get_reader(Reader=ascii.Basic) rdr.header.splitter.delimiter = ' ' rdr.data.splitter.delimiter = ' ' rdr.header.start_line = 0 rdr.data.start_line = 1 rdr.data.end_line = None rdr.header.comment = r'\s*#' rdr.data.comment = r'\s*#' Example table:: # Column definition is the first uncommented line # Default delimiter is the space character. apples oranges pears # Data starts after the header column definition, blank lines ignored 1 2 3 4 5 6 """ _format_name = 'basic' _description = 'Basic table with custom delimiters' header_class = BasicHeader data_class = BasicData class NoHeaderHeader(BasicHeader): """ Reader for table header without a header Set the start of header line number to `None`, which tells the basic reader there is no header line. """ start_line = None class NoHeaderData(BasicData): """ Reader for table data without a header Data starts at first uncommented line since there is no header line. """ start_line = 0 class NoHeader(Basic): """ Read a table with no header line. Columns are autonamed using header.auto_format which defaults to "col%d". Otherwise this reader the same as the :class:`Basic` class from which it is derived. Example:: # Table data 1 2 "hello there" 3 4 world """ _format_name = 'no_header' _description = 'Basic table with no headers' header_class = NoHeaderHeader data_class = NoHeaderData class CommentedHeaderHeader(BasicHeader): """ Header class for which the column definition line starts with the comment character. See the :class:`CommentedHeader` class for an example. """ def process_lines(self, lines): """ Return only lines that start with the comment regexp. For these lines strip out the matching characters. """ re_comment = re.compile(self.comment) for line in lines: match = re_comment.match(line) if match: yield line[match.end():] def write(self, lines): lines.append(self.write_comment + self.splitter.join(self.colnames)) class CommentedHeader(Basic): """ Read a file where the column names are given in a line that begins with the header comment character. ``header_start`` can be used to specify the line index of column names, and it can be a negative index (for example -1 for the last commented line). The default delimiter is the <space> character.:: # col1 col2 col3 # Comment line 1 2 3 4 5 6 """ _format_name = 'commented_header' _description = 'Column names in a commented line' header_class = CommentedHeaderHeader data_class = NoHeaderData def read(self, table): """ Read input data (file-like object, filename, list of strings, or single string) into a Table and return the result. """ out = super(CommentedHeader, self).read(table) # Strip off first comment since this is the header line for # commented_header format. if 'comments' in out.meta: out.meta['comments'] = out.meta['comments'][1:] if not out.meta['comments']: del out.meta['comments'] return out def write_header(self, lines, meta): """ Write comment lines after, rather than before, the header. """ self.header.write(lines) self.header.write_comments(lines, meta) class TabHeaderSplitter(core.DefaultSplitter): """Split lines on tab and do not remove whitespace""" delimiter = '\t' process_line = None class TabDataSplitter(TabHeaderSplitter): """ Don't strip data value whitespace since that is significant in TSV tables """ process_val = None skipinitialspace = False class TabHeader(BasicHeader): """ Reader for header of tables with tab separated header """ splitter_class = TabHeaderSplitter class TabData(BasicData): """ Reader for data of tables with tab separated data """ splitter_class = TabDataSplitter class Tab(Basic): """ Read a tab-separated file. Unlike the :class:`Basic` reader, whitespace is not stripped from the beginning and end of either lines or individual column values. Example:: col1 <tab> col2 <tab> col3 # Comment line 1 <tab> 2 <tab> 5 """ _format_name = 'tab' _description = 'Basic table with tab-separated values' header_class = TabHeader data_class = TabData class CsvSplitter(core.DefaultSplitter): """ Split on comma for CSV (comma-separated-value) tables """ delimiter = ',' class CsvHeader(BasicHeader): """ Header that uses the :class:`astropy.io.ascii.basic.CsvSplitter` """ splitter_class = CsvSplitter comment = None write_comment = None class CsvData(BasicData): """ Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter` """ splitter_class = CsvSplitter fill_values = [(core.masked, '')] comment = None write_comment = None class Csv(Basic): """ Read a CSV (comma-separated-values) file. Example:: num,ra,dec,radius,mag 1,32.23222,10.1211,0.8,18.1 2,38.12321,-88.1321,2.2,17.0 Plain csv (comma separated value) files typically contain as many entries as there are columns on each line. In contrast, common spreadsheet editors stop writing if all remaining cells on a line are empty, which can lead to lines where the rightmost entries are missing. This Reader can deal with such files. Masked values (indicated by an empty '' field value when reading) are written out in the same way with an empty ('') field. This is different from the typical default for `astropy.io.ascii` in which missing values are indicated by ``--``. Example:: num,ra,dec,radius,mag 1,32.23222,10.1211 2,38.12321,-88.1321,2.2,17.0 """ _format_name = 'csv' _io_registry_can_write = True _description = 'Comma-separated-values' header_class = CsvHeader data_class = CsvData def inconsistent_handler(self, str_vals, ncols): """ Adjust row if it is too short. If a data row is shorter than the header, add empty values to make it the right length. Note that this will *not* be called if the row already matches the header. Parameters ---------- str_vals : list A list of value strings from the current row of the table. ncols : int The expected number of entries from the table header. Returns ------- str_vals : list List of strings to be parsed into data entries in the output table. """ if len(str_vals) < ncols: str_vals.extend((ncols - len(str_vals)) * ['']) return str_vals class RdbHeader(TabHeader): """ Header for RDB tables """ col_type_map = {'n': core.NumType, 's': core.StrType} def get_type_map_key(self, col): return col.raw_type[-1] def get_cols(self, lines): """ Initialize the header Column objects from the table ``lines``. This is a specialized get_cols for the RDB type: Line 0: RDB col names Line 1: RDB col definitions Line 2+: RDB data rows Parameters ---------- lines : list List of table lines Returns ------- None """ header_lines = self.process_lines(lines) # this is a generator header_vals_list = [hl for _, hl in zip(range(2), self.splitter(header_lines))] if len(header_vals_list) != 2: raise ValueError('RDB header requires 2 lines') self.names, raw_types = header_vals_list if len(self.names) != len(raw_types): raise ValueError('RDB header mismatch between number of column names and column types') if any(not re.match(r'\d*(N|S)$', x, re.IGNORECASE) for x in raw_types): raise ValueError('RDB types definitions do not all match [num](N|S): {}'.format(raw_types)) self._set_cols_from_names() for col, raw_type in zip(self.cols, raw_types): col.raw_type = raw_type col.type = self.get_col_type(col) def write(self, lines): lines.append(self.splitter.join(self.colnames)) rdb_types = [] for col in self.cols: # Check if dtype.kind is string or unicode. See help(np.core.numerictypes) rdb_type = 'S' if col.info.dtype.kind in ('S', 'U') else 'N' rdb_types.append(rdb_type) lines.append(self.splitter.join(rdb_types)) class RdbData(TabData): """ Data reader for RDB data. Starts reading at line 2. """ start_line = 2 class Rdb(Tab): """ Read a tab-separated file with an extra line after the column definition line. The RDB format meets this definition. Example:: col1 <tab> col2 <tab> col3 N <tab> S <tab> N 1 <tab> 2 <tab> 5 In this reader the second line is just ignored. """ _format_name = 'rdb' _io_registry_format_aliases = ['rdb'] _io_registry_suffix = '.rdb' _description = 'Tab-separated with a type definition header line' header_class = RdbHeader data_class = RdbData<|fim▁end|>
<|file_name|>DynamicActivity.java<|end_file_name|><|fim▁begin|>package aaron.org.anote.viewbinder; <|fim▁hole|>import android.os.Bundle; public class DynamicActivity extends Activity { @Override public void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); Layout.start(this); } }<|fim▁end|>
import android.app.Activity;
<|file_name|>data.rs<|end_file_name|><|fim▁begin|>use redox::prelude::v1::*; use table::NodeTable; /// A data node (file/dir) pub enum Data { /// File File(File), /// Directory Dir(Dir), /// Nothing Nil, } <|fim▁hole|>impl Data { pub fn name(&self) -> &str { match self { &Data::File(ref f) => &f.name, &Data::Dir(ref d) => &d.name, &Data::Nil => "\0", } } } /// A file pub struct File { /// The name of the file name: String, /// The actual content of the file data: Vec<u8>, } impl File { /// Create a file from a slice of bytes pub fn from_bytes(b: &[u8]) -> Self { let name = unsafe { String::from_utf8_unchecked(b[0..64].to_vec()) }; let data = b[256..].to_vec(); File { name: name, data: data, } } } /// A directory pub struct Dir { /// The name of the directory name: String, /// The table of the directory nodes: Vec<DataPtr>, } impl Dir { /// Create a new directory from a slice of bytes pub fn from_bytes(b: &[u8]) -> Self { let name = unsafe { String::from_utf8_unchecked(b[0..64].to_vec()) }; let mut n = 0; while let Some(&35) = b.get(n + 256 - 1) { n += 256; } let nodes = b[n..].to_vec().iter().splitn(16).map(|x| DataPtr::from_bytes(x)).collect(); Dir { name: name, nodes: nodes, } } /// Get the table represented by this directory pub fn get_table<'a>(&'a self) -> NodeTable<'a> { NodeTable::from_bytes(&self.data[..]) } }<|fim▁end|>
<|file_name|>workspace.rs<|end_file_name|><|fim▁begin|>use crate::core::{Target, Workspace}; use crate::ops::CompileOptions; use crate::util::CargoResult; use anyhow::bail; use std::fmt::Write; fn get_available_targets<'a>( filter_fn: fn(&Target) -> bool, ws: &'a Workspace<'_>, options: &'a CompileOptions, ) -> CargoResult<Vec<&'a str>> { let packages = options.spec.get_packages(ws)?; let mut targets: Vec<_> = packages .into_iter() .flat_map(|pkg| { pkg.manifest() .targets() .iter() .filter(|target| filter_fn(target)) }) .map(Target::name) .collect(); targets.sort(); Ok(targets) } fn print_available_targets( filter_fn: fn(&Target) -> bool, ws: &Workspace<'_>, options: &CompileOptions, option_name: &str, plural_name: &str, ) -> CargoResult<()> { let targets = get_available_targets(filter_fn, ws, options)?; let mut output = String::new(); writeln!(output, "\"{}\" takes one argument.", option_name)?; if targets.is_empty() { writeln!(output, "No {} available.", plural_name)?; } else { writeln!(output, "Available {}:", plural_name)?; for target in targets { writeln!(output, " {}", target)?; } } bail!("{}", output) } pub fn print_available_packages(ws: &Workspace<'_>) -> CargoResult<()> { let packages = ws .members()<|fim▁hole|> let mut output = "\"--package <SPEC>\" requires a SPEC format value, \ which can be any package ID specifier in the dependency graph.\n\ Run `cargo help pkgid` for more information about SPEC format.\n\n" .to_string(); if packages.is_empty() { // This would never happen. // Just in case something regresses we covers it here. writeln!(output, "No packages available.")?; } else { writeln!(output, "Possible packages/workspace members:")?; for package in packages { writeln!(output, " {}", package)?; } } bail!("{}", output) } pub fn print_available_examples(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> { print_available_targets(Target::is_example, ws, options, "--example", "examples") } pub fn print_available_binaries(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> { print_available_targets(Target::is_bin, ws, options, "--bin", "binaries") } pub fn print_available_benches(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> { print_available_targets(Target::is_bench, ws, options, "--bench", "benches") } pub fn print_available_tests(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> { print_available_targets(Target::is_test, ws, options, "--test", "tests") }<|fim▁end|>
.map(|pkg| pkg.name().as_str()) .collect::<Vec<_>>();
<|file_name|>OpenCompareViewAction.java<|end_file_name|><|fim▁begin|>package org.openlca.app.collaboration.navigation.actions; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.jface.dialogs.IDialogConstants; import org.openlca.app.M; import org.openlca.app.collaboration.dialogs.SelectCommitDialog; import org.openlca.app.collaboration.views.CompareView; import org.openlca.app.db.Repository; import org.openlca.app.navigation.actions.INavigationAction; import org.openlca.app.navigation.elements.INavigationElement; import org.openlca.app.rcp.images.Icon; import org.openlca.git.model.Commit; public class OpenCompareViewAction extends Action implements INavigationAction { private final boolean compareWithHead; private List<INavigationElement<?>> selection; public OpenCompareViewAction(boolean compareWithHead) { if (compareWithHead) { setText(M.HEADRevision); } else { setText(M.Commit + "..."); setImageDescriptor(Icon.COMPARE_COMMIT.descriptor()); } this.compareWithHead = compareWithHead; } @Override public void run() { Commit commit = null; if (compareWithHead) { commit = Repository.get().commits.head(); } else { SelectCommitDialog dialog = new SelectCommitDialog(); if (dialog.open() != IDialogConstants.OK_ID) return; commit = dialog.getSelection(); } CompareView.update(commit, selection); } @Override public boolean accept(List<INavigationElement<?>> selection) { if (!Repository.isConnected())<|fim▁hole|> } }<|fim▁end|>
return false; this.selection = selection; return true;
<|file_name|>create_campaign.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # # Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,<|fim▁hole|>"""This example creates a campaign in a given advertiser. To create an advertiser, run create_advertiser.py. The LoadFromStorage method is pulling credentials and properties from a "googleads.yaml" file. By default, it looks for this file in your home directory. For more information, see the "Caching authentication information" section of our README. """ # Import appropriate modules from the client library. from googleads import dfa ADVERTISER_ID = 'INSERT_ADVERTISER_ID_HERE' CAMPAIGN_NAME = 'INSERT_CAMPAIGN_NAME_HERE' URL = 'INSERT_LANDING_PAGE_URL_HERE' LANDING_PAGE_NAME = 'INSERT_LANDING_PAGE_NAME_HERE' START_DATE = '%(year)s-%(month)02d-%(day)02dT12:00:00' % { 'year': 'INSERT_START_YEAR_HERE', 'month': int('INSERT_START_MONTH_HERE'), 'day': int('INSERT_START_DAY_HERE')} END_DATE = '%(year)s-%(month)02d-%(day)02dT12:00:00' % { 'year': 'INSERT_END_YEAR_HERE', 'month': int('INSERT_END_MONTH_HERE'), 'day': int('INSERT_END_DAY_HERE')} def main(client, advertiser_id, campaign_name, url, landing_page_name, start_date, end_date): # Initialize appropriate service. campaign_service = client.GetService( 'campaign', 'v1.20', 'https://advertisersapitest.doubleclick.net') # Create a default landing page for the campaign and save it. default_landing_page = { 'url': url, 'name': landing_page_name } default_landing_page_id = campaign_service.saveLandingPage( default_landing_page)['id'] # Construct and save the campaign. campaign = { 'name': campaign_name, 'advertiserId': advertiser_id, 'defaultLandingPageId': default_landing_page_id, 'archived': 'false', 'startDate': start_date, 'endDate': end_date } result = campaign_service.saveCampaign(campaign) # Display results. print 'Campaign with ID \'%s\' was created.' % result['id'] if __name__ == '__main__': # Initialize client object. dfa_client = dfa.DfaClient.LoadFromStorage() main(dfa_client, ADVERTISER_ID, CAMPAIGN_NAME, URL, LANDING_PAGE_NAME, START_DATE, END_DATE)<|fim▁end|>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
<|file_name|>connections.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding: iso8859-1 -*- # # connections.py - network connections statistics # # Copyright (c) 2005-2007, Carlos Rodrigues <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License (version 2) as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # """Statistics for all network connections currently known by the netfilter subsystem.""" import os import rrdtool from components.common import * from templates.connections.index import index as ConnectionsPage # # The file where we get our data from. # DATA_SOURCE = "/proc/net/ip_conntrack" class NetworkConnections(StatsComponent): """Network Connections Statistics.""" def __init__(self): self.name = "connections" if not os.path.exists(DATA_SOURCE): fail(self.name, "maybe the kernel module 'ip_conntrack' isn't loaded.") raise StatsException(DATA_SOURCE + " does not exist") self.title = "Network Connections" self.description = "tracked connections, by protocol" self.data_dir = properties["data"] + "/" + self.name self.database = self.data_dir + "/protocol.rrd" self.graphs_dir = properties["output"] + "/" + self.name if not os.path.exists(self.data_dir): os.makedirs(self.data_dir) if not os.path.exists(self.graphs_dir): os.makedirs(self.graphs_dir) if not os.path.exists(self.database): # # Remember: all "time" values are expressed in seconds. # refresh = properties["refresh"] heartbeat = refresh * 2 rrdtool.create(self.database, "--step", "%d" % refresh, "DS:proto_tcp:GAUGE:%d:0:U" % heartbeat, "DS:proto_udp:GAUGE:%d:0:U" % heartbeat, "DS:proto_other:GAUGE:%d:0:U" % heartbeat, "RRA:AVERAGE:0.5:1:%d" % (86400 / refresh), # 1 day of 'refresh' averages "RRA:AVERAGE:0.5:%d:672" % (900 / refresh), # 7 days of 1/4 hour averages "RRA:AVERAGE:0.5:%d:744" % (3600 / refresh), # 31 days of 1 hour averages "RRA:AVERAGE:0.5:%d:730" % (43200 / refresh)) # 365 days of 1/2 day averages def info(self): """Return some information about the component, as a tuple: (name, title, description)""" return (self.name, self.title, self.description) def update(self): """Update the historical data.""" f = open(DATA_SOURCE, "r") proto_tcp = 0 proto_udp = 0 proto_other = 0 for line in f: data = line.split() proto = data[0].lower() if proto == "tcp": proto_tcp += 1 elif proto == "udp": proto_udp += 1 else: proto_other += 1 f.close() rrdtool.update(self.database, "--template", "proto_tcp:proto_udp:proto_other", "N:%d:%d:%d" % (proto_tcp, proto_udp, proto_other)) def make_graphs(self): """Generate the daily, weekly and monthly graphics.""" height = str(properties["height"]) width = str(properties["width"]) refresh = properties["refresh"] background = properties["background"] border = properties["border"] for interval in ("1day", "1week", "1month", "1year"): rrdtool.graph("%s/graph-%s.png" % (self.graphs_dir, interval), "--start", "-%s" % interval, "--end", "-%d" % refresh, # because the last data point is still *unknown* "--title", "network connections (by protocol)", "--lazy", "--base", "1000", "--height", height, "--width", width, "--lower-limit", "0", "--upper-limit", "10.0", "--imgformat", "PNG", "--vertical-label", "connections", "--color", "BACK%s" % background, "--color", "SHADEA%s" % border, "--color", "SHADEB%s" % border, "DEF:proto_tcp=%s:proto_tcp:AVERAGE" % self.database, "DEF:proto_udp=%s:proto_udp:AVERAGE" % self.database, "DEF:proto_other=%s:proto_other:AVERAGE" % self.database, "AREA:proto_tcp#a0df05:TCP ", "GPRINT:proto_tcp:LAST:\\: %6.0lf conn (now)", "GPRINT:proto_tcp:MAX:%6.0lf conn (max)", "GPRINT:proto_tcp:AVERAGE:%6.0lf conn (avg)\\n",<|fim▁hole|> "STACK:proto_udp#ffe100:UDP ", "GPRINT:proto_udp:LAST:\\: %6.0lf conn (now)", "GPRINT:proto_udp:MAX:%6.0lf conn (max)", "GPRINT:proto_udp:AVERAGE:%6.0lf conn (avg)\\n", "STACK:proto_other#dc3c14:Other", "GPRINT:proto_other:LAST:\\: %6.0lf conn (now)", "GPRINT:proto_other:MAX:%6.0lf conn (max)", "GPRINT:proto_other:AVERAGE:%6.0lf conn (avg)") def make_html(self): """Generate the HTML pages.""" template = ConnectionsPage() template_fill(template, self.description) template_write(template, self.graphs_dir + "/index.html") # EOF - connections.py<|fim▁end|>
<|file_name|>test-get-reduction-export.js<|end_file_name|><|fim▁begin|>const moment = require('moment') const expect = require('chai').expect const sinon = require('sinon') const proxyquire = require('proxyquire') const breadcrumbHelper = require('../../helpers/breadcrumb-helper') const orgUnitConstant = require('../../../app/constants/organisation-unit.js') const activeStartDate = moment('25-12-2017', 'DD-MM-YYYY').toDate() // 2017-12-25T00:00:00.000Z const activeEndDate = moment('25-12-2018', 'DD-MM-YYYY').toDate() // 2018-12-25T00:00:00.000Z const breadcrumbs = breadcrumbHelper.TEAM_BREADCRUMBS const expectedReductionExport = [ { offenderManager: 'Test_Forename Test_Surname', reason: 'Disability', amount: 5, startDate: activeStartDate, endDate: activeEndDate, status: 'ACTIVE', additionalNotes: 'New Test Note' }] let getReductionsData let exportReductionService let getBreadcrumbsStub beforeEach(function () { getReductionsData = sinon.stub() getBreadcrumbsStub = sinon.stub().resolves(breadcrumbs) exportReductionService = proxyquire('../../../app/services/get-reductions-export', { './data/get-reduction-notes-export': getReductionsData, './get-breadcrumbs': getBreadcrumbsStub }) }) describe('services/get-reductions-export', function () { it('should return the expected reductions exports for team level', function () { getReductionsData.resolves(expectedReductionExport) return exportReductionService(1, orgUnitConstant.TEAM.name) .then(function (result) { expect(getReductionsData.calledWith(1, orgUnitConstant.TEAM.name)).to.be.eql(true) expect(getBreadcrumbsStub.calledWith(1, orgUnitConstant.TEAM.name)).to.be.eql(true) expect(result.reductionNotes[0].offenderManager).to.be.eql(expectedReductionExport[0].offenderManager) expect(result.reductionNotes[0].reason).to.be.eql(expectedReductionExport[0].reason) expect(result.reductionNotes[0].amount).to.be.eql(expectedReductionExport[0].amount) expect(result.reductionNotes[0].startDate).to.be.eql('25 12 2017, 00:00')<|fim▁hole|> }) }) })<|fim▁end|>
expect(result.reductionNotes[0].endDate).to.be.eql('25 12 2018, 00:00') expect(result.reductionNotes[0].status).to.be.eql(expectedReductionExport[0].status) expect(result.reductionNotes[0].additionalNotes).to.be.eql(expectedReductionExport[0].additionalNotes)
<|file_name|>test_adcps_jln_stc_recovered_driver.py<|end_file_name|><|fim▁begin|>__author__ = 'Mark Worden' from mi.core.log import get_logger log = get_logger() from mi.idk.config import Config import unittest import os from mi.dataset.driver.adcps_jln.stc.adcps_jln_stc_recovered_driver import parse from mi.dataset.dataset_driver import ParticleDataHandler <|fim▁hole|> def setUp(self): pass def tearDown(self): pass def test_one(self): sourceFilePath = os.path.join('mi', 'dataset', 'driver', 'adcps_jln', 'stc', 'resource', 'adcpt_20130929_091817.DAT') particle_data_hdlr_obj = ParticleDataHandler() particle_data_hdlr_obj = parse(Config().base_dir(), sourceFilePath, particle_data_hdlr_obj) log.debug("SAMPLES: %s", particle_data_hdlr_obj._samples) log.debug("FAILURE: %s", particle_data_hdlr_obj._failure) self.assertEquals(particle_data_hdlr_obj._failure, False) if __name__ == '__main__': test = SampleTest('test_one') test.test_one()<|fim▁end|>
class SampleTest(unittest.TestCase):
<|file_name|>primitive_docs.rs<|end_file_name|><|fim▁begin|>#[doc(primitive = "bool")] #[doc(alias = "true")] #[doc(alias = "false")] /// The boolean type. /// /// The `bool` represents a value, which could only be either [`true`] or [`false`]. If you cast /// a `bool` into an integer, [`true`] will be 1 and [`false`] will be 0. /// /// # Basic usage /// /// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc., /// which allow us to perform boolean operations using `&`, `|` and `!`. /// /// [`if`] requires a `bool` value as its conditional. [`assert!`], which is an /// important macro in testing, checks whether an expression is [`true`] and panics /// if it isn't. /// /// ``` /// let bool_val = true & false | false; /// assert!(!bool_val); /// ``` /// /// [`true`]: keyword.true.html /// [`false`]: keyword.false.html /// [`BitAnd`]: ops::BitAnd /// [`BitOr`]: ops::BitOr /// [`Not`]: ops::Not /// [`if`]: keyword.if.html /// /// # Examples /// /// A trivial example of the usage of `bool`: /// /// ``` /// let praise_the_borrow_checker = true; /// /// // using the `if` conditional /// if praise_the_borrow_checker { /// println!("oh, yeah!"); /// } else { /// println!("what?!!"); /// } /// /// // ... or, a match pattern /// match praise_the_borrow_checker { /// true => println!("keep praising!"), /// false => println!("you should praise!"), /// } /// ``` /// /// Also, since `bool` implements the [`Copy`] trait, we don't /// have to worry about the move semantics (just like the integer and float primitives). /// /// Now an example of `bool` cast to integer type: /// /// ``` /// assert_eq!(true as i32, 1); /// assert_eq!(false as i32, 0); /// ``` #[stable(feature = "rust1", since = "1.0.0")] mod prim_bool {} #[doc(primitive = "never")] #[doc(alias = "!")] // /// The `!` type, also called "never". /// /// `!` represents the type of computations which never resolve to any value at all. For example, /// the [`exit`] function `fn exit(code: i32) -> !` exits the process without ever returning, and /// so returns `!`. /// /// `break`, `continue` and `return` expressions also have type `!`. For example we are allowed to /// write: /// /// ``` /// #![feature(never_type)] /// # fn foo() -> u32 { /// let x: ! = { /// return 123 /// }; /// # } /// ``` /// /// Although the `let` is pointless here, it illustrates the meaning of `!`. Since `x` is never /// assigned a value (because `return` returns from the entire function), `x` can be given type /// `!`. We could also replace `return 123` with a `panic!` or a never-ending `loop` and this code /// would still be valid. /// /// A more realistic usage of `!` is in this code: /// /// ``` /// # fn get_a_number() -> Option<u32> { None } /// # loop { /// let num: u32 = match get_a_number() { /// Some(num) => num, /// None => break, /// }; /// # } /// ``` /// /// Both match arms must produce values of type [`u32`], but since `break` never produces a value /// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another /// behaviour of the `!` type - expressions with type `!` will coerce into any other type. /// /// [`u32`]: prim@u32 /// [`exit`]: process::exit /// /// # `!` and generics /// /// ## Infallible errors /// /// The main place you'll see `!` used explicitly is in generic code. Consider the [`FromStr`] /// trait: /// /// ``` /// trait FromStr: Sized { /// type Err; /// fn from_str(s: &str) -> Result<Self, Self::Err>; /// } /// ``` /// /// When implementing this trait for [`String`] we need to pick a type for [`Err`]. And since /// converting a string into a string will never result in an error, the appropriate type is `!`. /// (Currently the type actually used is an enum with no variants, though this is only because `!` /// was added to Rust at a later date and it may change in the future.) With an [`Err`] type of /// `!`, if we have to call [`String::from_str`] for some reason the result will be a /// [`Result<String, !>`] which we can unpack like this: /// /// ``` /// #![feature(exhaustive_patterns)] /// use std::str::FromStr; /// let Ok(s) = String::from_str("hello"); /// ``` /// /// Since the [`Err`] variant contains a `!`, it can never occur. If the `exhaustive_patterns` /// feature is present this means we can exhaustively match on [`Result<T, !>`] by just taking the /// [`Ok`] variant. This illustrates another behaviour of `!` - it can be used to "delete" certain /// enum variants from generic types like `Result`. /// /// ## Infinite loops /// /// While [`Result<T, !>`] is very useful for removing errors, `!` can also be used to remove /// successes as well. If we think of [`Result<T, !>`] as "if this function returns, it has not /// errored," we get a very intuitive idea of [`Result<!, E>`] as well: if the function returns, it /// *has* errored. /// /// For example, consider the case of a simple web server, which can be simplified to: /// /// ```ignore (hypothetical-example) /// loop { /// let (client, request) = get_request().expect("disconnected"); /// let response = request.process(); /// response.send(client); /// } /// ``` /// /// Currently, this isn't ideal, because we simply panic whenever we fail to get a new connection. /// Instead, we'd like to keep track of this error, like this: /// /// ```ignore (hypothetical-example) /// loop { /// match get_request() { /// Err(err) => break err, /// Ok((client, request)) => { /// let response = request.process(); /// response.send(client); /// }, /// } /// } /// ``` /// /// Now, when the server disconnects, we exit the loop with an error instead of panicking. While it /// might be intuitive to simply return the error, we might want to wrap it in a [`Result<!, E>`] /// instead: /// /// ```ignore (hypothetical-example) /// fn server_loop() -> Result<!, ConnectionError> { /// loop { /// let (client, request) = get_request()?; /// let response = request.process(); /// response.send(client); /// } /// } /// ``` /// /// Now, we can use `?` instead of `match`, and the return type makes a lot more sense: if the loop /// ever stops, it means that an error occurred. We don't even have to wrap the loop in an `Ok` /// because `!` coerces to `Result<!, ConnectionError>` automatically. /// /// [`String::from_str`]: str::FromStr::from_str /// [`String`]: string::String /// [`FromStr`]: str::FromStr /// /// # `!` and traits /// /// When writing your own traits, `!` should have an `impl` whenever there is an obvious `impl` /// which doesn't `panic!`. The reason is that functions returning an `impl Trait` where `!` /// does not have an `impl` of `Trait` cannot diverge as their only possible code path. In other /// words, they can't return `!` from every code path. As an example, this code doesn't compile: /// /// ```compile_fail /// use std::ops::Add; /// /// fn foo() -> impl Add<u32> { /// unimplemented!() /// } /// ``` /// /// But this code does: /// /// ``` /// use std::ops::Add; /// /// fn foo() -> impl Add<u32> { /// if true { /// unimplemented!() /// } else { /// 0 /// } /// } /// ``` /// /// The reason is that, in the first example, there are many possible types that `!` could coerce /// to, because many types implement `Add<u32>`. However, in the second example, /// the `else` branch returns a `0`, which the compiler infers from the return type to be of type /// `u32`. Since `u32` is a concrete type, `!` can and will be coerced to it. See issue [#36375] /// for more information on this quirk of `!`. /// /// [#36375]: https://github.com/rust-lang/rust/issues/36375 /// /// As it turns out, though, most traits can have an `impl` for `!`. Take [`Debug`] /// for example: /// /// ``` /// #![feature(never_type)] /// # use std::fmt; /// # trait Debug { /// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result; /// # } /// impl Debug for ! { /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// *self /// } /// } /// ``` /// /// Once again we're using `!`'s ability to coerce into any other type, in this case /// [`fmt::Result`]. Since this method takes a `&!` as an argument we know that it can never be /// called (because there is no value of type `!` for it to be called with). Writing `*self` /// essentially tells the compiler "We know that this code can never be run, so just treat the /// entire function body as having type [`fmt::Result`]". This pattern can be used a lot when /// implementing traits for `!`. Generally, any trait which only has methods which take a `self` /// parameter should have such an impl. /// /// On the other hand, one trait which would not be appropriate to implement is [`Default`]: /// /// ``` /// trait Default { /// fn default() -> Self; /// } /// ``` /// /// Since `!` has no values, it has no default value either. It's true that we could write an /// `impl` for this which simply panics, but the same is true for any type (we could `impl /// Default` for (eg.) [`File`] by just making [`default()`] panic.) /// /// [`File`]: fs::File /// [`Debug`]: fmt::Debug /// [`default()`]: Default::default /// #[unstable(feature = "never_type", issue = "35121")] mod prim_never {} #[doc(primitive = "char")] // /// A character type. /// /// The `char` type represents a single character. More specifically, since /// 'character' isn't a well-defined concept in Unicode, `char` is a '[Unicode /// scalar value]', which is similar to, but not the same as, a '[Unicode code /// point]'. /// /// [Unicode scalar value]: https://www.unicode.org/glossary/#unicode_scalar_value /// [Unicode code point]: https://www.unicode.org/glossary/#code_point /// /// This documentation describes a number of methods and trait implementations on the /// `char` type. For technical reasons, there is additional, separate /// documentation in [the `std::char` module](char/index.html) as well. /// /// # Representation /// /// `char` is always four bytes in size. This is a different representation than /// a given character would have as part of a [`String`]. For example: /// /// ``` /// let v = vec!['h', 'e', 'l', 'l', 'o']; /// /// // five elements times four bytes for each element /// assert_eq!(20, v.len() * std::mem::size_of::<char>()); /// /// let s = String::from("hello"); /// /// // five elements times one byte per element /// assert_eq!(5, s.len() * std::mem::size_of::<u8>()); /// ``` /// /// [`String`]: string/struct.String.html /// /// As always, remember that a human intuition for 'character' might not map to /// Unicode's definitions. For example, despite looking similar, the 'é' /// character is one Unicode code point while 'é' is two Unicode code points: /// /// ``` /// let mut chars = "é".chars(); /// // U+00e9: 'latin small letter e with acute' /// assert_eq!(Some('\u{00e9}'), chars.next()); /// assert_eq!(None, chars.next()); /// /// let mut chars = "é".chars(); /// // U+0065: 'latin small letter e' /// assert_eq!(Some('\u{0065}'), chars.next()); /// // U+0301: 'combining acute accent' /// assert_eq!(Some('\u{0301}'), chars.next()); /// assert_eq!(None, chars.next()); /// ``` /// /// This means that the contents of the first string above _will_ fit into a /// `char` while the contents of the second string _will not_. Trying to create /// a `char` literal with the contents of the second string gives an error: /// /// ```text /// error: character literal may only contain one codepoint: 'é' /// let c = 'é'; /// ^^^ /// ``` /// /// Another implication of the 4-byte fixed size of a `char` is that /// per-`char` processing can end up using a lot more memory: /// /// ``` /// let s = String::from("love: ❤️"); /// let v: Vec<char> = s.chars().collect(); /// /// assert_eq!(12, std::mem::size_of_val(&s[..])); /// assert_eq!(32, std::mem::size_of_val(&v[..])); /// ``` #[stable(feature = "rust1", since = "1.0.0")] mod prim_char {} #[doc(primitive = "unit")] #[doc(alias = "(")] #[doc(alias = ")")] #[doc(alias = "()")] // /// The `()` type, also called "unit". /// /// The `()` type has exactly one value `()`, and is used when there /// is no other meaningful value that could be returned. `()` is most /// commonly seen implicitly: functions without a `-> ...` implicitly /// have return type `()`, that is, these are equivalent: /// /// ```rust /// fn long() -> () {} /// /// fn short() {} /// ``` /// /// The semicolon `;` can be used to discard the result of an /// expression at the end of a block, making the expression (and thus /// the block) evaluate to `()`. For example, /// /// ```rust /// fn returns_i64() -> i64 { /// 1i64 /// } /// fn returns_unit() { /// 1i64; /// } /// /// let is_i64 = { /// returns_i64() /// }; /// let is_unit = { /// returns_i64(); /// }; /// ``` /// #[stable(feature = "rust1", since = "1.0.0")] mod prim_unit {} #[doc(alias = "ptr")] #[doc(primitive = "pointer")] // /// Raw, unsafe pointers, `*const T`, and `*mut T`. /// /// *[See also the `std::ptr` module](ptr).* /// /// Working with raw pointers in Rust is uncommon, typically limited to a few patterns. /// Raw pointers can be unaligned or [`null`]. However, when a raw pointer is /// dereferenced (using the `*` operator), it must be non-null and aligned. /// /// Storing through a raw pointer using `*ptr = data` calls `drop` on the old value, so /// [`write`] must be used if the type has drop glue and memory is not already /// initialized - otherwise `drop` would be called on the uninitialized memory. /// /// Use the [`null`] and [`null_mut`] functions to create null pointers, and the /// [`is_null`] method of the `*const T` and `*mut T` types to check for null. /// The `*const T` and `*mut T` types also define the [`offset`] method, for /// pointer math. /// /// # Common ways to create raw pointers /// /// ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`). /// /// ``` /// let my_num: i32 = 10; /// let my_num_ptr: *const i32 = &my_num; /// let mut my_speed: i32 = 88; /// let my_speed_ptr: *mut i32 = &mut my_speed; /// ``` /// /// To get a pointer to a boxed value, dereference the box:<|fim▁hole|>/// let my_num_ptr: *const i32 = &*my_num; /// let mut my_speed: Box<i32> = Box::new(88); /// let my_speed_ptr: *mut i32 = &mut *my_speed; /// ``` /// /// This does not take ownership of the original allocation /// and requires no resource management later, /// but you must not use the pointer after its lifetime. /// /// ## 2. Consume a box (`Box<T>`). /// /// The [`into_raw`] function consumes a box and returns /// the raw pointer. It doesn't destroy `T` or deallocate any memory. /// /// ``` /// let my_speed: Box<i32> = Box::new(88); /// let my_speed: *mut i32 = Box::into_raw(my_speed); /// /// // By taking ownership of the original `Box<T>` though /// // we are obligated to put it together later to be destroyed. /// unsafe { /// drop(Box::from_raw(my_speed)); /// } /// ``` /// /// Note that here the call to [`drop`] is for clarity - it indicates /// that we are done with the given value and it should be destroyed. /// /// ## 3. Create it using `ptr::addr_of!` /// /// Instead of coercing a reference to a raw pointer, you can use the macros /// [`ptr::addr_of!`] (for `*const T`) and [`ptr::addr_of_mut!`] (for `*mut T`). /// These macros allow you to create raw pointers to fields to which you cannot /// create a reference (without causing undefined behaviour), such as an /// unaligned field. This might be necessary if packed structs or uninitialized /// memory is involved. /// /// ``` /// #[derive(Debug, Default, Copy, Clone)] /// #[repr(C, packed)] /// struct S { /// aligned: u8, /// unaligned: u32, /// } /// let s = S::default(); /// let p = std::ptr::addr_of!(s.unaligned); // not allowed with coercion /// ``` /// /// ## 4. Get it from C. /// /// ``` /// # #![feature(rustc_private)] /// extern crate libc; /// /// use std::mem; /// /// unsafe { /// let my_num: *mut i32 = libc::malloc(mem::size_of::<i32>()) as *mut i32; /// if my_num.is_null() { /// panic!("failed to allocate memory"); /// } /// libc::free(my_num as *mut libc::c_void); /// } /// ``` /// /// Usually you wouldn't literally use `malloc` and `free` from Rust, /// but C APIs hand out a lot of pointers generally, so are a common source /// of raw pointers in Rust. /// /// [`null`]: ptr::null /// [`null_mut`]: ptr::null_mut /// [`is_null`]: pointer::is_null /// [`offset`]: pointer::offset /// [`into_raw`]: Box::into_raw /// [`drop`]: mem::drop /// [`write`]: ptr::write #[stable(feature = "rust1", since = "1.0.0")] mod prim_pointer {} #[doc(alias = "[]")] #[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases #[doc(alias = "[T; N]")] #[doc(primitive = "array")] /// A fixed-size array, denoted `[T; N]`, for the element type, `T`, and the /// non-negative compile-time constant size, `N`. /// /// There are two syntactic forms for creating an array: /// /// * A list with each element, i.e., `[x, y, z]`. /// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`. /// The type of `x` must be [`Copy`]. /// /// Note that `[expr; 0]` is allowed, and produces an empty array. /// This will still evaluate `expr`, however, and immediately drop the resulting value, so /// be mindful of side effects. /// /// Arrays of *any* size implement the following traits if the element type allows it: /// /// - [`Copy`] /// - [`Clone`] /// - [`Debug`] /// - [`IntoIterator`] (implemented for `[T; N]`, `&[T; N]` and `&mut [T; N]`) /// - [`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] /// - [`Hash`] /// - [`AsRef`], [`AsMut`] /// - [`Borrow`], [`BorrowMut`] /// /// Arrays of sizes from 0 to 32 (inclusive) implement the [`Default`] trait /// if the element type allows it. As a stopgap, trait implementations are /// statically generated up to size 32. /// /// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on /// an array. Indeed, this provides most of the API for working with arrays. /// Slices have a dynamic size and do not coerce to arrays. /// /// You can move elements out of an array with a [slice pattern]. If you want /// one element, see [`mem::replace`]. /// /// # Examples /// /// ``` /// let mut array: [i32; 3] = [0; 3]; /// /// array[1] = 1; /// array[2] = 2; /// /// assert_eq!([1, 2], &array[1..]); /// /// // This loop prints: 0 1 2 /// for x in array { /// print!("{} ", x); /// } /// ``` /// /// You can also iterate over reference to the array's elements: /// /// ``` /// let array: [i32; 3] = [0; 3]; /// /// for x in &array { } /// ``` /// /// You can use a [slice pattern] to move elements out of an array: /// /// ``` /// fn move_away(_: String) { /* Do interesting things. */ } /// /// let [john, roa] = ["John".to_string(), "Roa".to_string()]; /// move_away(john); /// move_away(roa); /// ``` /// /// # Editions /// /// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call /// `array.into_iter()` auto-referenced into a [slice iterator](slice::iter). Right now, the old behavior /// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring /// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition /// might be made consistent to the behavior of later editions. /// /// ```rust,edition2018 /// // Rust 2015 and 2018: /// /// # #![allow(array_into_iter)] // override our `deny(warnings)` /// let array: [i32; 3] = [0; 3]; /// /// // This creates a slice iterator, producing references to each value. /// for item in array.into_iter().enumerate() { /// let (i, x): (usize, &i32) = item; /// println!("array[{}] = {}", i, x); /// } /// /// // The `array_into_iter` lint suggests this change for future compatibility: /// for item in array.iter().enumerate() { /// let (i, x): (usize, &i32) = item; /// println!("array[{}] = {}", i, x); /// } /// /// // You can explicitly iterate an array by value using /// // `IntoIterator::into_iter` or `std::array::IntoIter::new`: /// for item in IntoIterator::into_iter(array).enumerate() { /// let (i, x): (usize, i32) = item; /// println!("array[{}] = {}", i, x); /// } /// ``` /// /// Starting in the 2021 edition, `array.into_iter()` uses `IntoIterator` normally to iterate /// by value, and `iter()` should be used to iterate by reference like previous editions. /// #[cfg_attr(bootstrap, doc = "```rust,edition2021,ignore")] #[cfg_attr(not(bootstrap), doc = "```rust,edition2021")] /// // Rust 2021: /// /// let array: [i32; 3] = [0; 3]; /// /// // This iterates by reference: /// for item in array.iter().enumerate() { /// let (i, x): (usize, &i32) = item; /// println!("array[{}] = {}", i, x); /// } /// /// // This iterates by value: /// for item in array.into_iter().enumerate() { /// let (i, x): (usize, i32) = item; /// println!("array[{}] = {}", i, x); /// } /// ``` /// /// Future language versions might start treating the `array.into_iter()` /// syntax on editions 2015 and 2018 the same as on edition 2021. So code using /// those older editions should still be written with this change in mind, to /// prevent breakage in the future. The safest way to accomplish this is to /// avoid the `into_iter` syntax on those editions. If an edition update is not /// viable/desired, there are multiple alternatives: /// * use `iter`, equivalent to the old behavior, creating references /// * use [`IntoIterator::into_iter`], equivalent to the post-2021 behavior (Rust 1.53+) /// * replace `for ... in array.into_iter() {` with `for ... in array {`, /// equivalent to the post-2021 behavior (Rust 1.53+) /// /// ```rust,edition2018 /// // Rust 2015 and 2018: /// /// let array: [i32; 3] = [0; 3]; /// /// // This iterates by reference: /// for item in array.iter() { /// let x: &i32 = item; /// println!("{}", x); /// } /// /// // This iterates by value: /// for item in IntoIterator::into_iter(array) { /// let x: i32 = item; /// println!("{}", x); /// } /// /// // This iterates by value: /// for item in array { /// let x: i32 = item; /// println!("{}", x); /// } /// /// // IntoIter can also start a chain. /// // This iterates by value: /// for item in IntoIterator::into_iter(array).enumerate() { /// let (i, x): (usize, i32) = item; /// println!("array[{}] = {}", i, x); /// } /// ``` /// /// [slice]: prim@slice /// [`Debug`]: fmt::Debug /// [`Hash`]: hash::Hash /// [`Borrow`]: borrow::Borrow /// [`BorrowMut`]: borrow::BorrowMut /// [slice pattern]: ../reference/patterns.html#slice-patterns #[stable(feature = "rust1", since = "1.0.0")] mod prim_array {} #[doc(primitive = "slice")] #[doc(alias = "[")] #[doc(alias = "]")] #[doc(alias = "[]")] /// A dynamically-sized view into a contiguous sequence, `[T]`. Contiguous here /// means that elements are laid out so that every element is the same /// distance from its neighbors. /// /// *[See also the `std::slice` module](crate::slice).* /// /// Slices are a view into a block of memory represented as a pointer and a /// length. /// /// ``` /// // slicing a Vec /// let vec = vec![1, 2, 3]; /// let int_slice = &vec[..]; /// // coercing an array to a slice /// let str_slice: &[&str] = &["one", "two", "three"]; /// ``` /// /// Slices are either mutable or shared. The shared slice type is `&[T]`, /// while the mutable slice type is `&mut [T]`, where `T` represents the element /// type. For example, you can mutate the block of memory that a mutable slice /// points to: /// /// ``` /// let mut x = [1, 2, 3]; /// let x = &mut x[..]; // Take a full slice of `x`. /// x[1] = 7; /// assert_eq!(x, &[1, 7, 3]); /// ``` /// /// As slices store the length of the sequence they refer to, they have twice /// the size of pointers to [`Sized`](marker/trait.Sized.html) types. /// Also see the reference on /// [dynamically sized types](../reference/dynamically-sized-types.html). /// /// ``` /// # use std::rc::Rc; /// let pointer_size = std::mem::size_of::<&u8>(); /// assert_eq!(2 * pointer_size, std::mem::size_of::<&[u8]>()); /// assert_eq!(2 * pointer_size, std::mem::size_of::<*const [u8]>()); /// assert_eq!(2 * pointer_size, std::mem::size_of::<Box<[u8]>>()); /// assert_eq!(2 * pointer_size, std::mem::size_of::<Rc<[u8]>>()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] mod prim_slice {} #[doc(primitive = "str")] // /// String slices. /// /// *[See also the `std::str` module](crate::str).* /// /// The `str` type, also called a 'string slice', is the most primitive string /// type. It is usually seen in its borrowed form, `&str`. It is also the type /// of string literals, `&'static str`. /// /// String slices are always valid UTF-8. /// /// # Examples /// /// String literals are string slices: /// /// ``` /// let hello = "Hello, world!"; /// /// // with an explicit type annotation /// let hello: &'static str = "Hello, world!"; /// ``` /// /// They are `'static` because they're stored directly in the final binary, and /// so will be valid for the `'static` duration. /// /// # Representation /// /// A `&str` is made up of two components: a pointer to some bytes, and a /// length. You can look at these with the [`as_ptr`] and [`len`] methods: /// /// ``` /// use std::slice; /// use std::str; /// /// let story = "Once upon a time..."; /// /// let ptr = story.as_ptr(); /// let len = story.len(); /// /// // story has nineteen bytes /// assert_eq!(19, len); /// /// // We can re-build a str out of ptr and len. This is all unsafe because /// // we are responsible for making sure the two components are valid: /// let s = unsafe { /// // First, we build a &[u8]... /// let slice = slice::from_raw_parts(ptr, len); /// /// // ... and then convert that slice into a string slice /// str::from_utf8(slice) /// }; /// /// assert_eq!(s, Ok(story)); /// ``` /// /// [`as_ptr`]: str::as_ptr /// [`len`]: str::len /// /// Note: This example shows the internals of `&str`. `unsafe` should not be /// used to get a string slice under normal circumstances. Use `as_str` /// instead. #[stable(feature = "rust1", since = "1.0.0")] mod prim_str {} #[doc(primitive = "tuple")] #[doc(alias = "(")] #[doc(alias = ")")] #[doc(alias = "()")] // /// A finite heterogeneous sequence, `(T, U, ..)`. /// /// Let's cover each of those in turn: /// /// Tuples are *finite*. In other words, a tuple has a length. Here's a tuple /// of length `3`: /// /// ``` /// ("hello", 5, 'c'); /// ``` /// /// 'Length' is also sometimes called 'arity' here; each tuple of a different /// length is a different, distinct type. /// /// Tuples are *heterogeneous*. This means that each element of the tuple can /// have a different type. In that tuple above, it has the type: /// /// ``` /// # let _: /// (&'static str, i32, char) /// # = ("hello", 5, 'c'); /// ``` /// /// Tuples are a *sequence*. This means that they can be accessed by position; /// this is called 'tuple indexing', and it looks like this: /// /// ```rust /// let tuple = ("hello", 5, 'c'); /// /// assert_eq!(tuple.0, "hello"); /// assert_eq!(tuple.1, 5); /// assert_eq!(tuple.2, 'c'); /// ``` /// /// The sequential nature of the tuple applies to its implementations of various /// traits. For example, in [`PartialOrd`] and [`Ord`], the elements are compared /// sequentially until the first non-equal set is found. /// /// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type). /// /// # Trait implementations /// /// If every type inside a tuple implements one of the following traits, then a /// tuple itself also implements it. /// /// * [`Clone`] /// * [`Copy`] /// * [`PartialEq`] /// * [`Eq`] /// * [`PartialOrd`] /// * [`Ord`] /// * [`Debug`] /// * [`Default`] /// * [`Hash`] /// /// [`Debug`]: fmt::Debug /// [`Hash`]: hash::Hash /// /// Due to a temporary restriction in Rust's type system, these traits are only /// implemented on tuples of arity 12 or less. In the future, this may change. /// /// # Examples /// /// Basic usage: /// /// ``` /// let tuple = ("hello", 5, 'c'); /// /// assert_eq!(tuple.0, "hello"); /// ``` /// /// Tuples are often used as a return type when you want to return more than /// one value: /// /// ``` /// fn calculate_point() -> (i32, i32) { /// // Don't do a calculation, that's not the point of the example /// (4, 5) /// } /// /// let point = calculate_point(); /// /// assert_eq!(point.0, 4); /// assert_eq!(point.1, 5); /// /// // Combining this with patterns can be nicer. /// /// let (x, y) = calculate_point(); /// /// assert_eq!(x, 4); /// assert_eq!(y, 5); /// ``` /// #[stable(feature = "rust1", since = "1.0.0")] mod prim_tuple {} #[doc(primitive = "f32")] /// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008). /// /// This type can represent a wide range of decimal numbers, like `3.5`, `27`, /// `-113.75`, `0.0078125`, `34359738368`, `0`, `-1`. So unlike integer types /// (such as `i32`), floating point types can represent non-integer numbers, /// too. /// /// However, being able to represent this wide range of numbers comes at the /// cost of precision: floats can only represent some of the real numbers and /// calculation with floats round to a nearby representable number. For example, /// `5.0` and `1.0` can be exactly represented as `f32`, but `1.0 / 5.0` results /// in `0.20000000298023223876953125` since `0.2` cannot be exactly represented /// as `f32`. Note, however, that printing floats with `println` and friends will /// often discard insignificant digits: `println!("{}", 1.0f32 / 5.0f32)` will /// print `0.2`. /// /// Additionally, `f32` can represent some special values: /// /// - −0.0: IEEE 754 floating point numbers have a bit that indicates their sign, so −0.0 is a /// possible value. For comparison −0.0 = +0.0, but floating point operations can carry /// the sign bit through arithmetic operations. This means −0.0 × +0.0 produces −0.0 and /// a negative number rounded to a value smaller than a float can represent also produces −0.0. /// - [∞](#associatedconstant.INFINITY) and /// [−∞](#associatedconstant.NEG_INFINITY): these result from calculations /// like `1.0 / 0.0`. /// - [NaN (not a number)](#associatedconstant.NAN): this value results from /// calculations like `(-1.0).sqrt()`. NaN has some potentially unexpected /// behavior: it is unequal to any float, including itself! It is also neither /// smaller nor greater than any float, making it impossible to sort. Lastly, /// it is considered infectious as almost all calculations where one of the /// operands is NaN will also result in NaN. /// /// For more information on floating point numbers, see [Wikipedia][wikipedia]. /// /// *[See also the `std::f32::consts` module](crate::f32::consts).* /// /// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format #[stable(feature = "rust1", since = "1.0.0")] mod prim_f32 {} #[doc(primitive = "f64")] /// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008). /// /// This type is very similar to [`f32`], but has increased /// precision by using twice as many bits. Please see [the documentation for /// `f32`][`f32`] or [Wikipedia on double precision /// values][wikipedia] for more information. /// /// *[See also the `std::f64::consts` module](crate::f64::consts).* /// /// [`f32`]: prim@f32 /// [wikipedia]: https://en.wikipedia.org/wiki/Double-precision_floating-point_format #[stable(feature = "rust1", since = "1.0.0")] mod prim_f64 {} #[doc(primitive = "i8")] // /// The 8-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i8 {} #[doc(primitive = "i16")] // /// The 16-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i16 {} #[doc(primitive = "i32")] // /// The 32-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i32 {} #[doc(primitive = "i64")] // /// The 64-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i64 {} #[doc(primitive = "i128")] // /// The 128-bit signed integer type. #[stable(feature = "i128", since = "1.26.0")] mod prim_i128 {} #[doc(primitive = "u8")] // /// The 8-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u8 {} #[doc(primitive = "u16")] // /// The 16-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u16 {} #[doc(primitive = "u32")] // /// The 32-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u32 {} #[doc(primitive = "u64")] // /// The 64-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u64 {} #[doc(primitive = "u128")] // /// The 128-bit unsigned integer type. #[stable(feature = "i128", since = "1.26.0")] mod prim_u128 {} #[doc(primitive = "isize")] // /// The pointer-sized signed integer type. /// /// The size of this primitive is how many bytes it takes to reference any /// location in memory. For example, on a 32 bit target, this is 4 bytes /// and on a 64 bit target, this is 8 bytes. #[stable(feature = "rust1", since = "1.0.0")] mod prim_isize {} #[doc(primitive = "usize")] // /// The pointer-sized unsigned integer type. /// /// The size of this primitive is how many bytes it takes to reference any /// location in memory. For example, on a 32 bit target, this is 4 bytes /// and on a 64 bit target, this is 8 bytes. #[stable(feature = "rust1", since = "1.0.0")] mod prim_usize {} #[doc(primitive = "reference")] #[doc(alias = "&")] #[doc(alias = "&mut")] // /// References, both shared and mutable. /// /// A reference represents a borrow of some owned value. You can get one by using the `&` or `&mut` /// operators on a value, or by using a [`ref`](keyword.ref.html) or /// <code>[ref](keyword.ref.html) [mut](keyword.mut.html)</code> pattern. /// /// For those familiar with pointers, a reference is just a pointer that is assumed to be /// aligned, not null, and pointing to memory containing a valid value of `T` - for example, /// <code>&[bool]</code> can only point to an allocation containing the integer values `1` /// ([`true`](keyword.true.html)) or `0` ([`false`](keyword.false.html)), but creating a /// <code>&[bool]</code> that points to an allocation containing the value `3` causes /// undefined behaviour. /// In fact, <code>[Option]\<&T></code> has the same memory representation as a /// nullable but aligned pointer, and can be passed across FFI boundaries as such. /// /// In most cases, references can be used much like the original value. Field access, method /// calling, and indexing work the same (save for mutability rules, of course). In addition, the /// comparison operators transparently defer to the referent's implementation, allowing references /// to be compared the same as owned values. /// /// References have a lifetime attached to them, which represents the scope for which the borrow is /// valid. A lifetime is said to "outlive" another one if its representative scope is as long or /// longer than the other. The `'static` lifetime is the longest lifetime, which represents the /// total life of the program. For example, string literals have a `'static` lifetime because the /// text data is embedded into the binary of the program, rather than in an allocation that needs /// to be dynamically managed. /// /// `&mut T` references can be freely coerced into `&T` references with the same referent type, and /// references with longer lifetimes can be freely coerced into references with shorter ones. /// /// Reference equality by address, instead of comparing the values pointed to, is accomplished via /// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while /// [`PartialEq`] compares values. /// /// ``` /// use std::ptr; /// /// let five = 5; /// let other_five = 5; /// let five_ref = &five; /// let same_five_ref = &five; /// let other_five_ref = &other_five; /// /// assert!(five_ref == same_five_ref); /// assert!(five_ref == other_five_ref); /// /// assert!(ptr::eq(five_ref, same_five_ref)); /// assert!(!ptr::eq(five_ref, other_five_ref)); /// ``` /// /// For more information on how to use references, see [the book's section on "References and /// Borrowing"][book-refs]. /// /// [book-refs]: ../book/ch04-02-references-and-borrowing.html /// /// # Trait implementations /// /// The following traits are implemented for all `&T`, regardless of the type of its referent: /// /// * [`Copy`] /// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!) /// * [`Deref`] /// * [`Borrow`] /// * [`Pointer`] /// /// [`Deref`]: ops::Deref /// [`Borrow`]: borrow::Borrow /// [`Pointer`]: fmt::Pointer /// /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its /// referent: /// /// * [`DerefMut`] /// * [`BorrowMut`] /// /// [`DerefMut`]: ops::DerefMut /// [`BorrowMut`]: borrow::BorrowMut /// /// The following traits are implemented on `&T` references if the underlying `T` also implements /// that trait: /// /// * All the traits in [`std::fmt`] except [`Pointer`] and [`fmt::Write`] /// * [`PartialOrd`] /// * [`Ord`] /// * [`PartialEq`] /// * [`Eq`] /// * [`AsRef`] /// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`) /// * [`Hash`] /// * [`ToSocketAddrs`] /// /// [`std::fmt`]: fmt /// ['Pointer`]: fmt::Pointer /// [`Hash`]: hash::Hash /// [`ToSocketAddrs`]: net::ToSocketAddrs /// /// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T` /// implements that trait: /// /// * [`AsMut`] /// * [`FnMut`] \(in addition, `&mut T` references get [`FnOnce`] if `T: FnMut`) /// * [`fmt::Write`] /// * [`Iterator`] /// * [`DoubleEndedIterator`] /// * [`ExactSizeIterator`] /// * [`FusedIterator`] /// * [`TrustedLen`] /// * [`Send`] \(note that `&T` references only get `Send` if <code>T: [Sync]</code>) /// * [`io::Write`] /// * [`Read`] /// * [`Seek`] /// * [`BufRead`] /// /// [`FusedIterator`]: iter::FusedIterator /// [`TrustedLen`]: iter::TrustedLen /// [`Seek`]: io::Seek /// [`BufRead`]: io::BufRead /// [`Read`]: io::Read /// /// Note that due to method call deref coercion, simply calling a trait method will act like they /// work on references as well as they do on owned values! The implementations described here are /// meant for generic contexts, where the final type `T` is a type parameter or otherwise not /// locally known. #[stable(feature = "rust1", since = "1.0.0")] mod prim_ref {} #[doc(primitive = "fn")] // /// Function pointers, like `fn(usize) -> bool`. /// /// *See also the traits [`Fn`], [`FnMut`], and [`FnOnce`].* /// /// [`Fn`]: ops::Fn /// [`FnMut`]: ops::FnMut /// [`FnOnce`]: ops::FnOnce /// /// Function pointers are pointers that point to *code*, not data. They can be called /// just like functions. Like references, function pointers are, among other things, assumed to /// not be null, so if you want to pass a function pointer over FFI and be able to accommodate null /// pointers, make your type [`Option<fn()>`](core::option#options-and-pointers-nullable-pointers) /// with your required signature. /// /// ### Safety /// /// Plain function pointers are obtained by casting either plain functions, or closures that don't /// capture an environment: /// /// ``` /// fn add_one(x: usize) -> usize { /// x + 1 /// } /// /// let ptr: fn(usize) -> usize = add_one; /// assert_eq!(ptr(5), 6); /// /// let clos: fn(usize) -> usize = |x| x + 5; /// assert_eq!(clos(5), 10); /// ``` /// /// In addition to varying based on their signature, function pointers come in two flavors: safe /// and unsafe. Plain `fn()` function pointers can only point to safe functions, /// while `unsafe fn()` function pointers can point to safe or unsafe functions. /// /// ``` /// fn add_one(x: usize) -> usize { /// x + 1 /// } /// /// unsafe fn add_one_unsafely(x: usize) -> usize { /// x + 1 /// } /// /// let safe_ptr: fn(usize) -> usize = add_one; /// /// //ERROR: mismatched types: expected normal fn, found unsafe fn /// //let bad_ptr: fn(usize) -> usize = add_one_unsafely; /// /// let unsafe_ptr: unsafe fn(usize) -> usize = add_one_unsafely; /// let really_safe_ptr: unsafe fn(usize) -> usize = add_one; /// ``` /// /// ### ABI /// /// On top of that, function pointers can vary based on what ABI they use. This /// is achieved by adding the `extern` keyword before the type, followed by the /// ABI in question. The default ABI is "Rust", i.e., `fn()` is the exact same /// type as `extern "Rust" fn()`. A pointer to a function with C ABI would have /// type `extern "C" fn()`. /// /// `extern "ABI" { ... }` blocks declare functions with ABI "ABI". The default /// here is "C", i.e., functions declared in an `extern {...}` block have "C" /// ABI. /// /// For more information and a list of supported ABIs, see [the nomicon's /// section on foreign calling conventions][nomicon-abi]. /// /// [nomicon-abi]: ../nomicon/ffi.html#foreign-calling-conventions /// /// ### Variadic functions /// /// Extern function declarations with the "C" or "cdecl" ABIs can also be *variadic*, allowing them /// to be called with a variable number of arguments. Normal Rust functions, even those with an /// `extern "ABI"`, cannot be variadic. For more information, see [the nomicon's section on /// variadic functions][nomicon-variadic]. /// /// [nomicon-variadic]: ../nomicon/ffi.html#variadic-functions /// /// ### Creating function pointers /// /// When `bar` is the name of a function, then the expression `bar` is *not* a /// function pointer. Rather, it denotes a value of an unnameable type that /// uniquely identifies the function `bar`. The value is zero-sized because the /// type already identifies the function. This has the advantage that "calling" /// the value (it implements the `Fn*` traits) does not require dynamic /// dispatch. /// /// This zero-sized type *coerces* to a regular function pointer. For example: /// /// ```rust /// use std::mem; /// /// fn bar(x: i32) {} /// /// let not_bar_ptr = bar; // `not_bar_ptr` is zero-sized, uniquely identifying `bar` /// assert_eq!(mem::size_of_val(&not_bar_ptr), 0); /// /// let bar_ptr: fn(i32) = not_bar_ptr; // force coercion to function pointer /// assert_eq!(mem::size_of_val(&bar_ptr), mem::size_of::<usize>()); /// /// let footgun = &bar; // this is a shared reference to the zero-sized type identifying `bar` /// ``` /// /// The last line shows that `&bar` is not a function pointer either. Rather, it /// is a reference to the function-specific ZST. `&bar` is basically never what you /// want when `bar` is a function. /// /// ### Traits /// /// Function pointers implement the following traits: /// /// * [`Clone`] /// * [`PartialEq`] /// * [`Eq`] /// * [`PartialOrd`] /// * [`Ord`] /// * [`Hash`] /// * [`Pointer`] /// * [`Debug`] /// /// [`Hash`]: hash::Hash /// [`Pointer`]: fmt::Pointer /// /// Due to a temporary restriction in Rust's type system, these traits are only implemented on /// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this /// may change. /// /// In addition, function pointers of *any* signature, ABI, or safety are [`Copy`], and all *safe* /// function pointers implement [`Fn`], [`FnMut`], and [`FnOnce`]. This works because these traits /// are specially known to the compiler. #[stable(feature = "rust1", since = "1.0.0")] mod prim_fn {}<|fim▁end|>
/// /// ``` /// let my_num: Box<i32> = Box::new(10);
<|file_name|>base_viewer_spec.js<|end_file_name|><|fim▁begin|>/* Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { PDFPageViewBuffer } from "../../web/base_viewer.js"; describe("BaseViewer", function () { describe("PDFPageViewBuffer", function () { function createViewsMap(startId, endId) { const map = new Map(); for (let id = startId; id <= endId; id++) { map.set(id, { id, destroy: () => {}, }); } return map; } it("handles `push` correctly", function () { const buffer = new PDFPageViewBuffer(3); const viewsMap = createViewsMap(1, 5), iterator = viewsMap.values(); for (let i = 0; i < 3; i++) { const view = iterator.next().value; buffer.push(view); } // Ensure that the correct views are inserted. expect([...buffer]).toEqual([ viewsMap.get(1), viewsMap.get(2), viewsMap.get(3), ]); for (let i = 3; i < 5; i++) { const view = iterator.next().value; buffer.push(view); } // Ensure that the correct views are evicted. expect([...buffer]).toEqual([ viewsMap.get(3), viewsMap.get(4), viewsMap.get(5), ]); }); it("handles `resize` correctly", function () { const buffer = new PDFPageViewBuffer(5); const viewsMap = createViewsMap(1, 5), iterator = viewsMap.values(); for (let i = 0; i < 5; i++) { const view = iterator.next().value; buffer.push(view); } // Ensure that keeping the size constant won't evict any views. buffer.resize(5); expect([...buffer]).toEqual([ viewsMap.get(1), viewsMap.get(2), viewsMap.get(3), viewsMap.get(4), viewsMap.get(5), ]); // Ensure that increasing the size won't evict any views. buffer.resize(10); expect([...buffer]).toEqual([ viewsMap.get(1), viewsMap.get(2), viewsMap.get(3), viewsMap.get(4), viewsMap.get(5), ]); // Ensure that decreasing the size will evict the correct views. buffer.resize(3); expect([...buffer]).toEqual([ viewsMap.get(3), viewsMap.get(4), viewsMap.get(5), ]); }); it("handles `resize` correctly, with `idsToKeep` provided", function () { const buffer = new PDFPageViewBuffer(5); const viewsMap = createViewsMap(1, 5), iterator = viewsMap.values(); for (let i = 0; i < 5; i++) { const view = iterator.next().value; buffer.push(view); } // Ensure that keeping the size constant won't evict any views, // while re-ordering them correctly. buffer.resize(5, new Set([1, 2])); expect([...buffer]).toEqual([ viewsMap.get(3), viewsMap.get(4), viewsMap.get(5), viewsMap.get(1), viewsMap.get(2), ]); // Ensure that increasing the size won't evict any views, // while re-ordering them correctly. buffer.resize(10, new Set([3, 4, 5])); expect([...buffer]).toEqual([ viewsMap.get(1), viewsMap.get(2), viewsMap.get(3), viewsMap.get(4), viewsMap.get(5), ]); // Ensure that decreasing the size will evict the correct views, // while re-ordering the remaining ones correctly. buffer.resize(3, new Set([1, 2, 5])); expect([...buffer]).toEqual([ viewsMap.get(1), viewsMap.get(2), viewsMap.get(5), ]); }); it("handles `has` correctly", function () { const buffer = new PDFPageViewBuffer(3); const viewsMap = createViewsMap(1, 2),<|fim▁hole|> buffer.push(view); } expect(buffer.has(viewsMap.get(1))).toEqual(true); expect(buffer.has(viewsMap.get(2))).toEqual(false); }); }); });<|fim▁end|>
iterator = viewsMap.values(); for (let i = 0; i < 1; i++) { const view = iterator.next().value;
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin <|fim▁hole|> # Register your models here. admin.site.register(dynamic_models.values())<|fim▁end|>
from .models import dynamic_models
<|file_name|>mockDomSource.ts<|end_file_name|><|fim▁begin|>import { Stream, empty } from 'most' import { DomSource } from './types' import { VNode } from 'mostly-dom' export interface MockConfig { readonly [key: string]: MockConfig | Stream <any> } export function mockDomSource( mockConfig?: MockConfig & { elements?: Stream<Array<HTMLElement>> }): DomSource { return new MockDomSource(mockConfig || {}, []) } const SCOPE_PREFIX = `___` class MockDomSource implements DomSource { private mockConfig: MockConfig & { elements?: Stream<Array<HTMLElement>> } private internalNamespace: Array<string> public isolateSink = isolateSink public isolateSource = isolateSource constructor( mockConfig: MockConfig & { elements?: Stream<Array<HTMLElement>> }, namespace: Array<string>) { this.mockConfig = mockConfig this.internalNamespace = namespace } public namespace(): Array<string> { return this.internalNamespace } public select(selector: string): DomSource { const trimmedSelector = selector.trim() const updatedNamespace = this.internalNamespace.concat(trimmedSelector) const mockConfig = this.mockConfig[selector] as MockConfig || {} return new MockDomSource(mockConfig, updatedNamespace) } public elements<T extends Element>(): Stream<Array<T>> { return (this.mockConfig.elements || empty()) as Stream<Array<T>> } public events<T extends Event>(eventType: string): Stream<T> { return (this.mockConfig[eventType] || empty()) as Stream<T> } } function isolateSource(source: DomSource, scope: string) { return source.select(`${SCOPE_PREFIX}${scope}`) } function isolateSink<T extends VNode>(vNode$: Stream<T>, scope: string) {<|fim▁hole|> return vNode$.tap((vNode) => { if (vNode.className && vNode.className.indexOf(generatedScope) === -1) vNode.className = ((vNode.className || '') + generatedScope).trim() }) }<|fim▁end|>
const generatedScope = `${SCOPE_PREFIX}${scope}`
<|file_name|>puback.go<|end_file_name|><|fim▁begin|>package message // PubackMessage is that a PUBACK Packet is the response to a PUBLISH Packet with QoS // level 1 type PubackMessage struct { fixedHeader // This contains the Packet Identifier from the PUBLISH Packet that is bening // acknowledged. packetID []byte } // SetPacketID sets Packet Identifier func (p *PubackMessage) SetPacketID(v []byte) { p.packetID = v }<|fim▁hole|>func (p *PubackMessage) PacketID() []byte { return p.packetID }<|fim▁end|>
// PacketID returns Packet Identifier
<|file_name|>test_core_priors.py<|end_file_name|><|fim▁begin|>""" Tests for priors. """ # pylint: disable=missing-docstring from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy as np<|fim▁hole|>import numpy.testing as nt import scipy.optimize as spop import reggie.core.priors as priors ### BASE TEST CLASS ########################################################### class PriorTest(object): def __init__(self, prior): self.prior = prior def test_repr(self): _ = repr(self.prior) def test_bounds(self): bshape = np.shape(self.prior.bounds) assert bshape == (2,) or bshape == (self.prior.ndim, 2) def test_sample(self): assert np.shape(self.prior.sample()) == (self.prior.ndim,) assert np.shape(self.prior.sample(5)) == (5, self.prior.ndim) def test_logprior(self): for theta in self.prior.sample(5, 0): g1 = spop.approx_fprime(theta, self.prior.get_logprior, 1e-8) _, g2 = self.prior.get_logprior(theta, True) nt.assert_allclose(g1, g2, rtol=1e-6) ### PER-INSTANCE TESTS ######################################################## class TestUniform(PriorTest): def __init__(self): PriorTest.__init__(self, priors.Uniform([0, 0], [1, 1])) class TestNormal(PriorTest): def __init__(self): PriorTest.__init__(self, priors.Normal([0, 0], [1, 1])) class TestLogNormal(PriorTest): def __init__(self): PriorTest.__init__(self, priors.LogNormal([0, 0], [1, 1])) def test_uniform(): nt.assert_raises(ValueError, priors.Uniform, 0, -1)<|fim▁end|>
<|file_name|>ip_configuration_py3.py<|end_file_name|><|fim▁begin|># coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from .sub_resource import SubResource class IPConfiguration(SubResource): """IP configuration. :param id: Resource ID. :type id: str :param private_ip_address: The private IP address of the IP configuration. :type private_ip_address: str :param private_ip_allocation_method: The private IP allocation method. Possible values are 'Static' and 'Dynamic'. Possible values include: 'Static', 'Dynamic' :type private_ip_allocation_method: str or ~azure.mgmt.network.v2017_08_01.models.IPAllocationMethod :param subnet: The reference of the subnet resource. :type subnet: ~azure.mgmt.network.v2017_08_01.models.Subnet :param public_ip_address: The reference of the public IP resource. :type public_ip_address: ~azure.mgmt.network.v2017_08_01.models.PublicIPAddress :param provisioning_state: Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. :type provisioning_state: str :param name: The name of the resource that is unique within a resource group. This name can be used to access the resource. :type name: str :param etag: A unique read-only string that changes whenever the resource is updated. :type etag: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'Subnet'}, 'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'PublicIPAddress'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, } <|fim▁hole|> super(IPConfiguration, self).__init__(id=id, **kwargs) self.private_ip_address = private_ip_address self.private_ip_allocation_method = private_ip_allocation_method self.subnet = subnet self.public_ip_address = public_ip_address self.provisioning_state = provisioning_state self.name = name self.etag = etag<|fim▁end|>
def __init__(self, *, id: str=None, private_ip_address: str=None, private_ip_allocation_method=None, subnet=None, public_ip_address=None, provisioning_state: str=None, name: str=None, etag: str=None, **kwargs) -> None:
<|file_name|>multiapp.go<|end_file_name|><|fim▁begin|>package main import ( "github.com/coscms/webx" ) type MainAction struct { *webx.Action hello webx.Mapper `webx:"/(.*)"` } func (c *MainAction) Hello(world string) { c.Write("hello %v", world) } <|fim▁hole|> app2 := webx.NewApp("/user/") app2.AddAction(&MainAction{}) webx.AddApp(app2) webx.Run("0.0.0.0:9999") }<|fim▁end|>
func main() { app1 := webx.NewApp("/") app1.AddAction(&MainAction{}) webx.AddApp(app1)
<|file_name|>pyrocket_backend.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # import usb from time import sleep class RocketManager: vendor_product_ids = [(0x1941, 0x8021), (0x0a81, 0x0701), (0x0a81, 0xff01), (0x1130, 0x0202), (0x2123,0x1010)] launcher_types = ["Original", "Webcam", "Wireless", "Striker II", "OIC Webcam"] housing_colors = ["green", "blue", "silver", "black", "gray"] def __init__(self): self.launchers = [] # ----------------------------- def acquire_devices(self): device_found = False for bus in usb.busses(): for dev in bus.devices: for i, (cheeky_vendor_id, cheeky_product_id) in enumerate(self.vendor_product_ids): if dev.idVendor == cheeky_vendor_id and dev.idProduct == cheeky_product_id: print "Located", self.housing_colors[i], "Rocket Launcher device." launcher = None if i == 0: launcher = OriginalRocketLauncher() elif i == 1: launcher = BlueRocketLauncher()<|fim▁hole|> elif i == 2: # launcher = BlueRocketLauncher() # EXPERIMENTAL return '''The '''+self.launcher_types[i]+''' ('''+self.housing_colors[i]+''') Rocket Launcher is not yet supported. Try the '''+self.launcher_types[0]+''' or '''+self.launcher_types[1]+''' one.''' elif i == 3: launcher = BlackRocketLauncher() elif i == 4: launcher = GrayRocketLauncher() return_code = launcher.acquire( dev ) if not return_code: self.launchers.append( launcher ) device_found = True elif return_code == 2: string = '''You don't have permission to operate the USB device. To give yourself permission by default (in Ubuntu), create the file /etc/udev/rules.d/40-missilelauncher.rules with the following line: SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ACTION=="add", SYSFS{idVendor}=="%04x", SYSFS{idProduct}=="%04x", GROUP="plugdev", MODE="0660" The .deb installer should have done this for you. If you just installed the .deb, you need to unplug and replug the USB device now. This will apply the new permissions from the .rules file.''' % (cheeky_vendor_id, cheeky_product_id) print string return '''You don't have permission to operate the USB device. If you just installed the .deb, you need to plug cycle the USB device now. This will apply the new permissions from the .rules file.''' if not device_found: return 'No USB Rocket Launcher appears\nto be connected.' # ============================================ # ============================================ class OriginalRocketLauncher: color_green = True has_laser = False green_directions = [1, 0, 2, 3, 4] def __init__(self): self.usb_debug = False self.previous_fire_state = False self.previous_limit_switch_states = [False]*4 # Down, Up, Left, Right # ------------------------------------------------------ def acquire(self, dev): self.handle = dev.open() try: self.handle.reset() except usb.USBError, e: if e.message.find("not permitted") >= 0: return 2 else: raise e # self.handle.setConfiguration(dev.configurations[0]) try: self.handle.claimInterface( 0 ) except usb.USBError, e: if e.message.find("could not claim interface") >= 0: self.handle.detachKernelDriver( 0 ) self.handle.claimInterface( 0 ) self.handle.setAltInterface(0) return 0 # ----------------------------- def issue_command(self, command_index): signal = 0 if command_index >= 0: signal = 1 << command_index try: self.handle.controlMsg(0x21, 0x09, [signal], 0x0200) except usb.USBError: pass # ----------------------------- def start_movement(self, command_index): self.issue_command( self.green_directions[command_index] ) # ----------------------------- def stop_movement(self): self.issue_command( -1 ) # ----------------------------- def check_limits(self): '''For the "green" rocket launcher, the MSB of byte 2 comes on when a rocket is ready to fire, and is cleared again shortly after the rocket fires and cylinder is charged further.''' bytes = self.handle.bulkRead(1, 8) if self.usb_debug: print "USB packet:", bytes limit_bytes = list(bytes)[0:2] self.previous_fire_state = limit_bytes[1] & (1 << 7) limit_signal = (limit_bytes[1] & 0x0F) | (limit_bytes[0] >> 6) new_limit_switch_states = [bool(limit_signal & (1 << i)) for i in range(4)] self.previous_limit_switch_states = new_limit_switch_states return new_limit_switch_states # ============================================ # ============================================ class BlueRocketLauncher(OriginalRocketLauncher): color_green = False def __init__(self): OriginalRocketLauncher.__init__(self) # ----------------------------- def start_movement(self, command_index): self.issue_command( command_index ) # ----------------------------- def stop_movement(self): self.issue_command( 5 ) # ----------------------------- def check_limits(self): '''For the "blue" rocket launcher, the firing bit is only toggled when the rocket fires, then is immediately reset.''' bytes = None self.issue_command( 6 ) try: bytes = self.handle.bulkRead(1, 1) except usb.USBError, e: if e.message.find("No error") >= 0 \ or e.message.find("could not claim interface") >= 0 \ or e.message.find("Value too large") >= 0: pass # if self.usb_debug: # print "POLLING ERROR" # TODO: Should we try again in a loop? else: raise e if self.usb_debug: print "USB packet:", bytes self.previous_fire_state = bool(bytes) if bytes is None: return self.previous_limit_switch_states else: limit_signal, = bytes new_limit_switch_states = [bool(limit_signal & (1 << i)) for i in range(4)] self.previous_limit_switch_states = new_limit_switch_states return new_limit_switch_states # ============================================ # ============================================ class BlackRocketLauncher(BlueRocketLauncher): striker_commands = [0xf, 0xe, 0xd, 0xc, 0xa, 0x14, 0xb] has_laser = True # ----------------------------- def issue_command(self, command_index): signal = self.striker_commands[command_index] try: self.handle.controlMsg(0x21, 0x09, [signal, signal]) except usb.USBError: pass # ----------------------------- def check_limits(self): return self.previous_limit_switch_states # ============================================ # ============================================ class GrayRocketLauncher(BlueRocketLauncher): striker_commands = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40] has_laser = False # ----------------------------- def issue_command(self, command_index): signal = self.striker_commands[command_index] try: self.handle.controlMsg(0x21,0x09, [0x02, signal, 0x00,0x00,0x00,0x00,0x00,0x00]) except usb.USBError: pass # ----------------------------- def check_limits(self): return self.previous_limit_switch_states<|fim▁end|>
<|file_name|>itchat_test.py<|end_file_name|><|fim▁begin|><|fim▁hole|> friends = itchat.get_friends(update = True)[0:] info = {} for i in friends: info[i['NickName']] = i.Signature print(info)<|fim▁end|>
import itchat itchat.login()
<|file_name|>l-arginine.py<|end_file_name|><|fim▁begin|>import pulsar as psr def load_ref_system(): """ Returns l-arginine as found in the IQMol fragment library. All credit to https://github.com/nutjunkie/IQmol """ return psr.make_system(""" N 0.8592 -2.9103 -0.8578 C 1.3352 -1.5376 -1.1529<|fim▁hole|> C 2.8596 -1.5658 -1.1624 O 3.6250 -1.8965 -0.2757 O 3.4285 -1.1488 -2.3160 C 0.8699 -0.4612 -0.1600 H 1.4712 0.4581 -0.3123 H 1.0768 -0.7804 0.8827 C -0.6054 -0.1308 -0.3266 H -1.2260 -1.0343 -0.1569 H -0.8065 0.1769 -1.3739 C -1.0120 0.9757 0.6424 H -0.4134 1.8919 0.4482 H -0.7821 0.6714 1.6839 N -2.4750 1.2329 0.5383 H -2.7251 1.4082 -0.4139 C -2.9738 2.2808 1.4124 N -3.4837 3.3356 0.8530 H -3.9046 4.0108 1.4410 N -2.8404 2.0695 2.8280 H -2.7215 1.1094 3.0676 H -3.5979 2.4725 3.3357 H -0.1386 -2.9250 -0.8895 H 1.1675 -3.1979 0.0476 H 0.9562 -1.2864 -2.1768 H 4.3768 -1.2078 -2.2540 """)<|fim▁end|>
<|file_name|>test_pkg.py<|end_file_name|><|fim▁begin|># Copyright (c) 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import re import subprocess from mock import Mock, MagicMock, patch import pexpect from trove.common import exception from trove.common import utils from trove.guestagent import pkg from trove.tests.unittests import trove_testtools """ Unit tests for the classes and functions in pkg.py. """ class PkgDEBInstallTestCase(trove_testtools.TestCase): def setUp(self): super(PkgDEBInstallTestCase, self).setUp() self.pkg = pkg.DebianPackagerMixin() self.pkg_fix = self.pkg._fix self.pkg_fix_package_selections = self.pkg._fix_package_selections p0 = patch('pexpect.spawn') p0.start() self.addCleanup(p0.stop) p1 = patch('trove.common.utils.execute') p1.start() self.addCleanup(p1.stop) self.pkg._fix = Mock(return_value=None) self.pkg._fix_package_selections = Mock(return_value=None) self.pkgName = 'packageName' def tearDown(self): super(PkgDEBInstallTestCase, self).tearDown() self.pkg._fix = self.pkg_fix self.pkg._fix_package_selections = self.pkg_fix_package_selections def test_pkg_is_installed_no_packages(self): packages = [] self.assertTrue(self.pkg.pkg_is_installed(packages)) def test_pkg_is_installed_yes(self): packages = ["package1=1.0", "package2"] self.pkg.pkg_version = MagicMock(side_effect=["1.0", "2.0"]) self.assertTrue(self.pkg.pkg_is_installed(packages)) def test_pkg_is_installed_no(self): packages = ["package1=1.0", "package2", "package3=3.1"] self.pkg.pkg_version = MagicMock(side_effect=["1.0", "2.0", "3.0"]) self.assertFalse(self.pkg.pkg_is_installed(packages)) def test_success_install(self): # test pexpect.spawn.return_value.expect.return_value = 7 pexpect.spawn.return_value.match = False self.assertTrue(self.pkg.pkg_install(self.pkgName, {}, 5000) is None) def test_success_install_with_config_opts(self): # test config_opts = {'option': 'some_opt'} pexpect.spawn.return_value.expect.return_value = 7 pexpect.spawn.return_value.match = False self.assertTrue( self.pkg.pkg_install(self.pkgName, config_opts, 5000) is None) def test_permission_error(self): # test pexpect.spawn.return_value.expect.return_value = 0 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPermissionError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_not_found_1(self): # test pexpect.spawn.return_value.expect.return_value = 1 pexpect.spawn.return_value.match = re.match('(.*)', self.pkgName) # test and verify self.assertRaises(pkg.PkgNotFoundError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_not_found_2(self): # test pexpect.spawn.return_value.expect.return_value = 2 pexpect.spawn.return_value.match = re.match('(.*)', self.pkgName) # test and verify self.assertRaises(pkg.PkgNotFoundError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_run_DPKG_bad_State(self): # test _fix method is called and PackageStateError is thrown pexpect.spawn.return_value.expect.return_value = 4 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPackageStateError, self.pkg.pkg_install, self.pkgName, {}, 5000) self.assertTrue(self.pkg._fix.called) def test_admin_lock_error(self): # test 'Unable to lock the administration directory' error pexpect.spawn.return_value.expect.return_value = 5 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgAdminLockError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_broken_error(self): pexpect.spawn.return_value.expect.return_value = 6 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgBrokenError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_timeout_error(self): # test timeout error pexpect.spawn.return_value.expect.side_effect = ( pexpect.TIMEOUT('timeout error')) # test and verify self.assertRaises(pkg.PkgTimeout, self.pkg.pkg_install, self.pkgName, {}, 5000) class PkgDEBRemoveTestCase(trove_testtools.TestCase): def setUp(self): super(PkgDEBRemoveTestCase, self).setUp() self.pkg = pkg.DebianPackagerMixin() self.pkg_version = self.pkg.pkg_version self.pkg_install = self.pkg._install self.pkg_fix = self.pkg._fix p0 = patch('pexpect.spawn') p0.start() self.addCleanup(p0.stop) p1 = patch('trove.common.utils.execute') p1.start() self.addCleanup(p1.stop) self.pkg.pkg_version = Mock(return_value="OK") self.pkg._install = Mock(return_value=None) self.pkg._fix = Mock(return_value=None) self.pkgName = 'packageName' def tearDown(self): super(PkgDEBRemoveTestCase, self).tearDown() self.pkg.pkg_version = self.pkg_version self.pkg._install = self.pkg_install self.pkg._fix = self.pkg_fix def test_remove_no_pkg_version(self): # test pexpect.spawn.return_value.expect.return_value = 6 pexpect.spawn.return_value.match = False with patch.object(self.pkg, 'pkg_version', return_value=None): self.assertTrue(self.pkg.pkg_remove(self.pkgName, 5000) is None) def test_success_remove(self): # test pexpect.spawn.return_value.expect.return_value = 6 pexpect.spawn.return_value.match = False self.assertTrue(self.pkg.pkg_remove(self.pkgName, 5000) is None) def test_permission_error(self): # test pexpect.spawn.return_value.expect.return_value = 0 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPermissionError, self.pkg.pkg_remove, self.pkgName, 5000) def test_package_not_found(self): # test pexpect.spawn.return_value.expect.return_value = 1 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgNotFoundError, self.pkg.pkg_remove, self.pkgName, 5000) def test_package_reinstall_first_1(self): # test pexpect.spawn.return_value.expect.return_value = 2 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPackageStateError, self.pkg.pkg_remove, self.pkgName, 5000) self.assertTrue(self.pkg._install.called) self.assertFalse(self.pkg._fix.called) def test_package_reinstall_first_2(self): # test pexpect.spawn.return_value.expect.return_value = 3 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPackageStateError, self.pkg.pkg_remove, self.pkgName, 5000) self.assertTrue(self.pkg._install.called) self.assertFalse(self.pkg._fix.called) def test_package_DPKG_first(self): # test pexpect.spawn.return_value.expect.return_value = 4 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPackageStateError, self.pkg.pkg_remove, self.pkgName, 5000) self.assertFalse(self.pkg._install.called) self.assertTrue(self.pkg._fix.called) def test_admin_lock_error(self): # test 'Unable to lock the administration directory' error pexpect.spawn.return_value.expect.return_value = 5 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgAdminLockError, self.pkg.pkg_remove, self.pkgName, 5000) def test_timeout_error(self): # test timeout error pexpect.spawn.return_value.expect.side_effect = ( pexpect.TIMEOUT('timeout error')) # test and verify self.assertRaises(pkg.PkgTimeout, self.pkg.pkg_remove, self.pkgName, 5000) @patch.object(subprocess, 'call') def test_timeout_error_with_exception(self, mock_call): # test timeout error pexpect.spawn.return_value.expect.side_effect = ( pexpect.TIMEOUT('timeout error')) pexpect.spawn.return_value.close.side_effect = ( pexpect.ExceptionPexpect('error')) # test and verify self.assertRaises(pkg.PkgTimeout, self.pkg.pkg_remove, self.pkgName, 5000) self.assertEqual(1, mock_call.call_count) class PkgDEBVersionTestCase(trove_testtools.TestCase): def setUp(self): super(PkgDEBVersionTestCase, self).setUp() self.pkgName = 'mysql-server-5.5' self.pkgVersion = '5.5.28-0' self.getoutput = pkg.getoutput def tearDown(self): super(PkgDEBVersionTestCase, self).tearDown() pkg.getoutput = self.getoutput def test_version_success(self): cmd_out = "%s:\n Installed: %s\n" % (self.pkgName, self.pkgVersion) pkg.getoutput = Mock(return_value=cmd_out) version = pkg.DebianPackagerMixin().pkg_version(self.pkgName) self.assertTrue(version) self.assertEqual(self.pkgVersion, version) def test_version_unknown_package(self): cmd_out = "N: Unable to locate package %s" % self.pkgName pkg.getoutput = Mock(return_value=cmd_out) self.assertFalse(pkg.DebianPackagerMixin().pkg_version(self.pkgName)) def test_version_no_version(self): cmd_out = "%s:\n Installed: %s\n" % (self.pkgName, "(none)") pkg.getoutput = Mock(return_value=cmd_out) self.assertFalse(pkg.DebianPackagerMixin().pkg_version(self.pkgName)) class PkgRPMVersionTestCase(trove_testtools.TestCase): def setUp(self): super(PkgRPMVersionTestCase, self).setUp() self.pkgName = 'python-requests' self.pkgVersion = '0.14.2-1.el6' self.getoutput = pkg.getoutput def tearDown(self): super(PkgRPMVersionTestCase, self).tearDown() pkg.getoutput = self.getoutput @patch('trove.guestagent.pkg.LOG') def test_version_no_output(self, mock_logging): cmd_out = '' pkg.getoutput = Mock(return_value=cmd_out) self.assertIsNone(pkg.RedhatPackagerMixin().pkg_version(self.pkgName)) def test_version_success(self): cmd_out = self.pkgVersion pkg.getoutput = Mock(return_value=cmd_out) version = pkg.RedhatPackagerMixin().pkg_version(self.pkgName) self.assertTrue(version) self.assertEqual(self.pkgVersion, version) class PkgRPMInstallTestCase(trove_testtools.TestCase): def setUp(self): super(PkgRPMInstallTestCase, self).setUp() self.pkg = pkg.RedhatPackagerMixin() self.getoutput = pkg.getoutput self.pkgName = 'packageName' p0 = patch('pexpect.spawn') p0.start() self.addCleanup(p0.stop) p1 = patch('trove.common.utils.execute') p1.start() self.addCleanup(p1.stop) def tearDown(self): super(PkgRPMInstallTestCase, self).tearDown() pkg.getoutput = self.getoutput def test_pkg_is_installed_no_packages(self): packages = [] self.assertTrue(self.pkg.pkg_is_installed(packages)) def test_pkg_is_installed_yes(self): packages = ["package1=1.0", "package2"] with patch.object(pkg, 'getoutput', MagicMock( return_value="package1=1.0\n" "package2=2.0")): self.assertTrue(self.pkg.pkg_is_installed(packages)) def test_pkg_is_installed_no(self): packages = ["package1=1.0", "package2", "package3=3.0"] with patch.object(pkg, 'getoutput', MagicMock( return_value="package1=1.0\n" "package2=2.0")): self.assertFalse(self.pkg.pkg_is_installed(packages)) def test_permission_error(self): # test pexpect.spawn.return_value.expect.return_value = 0 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPermissionError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_not_found(self): # test pexpect.spawn.return_value.expect.return_value = 1 pexpect.spawn.return_value.match = re.match('(.*)', self.pkgName) # test and verify self.assertRaises(pkg.PkgNotFoundError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_conflict_remove(self): # test pexpect.spawn.return_value.expect.return_value = 2 pexpect.spawn.return_value.match = re.match('(.*)', self.pkgName) self.pkg._rpm_remove_nodeps = Mock() # test and verify self.pkg._install(self.pkgName, 5000) self.assertTrue(self.pkg._rpm_remove_nodeps.called) def test_package_conflict_remove_install(self): with patch.object(self.pkg, '_install', side_effect=[3, 3, 0]): self.assertTrue( self.pkg.pkg_install(self.pkgName, {}, 5000) is None) self.assertEqual(3, self.pkg._install.call_count) @patch.object(utils, 'execute') def test__rpm_remove_nodeps(self, mock_execute): self.pkg._rpm_remove_nodeps(self.pkgName) mock_execute.assert_called_with('rpm', '-e', '--nodeps', self.pkgName, run_as_root=True, root_helper='sudo') def test_package_scriptlet_error(self): # test pexpect.spawn.return_value.expect.return_value = 5 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgScriptletError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_http_error(self): # test pexpect.spawn.return_value.expect.return_value = 6 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgDownloadError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_nomirrors_error(self): # test pexpect.spawn.return_value.expect.return_value = 7 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgDownloadError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_sign_error(self): # test pexpect.spawn.return_value.expect.return_value = 8 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgSignError, self.pkg.pkg_install, self.pkgName, {}, 5000) def test_package_already_installed(self): # test pexpect.spawn.return_value.expect.return_value = 9 pexpect.spawn.return_value.match = False # test and verify self.assertTrue(self.pkg.pkg_install(self.pkgName, {}, 5000) is None)<|fim▁hole|> def test_package_success_updated(self): # test pexpect.spawn.return_value.expect.return_value = 10 pexpect.spawn.return_value.match = False # test and verify self.assertTrue(self.pkg.pkg_install(self.pkgName, {}, 5000) is None) def test_package_success_installed(self): # test pexpect.spawn.return_value.expect.return_value = 11 pexpect.spawn.return_value.match = False # test and verify self.assertTrue(self.pkg.pkg_install(self.pkgName, {}, 5000) is None) def test_timeout_error(self): # test timeout error pexpect.spawn.return_value.expect.side_effect = ( pexpect.TIMEOUT('timeout error')) pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgTimeout, self.pkg.pkg_install, self.pkgName, {}, 5000) class PkgRPMRemoveTestCase(trove_testtools.TestCase): def setUp(self): super(PkgRPMRemoveTestCase, self).setUp() self.pkg = pkg.RedhatPackagerMixin() self.pkg_version = self.pkg.pkg_version self.pkg_install = self.pkg._install p0 = patch('pexpect.spawn') p0.start() self.addCleanup(p0.stop) p1 = patch('trove.common.utils.execute') p1.start() self.addCleanup(p1.stop) self.pkg.pkg_version = Mock(return_value="OK") self.pkg._install = Mock(return_value=None) self.pkgName = 'packageName' def tearDown(self): super(PkgRPMRemoveTestCase, self).tearDown() self.pkg.pkg_version = self.pkg_version self.pkg._install = self.pkg_install def test_permission_error(self): # test pexpect.spawn.return_value.expect.return_value = 0 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgPermissionError, self.pkg.pkg_remove, self.pkgName, 5000) def test_package_not_found(self): # test pexpect.spawn.return_value.expect.return_value = 1 pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgNotFoundError, self.pkg.pkg_remove, self.pkgName, 5000) def test_remove_no_pkg_version(self): # test pexpect.spawn.return_value.expect.return_value = 2 pexpect.spawn.return_value.match = False with patch.object(self.pkg, 'pkg_version', return_value=None): self.assertTrue(self.pkg.pkg_remove(self.pkgName, 5000) is None) def test_success_remove(self): # test pexpect.spawn.return_value.expect.return_value = 2 pexpect.spawn.return_value.match = False self.assertTrue(self.pkg.pkg_remove(self.pkgName, 5000) is None) def test_timeout_error(self): # test timeout error pexpect.spawn.return_value.expect.side_effect = ( pexpect.TIMEOUT('timeout error')) pexpect.spawn.return_value.match = False # test and verify self.assertRaises(pkg.PkgTimeout, self.pkg.pkg_remove, self.pkgName, 5000) class PkgDEBFixPackageSelections(trove_testtools.TestCase): def setUp(self): super(PkgDEBFixPackageSelections, self).setUp() self.pkg = pkg.DebianPackagerMixin() self.getoutput = pkg.getoutput def tearDown(self): super(PkgDEBFixPackageSelections, self).tearDown() pkg.getoutput = self.getoutput @patch.object(os, 'remove') @patch.object(pkg, 'NamedTemporaryFile') @patch.object(utils, 'execute') def test__fix_package_selections(self, mock_execute, mock_temp_file, mock_remove): packages = ["package1"] config_opts = {'option': 'some_opt'} pkg.getoutput = Mock( return_value="* package1/option: some_opt") self.pkg._fix_package_selections(packages, config_opts) self.assertEqual(2, mock_execute.call_count) self.assertEqual(1, mock_remove.call_count) @patch.object(os, 'remove') @patch.object(pkg, 'NamedTemporaryFile') @patch.object(utils, 'execute', side_effect=exception.ProcessExecutionError) def test_fail__fix_package_selections(self, mock_execute, mock_temp_file, mock_remove): packages = ["package1"] config_opts = {'option': 'some_opt'} pkg.getoutput = Mock( return_value="* package1/option: some_opt") self.assertRaises(pkg.PkgConfigureError, self.pkg._fix_package_selections, packages, config_opts) self.assertEqual(1, mock_remove.call_count) @patch.object(utils, 'execute') def test__fix(self, mock_execute): self.pkg._fix(30) mock_execute.assert_called_with('dpkg', '--configure', '-a', run_as_root=True, root_helper='sudo')<|fim▁end|>
<|file_name|>instance.ts<|end_file_name|><|fim▁begin|>import { computed, reactive } from 'vue'; import { api } from './os'; // TODO: 他のタブと永続化されたstateを同期 type Instance = { emojis: { category: string; }[]; }; const data = localStorage.getItem('instance'); // TODO: instanceをリアクティブにするかは再考の余地あり export const instance: Instance = reactive(data ? JSON.parse(data) : { // TODO: set default values }); <|fim▁hole|> const meta = await api('meta', { detail: false }); for (const [k, v] of Object.entries(meta)) { instance[k] = v; } localStorage.setItem('instance', JSON.stringify(instance)); } export const emojiCategories = computed(() => { const categories = new Set(); for (const emoji of instance.emojis) { categories.add(emoji.category); } return Array.from(categories); }); // このファイルに書きたくないけどここに書かないと何故かVeturが認識しない declare module '@vue/runtime-core' { interface ComponentCustomProperties { $instance: typeof instance; } }<|fim▁end|>
export async function fetchInstance() {
<|file_name|>array_simp_2.py<|end_file_name|><|fim▁begin|>t = int(raw_input()) MOD = 10**9 + 7 def modexp(a,b): res = 1 while b: if b&1: res *= a res %= MOD a = (a*a)%MOD b /= 2 return res fn = [1 for _ in xrange(100001)] ifn = [1 for _ in xrange(100001)] for i in range(1,100000): fn[i] = fn[i-1] * i<|fim▁hole|> ifn[i] = modexp(fn[i],MOD-2) def nCr(n,k): return fn[n] * ifn[k] * ifn[n-k] for ti in range(t): n = int(raw_input()) a = map(int,raw_input().split()) ans = 0 for i in range(n): if i%2==0: ans += nCr(n-1,i)%MOD * a[i]%MOD else: ans -= nCr(n-1,i)%MOD * a[i]%MOD ans %= MOD print ans<|fim▁end|>
fn[i] %= MOD
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.conf import settings from django.contrib import messages from django.forms import Form from django.http import Http404, HttpResponse, HttpResponseBadRequest from django.shortcuts import get_object_or_404, redirect, render from django.views.decorators.csrf import csrf_exempt from django.utils import timezone from django.utils.translation import ugettext as _ import dateutil.parser, json from itsdangerous import BadSignature from appointments.apps.timeslots.models import Action, Constraint from appointments.apps.timeslots.utils import strfdate, strftime, strptime, is_available from .forms import ReminderForm from .models import Appointment, User from .utils import get_logger, get_serializer, send_confirmation, send_receipt, send_reminder # Create your views here. def book(request): logger = get_logger(__name__, request) if 'POST' == request.method and request.is_ajax(): fields = json.loads(request.body) try: user = User.objects.get(email__iexact=fields['email']) except KeyError: # This is an error; time to log, then fail logger.warning("Bad form submission: KeyError (email)") return HttpResponseBadRequest() except User.DoesNotExist: user = User(email=fields['email'], is_active=False) user.save() logger.info("New user %s" % (str(user))) try: action = Action.objects.get(slug=fields['action']) except (KeyError, Action.DoesNotExist): logger.warning("Bad form submission: KeyError (action) or Action.DoesNotExist") # This is an error; time to log, then fail return HttpResponseBadRequest() try: constraint = Constraint.objects.get(slug=fields['constraint']) except (KeyError, Constraint.DoesNotExist): # This is an error; time to log, then fail logger.warning("Bad form submission: KeyError (constraint) or Constraint.DoesNotExist") return HttpResponseBadRequest() if action not in constraint.actions.all(): # This is an error; time to log, then fail logger.warning("Bad form submission: bad constraint/action combination") return HttpResponseBadRequest() # Ignore timezone to prevent one-off problems try: date = dateutil.parser.parse(fields['date'], ignoretz=True).date() time = strptime(fields['time']) except KeyError: # This is an error; time to log, then fail logger.warning("Bad form submission: KeyError (date and/or time)") return HttpResponseBadRequest() # Check if timeslot is available if not is_available(constraint, date, time): # Return some meaningful JSON to say that time is not available logger.warning("Bad form submission: timeslot not available") return HttpResponseBadRequest() # Preprocess sex to ensure it's a valid value sex = fields['sex'][0].upper() if fields.get('sex', None) else None if sex not in ['M', 'F']: sex = '' appointment = Appointment( user=user, action=action, constraint=constraint, date=date, time=time, # Optional fields... first_name=fields.get('first_name',''), last_name=fields.get('last_name',''),<|fim▁hole|> identity_number=fields.get('identity_number',''), document_number=fields.get('document_number',''), phone_number=fields.get('phone_number',''), mobile_number=fields.get('mobile_number',''), comment=fields.get('comment',''), ) # Save the appointment; then log it appointment.save() logger.info("New appointment by %s in %s/%s on %s at %s" % ( str(appointment.user), appointment.constraint.key.slug, appointment.constraint.slug, strfdate(appointment.date), strftime(appointment.time), ) ) send_receipt(appointment) messages.success(request, _("We've send you an e-mail receipt. Please confirm your appointment by following the instructions.")) # Return some JSON... return HttpResponse("Ok") elif 'POST' == request.method: logger.warning("XMLHttpRequest header not set on POST request") return HttpResponseBadRequest("XMLHttpRequest (AJAX) form submissions only please!") return render(request, 'book.html') def cancel(request, payload): from itsdangerous import BadSignature s = get_serializer() try: appointment_id = s.loads(payload) except BadSignature: return Http404 appointment = get_object_or_404(Appointment, pk=appointment_id) if appointment.is_cancelled(): messages.warning(request, _("You've already cancelled this appointment.")) return redirect('finish') if 'POST' == request.method: form = Form(request.POST) if form.is_valid(): appointment.cancel() messages.info(request, _("You successfully cancelled your appointment.")) return redirect('finish') # This doesn't seem to be the correct return code return Http404 form = Form() return render(request, 'cancel.html', {'form': form}) def confirm(request, payload): s = get_serializer() try: appointment_id = s.loads(payload) except BadSignature: return Http404 appointment = get_object_or_404(Appointment, pk=appointment_id) if appointment.is_cancelled(): messages.error(request, _("You cannot reconfirm a cancelled appointment. Please book again.")) elif appointment.is_confirmed(): messages.warning(request, _("Thank you, no need to reconfirm.")) else: appointment.confirm() appointment.user.verify() send_confirmation(appointment) messages.success(request, _("Thank you for confirming your appointment.")) return redirect('finish') def reminder(request): if 'POST' == request.method: form = ReminderForm(request.POST) if form.is_valid(): email = form.cleaned_data['email'] try: user = User.objects.get(email=email) date = timezone.now().date() appointments = user.appointments.filter(date__gte=date) send_reminder(user, appointments) except User.DoesNotExist: pass messages.success(request, _("We'll send you an e-mail with all your appointments.")) return redirect('finish') else: form = ReminderForm() return render(request, 'reminder.html', {'form': form}) # Custom error views def handler404(request): return render(request, '404.html')<|fim▁end|>
nationality = fields.get('nationality',''), sex=sex, # See if this works without any changes...
<|file_name|>runtime.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2007-2018, Raffaele Salmaso <[email protected]> # Copyright (c) 2012 Omoto Kenji # Copyright (c) 2011 Sam Stephenson # Copyright (c) 2011 Josh Peek # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from __future__ import absolute_import, division, print_function, unicode_literals import io import json import re import os from subprocess import Popen, PIPE, STDOUT import tempfile from .exceptions import RuntimeError, ProgramError, RuntimeUnavailable from .utils import json2_source, which def encode_unicode_codepoints(str): r""" >>> encode_unicode_codepoints("a") == 'a' True >>> ascii = ''.join(chr(i) for i in range(0x80)) >>> encode_unicode_codepoints(ascii) == ascii True >>> encode_unicode_codepoints('\u4e16\u754c') == '\\u4e16\\u754c' True """ codepoint_format = '\\u{0:04x}'.format def codepoint(m): return codepoint_format(ord(m.group(0))) return re.sub('[^\x00-\x7f]', codepoint, str) class Runtime(object): def __init__(self, name, command, runner_source, encoding='utf8'): self._name = name if isinstance(command, str): command = [command] self._command = command self._runner_source = runner_source self._encoding = encoding def __str__(self): return "{class_name}({runtime_name})".format( class_name=type(self).__name__, runtime_name=self._name, ) @property def name(self): return self._name def exec_(self, source): if not self.is_available(): raise RuntimeUnavailable() return self.Context(self).exec_(source) def eval(self, source): if not self.is_available(): raise RuntimeUnavailable() return self.Context(self).eval(source) def compile(self, source): if not self.is_available(): raise RuntimeUnavailable() return self.Context(self, source) def is_available(self): return self._binary() is not None def runner_source(self): return self._runner_source def _binary(self): """protected""" if not hasattr(self, "_binary_cache"): self._binary_cache = which(self._command) return self._binary_cache def _execfile(self, filename): """protected""" cmd = self._binary() + [filename] p = None try: p = Popen(cmd, stdout=PIPE, stderr=STDOUT) stdoutdata, stderrdata = p.communicate() ret = p.wait() finally: del p if ret == 0: return stdoutdata else: raise RuntimeError(stdoutdata) class Context(object): def __init__(self, runtime, source=''): self._runtime = runtime self._source = source def eval(self, source): if not source.strip(): data = "''" else: data = "'('+" + json.dumps(source, ensure_ascii=True) + "+')'" code = 'return eval({data})'.format(data=data) return self.exec_(code) def exec_(self, source): if self._source: source = self._source + '\n' + source (fd, filename) = tempfile.mkstemp(prefix='babeljs', suffix='.js') os.close(fd) try: with io.open(filename, "w+", encoding=self._runtime._encoding) as fp: fp.write(self._compile(source)) output = self._runtime._execfile(filename) finally: os.remove(filename) output = output.decode(self._runtime._encoding) output = output.replace("\r\n", "\n").replace("\r", "\n") output = self._extract_result(output.split("\n")[-2]) return output def call(self, identifier, *args): args = json.dumps(args) return self.eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args)) def _compile(self, source): """protected""" runner_source = self._runtime.runner_source() replacements = { '#{source}': lambda: source, '#{encoded_source}': lambda: json.dumps( "(function(){ " + encode_unicode_codepoints(source) + " })()" ), '#{json2_source}': json2_source, } pattern = "|".join(re.escape(k) for k in replacements) runner_source = re.sub(pattern, lambda m: replacements[m.group(0)](), runner_source) return runner_source def _extract_result(self, output_last_line): """protected""" if not output_last_line: status = value = None else: ret = json.loads(output_last_line) if len(ret) == 1: ret = [ret[0], None] status, value = ret if status == "ok": return value elif value and value.startswith('SyntaxError:'): raise RuntimeError(value) else: raise ProgramError(value) class PyV8Runtime(object): def __init__(self): try: import PyV8 except ImportError: self._is_available = False else: self._is_available = True @property def name(self): return "PyV8" def exec_(self, source): return self.Context().exec_(source) def eval(self, source): return self.Context().eval(source) def compile(self, source): return self.Context(source) def is_available(self): return self._is_available class Context: def __init__(self, source=""): self._source = source def exec_(self, source): source = '''\ (function() {{ {0}; {1}; }})()'''.format( encode_unicode_codepoints(self._source), encode_unicode_codepoints(source) ) source = str(source) import PyV8<|fim▁hole|> try: script = engine.compile(source) except js_errors as e: raise RuntimeError(e) try: value = script.run() except js_errors as e: raise ProgramError(e) return self.convert(value) def eval(self, source): return self.exec_('return ' + encode_unicode_codepoints(source)) def call(self, identifier, *args): args = json.dumps(args) return self.eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args)) @classmethod def convert(cls, obj): from PyV8 import _PyV8 if isinstance(obj, bytes): return obj.decode('utf8') if isinstance(obj, _PyV8.JSArray): return [cls.convert(v) for v in obj] elif isinstance(obj, _PyV8.JSFunction): return None elif isinstance(obj, _PyV8.JSObject): ret = {} for k in obj.keys(): v = cls.convert(obj[k]) if v is not None: ret[cls.convert(k)] = v return ret else: return obj<|fim▁end|>
import contextlib #backward compatibility with contextlib.nested(PyV8.JSContext(), PyV8.JSEngine()) as (ctxt, engine): js_errors = (PyV8.JSError, IndexError, ReferenceError, SyntaxError, TypeError)
<|file_name|>qwindowsmobilestyle.cpp<|end_file_name|><|fim▁begin|>/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation ([email protected]) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qwindowsmobilestyle.h" #include "qwindowsmobilestyle_p.h" #if !defined(QT_NO_STYLE_WINDOWSMOBILE) || defined(QT_PLUGIN) #include "qpainterpath.h" #include "qapplication.h" #include "qdesktopwidget.h" #include "qwidget.h" #include "qdockwidget.h" #include "qframe.h" #include "qmenu.h" #include "qpaintengine.h" #include "qpainter.h" #include "qgroupbox.h" #include "qstyleoption.h" #include "qlistview.h" #include "qdrawutil.h" #include "qtoolbar.h" #include "qabstractscrollarea.h" #include "qabstractbutton.h" #include "qcombobox.h" #include "qabstractscrollarea.h" #include "qframe.h" #include "qscrollbar.h" #include "qabstractitemview.h" #include "qmenubar.h" #include "qtoolbutton.h" #include "qtextedit.h" #include "qdialog.h" #include "qdebug.h" #include "qtabwidget.h" #ifdef Q_WS_WINCE #include "qt_windows.h" #include "qguifunctions_wince.h" extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp #endif // Q_WS_WINCE #include "qstylehelper_p.h" QT_BEGIN_NAMESPACE static const int windowsItemFrame = 1; // menu item frame width static const int windowsMobileitemViewCheckBoxSize = 13; static const int windowsMobileFrameGroupBoxOffset = 9; static const int windowsMobileIndicatorSize = 14; static const int windowsMobileExclusiveIndicatorSize = 14; static const int windowsMobileSliderThickness = 6; static const int windowsMobileIconSize = 16; static const int PE_IndicatorArrowUpBig = 0xf000101; static const int PE_IndicatorArrowDownBig = 0xf000102; static const int PE_IndicatorArrowLeftBig = 0xf000103; static const int PE_IndicatorArrowRightBig = 0xf000104; /* XPM */ static const char *const radiobutton_xpm[] = { "30 30 2 1", " c None", ". c #000000", " ........ ", " .............. ", " .... .... ", " .... .... ", " ... ... ", " ... ... ", " .. .. ", " .. .. ", " ... ... ", " .. .. ", " .. .. ", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", " .. .. ", " .. .. ", " ... ... ", " .. .. ", " .. .. ", " ... ... ", " ... ... ", " .... .... ", " .... .... ", " .............. ", " ........ "}; /* XPM */ static const char * const radiobutton_low_xpm[] = { "15 15 2 1", " c None", ". c #000000", " ..... ", " .. .. ", " . . ", " . . ", " . . ", ". .", ". .", ". .", ". .", ". .", " . . ", " . . ", " . . ", " .. .. ", " ..... "}; /* XPM */ static const char * const arrowleft_big_xpm[] = { "9 17 2 1", " c None", ". c #000000", " .", " ..", " ...", " ....", " .....", " ......", " .......", " ........", ".........", " ........", " .......", " ......", " .....", " ....", " ...", " ..", " ."}; /* XPM */ static const char * const arrowleft_xpm[] = { "8 15 2 1", " c None", ". c #000000", " .", " ..", " ...", " ....", " .....", " ......", " .......", "........", " .......", " ......", " .....", " ....", " ...", " ..", " ."}; /* XPM */ static const char *const horlines_xpm[] = { "2 2 2 1", " c None", ". c #000000", " ", ".."}; /* XPM */ static const char *const vertlines_xpm[] = { "2 2 2 1", " c None", ". c #000000", ". ", ". "}; /* XPM */ static const char *const radiochecked_xpm[] = { "18 18 2 1", " c None", ". c #000000", " ...... ", " .......... ", " .............. ", " .............. ", " ................ ", " ................ ", "..................", "..................", "..................", "..................", "..................", "..................", " ................ ", " ................ ", " .............. ", " .............. ", " .......... ", " ...... "}; /* XPM */ static const char * const radiochecked_low_xpm[] = { "9 9 2 1", " c None", ". c #000000", " ... ", " ....... ", " ....... ", ".........", ".........", ".........", " ....... ", " ....... ", " ... "}; static const char *const arrowdown_xpm[] = { "15 8 2 1", " c None", ". c #000000", "...............", " ............. ", " ........... ", " ......... ", " ....... ", " ..... ", " ... ", " . "}; static const char *const arrowdown_big_xpm[] = { "17 9 2 1", " c None", ". c #000000", ".................", " ............... ", " ............. ", " ........... ", " ......... ", " ....... ", " ..... ", " ... ", " . "}; /* XPM */ static const char *const checkedlight_xpm[] = { "24 24 2 1", " c None", ". c #000000", " ", " ", " ", " ", " ", " . ", " .. ", " ... ", " .... ", " ..... ", " ...... ", " . ...... ", " .. ...... ", " ... ...... ", " .... ...... ", " .......... ", " ......... ", " ....... ", " ..... ", " ... ", " . ", " ", " ", " "}; /* XPM */ static const char *const checkedbold_xpm[] = { "26 26 2 1", " c None", ". c #000000", " ", " ", " ", " ", " ", " ", " .. ", " ... ", " .... ", " ..... ", " .. ...... ", " ... ....... ", " .... ....... ", " ..... ....... ", " ...... ....... ", " .............. ", " ............ ", " .......... ", " ........ ", " ...... ", " .... ", " .. ", " ", " ", " ", " "}; /* XPM */ static const char * const checkedbold_low_xpm[] = { "9 8 2 1", " c None", ". c #000000", " .", " ..", ". ...", ".. ... ", "... ... ", " ..... ", " ... ", " . "}; /* XPM */ static const char * const checkedlight_low_xpm[] = { "8 8 2 1", " c None", ". c #000000", " .", " ..", " ...", ". ... ", ".. ... ", "..... ", " ... ", " . "}; /* XPM */ static const char * const highlightedradiobutton_xpm[] = { "30 30 3 1", " c None", ". c #000000", "+ c #0078CC", " ........ ", " .............. ", " ....++++++++.... ", " ....++++++++++++.... ", " ...++++ ++++... ", " ...+++ +++... ", " ..++ ++.. ", " ..++ ++.. ", " ...++ ++... ", " ..++ ++.. ", " ..++ ++.. ", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", " ..++ ++.. ", " ..++ ++.. ", " ...++ ++... ", " ..++ ++.. ", " ..++ ++.. ", " ...+++ +++... ", " ...++++ ++++... ", " ....++++++++++++.... ", " ....++++++++.... ", " .............. ", " ........ "}; /* XPM */ static const char * const highlightedradiobutton_low_xpm[] = { "15 15 3 1", " c None", ". c #000000", "+ c #3192D6", " ..... ", " ..+++++.. ", " .++ ++. ", " .+ +. ", " .+ +. ", ".+ +.", ".+ +.", ".+ +.", ".+ +.", ".+ +.", " .+ +. ", " .+ +. ", " .++ ++. ", " ..+++++.. ", " ..... "}; /* XPM */ static const char * const cross_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++..@@@..........@@@..++ ", " ++..@@@@........@@@@..++ ", " ++..@@@@@......@@@@@..++ ", " ++...@@@@@....@@@@@...++ ", " ++....@@@@@..@@@@@....++ ", " ++.....@@@@@@@@@@.....++ ", " ++......@@@@@@@@......++ ", " ++.......@@@@@@.......++ ", " ++.......@@@@@@.......++ ", " ++......@@@@@@@@......++ ", " ++.....@@@@@@@@@@.....++ ", " ++....@@@@@..@@@@@....++ ", " ++...@@@@@....@@@@@...++ ", " ++..@@@@@......@@@@@..++ ", " ++..@@@@........@@@@..++ ", " ++..@@@..........@@@..++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const cross_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +.@@....@@.+ ", " +.@@@..@@@.+ ", " +..@@@@@@..+ ", " +...@@@@...+ ", " +...@@@@...+ ", " +..@@@@@@..+ ", " +.@@@..@@@.+ ", " +.@@....@@.+ ", " +..........+ ", " ++++++++++++ ", " "}; /* XPM */ static const char * const max_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const max_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +..........+ ", " +.@@@@@@@@.+ ", " +.@@@@@@@@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@@@@@@@@.+ ", " +..........+ ", " +..........+ ", " ++++++++++++ ", " "}; /* XPM */ static const char * const normal_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const normal_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +.@@@@@@@@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@@@@@@@@.+ ", " +..........+ ", " ++++++++++++ ", " "}; /* XPM */ static const char * const min_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const min_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +.@@@@@@@@.+ ", " +..........+ ", " +..........+ ", " ++++++++++++ ", " "}; #ifdef Q_WS_WINCE_WM static char * sbhandleup_xpm[] = { "26 41 45 1", " c None", ". c #000000", "+ c #E7E7E7", "@ c #D6D7D6", "# c #949294", "$ c #737573", "% c #636563", "& c #636163", "* c #5A5D5A", "= c #5A595A", "- c #525552", "; c #525152", "> c #4A4D4A", ", c #7B797B", "' c #CECFCE", ") c #CED3CE", "! c #6B6D6B", "~ c #6B696B", "{ c #737173", "] c #7B7D7B", "^ c #848684", "/ c #848284", "( c #8C8A8C", "_ c #8C8E8C", ": c #B5B2B5", "< c #FFFFFF", "[ c #949694", "} c #B5B6B5", "| c #9C9A9C", "1 c #ADAEAD", "2 c #9C9E9C", "3 c #BDBABD", "4 c #BDBEBD", "5 c #F7F3F7", "6 c #C6C3C6", "7 c #C6C7C6", "8 c #A5A2A5", "9 c #CECBCE", "0 c #FFFBFF", "a c #ADAAAD", "b c #A5A6A5", "c c #D6D3D6", "d c #B5BAB5", "e c #DEDFDE", "f c #DEDBDE", "..........................", "+@#$%%&&&**===---;;;;>=,'+", "+@#$%%&&&**===---;;;;>=$'+", ")$!!~~%%&&&**===---;;;;>;'", "#{$]],,$${{{!!~~%%%&&&*-;]", "#{$]],,$${{{!!~~%%%&&&*-;]", ",$^//]],,$${{{!!~~%%%&&*;*", ",,(^^//]],$${!!!!!~~%%%&-*", ",,(^^//]],$${!!!!!~~%%%&-*", "]]_((^^//]$!%%~!{{!!~~%%-*", "//#__((^^]{:<<:~!{{{!!~~=*", "//#__((^^]{:<<:~!{{{!!~~=&", "//###__(/$:<<<<:~{${{!!~*&", "^^[[##_^]:<<<<<<}!{$${{!*%", "^^[[##_^]:<<<<<<}!{$${{!*%", "((|[[#_/:<<<<<<<<}!$$${{&~", "((||[#^1<<<<1:<<<<}!$$$$&~", "((||[#^1<<<<1:<<<<}!$$$$&~", "__2|#(1<<<<}],}<<<<}{$,$%~", "##2|_1<<<<}^((]3<<<<}{$,~!", "##2|_1<<<<}^((]3<<<<}{$,~!", "##2#1<<<<3^###(/4<<<<}{,~{", "##2#1<<<<3^###(/4<<<<}{,~!", "[[2_5<<<4(#|[[#_/6<<<<,,!{", "[|2_5<<4_[||||[[_/7<<<,]{$", "[|2_5<<4_[||||[[_/7<<<,]{$", "||8_5<6#|2222|||[_/9<<,]{$", "228#06[28888222||[_/'<,/$,", "228#06[28888222||[_/'<,/$,", "22a|6[8bbbb88822||[(/c](,]", "881b8baaabbbb88222|[(^(_,]", "881b8baaabbbb88222|[(^(_,]", "88111111aaabbb88822|[###]/", "bb:::11111aaabbb8822||[[/^", "bb:::11111aaabbb8822||[[//", "bb:::::1111aaabbb8822||[/(", "3a1::::::1111aaabb8822|_^8", "da1::::::1111aaabb8822|_^8", "e1aaabbbb888822||[[##__((@", "+e4:aaabbbb88822||[[[#[b@+", "+e4:aaabbbb88822||[[[#[bf+"}; static char * sbhandledown_xpm[] = { "26 40 46 1", " c None", ". c #E7E7E7", "+ c #DEDFDE", "@ c #BDBEBD", "# c #B5B2B5", "$ c #ADAAAD", "% c #A5A6A5", "& c #A5A2A5", "* c #9C9E9C", "= c #9C9A9C", "- c #949694", "; c #949294", "> c #D6D7D6", ", c #DEDBDE", "' c #D6DBD6", ") c #ADAEAD", "! c #8C8E8C", "~ c #8C8A8C", "{ c #BDBABD", "] c #848684", "^ c #B5BAB5", "/ c #848284", "( c #848A84", "_ c #7B7D7B", ": c #7B797B", "< c #C6C3C6", "[ c #D6D3D6", "} c #FFFBFF", "| c #CECFCE", "1 c #FFFFFF", "2 c #737573", "3 c #F7F3F7", "4 c #CECBCE", "5 c #737173", "6 c #C6C7C6", "7 c #6B6D6B", "8 c #B5B6B5", "9 c #6B696B", "0 c #636563", "a c #636163", "b c #5A5D5A", "c c #5A595A", "d c #525552", "e c #525152", "f c #4A4D4A", "g c #C6CBC6", ".+@#$$$%%%%&&&**==---;-%>.", ".+@#$$$%%%%&&&**==---;-%,.", "')$$$%%%%&&&&**==--;;!!~~>", "{$)######))))$$$%%&&**=!]&", "^$)######))))$$$%%&&**=!]&", "%%#####))))$$$%%%&&**==-/(", "%%###)))))$$$%%%&&**==--/]", "%%###)))))$$$%%%&&**==--//", "&&))))))$$$%%%&&&**=-;;;_/", "&&)%&%$$$%%%%&&***=-~]~!:_", "&&)%&%$$$%%%%&&***=-~]~!:_", "**$=<-&%%%%&&&**==-~/[_~:_", "**&;}<-*&&&&***==-!/|1:/2:", "**&;}<-*&&&&***==-!/|1:/2:", "==&!31<;=****===-!/411:_5:", "-=*!311@!-====--!/6111:_52", "-=*!311@!-====--!/6111:_52", "--*!3111@~;=--;!/<1111::75", ";;*;)1111{];;;~/@111185:95", ";;*;)1111{];;;~/@111185:97", ";;*=!)11118]~~_{1111852:97", ";;*=!)11118]~~_{1111852:97", "!!*=;~)11118_:81111852:207", "~~==-;])1111)#1111872222a9", "~~==-;])1111)#1111872222a9", "~~=--;!/#111111118722255a0", "]]--;;!]_#11111187522557b0", "]]--;;!]_#11111187522557b0", "//;;;!!~/2#1111#95255779ba", "//;!!~~]]_5#11#975557799cb", "//;!!~~]]_5#11#975557799ca", "__!~~]]//_27009755779900db", "::~]]//__:2257777799000adb", "::~]]//__:2257777799000adb", ":2]//__::225557799000aabeb", ";52__::225557799000aaabde_", ";52__::225557799000aaabde_", "[2779900aaabbcccdddeeeefeg", ".>;200aaabbcccdddeeeefc:|.", ".>;200aaabbcccdddeeeefc2|."}; static char * sbgripdown_xpm[] = { "26 34 39 1", " c None", ". c #949294", "+ c #9C9E9C", "@ c #9C9A9C", "# c #949694", "$ c #8C8E8C", "% c #8C8A8C", "& c #848684", "* c #848284", "= c #7B7D7B", "- c #7B797B", "; c #6B696B", "> c #636563", ", c #737573", "' c #636163", ") c #737173", "! c #5A5D5A", "~ c #6B6D6B", "{ c #5A595A", "] c #B5B6B5", "^ c #BDBEBD", "/ c #ADAEAD", "( c #BDBABD", "_ c #525552", ": c #313031", "< c #525152", "[ c #ADAAAD", "} c #BDBAB5", "| c #4A4D4A", "1 c #4A494A", "2 c #C6C3C6", "3 c #C6CBC6", "4 c #E7E7E7", "5 c #DEDFDE", "6 c #E7E3E7", "7 c #DEE3DE", "8 c #CECBCE", "9 c #8C928C", "0 c #CECFCE", "..+++@@@###...$$%&&**==-;>", "$.++@@@@##...$$%%&**==-->>", "$$+@@@@###..$$%%&&*==--,>>", "$$@@@@###..$$%%&&**==-,,>'", "%%@@@###..$$$%&&**==--,,''", "%%@@###..$$$%&&**==--,,)''", "%%@###...$$%%&&*==--,,))'!", "&&###...$$%%&&**==--,)))!!", "&&##...$$%%&&**==--,,))~!!", "&&#...$$%%&&**==--,,))~~!{", "**...$$%%&&**==--,,))~~;!{", "**..$$%%&&**===--,)))~~;{{", "**.$$%%&]^&===//,,))~~;;{{", "==$$%%&&]^*==-((,))~~;;>{_", "==$%%&&***::--,,::~~;;;>__", "==%%&&&**=::-,,)::~~;;>>__", "--%&&&**==--,,)))~~;;>>>__", "--&&&**==--,,)))~~;;>>>'_<", ",-&&**==]^-,))[[~;;>>>''<<", ",,&**==-]^-)))}};;>>>'''<<", ",,**==--,,::)~~;::>>'''!<<", "))*==--,,)::~~;;::>'''!!<|", "))==--,,)))~~;;;>>'''!!!||", "))=--,,)))~~;;;>>'''!!!{||", "~~--,,)))~~;;;>>'''!!!{{||", "~~-,,)))~~;;>>>'''!!!{{{|1", ";;,,)))~~;;>>>'''!!!{{{_1<", "~;,)))~~;;>>>'''!!!{{{__1'", "%>~))~~;;>>>'''!!!{{{__|1$", "2>>~~~;;>>>''!!!{{{{__<113", "4%'';;;>>>''!!!{{{{__<11%4", "45-!!'>>>''!!!{{{{_<|11)64", "447+!{{___<<<||||1111|+444", "444489~__<<<||||111>$04444"}; static char * sbgripup_xpm[] = { "26 34 38 1", " c None", ". c #E7E7E7", "+ c #D6DBD6", "@ c #C6C7C6", "# c #B5B6B5", "$ c #ADAEAD", "% c #ADAAAD", "& c #A5A6A5", "* c #A5A2A5", "= c #BDBEBD", "- c #DEDFDE", "; c #C6CBC6", "> c #9C9E9C", ", c #E7E3E7", "' c #BDBABD", ") c #B5B2B5", "! c #9C9A9C", "~ c #DEE3DE", "{ c #949694", "] c #D6D7D6", "^ c #949294", "/ c #DEDBDE", "( c #8C8E8C", "_ c #8C8A8C", ": c #848684", "< c #D6D3CE", "[ c #CECBCE", "} c #D6D3D6", "| c #848284", "1 c #313031", "2 c #7B7D7B", "3 c #CECFCE", "4 c #CECBC6", "5 c #7B797B", "6 c #737573", "7 c #737173", "8 c #6B6D6B", "9 c #6B696B", "....+@#$$%%%%&&&***$=-....", "...;$$$$$%%%&&&&**>>>>@...", ".,'$$)#'#####)))$$$%*!!$~.", ".=$)#'''####))))$$$%%*!{'.", "]$$''''#####)))$$$%%%&*{^/", "=$#'''#####)))$$$$%%&&&!^#", "$$'''#####))))$$$%%%&&*>(!", "$$''#####))))$$$%%%&&&*>(^", "$$######))))$$$$%%&&&**>(_", "%$#####))))$$$$%%%&&***>__", "%$####))))$$$$%%%&&&**>>__", "%%###)))))$$$%%%&&&**>>>_:", "%%##))))<])$$%[[&&***>>!::", "%%#)))))<]$$%%}<&&**>>!!:|", "&%)))))$$$11%%&&11*>>>!!:|", "&&))))$$$$11%&&&11*>>!!{||", "&&)))$$$$$%%%&&&**>>!!!{|2", "&&))$$$$$%%%&&&**>>>!!{{|2", "*&)$$$$$3]%&&&4@*>>!!{{{22", "**$$$$$%3]%&&&<<>>!!!{{^25", "**$$$$%%%%11&**>11!!{{^^25", "**$$$%%%%&11***>11!!{{^^55", "**$$%%%%&&&***>>!!!{{^^(55", ">>$%%%%&&&***>>>!!{{^^((56", ">>%%%%&&&&***>>!!!{{^^((66", ">>%%%&&&&***>>!!!{{^^((_67", "!>%%&&&&***>>>!!{{{^^(__67", "!!%&&&&***>>>!!!{{^^((_:77", "!!&&&&***>>>!!!{{^^((__:77", "!!&&&****>>!!!{{^^^(__::78", "{!&&****>>>!!{{{^^((_::|88", "{{&****>>>!!!{{^^((__:||88", "{{****>>>!!!{{^^^(__::|289", "{{***>>>!!!{{{^^((_::||289"}; static char * sbgripmiddle_xpm[] = { "26 2 12 1", " c None", ". c #949294", "+ c #A5A2A5", "@ c #9C9E9C", "# c #9C9A9C", "$ c #949694", "% c #8C8E8C", "& c #8C8A8C", "* c #848684", "= c #848284", "- c #7B7D7B", "; c #6B696B", "..++@@@###$$$..%%&&*==--;;", "..++@@@###$$$..%%&&*==--;;"}; static char * listviewhighmiddle_xpm[] = { "8 46 197 2", " c None", ". c #66759E", "+ c #6C789D", "@ c #6A789E", "# c #6B789E", "$ c #6A779D", "% c #6C789C", "& c #6F7D9B", "* c #6F7D9A", "= c #9DB6EE", "- c #9DB6ED", "; c #9CB6ED", "> c #A1B6EF", ", c #A2B6F0", "' c #93AAE9", ") c #95ABEA", "! c #94ABEA", "~ c #94A9E8", "{ c #8BA8EA", "] c #8BA7EA", "^ c #8AA7EA", "/ c #8EAAE8", "( c #8FAAE8", "_ c #88A2E7", ": c #8CA3E8", "< c #8BA3E7", "[ c #8BA3E8", "} c #8BA2E7", "| c #8CA2E7", "1 c #8DA2E7", "2 c #87A1E8", "3 c #87A1E9", "4 c #86A0E8", "5 c #86A1E7", "6 c #87A2E7", "7 c #859EE9", "8 c #849DE9", "9 c #869EE9", "0 c #869FE9", "a c #7C9BEA", "b c #7C9CEA", "c c #7B9CEA", "d c #7C9BE9", "e c #7E9CE9", "f c #7B9AEA", "g c #7C99E9", "h c #7C9AEA", "i c #7B9AE8", "j c #7A9AEA", "k c #7996E1", "l c #7C96E4", "m c #7B96E3", "n c #7B95E3", "o c #7E95E5", "p c #7E95E6", "q c #7292E1", "r c #7490DF", "s c #7591E0", "t c #7590DF", "u c #7392E1", "v c #6D8CDE", "w c #6F8EDD", "x c #6E8DDD", "y c #6E8DDE", "z c #6F8EDE", "A c #6E8EDE", "B c #718EDD", "C c #728EDD", "D c #6B89E0", "E c #6C89DF", "F c #6D89E0", "G c #6D89DF", "H c #6C88DF", "I c #6D88DF", "J c #6D86DD", "K c #6086E0", "L c #6686E0", "M c #6586E0", "N c #6486E0", "O c #6485E0", "P c #6786DF", "Q c #5F85E0", "R c #6583DE", "S c #6683DE", "T c #6682DD", "U c #6086DF", "V c #5F86E0", "W c #567ED7", "X c #567ED8", "Y c #557DD7", "Z c #5A7FD8", "` c #6281DA", " . c #5379D9", ".. c #5278D9", "+. c #547BD8", "@. c #4C73D7", "#. c #4B72D2", "$. c #4C73D4", "%. c #4C73D3", "&. c #4B72D4", "*. c #4F75D3", "=. c #5074D2", "-. c #4971D0", ";. c #4871D0", ">. c #335ECF", ",. c #325ECB", "'. c #335ECD", "). c #335ECE", "!. c #325DCD", "~. c #2E59C9", "{. c #3059C9", "]. c #2F59C9", "^. c #2F59C8", "/. c #2B59CA", "(. c #3355C6", "_. c #3354C5", ":. c #3156C7", "<. c #3056C7", "[. c #3355C7", "}. c #3355C5", "|. c #254EBF", "1. c #1F51C1", "2. c #234FC0", "3. c #234FBF", "4. c #2350C0", "5. c #1E50BE", "6. c #1D50C0", "7. c #264DBE", "8. c #264CBD", "9. c #254DBE", "0. c #244EBF", "a. c #254DBF", "b. c #234CBF", "c. c #244CC0", "d. c #244BC0", "e. c #234BC0", "f. c #234BBF", "g. c #234CBE", "h. c #2049B7", "i. c #2A49B5", "j. c #2749B5", "k. c #2749B6", "l. c #2D49B4", "m. c #2649B6", "n. c #2946B5", "o. c #2A48B6", "p. c #2947B5", "q. c #2946B6", "r. c #2848B6", "s. c #2549B5", "t. c #2648B6", "u. c #2744B5", "v. c #2744B4", "w. c #2744AF", "x. c #2543B4", "y. c #2543B2", "z. c #2442B2", "A. c #2442B3", "B. c #2442B5", "C. c #2543B3", "D. c #1F40B1", "E. c #1E40B1", "F. c #243EAE", "G. c #273BAC", "H. c #263DAC", "I. c #253CAB", "J. c #273CAB", "K. c #273CAC", "L. c #263BAA", "M. c #253CAE", "N. c #263BA6", "O. c #253BA5", "P. c #253AA5", "Q. c #253BA6", "R. c #253CA7", "S. c #263AA6", "T. c #243CA6", "U. c #253CA5", "V. c #273BA8", "W. c #2F4DA4", "X. c #2F4DA3", "Y. c #1B2F85", "Z. c #B5B5B6", "`. c #B5B5B5", " + c #B5B6B6", ".+ c #B5B4B6", "++ c #C2C3C5", "@+ c #C0C3C3", "#+ c #C1C3C4", "$+ c #E3E3E3", "%+ c #E3E3E4", "&+ c #E4E3E4", "*+ c #E2E3E4", "=+ c #ECEEEB", "-+ c #EBEDEA", ";+ c #EEF0ED", ">+ c #EFF0EE", ". + @ @ # # $ % ", "& & * & & & & & ", "= = - = = ; > , ", "' ) ! ! ! ) ' ~ ", "{ ] { { { ^ / ( ", "_ : < [ : } | 1 ", "2 2 2 3 2 4 5 6 ", "7 7 7 7 7 8 9 0 ", "a b a a a c d e ", "f g h h h h i j ", "k l m m m n o p ", "q q q q q q q q ", "r r s s s t q u ", "v w x y z A B C ", "D E F F G F H I ", "J K L M N O P Q ", "R R S S S T U V ", "W W X X X Y Z ` ", " . . . . ...+.W ", " . . . . ..... .", "@.#.$.$.%.&.*.=.", "-.-.;.-.-.-.-.-.", ">.,.'.).).!.!.>.", "~.{.].^.].^././.", "(.(.(.(.(._.:.<.", "(.(.[.[.[.[.(.}.", "|.1.2.3.3.4.5.6.", "7.7.7.7.7.8.9.0.", "a.b.c.d.c.e.f.g.", "h.i.j.k.j.k.l.m.", "n.o.p.q.r.p.s.t.", "u.u.v.u.u.u.u.u.", "w.x.y.z.A.y.B.C.", "D.D.E.D.D.D.D.D.", "D.D.E.D.D.D.D.D.", "F.G.H.I.J.K.L.M.", "N.N.O.N.N.P.Q.R.", "N.N.S.N.N.N.N.N.", "T.N.T.T.T.U.N.V.", "W.W.X.W.W.W.W.W.", "W.W.W.W.W.W.W.W.", "Y.Y.Y.Y.Y.Y.Y.Y.", "Z.`. + +.+Z.`.`.", "++@+#+#+#+#+@+@+", "$+%+&+&+*+%+%+%+", "=+-+;+-+-+>+-+-+"}; static char * listviewhighcornerleft_xpm[] = { "100 46 1475 2", " c None", ". c #FBFBFC", "+ c #E8EAE7", "@ c #758DC3", "# c #42599E", "$ c #28418A", "% c #19418F", "& c #3F5695", "* c #415896", "= c #435A98", "- c #445C99", "; c #465E9B", "> c #48609B", ", c #49629C", "' c #4A639D", ") c #49639D", "! c #4A629D", "~ c #4B639D", "{ c #4B649D", "] c #4C659D", "^ c #4D669D", "/ c #4E689D", "( c #506A9D", "_ c #516A9D", ": c #536B9C", "< c #546C9C", "[ c #566D9B", "} c #576D9B", "| c #586E9C", "1 c #5B6F9D", "2 c #61739D", "3 c #63749E", "4 c #64749E", "5 c #68769E", "6 c #6A779E", "7 c #6B789E", "8 c #66759E", "9 c #6C789D", "0 c #EEF0ED", "a c #D0D3DC", "b c #3E51A3", "c c #28428B", "d c #29428C", "e c #425996", "f c #455C99", "g c #485F9C", "h c #49619E", "i c #4A63A0", "j c #4B64A1", "k c #4B65A1", "l c #4C66A2", "m c #4D67A2", "n c #4F69A1", "o c #516AA1", "p c #536CA0", "q c #556DA1", "r c #576EA0", "s c #586F9F", "t c #586E9F", "u c #596F9E", "v c #5A6F9E", "w c #5C709E", "x c #5E719E", "y c #5F729F", "z c #62739F", "A c #63739E", "B c #64749D", "C c #65749E", "D c #69769D", "E c #6C799E", "F c #6D799F", "G c #707D9F", "H c #717F9E", "I c #6E7AA1", "J c #6C789E", "K c #6F7C9C", "L c #6F7D9B", "M c #2A4AA0", "N c #4971D0", "O c #4C72D8", "P c #5472C0", "Q c #5573BF", "R c #5774BF", "S c #5875BF", "T c #5976C1", "U c #5A76C1", "V c #5C78C2", "W c #5E7AC2", "X c #607CC3", "Y c #627EC3", "Z c #637FC4", "` c #6581C5", " . c #6682C6", ".. c #6783C7", "+. c #6984C8", "@. c #6B85C9", "#. c #6D87CA", "$. c #6F89CB", "%. c #718CCD", "&. c #748ECF", "*. c #7690D0", "=. c #7992D2", "-. c #7A93D3", ";. c #7C95D5", ">. c #7F98D7", ",. c #8099D8", "'. c #859CDB", "). c #8AA0DD", "!. c #8DA3DF", "~. c #8FA5E0", "{. c #90A5E0", "]. c #91A6E1", "^. c #91A5E1", "/. c #90A4E0", "(. c #8EA3DE", "_. c #92A6E2", ":. c #8FA4DF", "<. c #90A5DE", "[. c #90A5DC", "}. c #90A6DB", "|. c #91A6E0", "1. c #93A7E2", "2. c #95AAE6", "3. c #99AEEA", "4. c #9AB2EA", "5. c #99B1E9", "6. c #99B1E7", "7. c #98AFE6", "8. c #93A8E2", "9. c #97ACE7", "0. c #9AB3EB", "a. c #9DB5ED", "b. c #9DB6EE", "c. c #375095", "d. c #4056AD", "e. c #506DCD", "f. c #4360CC", "g. c #345ED6", "h. c #335ECF", "i. c #355ED6", "j. c #355FD6", "k. c #365FD6", "l. c #355FD0", "m. c #3760D5", "n. c #3A63D4", "o. c #3C63D1", "p. c #3B63CD", "q. c #3B63C9", "r. c #3B62C9", "s. c #3D63C8", "t. c #4065C5", "u. c #4567C5", "v. c #496BC5", "w. c #4F70C7", "x. c #5273C8", "y. c #5475CA", "z. c #5777CB", "A. c #5879CD", "B. c #5A7BCE", "C. c #5D7DCF", "D. c #5F7ECF", "E. c #617FD0", "F. c #6381D1", "G. c #6583D2", "H. c #6785D2", "I. c #6886D3", "J. c #6A88D4", "K. c #6C89D5", "L. c #6E8BD6", "M. c #708CD7", "N. c #718DD8", "O. c #738EDA", "P. c #748FDB", "Q. c #7691DC", "R. c #7893DD", "S. c #7994DD", "T. c #7A96DE", "U. c #7B97DF", "V. c #7C98E0", "W. c #7E9AE2", "X. c #7F9BE3", "Y. c #829DE4", "Z. c #849FE5", "`. c #87A0E6", " + c #88A1E7", ".+ c #89A2E6", "++ c #8CA3E7", "@+ c #8EA5E9", "#+ c #8EA6E9", "$+ c #8FA7E9", "%+ c #8FA8E8", "&+ c #8FA9E8", "*+ c #91A9E8", "=+ c #90A7E8", "-+ c #8FA8EA", ";+ c #90AAEA", ">+ c #93ABEA", ",+ c #95ABEA", "'+ c #93ABE9", ")+ c #94ABEA", "!+ c #90A9EA", "~+ c #93AAE9", "{+ c #273E7E", "]+ c #345ED5", "^+ c #3D60CE", "/+ c #3D60CF", "(+ c #345ECF", "_+ c #335ED0", ":+ c #355FD3", "<+ c #3A60CE", "[+ c #3A5FCB", "}+ c #385FC9", "|+ c #3B60C8", "1+ c #3C63CB", "2+ c #3E64CB", "3+ c #4166CA", "4+ c #4568C9", "5+ c #4A6CC7", "6+ c #4F71C8", "7+ c #5172CA", "8+ c #5475CE", "9+ c #5678D3", "0+ c #597CD6", "a+ c #5C7ED7", "b+ c #5E7FD8", "c+ c #6181D9", "d+ c #6383DA", "e+ c #6585DA", "f+ c #6786DB", "g+ c #6988DC", "h+ c #6B8ADD", "i+ c #6D8BDE", "j+ c #6F8DDE", "k+ c #718EDF", "l+ c #728FE0", "m+ c #7390E1", "n+ c #7390E2", "o+ c #7491E3", "p+ c #7592E4", "q+ c #7693E4", "r+ c #7794E5", "s+ c #7894E5", "t+ c #7995E6", "u+ c #7B96E6", "v+ c #7C97E7", "w+ c #7D9AE8", "x+ c #7F9CE9", "y+ c #829DE9", "z+ c #849EE9", "A+ c #859EE9", "B+ c #87A0E7", "C+ c #8AA2E7", "D+ c #8BA3E8", "E+ c #89A2E7", "F+ c #8CA6EA", "G+ c #8BA6EA", "H+ c #8BA7EA", "I+ c #8CA3E8", "J+ c #8BA8EA", "K+ c #8CA7EA", "L+ c #8CA8EA", "M+ c #4659C7", "N+ c #355ECF", "O+ c #3660CF", "P+ c #3860CE", "Q+ c #3961CD", "R+ c #3B61CB", "S+ c #3B61CA", "T+ c #3D62CA", "U+ c #3D63CA", "V+ c #4165CB", "W+ c #456ACB", "X+ c #4B6FCD", "Y+ c #5174CE", "Z+ c #5275D1", "`+ c #5477D4", " @ c #5678D9", ".@ c #587ADB", "+@ c #597BDB", "@@ c #5B7DDC", "#@ c #5E7FDC", "$@ c #6081DD", "%@ c #6283DE", "&@ c #6484DF", "*@ c #6787E0", "=@ c #6989E1", "-@ c #6B8BE1", ";@ c #6D8DE2", ">@ c #6F8EE3", ",@ c #718FE4", "'@ c #7290E4", ")@ c #7491E5", "!@ c #7692E6", "~@ c #7793E5", "{@ c #7894E6", "]@ c #7895E7", "^@ c #7996E8", "/@ c #7A97E8", "(@ c #7B98E9", "_@ c #7D99E8", ":@ c #7F9AE8", "<@ c #7F9BE9", "[@ c #7F9CEA", "}@ c #859EE8", "|@ c #859FE8", "1@ c #85A0E9", "2@ c #869FE9", "3@ c #86A1E7", "4@ c #86A0E9", "5@ c #87A1E7", "6@ c #88A2E7", "7@ c #87A1E9", "8@ c #5A6FCA", "9@ c #365FCF", "0@ c #345ED0", "a@ c #385FCC", "b@ c #385FCE", "c@ c #3A61CC", "d@ c #3B62CD", "e@ c #3E64CD", "f@ c #4167CF", "g@ c #4469CF", "h@ c #486CD1", "i@ c #4D71D2", "j@ c #5175D4", "k@ c #5376D6", "l@ c #5578DA", "m@ c #5679DC", "n@ c #587BDD", "o@ c #5A7DDE", "p@ c #5D80DE", "q@ c #5F82DF", "r@ c #6284DF", "s@ c #6585E0", "t@ c #6787E1", "u@ c #6988E2", "v@ c #6B8AE2", "w@ c #6D8CE3", "x@ c #6E8DE3", "y@ c #708EE4", "z@ c #718FE3", "A@ c #7391E4", "B@ c #7592E5", "C@ c #7895E5", "D@ c #7996E6", "E@ c #7A97E6", "F@ c #7B98E7", "G@ c #7A98E8", "H@ c #7B99E9", "I@ c #7E9AE9", "J@ c #7D9AE9", "K@ c #7E9AEA", "L@ c #809CE9", "M@ c #819DE8", "N@ c #7F9BEA", "O@ c #819DE9", "P@ c #819CE9", "Q@ c #839EE9", "R@ c #839EE8", "S@ c #839DEA", "T@ c #859FE9", "U@ c #87A0E8", "V@ c #86A0E8", "W@ c #87A1E8", "X@ c #3760CF", "Y@ c #3A61CE", "Z@ c #3A62CD", "`@ c #3F66CE", " # c #4368D0", ".# c #466CD2", "+# c #496DD5", "@# c #4E72D6", "## c #5175D8", "$# c #5276DA", "%# c #5578DC", "&# c #577ADC", "*# c #597CDD", "=# c #5B7DDD", "-# c #5D7FDE", ";# c #5E81DE", "># c #6183DF", ",# c #6386DF", "'# c #6687E0", ")# c #6888E0", "!# c #6A89E1", "~# c #6C8AE1", "{# c #6E8CE2", "]# c #6F8DE2", "^# c #7390E4", "/# c #7390E3", "(# c #7491E4", "_# c #7693E5", ":# c #7895E6", "<# c #7896E6", "[# c #7997E7", "}# c #7B97E7", "|# c #7B98E8", "1# c #7C98E8", "2# c #7E9BE9", "3# c #809CEA", "4# c #819CEA", "5# c #839DE9", "6# c #365FD0", "7# c #3660D0", "8# c #3961CF", "9# c #3B63CF", "0# c #3D64D0", "a# c #4067D0", "b# c #4469D2", "c# c #466BD3", "d# c #496ED5", "e# c #4C71D6", "f# c #4E72D8", "g# c #5074D9", "h# c #5376DB", "i# c #5578DB", "j# c #587ADC", "k# c #5B7CDC", "l# c #5D7EDD", "m# c #5F80DD", "n# c #6081DE", "o# c #6383DE", "p# c #6686DF", "q# c #6887E0", "r# c #6988E0", "s# c #6B89E1", "t# c #6C8AE0", "u# c #6E8CE1", "v# c #708EE2", "w# c #718FE2", "x# c #7290E3", "y# c #7391E2", "z# c #7492E1", "A# c #7592E2", "B# c #7691E3", "C# c #7591E3", "D# c #7692E3", "E# c #7693E3", "F# c #7793E4", "G# c #7893E4", "H# c #7994E5", "I# c #7D97E8", "J# c #7E98E8", "K# c #7D98E8", "L# c #7D99E9", "M# c #7D9BEA", "N# c #7D9CEA", "O# c #7E99E8", "P# c #7D9AEA", "Q# c #7C9BEA", "R# c #7C9CEA", "S# c #355FCF", "T# c #3860D0", "U# c #3A62D0", "V# c #3C64D1", "W# c #4167D1", "X# c #4369D3", "Y# c #466BD4", "Z# c #486DD5", "`# c #4A6ED7", " $ c #4C70D8", ".$ c #5478D9", "+$ c #577BDA", "@$ c #597DDB", "#$ c #5B7EDB", "$$ c #5D7FDC", "%$ c #6182DE", "&$ c #6284DE", "*$ c #6485DF", "=$ c #6586DF", "-$ c #6787DF", ";$ c #6888DF", ">$ c #6A8ADF", ",$ c #6C8BE0", "'$ c #6D8CE0", ")$ c #6E8DE1", "!$ c #6F8DE1", "~$ c #708EE1", "{$ c #718FE0", "]$ c #728FE1", "^$ c #7390E0", "/$ c #738FE0", "($ c #7490E1", "_$ c #7590E1", ":$ c #7591E1", "<$ c #7592E1", "[$ c #7692E2", "}$ c #7794E2", "|$ c #7894E3", "1$ c #7996E3", "2$ c #7A96E5", "3$ c #7B98E6", "4$ c #7B9AE8", "5$ c #7C99E8", "6$ c #7C96E5", "7$ c #7D97E7", "8$ c #7C99E9", "9$ c #7B9AE9", "0$ c #7B9AEA", "a$ c #5B6DCF", "b$ c #305EC8", "c$ c #335ECE", "d$ c #305ECA", "e$ c #345FCF", "f$ c #3761D0", "g$ c #3A62D1", "h$ c #3C64D2", "i$ c #4066D3", "j$ c #466BD5", "k$ c #486ED6", "l$ c #4A6ED6", "m$ c #4D71D8", "n$ c #4F72D9", "o$ c #5073D9", "p$ c #4F72D8", "q$ c #5074D8", "r$ c #5276D9", "s$ c #587ADA", "t$ c #5B7CDB", "u$ c #5D7EDC", "v$ c #5F7FDD", "w$ c #6081DC", "x$ c #6182DD", "y$ c #6283DD", "z$ c #6484DE", "A$ c #6585DD", "B$ c #6787DE", "C$ c #6988DF", "D$ c #6A89DE", "E$ c #6C8ADF", "F$ c #6D8BDF", "G$ c #6E8CE0", "H$ c #6F8DE0", "I$ c #718EE0", "J$ c #728FDF", "K$ c #728FDE", "L$ c #7290E0", "M$ c #7190E0", "N$ c #7291E0", "O$ c #7191E0", "P$ c #7392E1", "Q$ c #7493E1", "R$ c #7594E1", "S$ c #7594E2", "T$ c #7694E2", "U$ c #7695E2", "V$ c #7A96E4", "W$ c #7895E2", "X$ c #7A96E2", "Y$ c #7A96E3", "Z$ c #7B96E3", "`$ c #7996E1", " % c #7C96E4", ".% c #305EC9", "+% c #315ECC", "@% c #325ECE", "#% c #3760D0", "$% c #3962D1", "%% c #3E66D3", "&% c #4268D4", "*% c #446BD5", "=% c #476CD6", "-% c #496ED7", ";% c #4B6FD7", ">% c #4C70D7", ",% c #4E71D7", "'% c #5074D7", ")% c #5276D8", "!% c #5376D8", "~% c #5779DA", "{% c #597ADA", "]% c #5A7BDB", "^% c #5B7CDA", "/% c #5D7EDB", "(% c #5E7FDB", "_% c #6182DB", ":% c #6384DC", "<% c #6586DD", "[% c #6686DC", "}% c #6887DD", "|% c #6988DD", "1% c #6A8ADE", "2% c #6B8BDE", "3% c #6C8CDE", "4% c #6E8DDF", "5% c #6E8CDF", "6% c #6D8DDF", "7% c #6C8BDF", "8% c #6F8DDF", "9% c #718FDF", "0% c #7290DF", "a% c #7391E0", "b% c #7491E0", "c% c #7292E1", "d% c #3959C5", "e% c #345BC5", "f% c #315EC8", "g% c #355BC5", "h% c #325EC8", "i% c #315ECB", "j% c #345DCC", "k% c #335ECD", "l% c #345ECD", "m% c #355FCE", "n% c #3862D0", "o% c #3E66D2", "p% c #456BD5", "q% c #476CD5", "r% c #4B6ED7", "s% c #4B6FD6", "t% c #4B6FD5", "u% c #4D71D6", "v% c #5073D7", "w% c #5174D7", "x% c #5275D8", "y% c #5577D8", "z% c #5678D8", "A% c #5779D9", "B% c #587AD8", "C% c #597CD9", "D% c #5B7DD9", "E% c #5D7FDA", "F% c #5F80DB", "G% c #6182DC", "H% c #6484DC", "I% c #6585DC", "J% c #6787DD", "K% c #6988DE", "L% c #6B8ADE", "M% c #6B8ADF", "N% c #6989DE", "O% c #6B89DE", "P% c #6E8BDF", "Q% c #708CDE", "R% c #708DDF", "S% c #708FDF", "T% c #728EDF", "U% c #6F8EDD", "V% c #728EDD", "W% c #7390DF", "X% c #7490DF", "Y% c #335DC8", "Z% c #3759C5", "`% c #3859C5", " & c #335EC8", ".& c #325DCA", "+& c #345CCB", "@& c #335DCC", "#& c #345DCD", "$& c #355FCD", "%& c #3861D0", "&& c #3B64D1", "*& c #3E65D2", "=& c #4168D3", "-& c #456AD5", ";& c #4B6ED5", ">& c #4C6FD4", ",& c #4D70D5", "'& c #4F72D6", ")& c #5173D6", "!& c #5375D7", "~& c #5476D8", "{& c #5577D7", "]& c #5477D8", "^& c #5677D8", "/& c #5879D9", "(& c #597AD9", "_& c #5C7DDA", ":& c #6080DC", "<& c #6080DB", "[& c #6181DC", "}& c #6282DC", "|& c #6383DD", "1& c #6484DD", "2& c #6686DE", "3& c #6685DE", "4& c #6786DE", "5& c #6687DE", "6& c #6887DE", "7& c #6987DE", "8& c #6788DF", "9& c #6785DF", "0& c #6B89DF", "a& c #6C89DF", "b& c #6F8DDD", "c& c #6D8CDE", "d& c #445BBB", "e& c #3759BE", "f& c #375AC6", "g& c #355CC8", "h& c #345CCA", "i& c #355ECC", "j& c #365FCD", "k& c #3761CE", "l& c #3A63D0", "m& c #3D65D1", "n& c #466AD4", "o& c #476BD4", "p& c #486CD3", "q& c #4A6ED4", "r& c #4B6ED4", "s& c #4E71D6", "t& c #4F71D5", "u& c #5072D6", "v& c #5274D7", "w& c #5273D7", "x& c #5274D6", "y& c #5476D7", "z& c #5779D8", "A& c #587AD9", "B& c #5A7CDA", "C& c #5C7DDB", "D& c #5D7EDA", "E& c #6081DA", "F& c #6181DB", "G& c #6283DC", "H& c #6483DD", "I& c #6483DE", "J& c #6585DE", "K& c #6786DF", "L& c #6886DE", "M& c #6887DF", "N& c #6987DF", "O& c #6A88DF", "P& c #6786E0", "Q& c #6A86DE", "R& c #6B89E0", "S& c #365BC8", "T& c #365CC8", "U& c #375DCA", "V& c #375FCB", "W& c #3860CD", "X& c #3C63D0", "Y& c #4167D2", "Z& c #4268D2", "`& c #4368D2", " * c #4367D2", ".* c #4568D2", "+* c #466AD2", "@* c #496CD3", "#* c #4A6DD3", "$* c #4A6DD4", "%* c #4D70D4", "&* c #4F72D5", "** c #4C70D4", "=* c #4E72D5", "-* c #5173D5", ";* c #5375D6", ">* c #597BDA", ",* c #5B7DDA", "'* c #5C7EDB", ")* c #5D7FDB", "!* c #5E80DB", "~* c #5E81DA", "{* c #5F81DB", "]* c #5F82DB", "^* c #6384DD", "/* c #6384DE", "(* c #6585DF", "_* c #6486E0", ":* c #6583DD", "<* c #6386E0", "[* c #6686E0", "}* c #6B86DD", "|* c #6D86DD", "1* c #6086E0", "2* c #5573CD", "3* c #3959C3", "4* c #3959C4", "5* c #3759C0", "6* c #375BC7", "7* c #365CC7", "8* c #395FCC", "9* c #3B62CE", "0* c #3E64D0", "a* c #4066D1", "b* c #4166D1", "c* c #4064CF", "d* c #4065CF", "e* c #4266D0", "f* c #4468D1", "g* c #4569D1", "h* c #476BD2", "i* c #466AD1", "j* c #476AD2", "k* c #456AD1", "l* c #496DD2", "m* c #4A6FD3", "n* c #496ED2", "o* c #4B70D4", "p* c #4D71D4", "q* c #4E72D4", "r* c #5073D4", "s* c #5174D5", "t* c #5175D5", "u* c #5276D6", "v* c #5377D6", "w* c #5478D7", "x* c #5579D7", "y* c #567AD8", "z* c #577BD9", "A* c #597CD8", "B* c #5A7DD9", "C* c #5A7ED9", "D* c #5B7FDA", "E* c #5C80DA", "F* c #5D80DA", "G* c #5E81DB", "H* c #5D80DB", "I* c #6082DC", "J* c #6183DD", "K* c #6183DE", "L* c #6082DB", "M* c #6282DE", "N* c #6682DE", "O* c #6583DE", "P* c #3759BF", "Q* c #375AC2", "R* c #375AC1", "S* c #375AC4", "T* c #395DCA", "U* c #3A5ECA", "V* c #3C60CC", "W* c #3D61CD", "X* c #3D61CC", "Y* c #3C61CD", "Z* c #3E62CD", "`* c #3F64CE", " = c #4266CF", ".= c #4468D0", "+= c #4267CF", "@= c #4166CE", "#= c #4065CE", "$= c #4166CD", "%= c #4267CE", "&= c #456AD0", "*= c #4368CE", "== c #4468CF", "-= c #4569D0", ";= c #486BD1", ">= c #4B6FD3", ",= c #4C70D3", "'= c #4F73D4", ")= c #5275D5", "!= c #5477D6", "~= c #577BD7", "{= c #587CD8", "]= c #577CD8", "^= c #597DD9", "/= c #5A7DDA", "(= c #597DDA", "_= c #587CDA", ":= c #5A7EDA", "<= c #567BD8", "[= c #557AD9", "}= c #567BD9", "|= c #577CD9", "1= c #587DD9", "2= c #587ED9", "3= c #577ED8", "4= c #587DD8", "5= c #587ED8", "6= c #567ED7", "7= c #526ABD", "8= c #3759C1", "9= c #385BC7", "0= c #395CC8", "a= c #3B5DC9", "b= c #3B5ECA", "c= c #3A5FCA", "d= c #3B60CC", "e= c #3C61CC", "f= c #3D62CD", "g= c #3E63CD", "h= c #3C61CB", "i= c #3C61CA", "j= c #3D62CB", "k= c #3F64CC", "l= c #4065CD", "m= c #4669D0", "n= c #476AD0", "o= c #496BD1", "p= c #4A6DD2", "q= c #4B6ED2", "r= c #4D71D3", "s= c #4E73D4", "t= c #4F74D4", "u= c #5075D5", "v= c #5276D5", "w= c #5377D7", "x= c #5278D7", "y= c #5277D6", "z= c #5378D7", "A= c #5379D8", "B= c #5379D9", "C= c #5278D8", "D= c #5178D7", "E= c #3355C0", "F= c #3556C1", "G= c #395AC6", "H= c #385AC7", "I= c #395BC7", "J= c #395EC9", "K= c #395FCA", "L= c #3B60CA", "M= c #3B60CB", "N= c #375DC7", "O= c #385EC8", "P= c #395FC9", "Q= c #3A60CA", "R= c #3D63CC", "S= c #4367CF", "T= c #476BD1", "U= c #4A6ED2", "V= c #4B6FD2", "W= c #4C6FD2", "X= c #4D70D1", "Y= c #4E71D2", "Z= c #4E72D2", "`= c #4E74D4", " - c #4E75D5", ".- c #4E75D4", "+- c #4F75D3", "@- c #5075D2", "#- c #5075D3", "$- c #5177D7", "%- c #5178D8", "&- c #4F75D5", "*- c #5076D5", "=- c #4F76D6", "-- c #5279D9", ";- c #3C52B1", ">- c #3656C3", ",- c #3757C5", "'- c #3758C6", ")- c #3759C6", "!- c #375BC6", "~- c #385CC7", "{- c #385DC8", "]- c #365CC6", "^- c #355BC6", "/- c #355CC6", "(- c #365DC7", "_- c #375EC8", ":- c #375CC6", "<- c #385EC6", "[- c #3A5FC7", "}- c #3C60C8", "|- c #3D61C9", "1- c #3E62CA", "2- c #4063CC", "3- c #4165CE", "4- c #4268D0", "5- c #4269D1", "6- c #436AD2", "7- c #446AD2", "8- c #456BD2", "9- c #496CD1", "0- c #4C6CD0", "a- c #4D6CCF", "b- c #4E6DD0", "c- c #4F6ECF", "d- c #4E6FCF", "e- c #4C70CF", "f- c #4A71D0", "g- c #4F6FCF", "h- c #4B71D0", "i- c #4A72D1", "j- c #4B73D4", "k- c #4F70D0", "l- c #4C73D3", "m- c #4C73D6", "n- c #4B72D2", "o- c #4B71D1", "p- c #4C73D7", "q- c #3354C0", "r- c #3152BE", "s- c #3052BE", "t- c #3051BF", "u- c #2E4FBF", "v- c #2E4FBE", "w- c #2E50BF", "x- c #2F50BF", "y- c #3156C4", "z- c #2F56C5", "A- c #2E57C5", "B- c #2F57C5", "C- c #3057C6", "D- c #3258C6", "E- c #3459C7", "F- c #365AC7", "G- c #385BC8", "H- c #3B5DCA", "I- c #3B5DCB", "J- c #3C5ECC", "K- c #3C60CD", "L- c #3C62CE", "M- c #3D65D0", "N- c #3D66D1", "O- c #4166D2", "P- c #4667D2", "Q- c #4A67D1", "R- c #4C68D0", "S- c #4C69CF", "T- c #4D6BCE", "U- c #4E6DCD", "V- c #4E6ECE", "W- c #4E6DCE", "X- c #4970D0", "Y- c #4770D0", "Z- c #4B6BCE", "`- c #4A6CCE", " ; c #496DCF", ".; c #476FD0", "+; c #4870D0", "@; c #486DCF", "#; c #242F79", "$; c #2F41AC", "%; c #2040B8", "&; c #2041B8", "*; c #2243B3", "=; c #2243B8", "-; c #2343B8", ";; c #2444B8", ">; c #2445B8", ",; c #2445B6", "'; c #2445B7", "); c #2444B9", "!; c #2949BE", "~; c #2649BF", "{; c #234BBF", "]; c #224CBF", "^; c #224AC0", "/; c #244CC0", "(; c #254DC0", "_; c #254DC1", ":; c #264DC2", "<; c #274EC3", "[; c #274CC3", "}; c #274DC4", "|; c #254DC5", "1; c #214EC5", "2; c #204FC6", "3; c #1F50C8", "4; c #2151C9", "5; c #2B53C8", "6; c #3154C7", "7; c #3255C6", "8; c #2F57C7", "9; c #2C58C9", "0; c #2D59CA", "a; c #2D58C9", "b; c #2E5BCC", "c; c #325ECC", "d; c #325ECB", "e; c #1F40B1", "f; c #1F40B2", "g; c #1F40B3", "h; c #2A44BD", "i; c #2845BE", "j; c #2745BE", "k; c #2646BF", "l; c #2546BE", "m; c #2347BF", "n; c #2147BF", "o; c #2048C0", "p; c #1D48C0", "q; c #1C48C0", "r; c #1B47C0", "s; c #1C48BF", "t; c #1E49BE", "u; c #214ABD", "v; c #244CBD", "w; c #264DBE", "x; c #254EC0", "y; c #214FC2", "z; c #1B51C5", "A; c #1C51C7", "B; c #2250C8", "C; c #2A52C8", "D; c #3254C6", "E; c #3355C5", "F; c #3154C8", "G; c #3355C6", "H; c #2F57C8", "I; c #2E58C9", "J; c #2E59C9", "K; c #3059C9", "L; c #2040B6", "M; c #2743BB", "N; c #2844BC", "O; c #2743BD", "P; c #2844BE", "Q; c #2844BD", "R; c #2346BE", "S; c #2047BF", "T; c #1E48C0", "U; c #1D47C0", "V; c #1D49BF", "W; c #1F49BF", "X; c #204ABE", "Y; c #254DBF", "Z; c #234EC0", "`; c #2050C1", " > c #1C51C3", ".> c #1F51C6", "+> c #2651C8", "@> c #2D53C7", "#> c #3155C6", "$> c #3155C7", "%> c #3355C7", "&> c #3254C7", "*> c #1E40B1", "=> c #2141B8", "-> c #2442B9", ";> c #2744BB", ">> c #2945BB", ",> c #2A45BB", "'> c #2944BA", ")> c #2745BB", "!> c #2545BC", "~> c #2246BD", "{> c #2047BE", "]> c #1F47BD", "^> c #1D48BE", "/> c #1E49C0", "(> c #1F4AC0", "_> c #214BBF", ":> c #244CBE", "<> c #254DBE", "[> c #244DBE", "}> c #224FBF", "|> c #2051C1", "1> c #2151C3", "2> c #2252C5", "3> c #2151C1", "4> c #2851C6", "5> c #2A50C6", "6> c #2E54C6", "7> c #1F51C2", "8> c #1D52C5", "9> c #2651C9", "0> c #2950C7", "a> c #2D40A5", "b> c #2040B0", "c> c #1F40B0", "d> c #223CAE", "e> c #233CAE", "f> c #253BAC", "g> c #253BAD", "h> c #233CB0", "i> c #213EB2", "j> c #1F3FB4", "k> c #1E40B6", "l> c #1F3FB7", "m> c #1E3EB8", "n> c #1F3FB8", "o> c #2040B7", "p> c #2141B6", "q> c #2140B7", "r> c #2241B6", "s> c #2342B5", "t> c #2442B6", "u> c #2543B5", "v> c #2643B4", "w> c #2544B6", "x> c #2346B8", "y> c #2247B9", "z> c #2048BC", "A> c #1F48BF", "B> c #2049C0", "C> c #214AC0", "D> c #224BBF", "E> c #234CBE", "F> c #244DBF", "G> c #234CBF", "H> c #264DC0", "I> c #274EBF", "J> c #264DBF", "K> c #254EBF", "L> c #2050C0", "M> c #1F51C1", "N> c #1E42A4", "O> c #263BA6", "P> c #253BA7", "Q> c #253CA7", "R> c #1E41A5", "S> c #1F40AF", "T> c #273AAC", "U> c #1E40B0", "V> c #1F40B5", "W> c #1F40B6", "X> c #1F40B8", "Y> c #1E40B8", "Z> c #1F3EB8", "`> c #203FB7", " , c #2240B6", "., c #2341B7", "+, c #2345B9", "@, c #2147BB", "#, c #2148BA", "$, c #2049BB", "%, c #2049BD", "&, c #2049BF", "*, c #224BBE", "=, c #244DBD", "-, c #244CBF", ";, c #182969", ">, c #273BAD", ",, c #2739AB", "', c #263AAC", "), c #243CAE", "!, c #233DAE", "~, c #213EAF", "{, c #1F3FB0", "], c #2040B4", "^, c #1F3FB6", "/, c #1E3EB7", "(, c #2240B7", "_, c #2341B6", ":, c #2543B4", "<, c #2644B3", "[, c #2544B5", "}, c #2545B5", "|, c #2547B6", "1, c #2548B7", "2, c #2349BA", "3, c #1F49BE", "4, c #2149BD", "5, c #2049BE", "6, c #214BBE", "7, c #2249BE", "8, c #234CBD", "9, c #2149BE", "0, c #1E49BF", "a, c #253BA9", "b, c #253BAB", "c, c #263AAB", "d, c #213DAF", "e, c #203EAF", "f, c #1D40AF", "g, c #1D40B0", "h, c #1E40B4", "i, c #2241B7", "j, c #2643B6", "k, c #2744B5", "l, c #2643B5", "m, c #2346B6", "n, c #2147B7", "o, c #2644B6", "p, c #2247B7", "q, c #2248B8", "r, c #2647B7", "s, c #2549B7", "t, c #2645B7", "u, c #2148B8", "v, c #2847B6", "w, c #2549B6", "x, c #2849B6", "y, c #2049B7", "z, c #2A49B5", "A, c #243BA4", "B, c #253BA5", "C, c #253BA6", "D, c #263AA7", "E, c #263AA8", "F, c #2739AA", "G, c #243CAD", "H, c #223DAE", "I, c #1F3EAF", "J, c #1E3FB0", "K, c #1D40B1", "L, c #1E3FB1", "M, c #1F3FB3", "N, c #1F3FB5", "O, c #2140B6", "P, c #2140B8", "Q, c #2744B4", "R, c #2746B6", "S, c #2947B6", "T, c #2946B5", "U, c #2A48B6", "V, c #3551A8", "W, c #1F399C", "X, c #143D9F", "Y, c #263BA5", "Z, c #273BA8", "`, c #273BAA", " ' c #263AAD", ".' c #233CAD", "+' c #213DAE", "@' c #203FB2", "#' c #2342B6", "$' c #2443B6", "%' c #2543B6", "&' c #2644B5", "*' c #133D9E", "=' c #263BA7", "-' c #263BA9", ";' c #273BA9", ">' c #263AAA", ",' c #2539AB", "'' c #2639AB", ")' c #253AAC", "!' c #243BAD", "~' c #223DAF", "{' c #203FB0", "]' c #2040B1", "^' c #2140B3", "/' c #2543B1", "(' c #2744AF", "_' c #1A3CA0", ":' c #1D3BA2", "<' c #233BA4", "[' c #263AA5", "}' c #253AA5", "|' c #263AA6", "1' c #263BA4", "2' c #243BA5", "3' c #263BA8", "4' c #223EAF", "5' c #3B4CA5", "6' c #1D379A", "7' c #1E389C", "8' c #1E399F", "9' c #1F3BA2", "0' c #1F3BA3", "a' c #213BA4", "b' c #233AA3", "c' c #243AA3", "d' c #2539A4", "e' c #253AA6", "f' c #243BA7", "g' c #253CAA", "h' c #253CAC", "i' c #253CAD", "j' c #253CAE", "k' c #243DAE", "l' c #213FAF", "m' c #223FAF", "n' c #2040AF", "o' c #253D93", "p' c #1D3894", "q' c #1F379A", "r' c #1E389B", "s' c #1D399C", "t' c #1C3A9D", "u' c #1B3A9D", "v' c #183B9E", "w' c #163C9E", "x' c #153C9E", "y' c #163B9D", "z' c #173B9D", "A' c #193A9D", "B' c #1C3A9E", "C' c #1F3AA1", "D' c #223AA4", "E' c #253BA8", "F' c #273BA7", "G' c #263CAB", "H' c #263CAC", "I' c #243EAE", "J' c #273BAC", "K' c #2A3795", "L' c #1F389B", "M' c #1D389B", "N' c #1C399C", "O' c #1B399C", "P' c #1A3A9D", "Q' c #1D399B", "R' c #1B399B", "S' c #1A3A9C", "T' c #1B3A9F", "U' c #1D3AA0", "V' c #203BA2", "W' c #203BA3", "X' c #2639A6", "Y' c #1B3692", "Z' c #1C3794", "`' c #1D3796", " ) c #1E3898", ".) c #1E389A", "+) c #1F399B", "@) c #1A399C", "#) c #193A9E", "$) c #1A3BA0", "%) c #1C3BA2", "&) c #1D3CA3", "*) c #203CA4", "=) c #223BA5", "-) c #3C4699", ";) c #2B4595", ">) c #1C3793", ",) c #1D3895", "') c #1E3897", ")) c #1F3998", "!) c #1F3999", "~) c #1F399A", "{) c #1E399C", "]) c #1C3B9E", "^) c #1D3BA0", "/) c #1E3CA2", "() c #223CA5", "_) c #243CA6", ":) c #596FA9", "<) c #3B4894", "[) c #314993", "}) c #29499F", "|) c #28489E", "1) c #2B4BA1", "2) c #2C4BA1", "3) c #2D4CA2", "4) c #2E4CA3", "5) c #2F4CA4", "6) c #2E4CA4", "7) c #2F4DA3", "8) c #2F4DA4", "9) c #D3D5D2", "0) c #3B4794", "a) c #314791", "b) c #304892", "c) c #304893", "d) c #2F4995", "e) c #2F4997", "f) c #2D4A9A", "g) c #2A4A9D", "h) c #294A9F", "i) c #284AA0", "j) c #294AA0", "k) c #2B4AA1", "l) c #2D4CA3", "m) c #C9CAC9", "n) c #455D9B", "o) c #242F78", "p) c #1B2F85", "q) c #C6C3C8", "r) c #B5B2B6", "s) c #B5B7B4", "t) c #B5B7B3", "u) c #B5B2B5", "v) c #B5B3B4", "w) c #B5B5B4", "x) c #B5B6B3", "y) c #B5B4B4", "z) c #B5B3B5", "A) c #B5B4B5", "B) c #B5B5B5", "C) c #B5B5B3", "D) c #B5B5B6", "E) c #BAC3BE", "F) c #B9C3BD", "G) c #C1C3C4", "H) c #BFC3C2", "I) c #B9C3BE", "J) c #BBC3BF", "K) c #BDC3C1", "L) c #C0C3C3", "M) c #BEC3C1", "N) c #C2C3C5", "O) c #E6E3E8", "P) c #E0E2DF", "Q) c #E1E1E1", "R) c #E2E1E3", "S) c #E4E1E6", "T) c #E4E2E7", "U) c #E4E2E6", "V) c #E3E3E4", "W) c #E2E3E3", "X) c #E1E3E2", "Y) c #E3E3E3", "Z) c #E3E3E2", "`) c #EBEDEA", " ! c #EAECE9", ".! c #E9EBE8", "+! c #ECEEEB", ". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ", "0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ", "@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.", "c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+", "$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+", "{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+", "{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@", "{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+", "{+{+8@[email protected].(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#", "$ {[email protected]#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$", "$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %", "$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%", "$ $ [email protected]%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%", "$ $ 8@[email protected]%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%", "$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&", "{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*", "{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*", "{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=", "{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=", "{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=", "{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-", "{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ", "#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;", "#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;", "#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;", "#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;", "#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>", "#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;", "#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>", ";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,", ";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,", ";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,", ";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,", ";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;", ";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;", ";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'", ";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", ";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", "{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>", ":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", "9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", "+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)", "+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)", ". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)", ". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)", ". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"}; static char * listviewhighcornerright_xpm[] = { "100 46 780 2", " c None", ". c #6A779D", "+ c #6C789C", "@ c #6C789D", "# c #6B789D", "$ c #6A779E", "% c #66759E", "& c #64749E", "* c #63749E", "= c #61739D", "- c #576D9B", "; c #556C9C", "> c #4D679D", ", c #4A649D", "' c #49629D", ") c #465E9C", "! c #40579C", "~ c #3B5394", "{ c #2C4E97", "] c #314993", "^ c #2B4595", "/ c #1B4296", "( c #253D93", "_ c #19418F", ": c #0F3C96", "< c #42599E", "[ c #758DC3", "} c #E8EAE7", "| c #EEF0ED", "1 c #FBFBFC", "2 c #6F7D9B", "3 c #6F7D9A", "4 c #6E7B9C", "5 c #67759E", "6 c #63739E", "7 c #62739D", "8 c #596F9C", "9 c #4A639D", "0 c #47609C", "a c #445B9F", "b c #3E5697", "c c #2E509A", "d c #2D509A", "e c #2D4F99", "f c #2D4F98", "g c #28418A", "h c #3E51A3", "i c #D0D3DC", "j c #A1B6EF", "k c #A2B6F0", "l c #A1B6F0", "m c #A3B6F0", "n c #A0B6EF", "o c #9DB6EE", "p c #9CB5EF", "q c #9CB2F0", "r c #9FB5EE", "s c #9CB4EB", "t c #9AB3EC", "u c #9AB0EC", "v c #9DB3EB", "w c #9BB4EC", "x c #9BB4EE", "y c #9BB1EF", "z c #9BB0F0", "A c #90ACF0", "B c #93ABEE", "C c #91A8EB", "D c #8BA3E8", "E c #88A1E7", "F c #809DE9", "G c #7A99E8", "H c #7491E5", "I c #698AE4", "J c #6184E3", "K c #507EDC", "L c #4E7CDB", "M c #4F7DDC", "N c #5479DA", "O c #567BDC", "P c #577CDD", "Q c #5074DA", "R c #5174DB", "S c #5175DC", "T c #5276DD", "U c #4D71DE", "V c #4C72D8", "W c #3A6CE0", "X c #2B49A6", "Y c #E0E2DF", "Z c #93AAE9", "` c #94A9E8", " . c #94AAE9", ".. c #93A9E9", "+. c #92AAE9", "@. c #8DA9E8", "#. c #8CA7E9", "$. c #92ABE9", "%. c #8EAAE9", "&. c #8EA9E9", "*. c #8FAAE9", "=. c #8CA8E9", "-. c #8CA2E7", ";. c #86A1E6", ">. c #839EE9", ",. c #7F9CE9", "'. c #7A97E8", "). c #7693E7", "!. c #6E8EE8", "~. c #678AE9", "{. c #5D84E3", "]. c #577CDF", "^. c #4E77DF", "/. c #4A70DB", "(. c #4870DB", "_. c #4870DC", ":. c #4770E3", "<. c #496FDC", "[. c #486EDB", "}. c #466FE4", "|. c #466EE3", "1. c #4167D9", "2. c #4066D8", "3. c #3F66D8", "4. c #3D64D7", "5. c #3960DA", "6. c #476DD9", "7. c #446EE5", "8. c #305EC8", "9. c #8EAAE8", "0. c #8FAAE8", "a. c #91AAE9", "b. c #8FA9E8", "c. c #8BA8E8", "d. c #8AA7E9", "e. c #8BA5EA", "f. c #8AA7E8", "g. c #87A2E6", "h. c #859FE8", "i. c #7F9DE8", "j. c #7C9AE8", "k. c #7B95E7", "l. c #7090E8", "m. c #6B8BE9", "n. c #6386E6", "o. c #5881E1", "p. c #5479DE", "q. c #4D74DE", "r. c #476EDB", "s. c #446EE1", "t. c #446EE0", "u. c #446EDF", "v. c #446DE0", "w. c #426ADF", "x. c #3C64DA", "y. c #4360CC", "z. c #D3D5D2", "A. c #E6E3E8", "B. c #8DA2E7", "C. c #8CA6EA", "D. c #8DA3E9", "E. c #88A2E7", "F. c #87A1E7", "G. c #8AA1E7", "H. c #849EE9", "I. c #7D9AE9", "J. c #7B98E8", "K. c #7796E5", "L. c #7191E7", "M. c #688CE9", "N. c #6687E5", "O. c #5C83E1", "P. c #557BDE", "Q. c #4F76DE", "R. c #4C72DE", "S. c #456EDF", "T. c #426AD9", "U. c #4269D9", "V. c #4269D8", "W. c #3D64D9", "X. c #3A61DA", "Y. c #345ED6", "Z. c #335ECF", "`. c #C6C3C8", " + c #86A1E7", ".+ c #87A2E7", "++ c #87A0E7", "@+ c #859EE8", "#+ c #849DE9", "$+ c #7E9BE9", "%+ c #7A99E9", "&+ c #7A95E5", "*+ c #7593E7", "=+ c #6F8EE9", "-+ c #668AE5", ";+ c #6386E0", ">+ c #5B82DF", ",+ c #5379DE", "'+ c #5075DE", ")+ c #4B6FDC", "!+ c #446AD7", "~+ c #4269D6", "{+ c #4269D5", "]+ c #3E65D7", "^+ c #C9CAC9", "/+ c #869EE9", "(+ c #859FE9", "_+ c #849FE9", ":+ c #829DE8", "<+ c #819DE8", "[+ c #7B9AE9", "}+ c #7A96E6", "|+ c #7290E8", "1+ c #698CE6", "2+ c #6689E0", "3+ c #5D84E0", "4+ c #587FDF", "5+ c #5377DD", "6+ c #4B74DE", "7+ c #496BD8", "8+ c #7C9BE9", "9+ c #7E9CE9", "0+ c #7D9AEA", "a+ c #7D9BEA", "b+ c #7D98E8", "c+ c #7C98E8", "d+ c #7796E4", "e+ c #7592E6", "f+ c #7390E1", "g+ c #698DE0", "h+ c #6588DE", "i+ c #5E84E0", "j+ c #5880DF", "k+ c #5479DC", "l+ c #4F75DE", "m+ c #4A6FDB", "n+ c #436AD7", "o+ c #3F65D7", "p+ c #BAC3BE", "q+ c #7B9AE8", "r+ c #7B9AEA", "s+ c #7A9AEA", "t+ c #7B99E9", "u+ c #7D97E7", "v+ c #7D95E6", "w+ c #7D95E5", "x+ c #7C95E6", "y+ c #7493E3", "z+ c #7290DF", "A+ c #6C8DDE", "B+ c #6B89E1", "C+ c #6486DF", "D+ c #5D81DF", "E+ c #567DDE", "F+ c #4F73DE", "G+ c #496EDA", "H+ c #355ED6", "I+ c #345ED5", "J+ c #7E95E5", "K+ c #7C97E8", "L+ c #7C97E7", "M+ c #7B94E6", "N+ c #7A95E4", "O+ c #7695E5", "P+ c #7694E4", "Q+ c #7994E6", "R+ c #7995E4", "S+ c #7594E4", "T+ c #7391E2", "U+ c #6E8EDE", "V+ c #6B8ADE", "W+ c #6688DF", "X+ c #5F84E0", "Y+ c #5980E0", "Z+ c #4D72DD", "`+ c #456BD7", " @ c #4168D6", ".@ c #3C64D7", "+@ c #335ED0", "@@ c #4659C7", "#@ c #7292E1", "$@ c #7392E1", "%@ c #7492E1", "&@ c #718FDF", "*@ c #6F8EDE", "=@ c #6D8BDE", "-@ c #6B88DF", ";@ c #597FDF", ">@ c #557ADD", ",@ c #5176DC", "'@ c #4D74DD", ")@ c #496DDA", "!@ c #3860D8", "~@ c #7391E0", "{@ c #7290DE", "]@ c #6D8EDD", "^@ c #6D8DDD", "/@ c #7190E0", "(@ c #6C8DDD", "_@ c #6B89DF", ":@ c #6487E0", "<@ c #6085DF", "[@ c #5F81DE", "}@ c #567EDE", "|@ c #4F74D9", "1@ c #466BD7", "2@ c #4067D5", "3@ c #3C63D7", "4@ c #335ED3", "5@ c #335ED1", "6@ c #718EDD", "7@ c #728EDD", "8@ c #748EDD", "9@ c #708EDD", "0@ c #6F8DDD", "a@ c #6E8DDD", "b@ c #6C8ADE", "c@ c #6C89DF", "d@ c #6988DF", "e@ c #6387DF", "f@ c #6282DE", "g@ c #5681E0", "h@ c #577BDD", "i@ c #5277DB", "j@ c #4D73D8", "k@ c #4A70D8", "l@ c #436AD5", "m@ c #3F66D6", "n@ c #3C63D8", "o@ c #3960D8", "p@ c #3860D7", "q@ c #335ED2", "r@ c #345ED4", "s@ c #6C88DF", "t@ c #6D88DF", "u@ c #6B89DE", "v@ c #6888DF", "w@ c #6587E0", "x@ c #6989DF", "y@ c #6687E0", "z@ c #6287E0", "A@ c #6281DD", "B@ c #5881E0", "C@ c #557ADB", "D@ c #5176D9", "E@ c #4E75D7", "F@ c #4A6FD8", "G@ c #476BD6", "H@ c #4067D6", "I@ c #3C62D7", "J@ c #3C60D4", "K@ c #365ED1", "L@ c #345ED3", "M@ c #6786DF", "N@ c #5F85E0", "O@ c #5F86E0", "P@ c #6186DF", "Q@ c #6286E0", "R@ c #6284DF", "S@ c #6384DF", "T@ c #5B7FDE", "U@ c #577DDC", "V@ c #557BDA", "W@ c #5278D8", "X@ c #4E76D6", "Y@ c #4C72D7", "Z@ c #486DD8", "`@ c #4469D6", " # c #3F62D2", ".# c #3C60CF", "+# c #345ECF", "@# c #6086DF", "## c #6085E0", "$# c #6285DF", "%# c #6383DD", "&# c #6481DC", "*# c #6380DD", "=# c #6183DE", "-# c #6083DD", ";# c #6081DC", "># c #6080DD", ",# c #6083DE", "'# c #6181DC", ")# c #6280DD", "!# c #577EDB", "~# c #557CD7", "{# c #4F76D6", "]# c #4E74D7", "^# c #466CD7", "/# c #3B64D6", "(# c #4261CD", "_# c #375FCE", ":# c #5A7FD8", "<# c #6281DA", "[# c #5F81D8", "}# c #5C80D8", "|# c #557DD7", "1# c #577ED8", "2# c #567ED7", "3# c #587DD8", "4# c #577DD8", "5# c #587ED8", "6# c #567DD8", "7# c #5379D9", "8# c #5177D7", "9# c #4D74D5", "0# c #486ED9", "a# c #4068D4", "b# c #3D65D2", "c# c #4361CC", "d# c #345ECE", "e# c #325DCF", "f# c #2C5AD1", "g# c #3959C5", "h# c #547BD8", "i# c #567DD7", "j# c #557BD8", "k# c #5279D9", "l# c #5278D9", "m# c #4D74D6", "n# c #4B71D8", "o# c #496CD8", "p# c #4669D7", "q# c #3D66D3", "r# c #3F62CF", "s# c #4260CC", "t# c #5379D8", "u# c #4E75D4", "v# c #4C73D7", "w# c #476CD7", "x# c #4869D0", "y# c #4067D2", "z# c #3D64D1", "A# c #4261CC", "B# c #395FCE", "C# c #4F75D3", "D# c #5074D2", "E# c #5174D1", "F# c #5175D1", "G# c #4F74D3", "H# c #4C73D5", "I# c #4C73D4", "J# c #4A72D1", "K# c #4B70CF", "L# c #506CCC", "M# c #4D6BCE", "N# c #4167D0", "O# c #3D65D1", "P# c #3F63CF", "Q# c #3B5FCD", "R# c #3159CD", "S# c #4971D0", "T# c #4870CF", "U# c #4C6FCF", "V# c #4E6CCE", "W# c #4E6BCE", "X# c #4769CF", "Y# c #3D66D0", "Z# c #3C65D1", "`# c #4062CE", " $ c #3D5FCD", ".$ c #365FCF", "+$ c #325DCD", "@$ c #2D5AD0", "#$ c #3859C5", "$$ c #355FCF", "%$ c #355ECF", "&$ c #335ECE", "*$ c #305CCD", "=$ c #2B5ACE", "-$ c #3056C9", ";$ c #2553C6", ">$ c #2153C8", ",$ c #1F4FC7", "'$ c #274CC5", ")$ c #214AC7", "!$ c #1C48C8", "~$ c #1244C9", "{$ c #1043C9", "]$ c #1144C9", "^$ c #2A45BE", "/$ c #2744B5", "($ c #1D49C0", "_$ c #2B58DE", ":$ c #002D94", "<$ c #2B59CA", "[$ c #2A59CA", "}$ c #2E57C8", "|$ c #3255C6", "1$ c #3355C5", "2$ c #1C52C8", "3$ c #1D50C7", "4$ c #234FC6", "5$ c #264CC5", "6$ c #1D48C7", "7$ c #1245C8", "8$ c #1F44C2", "9$ c #2945BE", "0$ c #2A45BD", "a$ c #2040BF", "b$ c #3156C7", "c$ c #3056C7", "d$ c #3354C5", "e$ c #3355C6", "f$ c #3255C5", "g$ c #3254C5", "h$ c #1952C7", "i$ c #1951C8", "j$ c #2050C7", "k$ c #274CC4", "l$ c #244CC6", "m$ c #1F49C7", "n$ c #1E47C5", "o$ c #2045C3", "p$ c #1C44BF", "q$ c #2045BE", "r$ c #2040B8", "s$ c #3254C6", "t$ c #3055C6", "u$ c #2A54C6", "v$ c #2353C7", "w$ c #3054C5", "x$ c #2F55C5", "y$ c #2A54C5", "z$ c #2553C5", "A$ c #2F54C5", "B$ c #3155C6", "C$ c #2A54C7", "D$ c #1A52C8", "E$ c #204FC2", "F$ c #264DC6", "G$ c #234BC5", "H$ c #1D48C1", "I$ c #1E48BF", "J$ c #2646BE", "K$ c #2B45BD", "L$ c #1E43BE", "M$ c #2643BF", "N$ c #2243BF", "O$ c #3049BC", "P$ c #1E50BE", "Q$ c #1D50C0", "R$ c #1D50BF", "S$ c #1852C1", "T$ c #1E51C0", "U$ c #214FBF", "V$ c #2050C0", "W$ c #244EBF", "X$ c #2151C0", "Y$ c #234FBF", "Z$ c #2350C0", "`$ c #2351C0", " % c #244FBF", ".% c #2250C0", "+% c #2051C0", "@% c #1E50C0", "#% c #244DBE", "$% c #274DBF", "%% c #244CBF", "&% c #1C48C0", "*% c #2247BF", "=% c #2C44BD", "-% c #1C44BE", ";% c #1444BF", ">% c #1841BF", ",% c #1F40BF", "'% c #254DBE", ")% c #224FBE", "!% c #224FBF", "~% c #234EBF", "{% c #254CBD", "]% c #244DBD", "^% c #244CBD", "/% c #264DBE", "(% c #264DBD", "_% c #214BC0", ":% c #1D48C0", "<% c #2347BF", "[% c #2B44BD", "}% c #2444BE", "|% c #0F42BF", "1% c #0641BF", "2% c #0F41BF", "3% c #1741BE", "4% c #1F40BD", "5% c #234BBF", "6% c #234CBE", "7% c #214BBE", "8% c #244CBE", "9% c #214ABE", "0% c #214ABF", "a% c #1F48C0", "b% c #2746BE", "c% c #1F43BE", "d% c #0941BE", "e% c #0342BA", "f% c #0242BC", "g% c #1241B8", "h% c #1F40B7", "i% c #2F41AC", "j% c #2644AE", "k% c #2D49B4", "l% c #2649B6", "m% c #2949B7", "n% c #2849B5", "o% c #2149B8", "p% c #1E49B9", "q% c #1F48B8", "r% c #1F49B9", "s% c #2545B6", "t% c #2744B7", "u% c #2844B7", "v% c #2043B8", "w% c #1241B7", "x% c #1340B8", "y% c #0D41B8", "z% c #1941B8", "A% c #1F40B8", "B% c #203FB8", "C% c #2549B5", "D% c #2648B6", "E% c #2547B7", "F% c #2248B7", "G% c #2048B7", "H% c #2346B6", "I% c #2146B6", "J% c #2247B7", "K% c #2148B7", "L% c #2743B4", "M% c #2643B5", "N% c #2542B6", "O% c #1D42B7", "P% c #0E42B8", "Q% c #0C41B8", "R% c #1341B8", "S% c #1740B8", "T% c #1C41B8", "U% c #1F40B1", "V% c #2644B5", "W% c #2544B5", "X% c #2544B4", "Y% c #2444B5", "Z% c #2444B4", "`% c #2744B4", " & c #2241B7", ".& c #1D41B8", "+& c #0B42B8", "@& c #0942B8", "#& c #0C42B8", "$& c #0F41B8", "%& c #1641B8", "&& c #2442B5", "*& c #2543B3", "=& c #2342B2", "-& c #2341B4", ";& c #2141B3", ">& c #2141B5", ",& c #2140B5", "'& c #2040B5", ")& c #1C40B7", "!& c #1B41B3", "~& c #0142B6", "{& c #0E41B7", "]& c #1141B7", "^& c #1440B2", "/& c #113FB0", "(& c #1440B0", "_& c #213EAF", ":& c #233DAE", "<& c #223EAF", "[& c #1E40B1", "}& c #173EAD", "|& c #1440AF", "1& c #0D40AF", "2& c #0941B0", "3& c #0D3FAE", "4& c #1B3CAC", "5& c #233CAD", "6& c #203FB0", "7& c #273BAD", "8& c #1D40B0", "9& c #2040B1", "0& c #1E40B0", "a& c #1C40B0", "b& c #1B3DAC", "c& c #143DAC", "d& c #193DAD", "e& c #1B3DAD", "f& c #173DAD", "g& c #153DAC", "h& c #1C3CAC", "i& c #243CAD", "j& c #213FB0", "k& c #263BAA", "l& c #253CAE", "m& c #273AAC", "n& c #273AAD", "o& c #253BAD", "p& c #1D3CAC", "q& c #243BAD", "r& c #1E3CAC", "s& c #263BAD", "t& c #1A3DAC", "u& c #143DAB", "v& c #163DAC", "w& c #1A3CAC", "x& c #1F3CAD", "y& c #263BAB", "z& c #263BA6", "A& c #1E42A4", "B& c #2D40A5", "C& c #253BA6", "D& c #253CA7", "E& c #263AA5", "F& c #253BA7", "G& c #1E3BA6", "H& c #193DA6", "I& c #173DA5", "J& c #143DA6", "K& c #1A3DA7", "L& c #133DA6", "M& c #123DA5", "N& c #1A3CA7", "O& c #243BA6", "P& c #263AA7", "Q& c #273BA7", "R& c #263AA6", "S& c #223BA6", "T& c #1D3BA6", "U& c #173CA6", "V& c #133DA5", "W& c #1B3DA6", "X& c #193DA5", "Y& c #123DA4", "Z& c #163CA5", "`& c #213CA6", " * c #273BA8", ".* c #263BA7", "+* c #253BA5", "@* c #263BA5", "#* c #1C3BA6", "$* c #1B3BA9", "%* c #133BA8", "&* c #0A3BA7", "** c #083AA6", "=* c #123CA5", "-* c #0839A8", ";* c #0239A6", ">* c #123AA8", ",* c #1F49C8", "'* c #2F4DA4", ")* c #2E4DA3", "!* c #384CA4", "~* c #3C4DA7", "{* c #394EA7", "]* c #3B4CA5", "^* c #3C52B1", "/* c #3551A8", "(* c #3759BE", "_* c #4161C7", ":* c #0033A8", "<* c #596FA9", "[* c #2F4DA3", "}* c #2D4BA5", "|* c #2E4CA4", "1* c #2C4AA5", "2* c #2D4BA4", "3* c #354DA4", "4* c #3A4BA4", "5* c #394DA6", "6* c #4056AD", "7* c #445BBB", "8* c #B5B7B4", "9* c #1B2F85", "0* c #242F79", "a* c #B5B5B5", "b* c #B5B2B6", "c* c #C0C3C3", "d* c #E3E3E4", "e* c #EBEDEA", ". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ", "2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ", "j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ", "Z ` . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ", "9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ", "-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ", " +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ", "/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ", "8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ", "q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.", "J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @[email protected]+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ", "#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @[email protected]++@[email protected].+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", "#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@[email protected]+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ", "6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@[email protected]+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", "s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ", "M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.", "@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ", ":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.", "h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ", "l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.", "C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ", "S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.", "+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ", "<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.", "b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ", "e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.", "P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ", "'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.", "5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ", "k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", "C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ", "/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", "&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ", "U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.", "U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ", "k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.", "C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ", "z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.", "z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ", "'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ", "'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ", "9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ", "a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ", "c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ", "d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ", "e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "}; static char * tabmiddle_xpm[] = { "33 42 32 1", " c None", ". c #CECFEF", "+ c #CECBE7", "@ c #C6C7E7", "# c #C6CBE7", "$ c #BDBEDE", "% c #BDC3DE", "& c #CECBEF", "* c #B5B6D6", "= c #ADAECE", "- c #ADB2CE", "; c #BDBAD6", "> c #B5BAD6", ", c #C6C3DE", "' c #ADAAC6", ") c #B5B2CE", "! c #B5B6CE", "~ c #A5A2BD", "{ c #A5A6BD", "] c #9C9EB5", "^ c #9CA2BD", "/ c #ADAEC6", "( c #C6C3E7", "_ c #9C9AB5", ": c #A5A6C6", "< c #949AAD", "[ c #A5AAC6", "} c #9496AD", "| c #BDBADE", "1 c #BDBED6", "2 c #9CA2B5", "3 c #A5AABD", "..........................+@.#.#.", "........................$@%&#.#..", "......................**$$@@&#.#.", ".....................=-;>,%+@.#..", "....................'')!$$@@&#.#.", "...................~{=)$$@@&#.#..", "..................]^'/;;(%&#.#...", "................._]:/*>,%&@.#.#..", ".................<{[)!$%+@.#.#...", "................}~{=!$%@@.#......", "................]^/-|$@@.#.......", "................]'/*;@@&#........", "...............<~[)>,%&#.#.......", "...............]~=)$%+#.#........", "...............]'/;1@@.#.........", "...............~{)*,%&#..........", "...............2/-$$@#...........", "...............~[*>(@&#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>@@.#..........", "...............^=!$%&#...........", "...............{/*;@@.#..........", "...............{)!$%&#...........", "..............]'/;1@@.#..........", "..............23)>,%&#...........", "..............~=-$$@@.#..........", ".............]{/*;@@.#...........", "............<^[)>,%&#............", "............]{/!$%@@.#...........", "..........]^[-!$%@@.#............", ".........]^3/!>$@@.#.............", ".......<]^3/!>$@@&#..............", ".....<]2{[/!>$%@&#.#.............", "}<<_]2{3/-!>$%@&#.#.............."}; static char * tabselectedbeginn_xpm[] = { "33 39 28 1", " c None", ". c #CECFEF", "+ c #EFF3EF", "@ c #FFFBFF", "# c #F7FBF7", "$ c #FFFFFF", "% c #EFEFEF", "& c #F7F7F7", "* c #DEDFDE", "= c #E7E7E7", "- c #D6D3D6", "; c #DEE3DE", "> c #EFEBEF", ", c #F7F3F7", "' c #CECBCE", ") c #CECFCE", "! c #D6D7D6", "~ c #DEDBDE", "{ c #E7EBE7", "] c #C6C7C6", "^ c #E7E3E7", "/ c #BDC3BD", "( c #CED3CE", "_ c #BDBABD", ": c #C6C3C6", "< c #C6CBC6", "[ c #D6DBD6", "} c #BDBEBD", "..........................+@#$#$$", "........................%%&&@#$#$", "......................*==%%&&@#$$", "....................--*;>%,&@#$#$", "...................')!~={,+@#$#$$", "...................]-!^=%%&&@#$#$", "................../'(~;>%&&@#$#$$", "................._])!*={,&@#$#$$$", "................_])~*>%&&$#$$$$$$", "................:<![={&&@#$$$$$$$", "................:)!^=,+@#$$$$$$$$", "...............}'(*^%+@#$#$$$$$$$", "...............:<!*>%&&$#$$$$$$$$", ".............../)!^{,&@#$$$$$$$$$", "...............](*^%+@#$$$$$$$$$$", "...............]!~=%&&$$$$$$$$$$$", "...............'(*=,+@#$$$$$$$$$$", "...............<!*>%&&$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'!^=,&@#$$$$$$$$$$", "...............<~*>%&#$$$$$$$$$$$", "...............)!^{,&@#$$$$$$$$$$", "..............])~;%+@#$$$$$$$$$$$", "..............]-[={&&$#$$$$$$$$$$", ".............])!^=,&@#$$$$$$$$$$$", "............:'-*^%+@#$$$$$$$$$$$$", "............])~*>%&&$#$$$$$$$$$$$", "...........:'!*={,&@#$$$$$$$$$$$$", "..........:'-~^=,+@#$$$$$$$$$$$$$", ".......}]'-~^=%,&@#$$$$$$$$$$$$$$", ".....}:])-~^=%,+@#$#$$$$$$$$$$$$$", "}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"}; static char * tabselectedend_xpm[] = { "33 42 33 1", " c None", ". c #FFFFFF", "+ c #CECBE7", "@ c #C6C7E7", "# c #CECFEF", "$ c #C6CBE7", "% c #BDBEDE", "& c #BDC3DE", "* c #CECBEF", "= c #B5B6D6", "- c #ADAECE", "; c #ADB2CE", "> c #BDBAD6", ", c #B5BAD6", "' c #C6C3DE", ") c #ADAAC6", "! c #B5B2CE", "~ c #B5B6CE", "{ c #A5A2BD", "] c #A5A6BD", "^ c #9C9EB5", "/ c #9CA2BD", "( c #ADAEC6", "_ c #C6C3E7", ": c #9C9AB5", "< c #A5A6C6", "[ c #949AAD", "} c #A5AAC6", "| c #9496AD", "1 c #BDBADE", "2 c #BDBED6", "3 c #9CA2B5", "4 c #A5AABD", "..........................+@#$#$#", "........................%@&*$#$##", "......................==%%@@*$#$#", ".....................-;>,'&+@#$##", "....................))!~%%@@*$#$#", "...................{]-!%%@@*$#$##", "..................^/)(>>_&*$#$###", ".................:^<(=,'&*@#$#$##", ".................[]}!~%&+@#$#$###", "................|{]-~%&@@#$######", "................^/(;1%@@#$#######", "................^)(=>@@*$########", "...............[{}!,'&*$#$#######", "...............^{-!%&+$#$########", "...............^)(>2@@#$#########", "...............{]!='&*$##########", "...............3(;%%@$###########", "...............{}=,_@*$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,@@#$##########", ".............../-~%&*$###########", "...............](=>@@#$##########", "...............]!~%&*$###########", "..............^)(>2@@#$##########", "..............34!,'&*$###########", "..............{-;%%@@#$##########", ".............^](=>@@#$###########", "............[/}!,'&*$############", "............^](~%&@@#$###########", "..........^/};~%&@@#$############", ".........^/4(~,%@@#$#############", ".......[^/4(~,%@@*$##############", ".....[^3]}(~,%&@*$#$#############", "|[[:^3]4(;~,%&@*$#$##############"}; static char * tabend_xpm[] = { "33 42 3 1", " c None", ". c #CECFEF", "+ c #FFFFFF", "..........................+++++++", "........................+++++++++", "......................+++++++++++", ".....................++++++++++++", "....................+++++++++++++", "...................++++++++++++++", "..................+++++++++++++++", ".................++++++++++++++++", ".................++++++++++++++++", "................+++++++++++++++++", "................+++++++++++++++++", "................+++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "..............+++++++++++++++++++", "..............+++++++++++++++++++", "..............+++++++++++++++++++", ".............++++++++++++++++++++", "............+++++++++++++++++++++", "............+++++++++++++++++++++", "..........+++++++++++++++++++++++", ".........++++++++++++++++++++++++", ".......++++++++++++++++++++++++++", ".....++++++++++++++++++++++++++++", "+++++++++++++++++++++++++++++++++"}; QColor fromHsl(QColor c) { const qreal h = c.hueF(); const qreal s = c.saturationF(); const qreal l = c.valueF(); qreal ca[3] = {0, 0, 0}; if (s == 0 || h == 1) { // achromatic case ca[0] = ca[1] = ca[2] = l; } else { // chromatic case qreal temp2; if (l < qreal(0.5)) temp2 = l * (qreal(1.0) + s); else temp2 = l + s - (l * s); const qreal temp1 = (qreal(2.0) * l) - temp2; qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), h, h - (qreal(1.0) / qreal(3.0)) }; for (int i = 0; i != 3; ++i) { if (temp3[i] < qreal(0.0)) temp3[i] += qreal(1.0); else if (temp3[i] > qreal(1.0)) temp3[i] -= qreal(1.0); const qreal sixtemp3 = temp3[i] * qreal(6.0); if (sixtemp3 < qreal(1.0)) ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3)); else if ((temp3[i] * qreal(2.0)) < qreal(1.0)) ca[i] = (temp2); else if ((temp3[i] * qreal(3.0)) < qreal(2.0)) ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0); else ca[i] = temp1; } } return QColor::fromRgbF(ca[0], ca[1], ca[2]); } #define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) #define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) QColor toHsl(QColor c) { QColor color; qreal h; qreal s; qreal l; const qreal r = c.redF(); const qreal g = c.greenF(); const qreal b = c.blueF(); const qreal max = Q_MAX_3(r, g, b); const qreal min = Q_MIN_3(r, g, b); const qreal delta = max - min; const qreal delta2 = max + min; const qreal lightness = qreal(0.5) * delta2; l = (lightness); if (qFuzzyIsNull(delta)) { // achromatic case, hue is undefined h = 0; s = 0; } else { // chromatic case qreal hue = 0; if (lightness < qreal(0.5)) s = ((delta / delta2)); else s = ((delta / (qreal(2.0) - delta2))); if (qFuzzyCompare(r, max)) { hue = ((g - b) /delta); } else if (qFuzzyCompare(g, max)) { hue = (2.0 + (b - r) / delta); } else if (qFuzzyCompare(b, max)) { hue = (4.0 + (r - g) / delta); } else { Q_ASSERT_X(false, "QColor::toHsv", "internal error"); } hue *= 60.0; if (hue < 0.0) hue += 360.0; h = (hue * 100); } h = h / 36000; return QColor::fromHsvF(h, s, l); } void tintColor(QColor &color, QColor tintColor, qreal _saturation) { tintColor = toHsl(tintColor); color = toHsl(color); qreal hue = tintColor.hueF(); qreal saturation = color.saturationF(); if (_saturation) saturation = _saturation; qreal lightness = color.valueF(); color.setHsvF(hue, saturation, lightness); color = fromHsl(color); color.toRgb(); } void tintImagePal(QImage *image, QColor color, qreal saturation) { QVector<QRgb> colorTable = image->colorTable(); for (int i=2;i< colorTable.size();i++) { QColor c(toHsl(colorTable.at(i))); tintColor(c, color, saturation); colorTable[i] = c.rgb(); } image->setColorTable(colorTable); } void tintImage(QImage *image, QColor color, qreal saturation) { *image = image->convertToFormat(QImage::Format_RGB32); for (int x = 0; x < image->width(); x++) for (int y = 0; y < image->height(); y++) { QColor c(image->pixel(x,y)); tintColor(c, color, saturation); image->setPixel(x, y, c.rgb()); } } #endif //Q_WS_WINCE_WM enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight }; #ifdef Q_WS_WINCE_WM void QWindowsMobileStylePrivate::tintImagesButton(QColor color) { if (currentTintButton == color) return; currentTintButton = color; imageTabEnd = QImage(tabend_xpm); imageTabSelectedEnd = QImage(tabselectedend_xpm); imageTabSelectedBegin = QImage(tabselectedbeginn_xpm); imageTabMiddle = QImage(tabmiddle_xpm); tintImage(&imageTabEnd, color, 0.0); tintImage(&imageTabSelectedEnd, color, 0.0); tintImage(&imageTabSelectedBegin, color, 0.0); tintImage(&imageTabMiddle, color, 0.0); if (!doubleControls) { int height = imageTabMiddle.height() / 2 + 1; imageTabEnd = imageTabEnd.scaledToHeight(height); imageTabMiddle = imageTabMiddle.scaledToHeight(height); imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height); imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height); } } void QWindowsMobileStylePrivate::tintImagesHigh(QColor color) { if (currentTintHigh == color) return; currentTintHigh = color; tintListViewHighlight(color); imageScrollbarHandleUpHigh = imageScrollbarHandleUp; imageScrollbarHandleDownHigh = imageScrollbarHandleDown; tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8)); tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8)); } void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color) { imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm); tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0)); imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm); tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0)); imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm); tintImage(&imageListViewHighlightMiddle, color, qreal(0.0)); int height = imageListViewHighlightMiddle.height(); if (!doubleControls) { height = height / 2; imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height); imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height); imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height); } } #endif //Q_WS_WINCE_WM void QWindowsMobileStylePrivate::setupWindowsMobileStyle65() { #ifdef Q_WS_WINCE_WM wm65 = qt_wince_is_windows_mobile_65(); if (wm65) { imageScrollbarHandleUp = QImage(sbhandleup_xpm); imageScrollbarHandleDown = QImage(sbhandledown_xpm); imageScrollbarGripUp = QImage(sbgripup_xpm); imageScrollbarGripDown = QImage(sbgripdown_xpm); imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm); if (!doubleControls) { imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2); imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2); imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2); imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2); imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2); } else { } tintImagesHigh(Qt::blue); } #endif //Q_WS_WINCE_WM } void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab) { #ifndef QT_NO_TABBAR #ifdef Q_WS_WINCE_WM if (wm65) { tintImagesButton(tab->palette.button().color()); QRect r; r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0)); r.setBottomRight(tab->rect.bottomRight()); if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.window()); } else { painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0))); } if (tab->selectedPosition == QStyleOptionTab::NextIsSelected) { painter->drawImage(r, imageTabSelectedBegin); } else if (tab->position == QStyleOptionTab::End || tab->position == QStyleOptionTab::OnlyOneTab) { if (!(tab->state & QStyle::State_Selected)) { painter->drawImage(r, imageTabEnd); } } else if (tab->state & QStyle::State_Selected) { painter->drawImage(r, imageTabSelectedEnd); } else { painter->drawImage(r, imageTabMiddle); } if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) { painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd); } //imageTabBarBig return; } #endif //Q_WS_WINCE_WM painter->save(); painter->setPen(tab->palette.shadow().color()); if (doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } if(tab->shape == QTabBar::RoundedNorth) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.light()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } } else if(tab->shape == QTabBar::RoundedSouth) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); if (doubleControls) painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1)); else painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } } else if(tab->shape == QTabBar::RoundedEast) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.light()); painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft()); painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); } } else if(tab->shape == QTabBar::RoundedWest) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.light()); painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); } } painter->restore(); #endif //QT_NO_TABBAR } void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect) { #ifdef Q_WS_WINCE_WM if (wm65) { QRect r; if (rect.isValid()) r = rect; else r = option->rect; tintImagesHigh(option->palette.highlight().color()); painter->setPen(QColor(Qt::lightGray)); if (option->viewItemPosition == QStyleOptionViewItemV4::Middle) { painter->drawImage(r, imageListViewHighlightMiddle); } else if (option->viewItemPosition == QStyleOptionViewItemV4::Beginning) { painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle); } else if (option->viewItemPosition == QStyleOptionViewItemV4::End) { painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle); } else { painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle); } QImage cornerLeft = imageListViewHighlightCornerLeft; QImage cornerRight = imageListViewHighlightCornerRight; int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width(); if ((width * 2) > r.width()) { width = (r.width() - 5) / 2; } cornerLeft = cornerLeft.scaled(width, r.height()); cornerRight = cornerRight.scaled(width, r.height()); if ((option->viewItemPosition == QStyleOptionViewItemV4::Beginning) || (option->viewItemPosition == QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) { painter->drawImage(r.topLeft(), cornerLeft); } if ((option->viewItemPosition == QStyleOptionViewItemV4::End) || (option->viewItemPosition == QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) { painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight); } return; } #endif //Q_WS_WINCE_WM QPalette::ColorGroup cg = option->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (rect.isValid()) painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight)); else painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight)); } void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame) { #ifdef Q_WS_WINCE_WM if (wm65) { if (newScrollbar->orientation == Qt::Horizontal) { QTransform transform; transform.rotate(-90); QRect r = newScrollbar->rect; p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform)); p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform)); p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform)); } else { QRect r = newScrollbar->rect; p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle); p->drawImage(r.topLeft(), imageScrollbarGripUp); p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown); } return ; } #endif if (newScrollbar->orientation == Qt::Horizontal) { p->fillRect(newScrollbar->rect,option->palette.button()); QRect r = newScrollbar->rect; p->drawLine(r.topLeft(), r.bottomLeft()); p->drawLine(r.topRight(), r.bottomRight()); if (smartphone) { p->drawLine(r.topLeft(), r.topRight()); p->drawLine(r.bottomLeft(), r.bottomRight()); } } else { p->fillRect(newScrollbar->rect,option->palette.button()); QRect r = newScrollbar->rect; p->drawLine(r.topLeft(), r.topRight()); p->drawLine(r.bottomLeft(), r.bottomRight()); if (smartphone) { p->drawLine(r.topLeft(), r.bottomLeft()); p->drawLine(r.topRight(), r.bottomRight()); } } if (newScrollbar->state & QStyle::State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*newScrollbar); fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2, newScrollbar->rect.width() - 5, newScrollbar->rect.height() - 5); } int gripMargin = doubleControls ? 4 : 2; int doubleLines = doubleControls ? 2 : 1; //If there is a frame around the scrollbar (abstractScrollArea), //then the margin is different, because of the missing frame int gripMarginFrame = doubleControls ? 3 : 1; if (drawCompleteFrame) gripMarginFrame = 0; //draw grips if (!smartphone) if (newScrollbar->orientation == Qt::Horizontal) { for (int i = -3; i < 3; i += 2) { p->drawLine( QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, newScrollbar->rect.top() + gripMargin +gripMarginFrame), QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, newScrollbar->rect.bottom() - gripMargin)); } } else { for (int i = -2; i < 4 ; i += 2) { p->drawLine( QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame , newScrollbar->rect.center().y() + 1 + i * doubleLines - 1), QPoint(newScrollbar->rect.right() - gripMargin, newScrollbar->rect.center().y() + 1 + i * doubleLines - 1)); } } if (!smartphone) { QRect r; if (doubleControls) r = option->rect.adjusted(1, 1, -1, 0); else r = option->rect.adjusted(0, 0, -1, 0); if (drawCompleteFrame && doubleControls) r.adjust(0, 0, 0, -1); //Check if the scrollbar is part of an abstractItemView and draw the frame according if (drawCompleteFrame) p->drawRect(r); else if (newScrollbar->orientation == Qt::Horizontal) p->drawLine(r.topLeft(), r.topRight()); else p->drawLine(r.topLeft(), r.bottomLeft()); } } void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool ) { #ifdef Q_WS_WINCE_WM if (wm65) { tintImagesHigh(opt->palette.highlight().color()); QRect r = opt->rect; if (opt->orientation == Qt::Horizontal) { QTransform transform; transform.rotate(-90); if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform)); else p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform)); } else { if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh); else p->drawImage(r.topLeft(), imageScrollbarHandleUp); } return ; } #endif //Q_WS_WINCE_WM QBrush fill = opt->palette.button(); if (opt->state & QStyle::State_Sunken) fill = opt->palette.shadow(); QStyleOption arrowOpt = *opt; if (doubleControls) arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3); else arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); bool horizontal = (opt->orientation == Qt::Horizontal); if (horizontal) { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0,0,1,0); p->drawLine(r.topRight(), r.bottomRight()); if (doubleControls) arrowOpt.rect.adjust(0, -2 ,0, -2); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0); } else { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0, 0, 0, 1); p->drawLine(r.bottomLeft(), r.bottomRight()); if (completeFrame) arrowOpt.rect.adjust(-2, 0, -2, 0); if (doubleControls) arrowOpt.rect.adjust(0, -4 , 0, -4); if (completeFrame && doubleControls) arrowOpt.rect.adjust(2, 0, 2, 0); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0); } } void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar) { #ifndef QT_NO_SCROLLBAR #ifdef Q_WS_WINCE_WM if (wm65) { tintImagesHigh(opt->palette.highlight().color()); QRect r = opt->rect; if (opt->orientation == Qt::Horizontal) { QTransform transform; transform.rotate(-90); if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform)); else p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform)); } else { if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh); else p->drawImage(r.topLeft(), imageScrollbarHandleDown); } return ; } #endif //Q_WS_WINCE_WM QBrush fill = opt->palette.button(); if (opt->state & QStyle::State_Sunken) fill = opt->palette.shadow(); QStyleOption arrowOpt = *opt; if (doubleControls) arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3); else arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); bool horizontal = (opt->orientation == Qt::Horizontal); if (horizontal) { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0, 0, 0, 0); p->drawLine(r.topLeft(), r.bottomLeft()); if (secondScrollBar) p->drawLine(r.topRight(), r.bottomRight()); if (doubleControls) arrowOpt.rect.adjust(0, 4, 0, 4 ); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0); } else { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0, -1, 0, -1); p->drawLine(r.topLeft(), r.topRight()); if (secondScrollBar) p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1)); if (completeFrame) arrowOpt.rect.adjust(-2, 0, -2, 0); if (doubleControls) arrowOpt.rect.adjust(1, 0, 1, 0 ); if (completeFrame && doubleControls) arrowOpt.rect.adjust(1, 0, 1, 0); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0); } #endif //QT_NO_SCROLLBAR } void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt) { #ifndef QT_NO_SCROLLBAR #ifdef Q_OS_WINCE_WM if (wm65) { p->fillRect(opt->rect, QColor(231, 231, 231)); return ; } #endif QBrush fill; if (smartphone) { fill = opt->palette.light(); p->fillRect(opt->rect, fill); fill = opt->palette.button(); QImage image; #ifndef QT_NO_IMAGEFORMAT_XPM if (opt->orientation == Qt::Horizontal) image = QImage(vertlines_xpm); else image = QImage(horlines_xpm); #endif image.setColor(1, opt->palette.button().color().rgb()); fill.setTextureImage(image); } else { fill = opt->palette.light(); } p->fillRect(opt->rect, fill); #endif //QT_NO_SCROLLBAR } QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) { qApp->setEffectEnabled(Qt::UI_FadeMenu, false); qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); } QWindowsMobileStyle::QWindowsMobileStyle() : QWindowsStyle(*new QWindowsMobileStylePrivate) { qApp->setEffectEnabled(Qt::UI_FadeMenu, false); qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); } QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() { #ifdef Q_WS_WINCE doubleControls = qt_wince_is_high_dpi(); smartphone = qt_wince_is_smartphone(); #else doubleControls = false; smartphone = false; #endif //Q_WS_WINCE #ifndef QT_NO_IMAGEFORMAT_XPM imageArrowDown = QImage(arrowdown_xpm); imageArrowUp = QImage(arrowdown_xpm).mirrored(); imageArrowLeft = QImage(arrowleft_xpm); imageArrowRight = QImage(arrowleft_xpm).mirrored(true, false); if (doubleControls) { imageRadioButton = QImage(radiobutton_xpm); imageRadioButtonChecked = QImage(radiochecked_xpm); imageChecked = QImage(checkedlight_xpm); imageCheckedBold = QImage(checkedbold_xpm); imageRadioButtonHighlighted = QImage(highlightedradiobutton_xpm); imageClose = QImage(cross_big_xpm); imageMaximize = QImage(max_big_xpm); imageMinimize = QImage(min_big_xpm); imageNormalize = QImage(normal_big_xpm); } else { imageRadioButton = QImage(radiobutton_low_xpm); imageRadioButtonChecked = QImage(radiochecked_low_xpm); imageChecked = QImage(checkedlight_low_xpm); imageCheckedBold = QImage(checkedbold_low_xpm); imageRadioButtonHighlighted = QImage(highlightedradiobutton_low_xpm); imageClose = QImage(cross_small_xpm); imageMaximize = QImage(max_small_xpm); imageMinimize = QImage(min_small_xpm); imageNormalize = QImage(normal_small_xpm); } setupWindowsMobileStyle65(); imageArrowDownBig = QImage(arrowdown_big_xpm); imageArrowUpBig = QImage(arrowdown_big_xpm).mirrored(); imageArrowLeftBig = QImage(arrowleft_big_xpm); imageArrowRightBig = QImage(arrowleft_big_xpm).mirrored(true, false); #endif } void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); bool doRestore = false; QRect rect = option->rect; painter->setClipping(false); switch (element) { case PE_PanelButtonTool: { int penSize = 1; if (d->doubleControls) penSize = 2; if (widget) if (QWidget *parent = widget->parentWidget()) #ifndef QT_NO_TABWIDGET if (qobject_cast<QTabWidget *>(parent->parentWidget())) { #else if (false) { #endif //QT_NO_TABBAR rect.adjust(0,2*penSize,0,-1*penSize); qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); if (option->state & (State_Sunken)) qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.shadow()); } else { if (!(option->state & State_AutoRaise) || (option->state & (State_Sunken | State_On))) qDrawPlainRect(painter,option->rect.adjusted(0, penSize, 0, -1 * penSize) , option->palette.button().color(), 0, &option->palette.button()); if (option->state & (State_Sunken)) { qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); } if (option->state & (State_On)){ QBrush fill = QBrush(option->palette.light().color()); painter->fillRect(rect.adjusted(windowsItemFrame , windowsItemFrame , -windowsItemFrame , -windowsItemFrame ), fill); qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); } } break; } case PE_IndicatorButtonDropDown: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.button()); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.button()); break; #ifndef QT_NO_TABBAR case PE_IndicatorTabTear: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { bool rtl = tab->direction == Qt::RightToLeft; QRect rect = tab->rect; QPainterPath path; rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); int count = 3; for(int jags = 1; jags <= count; ++jags, rtl = !rtl) path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); painter->setPen(QPen(tab->palette.light(), qreal(.8))); painter->setBrush(tab->palette.background()); painter->setRenderHint(QPainter::Antialiasing); painter->drawPath(path); } break; #endif //QT_NO_TABBAR #ifndef QT_NO_TOOLBAR case PE_IndicatorToolBarSeparator: { painter->save(); QPoint p1, p2; if (option->state & State_Horizontal) { p1 = QPoint(option->rect.width()/2, 0); p2 = QPoint(p1.x(), option->rect.height()); } else { p1 = QPoint(0, option->rect.height()/2); p2 = QPoint(option->rect.width(), p1.y()); } painter->setPen(option->palette.mid().color()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } painter->drawLine(p1, p2); painter->restore(); break; } #endif // QT_NO_TOOLBAR case PE_IndicatorToolBarHandle: painter->save(); painter->translate(option->rect.x(), option->rect.y()); if (option->state & State_Horizontal) { int x = option->rect.width() / 2 - 4; if (QApplication::layoutDirection() == Qt::RightToLeft) x -= 2; if (option->rect.height() > 4) { qDrawWinButton(painter,x-1,0,7,option->rect.height(), option->palette, false, 0); qDrawShadePanel(painter, x, 1, 3, option->rect.height() - 1, option->palette, false, 0); qDrawShadePanel(painter, x + 3, 1, 3, option->rect.height() - 1, option->palette, false, 0); painter->setPen(option->palette.button().color()); } } else { if (option->rect.width() > 4) { int y = option->rect.height() / 2 - 4; qDrawShadePanel(painter, 2, y, option->rect.width() - 2, 3, option->palette, false, 0); qDrawShadePanel(painter, 2, y + 3, option->rect.width() - 2, 3, option->palette, false, 0); } } painter->restore(); break; #ifndef QT_NO_PROGRESSBAR case PE_IndicatorProgressChunk: { bool vertical = false; if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) vertical = (pb2->orientation == Qt::Vertical); if (!vertical) { painter->fillRect(option->rect.x(), option->rect.y()+2, option->rect.width(), option->rect.height()-4, option->palette.brush(QPalette::Highlight)); } else { painter->fillRect(option->rect.x()+2, option->rect.y(), option->rect.width()-4, option->rect.height(), option->palette.brush(QPalette::Highlight)); } } break; #endif // QT_NO_PROGRESSBAR case PE_FrameButtonTool: { #ifndef QT_NO_DOCKWIDGET if (widget && widget->inherits("QDockWidgetTitleButton")) { if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent())) if (dw->isFloating()){ qDrawPlainRect(painter,option->rect.adjusted(1, 1, 0, 0), option->palette.shadow().color(),1,&option->palette.button()); return; } } #endif // QT_NO_DOCKWIDGET QBrush fill; bool stippled; bool panel = (element == PE_PanelButtonTool); if ((!(option->state & State_Sunken )) && (!(option->state & State_Enabled) || ((option->state & State_Enabled ) && !(option->state & State_MouseOver))) && (option->state & State_On)) { fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); stippled = true; } else { fill = option->palette.brush(QPalette::Button); stippled = false; } if (option->state & (State_Raised | State_Sunken | State_On)) { if (option->state & State_AutoRaise) { if(option->state & (State_Enabled | State_Sunken | State_On)){ if (panel) qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); else qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); } if (stippled) { painter->setPen(option->palette.button().color()); painter->drawRect(option->rect.adjusted(1, 1, -2, -2)); } } else { qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); } } else { painter->fillRect(option->rect, fill); } break; } case PE_FrameFocusRect: if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) { //### check for d->alt_down int penSize; d->doubleControls ? penSize = 2 : penSize = 1; bool alternateFocusStyle = false; if (!widget) alternateFocusStyle = true; #ifndef QT_NO_COMBOBOX if (qobject_cast<const QComboBox*>(widget)) alternateFocusStyle = true; #endif if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, option)) return; QRect r = option->rect; painter->save(); painter->setBackgroundMode(Qt::TransparentMode); if (alternateFocusStyle) { QColor bg_col = fropt->backgroundColor; if (!bg_col.isValid()) bg_col = painter->background().color(); // Create an "XOR" color. QColor patternCol((bg_col.red() ^ 0xff) & 0xff, (bg_col.green() ^ 0xff) & 0xff, (bg_col.blue() ^ 0xff) & 0xff); painter->setBrush(QBrush(patternCol, Qt::Dense4Pattern)); painter->setBrushOrigin(r.topLeft()); } else { painter->setPen(option->palette.highlight().color()); painter->setBrush(option->palette.highlight()); } painter->setPen(Qt::NoPen); painter->setBrushOrigin(r.topLeft()); painter->drawRect(r.left(), r.top(), r.width(), penSize); // Top painter->drawRect(r.left(), r.bottom(), r.width() + penSize - 1, penSize); // Bottom painter->drawRect(r.left(), r.top(), penSize, r.height()); // Left painter->drawRect(r.right(), r.top(), penSize, r.height()); // Right painter->restore(); } break; case PE_PanelButtonBevel: { QBrush fill; bool panel = element != PE_FrameButtonBevel; painter->setBrushOrigin(option->rect.topLeft()); if (!(option->state & State_Sunken) && (option->state & State_On)) fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); else fill = option->palette.brush(QPalette::Button); if (option->state & (State_Raised | State_On | State_Sunken)) { if (d->doubleControls) qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),2,&fill); else qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),1,&fill); } else { if (panel) painter->fillRect(option->rect, fill); else painter->drawRect(option->rect); } break; } case PE_FrameGroupBox: if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { const QStyleOptionFrameV2 *frame2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(option); if (frame2 && !(frame2->features & QStyleOptionFrameV2::Flat)) { QPen oldPen = painter->pen(); QRect r = frame->rect; painter->setPen(frame->palette.shadow().color()); painter->fillRect(r.x(), r.y(), r.x() + r.width()-1, r.y() + r.height() - windowsMobileFrameGroupBoxOffset, frame->palette.light()); painter ->drawLine(r.topLeft() + QPoint(-2, 1), r.topRight()+ QPoint(0, 1)); if (d->doubleControls) painter ->drawLine(r.topLeft() + QPoint(-2, 2), r.topRight()+ QPoint(0, 2)); painter->setPen(oldPen); } } break; case PE_IndicatorCheckBox: { QBrush fill; QRect r = d->doubleControls ? option->rect.adjusted(0,1,0,-1) : option->rect; if (option->state & State_NoChange) fill = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern); else if (option->state & State_Sunken) fill = option->palette.button(); else if (option->state & State_Enabled) fill = option->palette.base(); else fill = option->palette.background(); painter->save(); doRestore = true; if (d->doubleControls && (option->state & State_NoChange)) painter->fillRect(r, fill); else painter->fillRect(option->rect, fill); painter->setPen(option->palette.shadow().color()); painter->drawLine(r.topLeft(), r.topRight()); painter->drawLine(r.topRight(), r.bottomRight()); painter->drawLine(r.bottomLeft(), r.bottomRight()); painter->drawLine(r.bottomLeft(), r.topLeft()); if (d->doubleControls) { QRect r0 = r.adjusted(1, 1, -1, -1); painter->drawLine(r0.topLeft(), r0.topRight()); painter->drawLine(r0.topRight(), r0.bottomRight()); painter->drawLine(r0.bottomLeft(), r0.bottomRight()); painter->drawLine(r0.bottomLeft(), r0.topLeft()); } if (option->state & State_HasFocus) { painter->setPen(option->palette.highlight().color()); QRect r2 = d->doubleControls ? r.adjusted(2, 2, -2, -2) : r.adjusted(1, 1, -1, -1); painter->drawLine(r2.topLeft(), r2.topRight()); painter->drawLine(r2.topRight(), r2.bottomRight()); painter->drawLine(r2.bottomLeft(), r2.bottomRight()); painter->drawLine(r2.bottomLeft(), r2.topLeft()); if (d->doubleControls) { QRect r3 = r2.adjusted(1, 1, -1, -1); painter->drawLine(r3.topLeft(), r3.topRight()); painter->drawLine(r3.topRight(), r3.bottomRight()); painter->drawLine(r3.bottomLeft(), r3.bottomRight()); painter->drawLine(r3.bottomLeft(), r3.topLeft()); } painter->setPen(option->palette.shadow().color()); } //fall through... } case PE_IndicatorViewItemCheck: case PE_Q3CheckListIndicator: { if (!doRestore) { painter->save(); doRestore = true; } if (element == PE_Q3CheckListIndicator || element == PE_IndicatorViewItemCheck) { painter->setPen(option->palette.shadow().color()); if (option->state & State_NoChange) painter->setBrush(option->palette.brush(QPalette::Button)); if (d->doubleControls) { QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize * 2, windowsMobileitemViewCheckBoxSize * 2); qDrawPlainRect(painter, r, option->palette.shadow().color(), 2); } else { QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize); qDrawPlainRect(painter, r, option->palette.shadow().color(), 1); } if (option->state & State_Enabled) d->imageChecked.setColor(1, option->palette.shadow().color().rgba()); else d->imageChecked.setColor(1, option->palette.dark().color().rgba()); if (!(option->state & State_Off)) { if (d->doubleControls) painter->drawImage(option->rect.x(), option->rect.y(), d->imageChecked); else painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageChecked); } } else { if (option->state & State_NoChange) d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); else if (option->state & State_Enabled) d->imageCheckedBold.setColor(1, option->palette.shadow().color().rgba()); else d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); if (!(option->state & State_Off)) { if (d->doubleControls) painter->drawImage(option->rect.x() + 2, option->rect.y(), d->imageCheckedBold); else painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageCheckedBold); } } if (doRestore) painter->restore(); break; } case PE_IndicatorRadioButton: { painter->save(); if (option->state & State_HasFocus) { d->imageRadioButtonHighlighted.setColor(1, option->palette.shadow().color().rgba()); d->imageRadioButtonHighlighted.setColor(2, option->palette.highlight().color().rgba()); painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButtonHighlighted); } else { d->imageRadioButton.setColor(1, option->palette.shadow().color().rgba()); painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButton); } if (option->state & (State_Sunken | State_On)) { if (option->state & State_Enabled) d->imageRadioButtonChecked.setColor(1, option->palette.shadow().color().rgba()); else d->imageRadioButtonChecked.setColor(1, option->palette.dark().color().rgba()); static const int offset = d->doubleControls ? 6 : 3; painter->drawImage(option->rect.x() + offset, option->rect.y() + offset, d->imageRadioButtonChecked); } painter->restore(); break; } case PE_PanelButtonCommand: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { QBrush fill; State flags = option->state; QPalette pal = option->palette; QRect r = option->rect; if ((flags & State_Sunken || flags & State_On) ) fill = pal.brush(QPalette::Shadow); else fill = pal.brush(QPalette::Button); int singleLine = 1; int doubleLine = 2; if (d->doubleControls) { singleLine = 2; doubleLine = 4; } if (button->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) { if (d->doubleControls) { qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); qDrawPlainRect(painter, r.adjusted(1, 1, -1, 1), pal.shadow().color(), 1, &fill); } else { qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); } } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) { qDrawPlainRect(painter, r, pal.shadow().color(), singleLine, &fill); } else { painter->fillRect(r, fill); } } break; case PE_FrameDefaultButton: { painter->save(); painter->setPen(option->palette.shadow().color()); QRect rect = option->rect; if (d->doubleControls) { rect.adjust(1, 1, -2, -2); painter->drawRect(rect); painter->drawRect(rect.adjusted(1, 1, -1, -1)); } else { rect.adjust(2, 2, -3, -3); painter->drawRect(rect); } painter->restore(); break; } case PE_IndicatorSpinPlus: case PE_IndicatorSpinMinus: { QRect r = option->rect; int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2; QRect br = r.adjusted(fw, fw, -fw, -fw); int offset = (option->state & State_Sunken) ? 1 : 0; int step = (br.width() + 4) / 5; painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, br.width(), step, option->palette.buttonText()); if (element == PE_IndicatorSpinPlus) painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4, step, br.height() - 7, option->palette.buttonText()); break; } case PE_IndicatorSpinUp: case PE_IndicatorSpinDown: { painter->save(); QPoint points[7]; switch (element) { case PE_IndicatorSpinUp: points[0] = QPoint(-2, -4); points[1] = QPoint(-2, 2); points[2] = QPoint(-1, -3); points[3] = QPoint(-1, 1); points[4] = QPoint(0, -2); points[5] = QPoint(0, 0); points[6] = QPoint(1, -1); break; case PE_IndicatorSpinDown: points[0] = QPoint(0, -4); points[1] = QPoint(0, 2); points[2] = QPoint(-1, -3); points[3] = QPoint(-1, 1); points[4] = QPoint(-2, -2); points[5] = QPoint(-2, 0); points[6] = QPoint(-3, -1); break; default: break; } if (option->state & State_Sunken) painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal), proxy()->pixelMetric(PM_ButtonShiftVertical)); if (option->state & State_Enabled) { painter->translate(option->rect.x() + option->rect.width() / 2, option->rect.y() + option->rect.height() / 2); painter->setPen(option->palette.buttonText().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } else { painter->translate(option->rect.x() + option->rect.width() / 2 + 1, option->rect.y() + option->rect.height() / 2 + 1); painter->setPen(option->palette.light().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); painter->translate(-1, -1); painter->setPen(option->palette.mid().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } painter->restore(); break; } case PE_IndicatorArrowUpBig: case PE_IndicatorArrowDownBig: case PE_IndicatorArrowLeftBig: case PE_IndicatorArrowRightBig: case PE_IndicatorArrowUp: case PE_IndicatorArrowDown: case PE_IndicatorArrowRight: case PE_IndicatorArrowLeft: { painter->save(); if (d->doubleControls) { QColor color; if (option->state & State_Sunken) color = option->palette.light().color(); else color = option->palette.buttonText().color(); QImage image; int xoffset, yoffset; bool isTabBarArrow = widget && widget->parent() && widget->inherits("QToolButton") && widget->parent()->inherits("QTabBar"); switch (element) { case PE_IndicatorArrowUp: image = d->imageArrowUp; xoffset = 1; yoffset = 12; break; case PE_IndicatorArrowDown: image = d->imageArrowDown; xoffset = 1; yoffset =12; break; case PE_IndicatorArrowLeft: image = d->imageArrowLeft; xoffset = 8; yoffset = isTabBarArrow ? 12 : 2; break; case PE_IndicatorArrowRight: image = d->imageArrowRight; xoffset = 8; yoffset = isTabBarArrow ? 12 : 2; break; case PE_IndicatorArrowUpBig: image = d->imageArrowUpBig; xoffset = 3; yoffset = 12; break; case PE_IndicatorArrowDownBig: image = d->imageArrowDownBig; xoffset = 2; yoffset =12; break; case PE_IndicatorArrowLeftBig: image = d->imageArrowLeftBig; xoffset = 8; yoffset = 2; break; case PE_IndicatorArrowRightBig: image = d->imageArrowRightBig; xoffset = 8; yoffset = 2; break; default: break; } image.setColor(1, color.rgba()); painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image); } else { QPoint points[7]; switch (element) { case PE_IndicatorArrowUp: case PE_IndicatorArrowUpBig: points[0] = QPoint(-3, 1); points[1] = QPoint(3, 1); points[2] = QPoint(-2, 0); points[3] = QPoint(2, 0); points[4] = QPoint(-1, -1); points[5] = QPoint(1, -1); points[6] = QPoint(0, -2); break; case PE_IndicatorArrowDown: case PE_IndicatorArrowDownBig: points[0] = QPoint(-3, -1); points[1] = QPoint(3, -1); points[2] = QPoint(-2, 0); points[3] = QPoint(2, 0); points[4] = QPoint(-1, 1); points[5] = QPoint(1, 1); points[6] = QPoint(0, 2); break; case PE_IndicatorArrowRight: case PE_IndicatorArrowRightBig: points[0] = QPoint(-2, -3); points[1] = QPoint(-2, 3); points[2] = QPoint(-1, -2); points[3] = QPoint(-1, 2); points[4] = QPoint(0, -1); points[5] = QPoint(0, 1); points[6] = QPoint(1, 0); break; case PE_IndicatorArrowLeft: case PE_IndicatorArrowLeftBig: points[0] = QPoint(0, -3); points[1] = QPoint(0, 3); points[2] = QPoint(-1, -2); points[3] = QPoint(-1, 2); points[4] = QPoint(-2, -1); points[5] = QPoint(-2, 1); points[6] = QPoint(-3, 0); break; default: break; } if (option->state & State_Sunken) painter->setPen(option->palette.light().color()); else painter->setPen(option->palette.buttonText().color()); if (option->state & State_Enabled) { painter->translate(option->rect.x() + option->rect.width() / 2, option->rect.y() + option->rect.height() / 2 - 1); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } else { painter->translate(option->rect.x() + option->rect.width() / 2, option->rect.y() + option->rect.height() / 2 - 1); painter->setPen(option->palette.mid().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } } painter->restore(); break; } #ifndef QT_NO_TABWIDGET case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) { QRect rect = option->rect; QPalette pal = option->palette; painter->save(); QBrush fill = pal.light(); painter->fillRect(rect, fill); painter->setPen(pal.shadow().color()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } switch (tab->shape) { case QTabBar::RoundedNorth: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif { if (d->doubleControls) painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1)); else painter->drawLine(rect.topLeft(), rect.topRight()); } break; case QTabBar::RoundedSouth: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif { if (d->doubleControls) painter->drawLine(rect.bottomLeft(), rect.bottomRight()); else painter->drawLine(rect.bottomLeft(), rect.bottomRight()); } break; case QTabBar::RoundedEast: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif painter->drawLine(rect.topRight(), rect.bottomRight()); break; case QTabBar::RoundedWest: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif painter->drawLine(rect.topLeft(), rect.bottomLeft()); break; case QTabBar::TriangularWest: case QTabBar::TriangularEast: case QTabBar::TriangularSouth: case QTabBar::TriangularNorth: if (d->doubleControls) qDrawPlainRect(painter, rect.adjusted(0,-2,0,0), option->palette.shadow().color(),2,&pal.light()); else qDrawPlainRect(painter, rect, option->palette.shadow().color(),1,&pal.light()); break; default: break; } painter->restore(); } break; #endif //QT_NO_TABBAR #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewRow: if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) cg = QPalette::Inactive; if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget)) d->drawPanelItemViewSelected(painter, vopt); else if (vopt->features & QStyleOptionViewItemV2::Alternate) painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); else if (!(vopt->state & QStyle::State_Enabled)) painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base)); } break; case PE_PanelItemViewItem: if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) cg = QPalette::Inactive; if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) { d->drawPanelItemViewSelected(painter, vopt); } else { if (vopt->backgroundBrush.style() != Qt::NoBrush) { QPointF oldBO = painter->brushOrigin(); painter->setBrushOrigin(vopt->rect.topLeft()); painter->fillRect(vopt->rect, vopt->backgroundBrush); painter->setBrushOrigin(oldBO); } if (vopt->state & QStyle::State_Selected) { QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText, option, widget); d->drawPanelItemViewSelected(painter, vopt, textRect); } } } break; #endif //QT_NO_ITEMVIEWS case PE_FrameWindow: { QPalette popupPal = option->palette; popupPal.setColor(QPalette::Light, option->palette.background().color()); popupPal.setColor(QPalette::Midlight, option->palette.light().color()); if (d->doubleControls) qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),2,0); else qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),1,0); break; } case PE_FrameTabBarBase: { break; } case PE_Widget: break; case PE_IndicatorMenuCheckMark: { int markW = option->rect.width() > 7 ? 7 : option->rect.width(); int markH = markW; if (d->doubleControls) markW*=2; markH*=2; int posX = option->rect.x() + (option->rect.width() - markW)/2 + 1; int posY = option->rect.y() + (option->rect.height() - markH)/2; QVector<QLineF> a; a.reserve(markH); int i, xx, yy; xx = posX; yy = 3 + posY; for (i = 0; i < markW/2; ++i) { a << QLineF(xx, yy, xx, yy + 2); ++xx; ++yy; } yy -= 2; for (; i < markH; ++i) { a << QLineF(xx, yy, xx, yy + 2); ++xx; --yy; } if (!(option->state & State_Enabled) && !(option->state & State_On)) { int pnt; painter->setPen(option->palette.highlightedText().color()); QPoint offset(1, 1); for (pnt = 0; pnt < a.size(); ++pnt) a[pnt].translate(offset.x(), offset.y()); painter->drawLines(a); for (pnt = 0; pnt < a.size(); ++pnt) a[pnt].translate(offset.x(), offset.y()); } painter->setPen(option->palette.text().color()); painter->drawLines(a); break; } case PE_IndicatorBranch: { // Copied from the Windows style. static const int decoration_size = d->doubleControls ? 18 : 9; static const int ofsA = d->doubleControls ? 4 : 2; static const int ofsB = d->doubleControls ? 8 : 4; static const int ofsC = d->doubleControls ? 12 : 6; static const int ofsD = d->doubleControls ? 1 : 0; int mid_h = option->rect.x() + option->rect.width() / 2; int mid_v = option->rect.y() + option->rect.height() / 2; int bef_h = mid_h; int bef_v = mid_v; int aft_h = mid_h; int aft_v = mid_v; if (option->state & State_Children) { int delta = decoration_size / 2; bef_h -= delta; bef_v -= delta; aft_h += delta; aft_v += delta; QPen oldPen = painter->pen(); QPen crossPen = oldPen; crossPen.setWidth(2); painter->setPen(crossPen); painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD); if (!(option->state & State_Open)) painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD); painter->setPen(option->palette.dark().color()); painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1); if (d->doubleControls) painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3); painter->setPen(oldPen); } QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern); if (option->state & State_Item) { if (option->direction == Qt::RightToLeft) painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush); else painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush); } if (option->state & State_Sibling) painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush); if (option->state & (State_Open | State_Children | State_Item | State_Sibling)) painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush); break; } case PE_Frame: qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), d->doubleControls ? 2 : 1, &option->palette.background()); break; case PE_FrameLineEdit: case PE_FrameMenu: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1); break; case PE_FrameStatusBar: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,0); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,0); break; default: QWindowsStyle::drawPrimitive(element, option, painter, widget); break; } } void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); painter->setClipping(false); switch (element) { case CE_MenuBarEmptyArea: painter->setClipping(true); QWindowsStyle::drawControl(element, option, painter, widget); break; case CE_PushButtonBevel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { QRect br = button->rect; int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); if (button->features & QStyleOptionButton::AutoDefaultButton) br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); QStyleOptionButton tmpBtn = *button; tmpBtn.rect = br; proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget); if (button->features & QStyleOptionButton::HasMenu) { int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); QRect ir = button->rect; QStyleOptionButton newButton = *button; if (d->doubleControls) newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4); else newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4); proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget); } if (button->features & QStyleOptionButton::DefaultButton) proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget); } break; case CE_RadioButton: case CE_CheckBox: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { bool isRadio = (element == CE_RadioButton); QStyleOptionButton subopt = *button; subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, button, widget); proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, &subopt, painter, widget); subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents : SE_CheckBoxContents, button, widget); proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); if (button->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*button); fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect : SE_CheckBoxFocusRect, button, widget); proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } break; case CE_RadioButtonLabel: case CE_CheckBoxLabel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { uint alignment = visualAlignment(button->direction, Qt::AlignLeft | Qt::AlignVCenter); if (!styleHint(SH_UnderlineShortcut, button, widget)) alignment |= Qt::TextHideMnemonic; QPixmap pix; QRect textRect = button->rect; if (!button->icon.isNull()) { pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); proxy()->drawItemPixmap(painter, button->rect, alignment, pix); if (button->direction == Qt::RightToLeft) textRect.setRight(textRect.right() - button->iconSize.width() - 4); else textRect.setLeft(textRect.left() + button->iconSize.width() + 4); } if (!button->text.isEmpty()){ if (button->state & State_Enabled) proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, button->palette, false, button->text, QPalette::WindowText); else proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, button->palette, false, button->text, QPalette::Mid); } } break; #ifndef QT_NO_PROGRESSBAR case CE_ProgressBarGroove: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.brush(QPalette::Window)); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.brush(QPalette::Window)); break; #endif //QT_NO_PROGRESSBAR #ifndef QT_NO_TABBAR case CE_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget); proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget); } break; case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) { d->drawTabBarTab(painter, tab); } else { QCommonStyle::drawControl(element, option, painter, widget); } break; } #endif // QT_NO_TABBAR #ifndef QT_NO_TOOLBAR case CE_ToolBar: if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { QRect rect = option->rect; painter->save(); painter->setPen(option->palette.dark().color()); painter->fillRect(rect,option->palette.button()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(4); painter->setPen(pen); } if (toolBar->toolBarArea == Qt::TopToolBarArea) painter->drawLine(rect.bottomLeft(), rect.bottomRight()); else painter->drawLine(rect.topLeft(), rect.topRight()); painter->restore(); break; } #endif //QT_NO_TOOLBAR case CE_Header: if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { QRegion clipRegion = painter->clipRegion(); painter->setClipRect(option->rect); proxy()->drawControl(CE_HeaderSection, header, painter, widget); QStyleOptionHeader subopt = *header; subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget); if (header->state & State_Sunken) subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color()); subopt.state |= QStyle::State_On; if (subopt.rect.isValid()) proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget); if (header->sortIndicator != QStyleOptionHeader::None) { subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget); proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); } painter->setClipRegion(clipRegion); } break; case CE_HeaderSection: if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { QBrush fill; QColor color; QRect rect = option->rect; painter->setPen(option->palette.shadow().color()); int penSize = 1; if (d->doubleControls) { penSize = 2; QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } //fix Frame if (header->position == QStyleOptionHeader::End || (header->position == QStyleOptionHeader::OnlyOneSection && !header->text.isEmpty())) if (Qt::Horizontal == header->orientation ) rect.adjust(0, 0, penSize, 0); else rect.adjust(0, 0, 0, penSize); if (option->state & State_Sunken) { fill = option->palette.brush(QPalette::Shadow); color = option->palette.light().color(); painter->drawLine(rect.bottomLeft(), rect.bottomRight()); painter->drawLine(rect.topRight(), rect.bottomRight()); rect.adjust(0, 0, -penSize, -penSize); } else { fill = option->palette.brush(QPalette::Button); color = option->palette.shadow().color(); if (Qt::Horizontal == header->orientation ) rect.adjust(-penSize, 0, 0, 0); else rect.adjust(0, -penSize, 0, 0); } if (Qt::Horizontal == header->orientation ) rect.adjust(0,-penSize,0,0); else rect.adjust(-penSize, 0, 0, 0); if (option->state & State_Sunken) { qDrawPlainRect(painter, rect, color, penSize, &fill); } else { //Corner rect.adjust(-penSize, 0, 0, 0); qDrawPlainRect(painter, rect, color, penSize, &fill); } //Hack to get rid of some double lines... StyleOptions need a clean flag for that rect = option->rect; #ifndef QT_NO_SCROLLAREA if (const QAbstractScrollArea *abstractScrollArea = qobject_cast<const QAbstractScrollArea *> (widget) ) { QRect rectScrollArea = abstractScrollArea->geometry(); if (Qt::Horizontal == header->orientation ) if ((rectScrollArea.right() - rect.right() ) > 1) painter->drawLine(rect.topRight(), rect.bottomRight()); else ; else if ((rectScrollArea.bottom() - rect.bottom() ) > 1) painter->drawLine(rect.bottomLeft(), rect.bottomRight()); } #endif // QT_NO_SCROLLAREA break; } #ifndef QT_NO_COMBOBOX case CE_ComboBoxLabel: // This is copied from qcommonstyle.cpp with the difference, that // the editRect isn't adjusted when calling drawItemText. if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); painter->save(); painter->setClipRect(editRect); if (!cb->currentIcon.isNull()) { QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); QRect iconRect(editRect); iconRect.setWidth(cb->iconSize.width() + 4); iconRect = alignedRect(cb->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); if (cb->editable) painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); if (cb->direction == Qt::RightToLeft) editRect.translate(-4 - cb->iconSize.width(), 0); else editRect.translate(cb->iconSize.width() + 4, 0); } if (!cb->currentText.isEmpty() && !cb->editable) { proxy()->drawItemText(painter, editRect, visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), cb->palette, cb->state & State_Enabled, cb->currentText); } painter->restore(); } break; #endif // QT_NO_COMBOBOX #ifndef QT_NO_DOCKWIDGET case CE_DockWidgetTitle: if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { const QStyleOptionDockWidgetV2 *v2 = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(option); bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar; QRect rect = dwOpt->rect; QRect r = rect; if (verticalTitleBar) { QSize s = r.size(); s.transpose(); r.setSize(s); painter->save(); painter->translate(r.left(), r.top() + r.width()); painter->rotate(-90); painter->translate(-r.left(), -r.top()); } bool floating = false; bool active = dwOpt->state & State_Active; int menuOffset = 0; //used to center text when floated QColor inactiveCaptionTextColor = option->palette.highlightedText().color(); if (dwOpt->movable) { QColor left, right; //Titlebar gradient if (widget && widget->isWindow()) { floating = true; if (active) { right = option->palette.highlight().color(); left = right.lighter(125); } else { left = option->palette.highlight().color().lighter(125); right = QColor(0xff, 0xff, 0xff); } menuOffset = 2; QBrush fillBrush(left); if (left != right) { QPoint p1(r.x(), r.top() + r.height()/2); QPoint p2(rect.right(), r.top() + r.height()/2); QLinearGradient lg(p1, p2); lg.setColorAt(0, left); lg.setColorAt(1, right); fillBrush = lg; } painter->fillRect(r.adjusted(0, 0, 0, -3), fillBrush); } else { painter->fillRect(r.adjusted(0, 0, 0, -3), option->palette.button().color()); } painter->setPen(dwOpt->palette.color(QPalette::Light)); if (!widget || !widget->isWindow()) { painter->drawLine(r.topLeft(), r.topRight()); painter->setPen(dwOpt->palette.color(QPalette::Dark)); painter->drawLine(r.bottomLeft(), r.bottomRight()); } } if (!dwOpt->title.isEmpty()) { QFont oldFont = painter->font(); QFont newFont = oldFont; if (newFont.pointSize() > 2) newFont.setPointSize(newFont.pointSize() - 2); if (floating) newFont.setBold(true); painter->setFont(newFont); QPalette palette = dwOpt->palette; palette.setColor(QPalette::Window, inactiveCaptionTextColor); QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget); if (verticalTitleBar) { titleRect = QRect(r.left() + rect.bottom() - titleRect.bottom(), r.top() + titleRect.left() - rect.left(), titleRect.height(), titleRect.width()); } proxy()->drawItemText(painter, titleRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette, dwOpt->state & State_Enabled, dwOpt->title, floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText); painter->setFont(oldFont); } if (verticalTitleBar) painter->restore(); } return; #endif // QT_NO_DOCKWIDGET case CE_PushButtonLabel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { painter->save(); QRect ir = button->rect; QPalette::ColorRole colorRole; uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; if (!styleHint(SH_UnderlineShortcut, button, widget)) tf |= Qt::TextHideMnemonic; if (button->state & (State_On | State_Sunken)) colorRole = QPalette::Light; else colorRole = QPalette::ButtonText; if (!button->icon.isNull()) { QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; if (mode == QIcon::Normal && button->state & State_HasFocus) mode = QIcon::Active; QIcon::State state = QIcon::Off; if (button->state & State_On) state = QIcon::On; QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); int pixw = pixmap.width(); int pixh = pixmap.height(); //Center the icon if there is no text QPoint point; if (button->text.isEmpty()) { point = QPoint(ir.x() + ir.width() / 2 - pixw / 2, ir.y() + ir.height() / 2 - pixh / 2); } else { point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2); } if (button->direction == Qt::RightToLeft) point.rx() += pixw; if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft) point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2; painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); if (button->direction == Qt::RightToLeft) ir.translate(-4, 0); else ir.translate(pixw + 4, 0); ir.setWidth(ir.width() - (pixw + 4)); // left-align text if there is if (!button->text.isEmpty()) tf |= Qt::AlignLeft; } else { tf |= Qt::AlignHCenter; } if (button->state & State_Enabled) proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole); else proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid); painter->restore(); } break; default: QWindowsStyle::drawControl(element, option, painter, widget); break; } } void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { painter->setClipping(false); QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); switch (control) { #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); int ticks = slider->tickPosition; QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget); if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { int mid = thickness / 2; if (ticks & QSlider::TicksAbove) mid += len / 8; if (ticks & QSlider::TicksBelow) mid -= len / 8; painter->setPen(slider->palette.shadow().color()); if (slider->orientation == Qt::Horizontal) { qDrawPlainRect(painter, groove.x(), groove.y() + mid - 2, groove.width(), 4, option->palette.shadow().color(),1,0); } else { qDrawPlainRect(painter, groove.x()+mid-2, groove.y(), 4, groove.height(), option->palette.shadow().color(),1,0); } } if (slider->subControls & SC_SliderTickmarks) { QStyleOptionSlider tmpSlider = *slider; tmpSlider.subControls = SC_SliderTickmarks; QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget); } if (slider->subControls & SC_SliderHandle) { const QColor c0 = slider->palette.shadow().color(); const QColor c1 = slider->palette.dark().color(); const QColor c3 = slider->palette.midlight().color(); const QColor c4 = slider->palette.dark().color(); QBrush handleBrush; if (slider->state & State_Enabled) { handleBrush = slider->palette.color(QPalette::Light); } else { handleBrush = QBrush(slider->palette.color(QPalette::Shadow), Qt::Dense4Pattern); } int x = handle.x(), y = handle.y(), wi = handle.width(), he = handle.height(); int x1 = x; int x2 = x+wi-1; int y1 = y; int y2 = y+he-1; Qt::Orientation orient = slider->orientation; bool tickAbove = slider->tickPosition == QSlider::TicksAbove; bool tickBelow = slider->tickPosition == QSlider::TicksBelow; if (slider->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*slider); fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget); proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { Qt::BGMode oldMode = painter->backgroundMode(); painter->setBackgroundMode(Qt::OpaqueMode); qDrawPlainRect(painter, QRect(x, y, wi, he) ,slider->palette.shadow().color(),1,&handleBrush); painter->setBackgroundMode(oldMode); QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); if (slider->state & State_Sunken) painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill); return; } QSliderDirection dir; if (orient == Qt::Horizontal) if (tickAbove) dir = SliderUp; else dir = SliderDown; else if (tickAbove) dir = SliderLeft; else dir = SliderRight; QPolygon polygon; int d = 0; switch (dir) { case SliderUp: x2++; y1 = y1 + wi / 2; d = (wi + 1) / 2 - 1; polygon.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d,y1 - d); break; case SliderDown: x2++; y2 = y2 - wi/2; d = (wi + 1) / 2 - 1; polygon.setPoints(5, x1, y1, x1, y2, x1 + d,y2 + d, x2, y2, x2, y1); break; case SliderLeft: d = (he + 1) / 2 - 1; x1 = x1 + he/2; polygon.setPoints(5, x1, y1, x1 - d, y1 + d, x1,y2, x2, y2, x2, y1); y1--; break; case SliderRight: d = (he + 1) / 2 - 1; x2 = x2 - he/2; polygon.setPoints(5, x1, y1, x1, y2, x2,y2, x2 + d, y1 + d, x2, y1); y1--; break; } QBrush oldBrush = painter->brush(); painter->setPen(Qt::NoPen); painter->setBrush(handleBrush); Qt::BGMode oldMode = painter->backgroundMode(); painter->setBackgroundMode(Qt::OpaqueMode); painter->drawRect(x1, y1, x2-x1+1, y2-y1+1); painter->drawPolygon(polygon); QBrush fill = QBrush(option->palette.button().color(), Qt::Dense4Pattern); painter->setBrush(oldBrush); painter->setBackgroundMode(oldMode); if (slider->state & State_Sunken) painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill); if (dir != SliderUp) { painter->setPen(c0); painter->drawLine(x1, y1, x2, y1); } if (dir != SliderLeft) { painter->setPen(c0); painter->drawLine(x1, y1, x1, y2); } if (dir != SliderRight) { painter->setPen(c0); painter->drawLine(x2, y1, x2, y2); } if (dir != SliderDown) { painter->setPen(c0); painter->drawLine(x1, y2, x2, y2); } switch (dir) { case SliderUp: if (slider->state & State_Sunken) painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4, y1),fill); painter->setPen(c0); painter->drawLine(x1, y1, x1 + d, y1 - d); d = wi - d - 1; painter->drawLine(x2, y1, x2 -d , y1 -d ); d--; break; case SliderDown: if (slider->state & State_Sunken) painter->fillRect(QRectF(x1+3, y2 - d, x2 - x1 -4,y2 - 8),fill); painter->setPen(c0); painter->drawLine(x1, y2, x1 + d, y2 + d); d = wi - d - 1; painter->drawLine(x2, y2, x2 - d, y2 + d); d--; break; case SliderLeft: if (slider->state & State_Sunken) painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1, y2 - y1 - 3),fill); painter->setPen(c0); painter->drawLine(x1, y1, x1 - d, y1 + d); d = he - d - 1; painter->drawLine(x1, y2, x1 - d, y2 - d); d--; break; case SliderRight: if (slider->state & State_Sunken) painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3),fill); painter->setPen(c0); painter->drawLine(x2, y1, x2 + d, y1 + d); painter->setPen(c0); d = he - d - 1; painter->drawLine(x2, y2, x2 + d, y2 - d); d--; break; } } } break; #endif //QT_NO_SLIDER #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: painter->save(); painter->setPen(option->palette.shadow().color()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::SquareCap); painter->setPen(pen); } if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { d->drawScrollbarGroove(painter, scrollbar); // Make a copy here and reset it for each primitive. QStyleOptionSlider newScrollbar = *scrollbar; State saveFlags = scrollbar->state; //Check if the scrollbar is part of an abstractItemView and draw the frame according bool drawCompleteFrame = true; bool secondScrollBar = false; if (widget) if (QWidget *parent = widget->parentWidget()) { if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) { drawCompleteFrame = (abstractScrollArea->frameStyle() == QFrame::NoFrame) || (abstractScrollArea->frameStyle() == QFrame::StyledPanel); secondScrollBar = (abstractScrollArea->horizontalScrollBar()->isVisible() && abstractScrollArea->verticalScrollBar()->isVisible()) ; } #ifndef QT_NO_LISTVIEW if (QListView *listView = qobject_cast<QListView *>(parent->parentWidget())) drawCompleteFrame = false; #endif } if (scrollbar->minimum == scrollbar->maximum) saveFlags |= State_Enabled; if (scrollbar->subControls & SC_ScrollBarSubLine) { newScrollbar.state = saveFlags; newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); } } if (scrollbar->subControls & SC_ScrollBarAddLine) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); } } if (scrollbar->subControls & SC_ScrollBarSlider) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSlider)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame); } } } painter->restore(); break; #endif // QT_NO_SCROLLBAR case CC_ToolButton: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { QRect button, menuarea; bool isTabWidget = false; #ifndef QT_NO_TABWIDGET if (widget) if (QWidget *parent = widget->parentWidget()) isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget())); #endif //QT_NO_TABWIDGET button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget); menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); State buttonFlags = toolbutton->state; if (buttonFlags & State_AutoRaise) { if (!(buttonFlags & State_MouseOver)) { buttonFlags &= ~State_Raised; } } State menuFlags = buttonFlags; if (toolbutton->activeSubControls & SC_ToolButton) buttonFlags |= State_Sunken; if (toolbutton->activeSubControls & SC_ToolButtonMenu) menuFlags |= State_On; QStyleOption tool(0); tool.palette = toolbutton->palette; if (toolbutton->subControls & SC_ToolButton) { tool.rect = button; tool.state = buttonFlags; proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = buttonFlags & State_Enabled; QStyleOption toolMenu(0); toolMenu = *toolbutton; toolMenu.state = menuFlags; if (buttonFlags & State_Sunken) proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget); QStyleOption arrowOpt(0); arrowOpt.rect = tool.rect; arrowOpt.palette = tool.palette; State flags = State_None; if (menuFlags & State_Enabled) flags |= State_Enabled; if ((menuFlags & State_On) && !(buttonFlags & State_Sunken)) { flags |= State_Sunken; painter->fillRect(menuarea, option->palette.shadow()); } arrowOpt.state = flags; proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); } if (toolbutton->state & State_HasFocus) { QStyleOptionFocusRect focusRect; focusRect.QStyleOption::operator=(*toolbutton); focusRect.rect.adjust(3, 3, -3, -3); if (toolbutton->features & QStyleOptionToolButton::Menu) focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget); } QStyleOptionToolButton label = *toolbutton; if (isTabWidget) label.state = toolbutton->state; else label.state = toolbutton->state & State_Enabled; int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); label.rect = button.adjusted(fw, fw, -fw, -fw); proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget); } break; #ifndef QT_NO_GROUPBOX case CC_GroupBox: if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { // Draw frame painter->save(); QFont font = painter->font(); font.setBold(true); painter->setFont(font); QStyleOptionGroupBox groupBoxFont = *groupBox; groupBoxFont.fontMetrics = QFontMetrics(font); QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget); QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0); if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { QStyleOptionFrameV2 frame; frame.QStyleOption::operator=(*groupBox); frame.features = groupBox->features; frame.lineWidth = groupBox->lineWidth; frame.midLineWidth = groupBox->midLineWidth; frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); painter->save(); QRegion region(groupBox->rect); if (!groupBox->text.isEmpty()) { bool ltr = groupBox->direction == Qt::LeftToRight; QRect finalRect = checkBoxRect.united(textRect); if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); region -= finalRect; } proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); painter->restore(); } // Draw checkbox if (groupBox->subControls & SC_GroupBoxCheckBox) { QStyleOptionButton box; box.QStyleOption::operator=(*groupBox); box.rect = checkBoxRect; proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); } // Draw title if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { QColor textColor = groupBox->textColor; if (textColor.isValid()) painter->setPen(textColor); else painter->setPen(groupBox->palette.link().color()); painter->setPen(groupBox->palette.link().color()); int alignment = int(groupBox->textAlignment); if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) alignment |= Qt::TextHideMnemonic; if (groupBox->state & State_Enabled) proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, groupBox->palette, true, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::Link); else proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, groupBox->palette, true, groupBox->text, QPalette::Mid); if (groupBox->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*groupBox); fropt.rect = textRect; proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } painter->restore(); } break; #endif //QT_NO_GROUPBOX #ifndef QT_NO_COMBOBOX case CC_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { QBrush editBrush = cmb->palette.brush(QPalette::Base); if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush); else painter->fillRect(option->rect, editBrush); State flags = State_None; QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); if ((option->state & State_On)) { painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow)); } if (d->doubleControls) ar.adjust(5, 0, 5, 0); else ar.adjust(2, 0, -2, 0); if (option->state & State_Enabled) flags |= State_Enabled; if (option->state & State_On) flags |= State_Sunken; QStyleOption arrowOpt(0); arrowOpt.rect = ar; arrowOpt.palette = cmb->palette; arrowOpt.state = flags; proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget); if (cmb->subControls & SC_ComboBoxEditField) { QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); if (cmb->state & State_HasFocus && !cmb->editable) painter->fillRect(re.x(), re.y(), re.width(), re.height(), cmb->palette.brush(QPalette::Highlight)); if (cmb->state & State_HasFocus) { painter->setPen(cmb->palette.highlightedText().color()); painter->setBackground(cmb->palette.highlight()); } else { painter->setPen(cmb->palette.text().color()); painter->setBackground(cmb->palette.background()); } if (cmb->state & State_HasFocus && !cmb->editable) { QStyleOptionFocusRect focus; focus.QStyleOption::operator=(*cmb); focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget); focus.state |= State_FocusAtBorder; focus.backgroundColor = cmb->palette.highlight().color(); if ((option->state & State_On)) proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); } } } break; #endif // QT_NO_COMBOBOX #ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { QStyleOptionSpinBox copy = *spinBox; //PrimitiveElement primitiveElement; int primitiveElement; if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget); qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0); } QPalette shadePal(option->palette); shadePal.setColor(QPalette::Button, option->palette.light().color()); shadePal.setColor(QPalette::Light, option->palette.base().color()); if (spinBox->subControls & SC_SpinBoxUp) { copy.subControls = SC_SpinBoxUp; QPalette pal2 = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { pal2.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; } copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; } else { copy.state |= State_Raised; copy.state &= ~State_Sunken; } primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig : PE_IndicatorArrowUpBig); copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); if (copy.state & (State_Sunken | State_On)) qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow)); else qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base)); copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0); proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget); } if (spinBox->subControls & SC_SpinBoxDown) { copy.subControls = SC_SpinBoxDown; copy.state = spinBox->state; QPalette pal2 = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { pal2.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; } copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; } else { copy.state |= State_Raised; copy.state &= ~State_Sunken; } primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig : PE_IndicatorArrowDownBig); copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base)); if (copy.state & (State_Sunken | State_On)) qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow)); else qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base)); copy.rect.adjust(3, 0, -4, 0); if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) { int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget); copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget); } else { proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget); } if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget); } } } break; #endif // QT_NO_SPINBOX default: QWindowsStyle::drawComplexControl(control, option, painter, widget); break; } } QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const { QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); switch (type) { case CT_PushButton: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { newSize = QCommonStyle::sizeFromContents(type, option, size, widget); int w = newSize.width(), h = newSize.height(); int defwidth = 0; if (button->features & QStyleOptionButton::AutoDefaultButton) defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); int minwidth = int(QStyleHelper::dpiScaled(55.0f)); int minheight = int(QStyleHelper::dpiScaled(19.0f)); if (w < minwidth + defwidth && button->icon.isNull()) w = minwidth + defwidth; if (h < minheight + defwidth) h = minheight + defwidth; newSize = QSize(w + 4, h + 4); } break; #ifndef QT_NO_GROUPBOX case CT_GroupBox: if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) { newSize = size + QSize(!grb->isFlat() ? 16 : 0, !grb->isFlat() ? 16 : 0); } break; #endif // QT_NO_GROUPBOX case CT_RadioButton: case CT_CheckBox: newSize = size; if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { bool isRadio = (type == CT_RadioButton); QRect irect = visualRect(button->direction, button->rect, proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, button, widget)); int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight : PM_IndicatorHeight, button, widget); int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10; if (d_func()->doubleControls) margins *= 2; newSize += QSize(irect.right() + margins, 1); newSize.setHeight(qMax(newSize.height(), h)); } break; #ifndef QT_NO_COMBOBOX case CT_ComboBox: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0; newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23) } break; #endif #ifndef QT_NO_SPINBOX case CT_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0; newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6); } break; #endif #ifndef QT_NO_LINEEDIT case CT_LineEdit: newSize += QSize(0,1); break; #endif case CT_ToolButton: newSize = QSize(newSize.width() + 1, newSize.height()); break; case CT_TabBarTab: if (d_func()->doubleControls) newSize = QSize(newSize.width(), 42); else newSize = QSize(newSize.width(), 21); break; case CT_HeaderSection: newSize += QSize(4, 2); break; #ifndef QT_NO_ITEMVIEWS #ifdef Q_WS_WINCE_WM case CT_ItemViewItem: if (d_func()->wm65) if (d_func()->doubleControls) newSize.setHeight(46); else newSize.setHeight(23); break; #endif //Q_WS_WINCE_WM #endif //QT_NO_ITEMVIEWS default: break; } return newSize; } QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); QRect rect = QWindowsStyle::subElementRect(element, option, widget); switch (element) { #ifndef QT_NO_TABWIDGET case SE_TabWidgetTabBar: if (d->doubleControls) rect.adjust(-2, 0, 2, 0); else rect.adjust(-2, 0, 2, 0); break; #endif //QT_NO_TABWIDGET case SE_CheckBoxFocusRect: rect.adjust(1,0,-2,-1); break; case SE_RadioButtonFocusRect: rect.adjust(1,1,-2,-2); break; default: break; #ifndef QT_NO_SLIDER case SE_SliderFocusRect: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { rect = slider->rect; } break; case SE_PushButtonFocusRect: if (d->doubleControls) rect.adjust(-1, -1, 0, 0); break; #endif // QT_NO_SLIDER #ifndef QT_NO_ITEMVIEWS case SE_ItemViewItemFocusRect: #ifdef Q_WS_WINCE_WM if (d->wm65) rect = QRect(); #endif break; #endif //QT_NO_ITEMVIEWS } return rect; } QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); switch (control) { #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); float stretchFactor = 1.4f; int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor); #ifdef Q_WS_WINCE_WM if (d->wm65) { sliderButtonExtent = d->imageScrollbarHandleUp.width(); sliderButtonExtentDir = d->imageScrollbarHandleUp.height(); } #endif //Q_WS_WINCE_WM int sliderlen; int maxlen = ((scrollbar->orientation == Qt::Horizontal) ? scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2); // calculate slider length if (scrollbar->maximum != scrollbar->minimum) { uint range = scrollbar->maximum - scrollbar->minimum; sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); if (sliderlen < slidermin || range > INT_MAX / 2) sliderlen = slidermin; if (sliderlen > maxlen) sliderlen = maxlen; } else { sliderlen = maxlen; } int sliderstart = sliderButtonExtentDir + sliderPositionFromValue(scrollbar->minimum, scrollbar->maximum, scrollbar->sliderPosition, maxlen - sliderlen, scrollbar->upsideDown); if (d->smartphone) { sliderstart -= sliderButtonExtentDir; sliderlen += 2*sliderButtonExtent; } switch (subControl) { case SC_ScrollBarSubLine: // top/left button if (scrollbar->orientation == Qt::Horizontal) { int buttonWidth = qMin(scrollbar->rect.width() / 2, sliderButtonExtentDir ); rect.setRect(0, 0, buttonWidth, sliderButtonExtent); } else { int buttonHeight = qMin(scrollbar->rect.height() / 2, sliderButtonExtentDir); rect.setRect(0, 0, sliderButtonExtent, buttonHeight); } if (d->smartphone) rect.setRect(0, 0, 0, 0); break; case SC_ScrollBarAddLine: // bottom/right button if (scrollbar->orientation == Qt::Horizontal) { int buttonWidth = qMin(scrollbar->rect.width()/2, sliderButtonExtentDir); rect.setRect(scrollbar->rect.width() - buttonWidth, 0, buttonWidth, sliderButtonExtent); } else { int buttonHeight = qMin(scrollbar->rect.height()/2, sliderButtonExtentDir ); rect.setRect(0, scrollbar->rect.height() - buttonHeight, sliderButtonExtent, buttonHeight); } if (d->smartphone) rect.setRect(0, 0, 0, 0); break; case SC_ScrollBarSubPage: // between top/left button and slider if (scrollbar->orientation == Qt::Horizontal) if (d->smartphone) rect.setRect(0, 0, sliderstart, sliderButtonExtent); else rect.setRect(sliderButtonExtent, 0, sliderstart - sliderButtonExtent, sliderButtonExtent); else if (d->smartphone) rect.setRect(0, 0, sliderButtonExtent, sliderstart); else rect.setRect(0, sliderButtonExtent, sliderButtonExtent, sliderstart - sliderButtonExtent); break; case SC_ScrollBarAddPage: // between bottom/right button and slider if (scrollbar->orientation == Qt::Horizontal) if (d->smartphone) rect.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart - sliderlen + 2*sliderButtonExtent, sliderButtonExtent); else rect.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart - sliderlen + sliderButtonExtent, sliderButtonExtent); else if (d->smartphone) rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, maxlen - sliderstart - sliderlen + 2*sliderButtonExtent); else rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, maxlen - sliderstart - sliderlen + sliderButtonExtent); break; case SC_ScrollBarGroove: if (scrollbar->orientation == Qt::Horizontal) rect.setRect(sliderButtonExtent, 0, scrollbar->rect.width() - sliderButtonExtent * 2, scrollbar->rect.height()); else rect.setRect(0, sliderButtonExtent, scrollbar->rect.width(), scrollbar->rect.height() - sliderButtonExtent * 2); break; case SC_ScrollBarSlider: if (scrollbar->orientation == Qt::Horizontal) rect.setRect(sliderstart, 0, sliderlen, sliderButtonExtent); else rect.setRect(0, sliderstart, sliderButtonExtent, sliderlen); break; default: break; } rect = visualRect(scrollbar->direction, scrollbar->rect, rect); } break; #endif // QT_NO_SCROLLBAR #ifndef QT_NO_TOOLBUTTON case CC_ToolButton: if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget); rect = toolButton->rect; switch (subControl) { case SC_ToolButton: if ((toolButton->features & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) == QStyleOptionToolButton::Menu) rect.adjust(0, 0, -mbi, 0); break; case SC_ToolButtonMenu: if ((toolButton->features & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) == QStyleOptionToolButton::Menu) rect.adjust(rect.width() - mbi, 1, 0, 1); break; default: break; } rect = visualRect(toolButton->direction, toolButton->rect, rect); } break; #endif // QT_NO_TOOLBUTTON #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); switch (subControl) { case SC_SliderHandle: { int sliderPos = 0; int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); bool horizontal = slider->orientation == Qt::Horizontal; sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, (horizontal ? slider->rect.width() : slider->rect.height()) - len, slider->upsideDown); if (horizontal) rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); else rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); break; } default: break; } rect = visualRect(slider->direction, slider->rect, rect); } break; #endif //QT_NO_SLIDER #ifndef QT_NO_COMBOBOX case CC_ComboBox: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { int x = comboBox->rect.x(), y = comboBox->rect.y(), wi = comboBox->rect.width(), he = comboBox->rect.height(); int xpos = x; int margin = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; int bmarg = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; if (subControl == SC_ComboBoxArrow) xpos += wi - int((he - 2*bmarg)*0.9) - bmarg; else xpos += wi - (he - 2*bmarg) - bmarg; switch (subControl) { case SC_ComboBoxArrow: rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg); break; case SC_ComboBoxEditField: rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin); if (d->doubleControls) { if (comboBox->editable) rect.adjust(2, 0, 0, 0); else rect.adjust(4, 2, 0, -2); } else if (!comboBox->editable) { rect.adjust(2, 1, 0, -1); } break; case SC_ComboBoxFrame: rect = comboBox->rect; break; default: break; } } #endif //QT_NO_COMBOBOX #ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { QSize bs; int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0; bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height()))); // 1.6 -approximate golden mean bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8)))); bs = bs.expandedTo(QApplication::globalStrut()); int x, lx, rx; x = spinBox->rect.width() - bs.width()*2; lx = fw; rx = x - fw; switch (subControl) { case SC_SpinBoxUp: rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height()); break; case SC_SpinBoxDown: rect = QRect(x + bs.width(), 0, bs.width(), bs.height()); break; case SC_SpinBoxEditField: if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) { rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw); } else { rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw); } break; case SC_SpinBoxFrame: rect = spinBox->rect; default: break; } rect = visualRect(spinBox->direction, spinBox->rect, rect); } break; #endif // Qt_NO_SPINBOX #ifndef QT_NO_GROUPBOX case CC_GroupBox: { if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { switch (subControl) { case SC_GroupBoxFrame: // FALL THROUGH case SC_GroupBoxContents: { int topMargin = 0; int topHeight = 0; int bottomMargin = 0; int labelMargin = 2; QRect frameRect = groupBox->rect; int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); if (groupBox->text.size()) { topHeight = groupBox->fontMetrics.height(); if (verticalAlignment & Qt::AlignVCenter) topMargin = topHeight+5; else if (verticalAlignment & Qt::AlignTop) topMargin = -topHeight+5; } if (subControl == SC_GroupBoxFrame) { frameRect.setTop(topMargin); frameRect.setBottom(frameRect.height() + bottomMargin); rect = frameRect; break; } int frameWidth = 0; if (groupBox->text.size()) { frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth); } else { rect = groupBox->rect; } break; } case SC_GroupBoxCheckBox: // FALL THROUGH case SC_GroupBoxLabel: { QFontMetrics fontMetrics = groupBox->fontMetrics; int h = fontMetrics.height(); int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); int margX = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 2; int margY = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 2; rect = groupBox->rect.adjusted(margX, margY, -margX, 0); if (groupBox->text.size()) rect.setHeight(h); else rect.setHeight(0); int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1; bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; // Adjusted rect for label + indicatorWidth + indicatorSpace QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, QSize(textWidth + checkBoxSize, h), rect); // Adjust totalRect if checkbox is set if (hasCheckBox) { bool ltr = groupBox->direction == Qt::LeftToRight; int left = 2; // Adjust for check box if (subControl == SC_GroupBoxCheckBox) { int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; totalRect.setRect(left, top, indicatorWidth, indicatorHeight); // Adjust for label } else { left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); totalRect.setRect(left, totalRect.top(), totalRect.width() - checkBoxSize, totalRect.height()); } } if ((subControl== SC_GroupBoxLabel)) totalRect.adjust(-2,0,6,0); rect = totalRect; break; } default: break; } } break; } #endif // QT_NO_GROUPBOX default: break; } return rect; } QPalette QWindowsMobileStyle::standardPalette() const { QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ), QColor(132, 130, 132), QColor(198, 195, 198), Qt::black, Qt::white, Qt::white, QColor(198, 195, 198)); palette.setColor(QPalette::Window, QColor(206, 223, 239)); palette.setColor(QPalette::Link, QColor(8,77,123)); //Alternate TextColor for labels... palette.setColor(QPalette::Base, Qt::white); palette.setColor(QPalette::Button, QColor(206, 223, 239)); palette.setColor(QPalette::Highlight, QColor(49, 146, 214)); palette.setColor(QPalette::Light, Qt::white); palette.setColor(QPalette::Text, Qt::black); palette.setColor(QPalette::ButtonText, Qt::black); palette.setColor(QPalette::Midlight, QColor(222, 223, 222 )); palette.setColor(QPalette::Dark, QColor(132, 130, 132)); palette.setColor(QPalette::Mid, QColor(189, 190, 189)); palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow) return palette; } /*! \reimp */ void QWindowsMobileStyle::polish(QApplication *application) {<|fim▁hole|>void QWindowsMobileStyle::polish(QWidget *widget) { #ifndef QT_NO_TOOLBAR if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) { QPalette pal = toolBar->palette(); pal.setColor(QPalette::Background, pal.button().color()); toolBar->setPalette(pal); } else #endif //QT_NO_TOOLBAR QWindowsStyle::polish(widget); } void QWindowsMobileStyle::unpolish(QWidget *widget) { QWindowsStyle::unpolish(widget); } void QWindowsMobileStyle::unpolish(QApplication *app) { QWindowsStyle::unpolish(app); } /*! \reimp */ void QWindowsMobileStyle::polish(QPalette &palette) { QWindowsStyle::polish(palette); } int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); int ret; switch (pm) { case PM_DefaultTopLevelMargin: ret =0; break; case PM_DefaultLayoutSpacing: d->doubleControls ? ret = 8 : ret = 4; break; case PM_HeaderMargin: d->doubleControls ? ret = 2 : ret = 1; break; case PM_DefaultChildMargin: d->doubleControls ? ret = 10 : ret = 5; break; case PM_ToolBarSeparatorExtent: d->doubleControls ? ret = 6 : ret = 3; break; case PM_DefaultFrameWidth: d->doubleControls ? ret = 2 : ret = 1; break; case PM_MenuVMargin: ret = 1; break; case PM_MenuHMargin: ret = 1; break; case PM_MenuButtonIndicator: ret = d->doubleControls ? 24 : 14; break; case PM_ComboBoxFrameWidth: d->doubleControls ? ret = 2 : ret = 1; break; case PM_SpinBoxFrameWidth: d->doubleControls ? ret = 2 : ret = 1; break; case PM_ButtonDefaultIndicator: case PM_ButtonShiftHorizontal: case PM_ButtonShiftVertical: d->doubleControls ? ret = 2 : ret = 1; break; #ifndef QT_NO_TABBAR case PM_TabBarTabShiftHorizontal: ret = 0; break; case PM_TabBarTabShiftVertical: ret = 0; break; #endif case PM_MaximumDragDistance: ret = 60; break; case PM_TabBarTabVSpace: ret = d->doubleControls ? 12 : 6; break; case PM_TabBarBaseHeight: ret = 0; break; case PM_IndicatorWidth: ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; break; case PM_IndicatorHeight: ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; break; case PM_ExclusiveIndicatorWidth: ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; break; case PM_ExclusiveIndicatorHeight: ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; break; #ifndef QT_NO_SLIDER case PM_SliderLength: ret = d->doubleControls ? 16 : 8; break; case PM_FocusFrameHMargin: ret = d->doubleControls ? 1 : 2; break; case PM_SliderThickness: ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness; break; case PM_TabBarScrollButtonWidth: ret = d->doubleControls ? 14 * 2 : 18; break; case PM_CheckBoxLabelSpacing: case PM_RadioButtonLabelSpacing: ret = d->doubleControls ? 6 * 2 : 6; break; // Returns the number of pixels to use for the business part of the // slider (i.e., the non-tickmark portion). The remaining space is shared // equally between the tickmark regions. case PM_SliderControlThickness: if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); int ticks = sl->tickPosition; int n = 0; if (ticks & QSlider::TicksAbove) ++n; if (ticks & QSlider::TicksBelow) ++n; if (!n) { ret = space; break; } int thick = 8; if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4; space -= thick; if (space > 0) thick += (space * 2) / (n + 2); ret = thick; } else { ret = 0; } break; #endif // QT_NO_SLIDER #ifndef QT_NO_MENU case PM_SmallIconSize: d->doubleControls ? ret = windowsMobileIconSize * 2 : ret = windowsMobileIconSize; break; case PM_ButtonMargin: d->doubleControls ? ret = 8 : ret = 4; break; case PM_LargeIconSize: d->doubleControls ? ret = 64 : ret = 32; break; case PM_IconViewIconSize: ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); break; case PM_ToolBarIconSize: d->doubleControls ? ret = 2 * windowsMobileIconSize : ret = windowsMobileIconSize; break; case PM_DockWidgetTitleMargin: ret = 2; break; #if defined(Q_WS_WIN) #else case PM_DockWidgetFrameWidth: ret = 4; break; #endif // Q_WS_WIN break; #endif // QT_NO_MENU case PM_TitleBarHeight: d->doubleControls ? ret = 42 : ret = 21; break; case PM_ScrollBarSliderMin: #ifdef Q_WS_WINCE_WM if (d->wm65) #else if (false) #endif { d->doubleControls ? ret = 68 : ret = 34; } else { d->doubleControls ? ret = 36 : ret = 18; } break; case PM_ScrollBarExtent: { if (d->smartphone) ret = 9; else d->doubleControls ? ret = 25 : ret = 13; #ifdef Q_WS_WINCE_WM if (d->wm65) #else if (false) #endif { d->doubleControls ? ret = 26 : ret = 13; break; } #ifndef QT_NO_SCROLLAREA //Check if the scrollbar is part of an abstractItemView and set size according if (widget) if (QWidget *parent = widget->parentWidget()) if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) if (d->smartphone) ret = 8; else d->doubleControls ? ret = 24 : ret = 12; #endif } break; case PM_SplitterWidth: ret = qMax(4, QApplication::globalStrut().width()); break; #if defined(Q_WS_WIN) case PM_MDIFrameWidth: ret = 1; break; #endif case PM_ToolBarExtensionExtent: d->doubleControls ? ret = 32 : ret = 16; break; case PM_ToolBarItemMargin: d->doubleControls ? ret = 2 : ret = 1; break; case PM_ToolBarItemSpacing: d->doubleControls ? ret = 2 : ret = 1; break; case PM_ToolBarHandleExtent: d->doubleControls ? ret = 16 : ret = 8; break; case PM_ButtonIconSize: d->doubleControls ? ret = 32 : ret = 16; break; case PM_TextCursorWidth: ret = 2; break; case PM_TabBar_ScrollButtonOverlap: ret = 0; break; default: ret = QWindowsStyle::pixelMetric(pm, opt, widget); break; } return ret; } int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const { int ret; switch (hint) { case SH_Menu_MouseTracking: case SH_ComboBox_ListMouseTracking: case SH_EtchDisabledText: ret = 0; break; case SH_DitherDisabledText: ret = 0; break; case SH_ItemView_ShowDecorationSelected: ret = 0; break; #ifndef QT_NO_TABWIDGET case SH_TabWidget_DefaultTabPosition: ret = QTabWidget::South; break; #endif case SH_ToolBar_Movable: ret = false; break; case SH_ScrollBar_ContextMenu: ret = false; break; case SH_MenuBar_AltKeyNavigation: ret = false; break; case SH_RequestSoftwareInputPanel: ret = RSIP_OnMouseClick; break; default: ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); break; } return ret; } QPixmap QWindowsMobileStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); switch (sp) { #ifndef QT_NO_IMAGEFORMAT_XPM case SP_ToolBarHorizontalExtensionButton: { QPixmap pixmap = QCommonStyle::standardPixmap(sp, option, widget); if (d->doubleControls) return pixmap.scaledToHeight(pixmap.height() * 2); else return pixmap; } case SP_TitleBarMaxButton: case SP_TitleBarCloseButton: case SP_TitleBarNormalButton: case SP_TitleBarMinButton: { QImage image; switch (sp) { case SP_TitleBarMaxButton: image = d->imageMaximize; break; case SP_TitleBarCloseButton: image = d->imageClose; break; case SP_TitleBarNormalButton: image = d->imageNormalize; break; case SP_TitleBarMinButton: image = d->imageMinimize; break; default: break; } if (option) { image.setColor(0, option->palette.shadow().color().rgba()); image.setColor(1, option->palette.highlight().color().rgba()); image.setColor(2, option->palette.highlight().color().lighter(150).rgba()); image.setColor(3, option->palette.highlightedText().color().rgba()); } return QPixmap::fromImage(image); } #endif default: return QWindowsStyle::standardPixmap(sp, option, widget); } } QPixmap QWindowsMobileStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const { switch (iconMode) { case QIcon::Selected: { #ifdef Q_WS_WINCE_WM if (d_func()->wm65) return pixmap; #endif //Q_WS_WINCE_WM QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); int imgh = img.height(); int imgw = img.width(); for (int y = 0; y < imgh; y += 2) { for (int x = 0; x < imgw; x += 2) { QColor c = option->palette.highlight().color().rgb(); c.setAlpha( qAlpha(img.pixel(x, y))); QRgb pixel = c.rgba(); img.setPixel(x, y, pixel); } } return QPixmap::fromImage(img); } default: break; } return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, option); } bool QWindowsMobileStyle::doubleControls() const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); return d->doubleControls; } void QWindowsMobileStyle::setDoubleControls(bool doubleControls) { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); d->doubleControls = doubleControls; } QT_END_NAMESPACE #endif // QT_NO_STYLE_WINDOWSMOBILE<|fim▁end|>
QWindowsStyle::polish(application); } /*! \reimp */
<|file_name|>tabview.js<|end_file_name|><|fim▁begin|>// JavaScript Document /* Copyright (C) 2005 Ilya S. Lyubinskiy. All rights reserved. Technical support: http://www.php-development.ru/ YOU MAY NOT (1) Remove or modify this copyright notice. (2) Distribute this code, any part or any modified version of it. Instead, you can link to the homepage of this code: http://www.php-development.ru/javascripts/tabview.php. YOU MAY (1) Use this code on your website. (2) Use this code as a part of another product. NO WARRANTY This code is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. You expressly acknowledge and agree that use of this code is at your own risk. If you find my script useful, you can support my site in the following ways: 1. Vote for the script at HotScripts.com (you can do it on my site) 2. Link to the homepage of this script or to the homepage of my site:<|fim▁hole|> http://www.php-development.ru/javascripts/tabview.php http://www.php-development.ru/ You will get 50% commission on all orders made by your referrals. More information can be found here: http://www.php-development.ru/affiliates.php */ // ----- Auxiliary ------------------------------------------------------------- function tabview_aux(TabViewId, id) { var TabView = document.getElementById(TabViewId); // ----- Tabs ----- var Tabs = TabView.firstChild; while (Tabs.className != "Tabs" ) Tabs = Tabs.nextSibling; var Tab = Tabs.firstChild; var i = 0; do { if (Tab.tagName == "A") { i++; if (Tab.href == null || Tab.href ==""){ Tab.href = "javascript:tabview_switch('"+TabViewId+"', "+i+");"; } Tab.className = (i == id) ? "Active" : ""; Tab.blur(); } } while (Tab = Tab.nextSibling); // ----- Pages ----- var Pages = TabView.firstChild; if(Pages == null) return; while (Pages.className != 'Pages') Pages = Pages.nextSibling; var Page = Pages.firstChild; var i = 0; do { if (Page.className == 'Page') { i++; Page.style.overflow = "auto"; //Page.style.position = "absolute"; Page.style.display = (i == id) ? 'block' : 'none'; //Page.style.top = (i == id) ? 0 :1000; //Page.style.left = (i == id) ? 0 :-1000; } } while (Page = Page.nextSibling); } function getTabId(TabViewId,tabName){ var TabView = document.getElementById(TabViewId); var Tabs = TabView.firstChild; while (Tabs.className != "Tabs" ) Tabs = Tabs.nextSibling; var Tab = Tabs.firstChild; var i = 0; do{ if (Tab.tagName == "A"){ i++; if(Tab.firstChild.nodeValue==tabName) return i; } }while (Tab = Tab.nextSibling); return -1; } // ----- Functions ------------------------------------------------------------- function tabview_switch(TabViewId, id) { tabview_aux(TabViewId, id); } function tabview_switch_by_name(TabViewId, tabName) { var id=getTabId(TabViewId,tabName); if(id!=-1){ tabview_aux(TabViewId, id); } } function tabview_initialize(TabViewId) { tabview_aux(TabViewId, 1); }<|fim▁end|>
<|file_name|>02-Properties.js<|end_file_name|><|fim▁begin|>import React from 'react'; class MyPropertiesExample extends React.Component { render() { return ( <div> <h1>Properties</h1> My favourite dish is {this.props.dish}. </div> ); } } MyPropertiesExample.defaultProps = { dish: 'shrimp with pasta' }; MyPropertiesExample.propTypes = { dish: React.PropTypes.string.isRequired }; class MyVodooComponent extends React.Component { render() { return ( <MyPropertiesExample dish="chicken"/> ); } }<|fim▁hole|><|fim▁end|>
export default MyPropertiesExample;
<|file_name|>Client085.java<|end_file_name|><|fim▁begin|>/* * JBoss, Home of Professional Open Source * Copyright 2007, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. * See the copyright.txt in the distribution for a * full listing of individual contributors. * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License, v. 2.1. * This program is distributed in the hope that it will be useful, but WITHOUT A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License, * v.2.1 along with this distribution; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * (C) 2005-2006, * @author JBoss Inc. */ // // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 // // Arjuna Technologies Ltd., // Newcastle upon Tyne, // Tyne and Wear, // UK. // package org.jboss.jbossts.qa.RawResources02Clients2; /* * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved. * * HP Arjuna Labs, * Newcastle upon Tyne, * Tyne and Wear, * UK. * * $Id: Client085.java,v 1.3 2003/07/07 13:43:32 jcoleman Exp $ */ /* * Try to get around the differences between Ansi CPP and * K&R cpp with concatenation. */ /* * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved. * * HP Arjuna Labs, * Newcastle upon Tyne, * Tyne and Wear, * UK. * * $Id: Client085.java,v 1.3 2003/07/07 13:43:32 jcoleman Exp $ */ import org.jboss.jbossts.qa.RawResources02.*; import org.jboss.jbossts.qa.Utils.OAInterface; import org.jboss.jbossts.qa.Utils.ORBInterface; import org.jboss.jbossts.qa.Utils.OTS; import org.jboss.jbossts.qa.Utils.ServerIORStore; import org.omg.CORBA.TRANSACTION_ROLLEDBACK; public class Client085 { public static void main(String[] args) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); String serviceIOR1 = ServerIORStore.loadIOR(args[args.length - 2]); Service service1 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR1)); String serviceIOR2 = ServerIORStore.loadIOR(args[args.length - 1]); Service service2 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR2)); ResourceBehavior[] resourceBehaviors1 = new ResourceBehavior[1]; resourceBehaviors1[0] = new ResourceBehavior(); resourceBehaviors1[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteRollback; resourceBehaviors1[0].rollback_behavior = RollbackBehavior.RollbackBehaviorReturn; resourceBehaviors1[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors1[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; ResourceBehavior[] resourceBehaviors2 = new ResourceBehavior[1]; resourceBehaviors2[0] = new ResourceBehavior(); resourceBehaviors2[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteReadOnly; resourceBehaviors2[0].rollback_behavior = RollbackBehavior.RollbackBehaviorReturn; resourceBehaviors2[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors2[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; boolean correct = true; OTS.current().begin(); service1.oper(resourceBehaviors1, OTS.current().get_control()); service2.oper(resourceBehaviors2, OTS.current().get_control()); <|fim▁hole|> correct = false; } catch (TRANSACTION_ROLLEDBACK transactionRolledback) { } correct = correct && service1.is_correct() && service2.is_correct(); if (!correct) { System.err.println("service1.is_correct() or service2.is_correct() returned false"); } ResourceTrace resourceTrace1 = service1.get_resource_trace(0); ResourceTrace resourceTrace2 = service2.get_resource_trace(0); correct = correct && (resourceTrace1 == ResourceTrace.ResourceTracePrepareRollback); correct = correct && ((resourceTrace2 == ResourceTrace.ResourceTracePrepare) || (resourceTrace2 == ResourceTrace.ResourceTraceRollback)); if (correct) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (Exception exception) { System.err.println("Client085.main: " + exception); exception.printStackTrace(System.err); System.out.println("Failed"); } try { OAInterface.shutdownOA(); ORBInterface.shutdownORB(); } catch (Exception exception) { System.err.println("Client085.main: " + exception); exception.printStackTrace(System.err); } } }<|fim▁end|>
try { OTS.current().commit(true); System.err.println("Commit succeeded when it shouldn't");
<|file_name|>QueryStringService.js<|end_file_name|><|fim▁begin|>angular.module('openITCOCKPIT') .service('QueryStringService', function(){ return { getCakeId: function(){ var url = window.location.href; url = url.split('/'); var id = url[url.length - 1]; id = parseInt(id, 10); return id; }, getCakeIds: function(){ var url = window.location.href; var ids = []; url = url.split('/'); if(url.length > 5){ //Ignore protocol, controller and action //[ "https:", "", "example.com", "commands", "copy", "39", "31" ] for(var i = 5; i < url.length; i++){ if(isNaN(url[i]) === false && url[i] !== null && url[i] !== ''){ ids.push(parseInt(url[i], 10)); } } } return ids; }, getValue: function(varName, defaultReturn){ defaultReturn = (typeof defaultReturn === 'undefined') ? null : defaultReturn; var sourceUrl = parseUri(decodeURIComponent(window.location.href)).source; if(sourceUrl.includes('/#!/')){ sourceUrl = sourceUrl.replace('/#!', ''); } var query = parseUri(sourceUrl).queryKey; if(query.hasOwnProperty(varName)){ return query[varName]; } return defaultReturn; }, getIds: function(varName, defaultReturn){ defaultReturn = (typeof defaultReturn === 'undefined') ? null : defaultReturn;<|fim▁hole|> var sourceUrl = parseUri(decodeURIComponent(window.location.href)).source; if(sourceUrl.includes('/#!/')){ sourceUrl = sourceUrl.replace('/#!', ''); } var url = new URL(sourceUrl); var serviceIds = url.searchParams.getAll(varName); //getAll('filter[Service.id][]'); returns [861, 53, 860] if(serviceIds.length > 0){ return serviceIds; } return defaultReturn; }catch(e){ //IE or Edge?? ////&filter[Service.id][]=861&filter[Service.id][]=53&filter[Service.id][]=860&bert=123 var sourceUrl = parseUri(decodeURIComponent(window.location.href)).source; if(sourceUrl.includes('/#!/')){ sourceUrl = sourceUrl.replace('/#!', ''); } var urlString = sourceUrl; var peaces = urlString.split(varName); //split returns [ "https://foo.bar/services/index?angular=true&", "=861&", "=53&", "=860&", "=865&", "=799&", "=802&bert=123" ] var ids = []; for(var i = 0; i < peaces.length; i++){ if(peaces[i].charAt(0) === '='){ //Read from = to next & var currentId = ''; for(var k = 0; k < peaces[i].length; k++){ var currentChar = peaces[i].charAt(k); if(currentChar !== '='){ if(currentChar === '&'){ //Next variable in GET break; } currentId = currentId + currentChar; } } ids.push(currentId); } } if(ids.length > 0){ return ids; } return defaultReturn; } }, hasValue: function(varName){ var sourceUrl = parseUri(decodeURIComponent(window.location.href)).source; if(sourceUrl.includes('/#!/')){ sourceUrl = sourceUrl.replace('/#!', ''); } var query = parseUri(sourceUrl).queryKey; return query.hasOwnProperty(varName); }, hoststate: function(stateParams){ var states = { up: false, down: false, unreachable: false }; if(typeof stateParams === "undefined"){ return states; } if(typeof stateParams.hoststate === "undefined"){ return states; } for(var index in stateParams.hoststate){ switch(stateParams.hoststate[index]){ case 0: case '0': states.up = true; break; case 1: case '1': states.down = true; break; case 2: case '2': states.unreachable = true; break; } } return states; }, servicestate: function(stateParams){ var states = { ok: false, warning: false, critical: false, unknown: false }; if(typeof stateParams === "undefined"){ return states; } if(typeof stateParams.servicestate === "undefined"){ return states; } for(var index in stateParams.servicestate){ switch(stateParams.servicestate[index]){ case 0: case '0': states.ok = true; break; case 1: case '1': states.warning = true; break; case 2: case '2': states.critical = true; break; case 3: case '3': states.unknown = true; break; } } return states; }, getStateValue: function(stateParams, varName, defaultReturn){ defaultReturn = (typeof defaultReturn === 'undefined') ? null : defaultReturn; if(typeof stateParams[varName] !== "undefined"){ if(stateParams[varName] === null){ return defaultReturn; } return stateParams[varName]; } return defaultReturn; } } });<|fim▁end|>
try{ //&filter[Service.id][]=861&filter[Service.id][]=53&filter[Service.id][]=860
<|file_name|>gulpfile.babel.js<|end_file_name|><|fim▁begin|>'use strict';<|fim▁hole|>import gulp from 'gulp'; import gutil from 'gulp-util'; import uglify from 'gulp-uglify'; import stylus from 'gulp-stylus'; import watch from 'gulp-watch'; import plumber from 'gulp-plumber'; import cleanCss from 'gulp-clean-css'; import imagemin from 'gulp-imagemin'; import concat from 'gulp-concat'; import babel from 'gulp-babel'; // Minificação dos arquivos .js gulp.task('minjs', () => { return gulp // Define a origem dos arquivos .js .src(['src/js/**/*.js']) // Prevençãao de erros .pipe(plumber()) // Suporte para o padrão ES6 .pipe(babel({ presets: ['es2015'] })) // Realiza minificação .pipe(uglify()) // Altera a extenção do arquivo .pipe(concat('app.min.js')) // Salva os arquivos minificados na pasta de destino .pipe(gulp.dest('dist/js')); }); gulp.task('stylus', () => { return gulp // Define a origem dos arquivos .scss .src('src/stylus/**/*.styl') // Prevençãao de erros .pipe(plumber()) // Realiza o pré-processamento para css .pipe(stylus()) // Realiza a minificação do css .pipe(cleanCss()) // Altera a extenção do arquivo .pipe(concat('style.min.css')) // Salva os arquivos processados na pasta de destino .pipe(gulp.dest('dist/css')); }); gulp.task('images', () => gulp.src('src/assets/*') .pipe(imagemin()) .pipe(gulp.dest('dist/assets')) ); gulp.task('watch', function() { gulp.start('default') gulp.watch('src/js/**/*.js', ['minjs']) gulp.watch('src/stylus/**/*.styl', ['stylus']) gulp.watch('src/assets/*', ['images']) }); gulp.task('default', ['minjs', 'stylus', 'images']);<|fim▁end|>
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
#import DBusInterface
<|file_name|>leadership-search-test.js<|end_file_name|><|fim▁begin|>import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import Ember from 'ember'; import wait from 'ember-test-helpers/wait'; const { Service, RSVP, Object:EmberObject } = Ember; const { resolve } = RSVP; moduleForComponent('leadership-search', 'Integration | Component | leadership search', { integration: true }); test('it renders', function(assert) { this.set('nothing', parseInt); this.set('existingUsers', []); this.render(hbs`{{leadership-search existingUsers=existingUsers selectUser=(action nothing)}}`); const search = 'input[type="search"]'; assert.equal(this.$(search).length, 1); }); test('less than 3 charecters triggers warning', function(assert) { this.set('nothing', parseInt); this.set('existingUsers', []); this.render(hbs`{{leadership-search existingUsers=existingUsers selectUser=(action nothing)}}`); const search = 'input[type="search"]'; const results = 'ul'; this.$(search).val('ab').trigger('keyup'); return wait().then(()=>{ assert.equal(this.$(results).text().trim(), 'keep typing...'); }); }); test('input triggers search', function(assert) { let storeMock = Service.extend({ query(what, {q, limit}){ assert.equal('user', what); assert.equal(100, limit); assert.equal('search words', q); return resolve([EmberObject.create({fullName: 'test person', email: 'testemail'})]); } }); this.register('service:store', storeMock); this.set('nothing', parseInt); this.set('existingUsers', []); this.render(hbs`{{leadership-search existingUsers=existingUsers selectUser=(action nothing)}}`); const search = 'input[type="search"]'; const results = 'ul li'; const resultsCount = `${results}:eq(0)`; const firstResult = `${results}:eq(1)`; this.$(search).val('search words').trigger('keyup'); return wait().then(()=>{ assert.equal(this.$(resultsCount).text().trim(), '1 result'); assert.equal(this.$(firstResult).text().replace(/[\t\n\s]+/g, ""), 'testpersontestemail'); }); }); test('no results displays messages', function(assert) { let storeMock = Service.extend({ query(what, {q, limit}){ assert.equal('user', what); assert.equal(100, limit);<|fim▁hole|> assert.equal('search words', q); return resolve([]); } }); this.register('service:store', storeMock); this.set('nothing', parseInt); this.set('existingUsers', []); this.render(hbs`{{leadership-search existingUsers=existingUsers selectUser=(action nothing)}}`); const search = 'input[type="search"]'; const results = 'ul li'; const resultsCount = `${results}:eq(0)`; this.$(search).val('search words').trigger('keyup'); return wait().then(()=>{ assert.equal(this.$(resultsCount).text().trim(), 'no results'); }); }); test('click user fires add user', function(assert) { let user1 = EmberObject.create({ fullName: 'test person', email: 'testemail' }); let storeMock = Service.extend({ query(){ return resolve([user1]); } }); this.register('service:store', storeMock); this.set('select', user => { assert.equal(user1, user); }); this.set('existingUsers', []); this.render(hbs`{{leadership-search existingUsers=existingUsers selectUser=(action select)}}`); const search = 'input[type="search"]'; const results = 'ul li'; const firstResult = `${results}:eq(1)`; this.$(search).val('test').trigger('keyup'); return wait().then(()=>{ assert.equal(this.$(firstResult).text().replace(/[\t\n\s]+/g, ""), 'testpersontestemail'); this.$(firstResult).click(); }); }); test('can not add users twice', function(assert) { assert.expect(6); let user1 = EmberObject.create({ id: 1, fullName: 'test person', email: 'testemail' }); let user2 = EmberObject.create({ id: 2, fullName: 'test person2', email: 'testemail2' }); let storeMock = Service.extend({ query(){ return resolve([user1, user2]); } }); this.register('service:store', storeMock); this.set('select', (user) => { assert.equal(user, user2, 'only user2 should be sent here'); }); this.set('existingUsers', [user1]); this.render(hbs`{{leadership-search existingUsers=existingUsers selectUser=(action select)}}`); const search = 'input[type="search"]'; const results = 'ul li'; const resultsCount = `${results}:eq(0)`; const firstResult = `${results}:eq(1)`; const secondResult = `${results}:eq(2)`; this.$(search).val('test').trigger('keyup'); return wait().then(()=>{ assert.equal(this.$(resultsCount).text().trim(), '2 results'); assert.equal(this.$(firstResult).text().replace(/[\t\n\s]+/g, ""), 'testpersontestemail'); assert.notOk(this.$(firstResult).hasClass('clickable')); assert.equal(this.$(secondResult).text().replace(/[\t\n\s]+/g, ""), 'testperson2testemail2'); assert.ok(this.$(secondResult).hasClass('clickable')); this.$(firstResult).click(); this.$(secondResult).click(); }); });<|fim▁end|>
<|file_name|>NexusEnMaven.java<|end_file_name|><|fim▁begin|>package com.ctrip.framework.cs.enterprise; import com.ctrip.framework.cs.configuration.ConfigurationManager; import com.ctrip.framework.cs.configuration.InitConfigurationException; import com.ctrip.framework.cs.util.HttpUtil; import com.ctrip.framework.cs.util.PomUtil; import com.google.gson.Gson; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.HttpURLConnection; import java.net.URL; /** * Created by jiang.j on 2016/10/20. */ public class NexusEnMaven implements EnMaven { class NexusPomInfo{ String groupId; String artifactId; String version; } class RepoDetail{ String repositoryURL; String repositoryKind; } class SearchResult{ <|fim▁hole|> class ResourceResult{ ResourceInfo[] data; } class ResourceInfo{ String text; } Logger logger = LoggerFactory.getLogger(getClass()); private InputStream getContentByName(String[] av,String fileName) throws InitConfigurationException { InputStream rtn = null; String endsWith = ".pom"; if(av == null && fileName == null){ return null; }else if(av==null) { endsWith = "-sources.jar"; av = PomUtil.getArtifactIdAndVersion(fileName); } if(av == null){ return null; } String searchUrl = (ConfigurationManager.getConfigInstance().getString("vi.maven.repository.url") + "/nexus/service/local/lucene/search?a=" + av[0] + "&v=" + av[1]); if(av.length >2){ searchUrl += "&g="+av[2]; } logger.debug(searchUrl); try { URL url = new URL(searchUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(200); conn.setReadTimeout(500); conn.setRequestMethod("GET"); conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); conn.setRequestProperty("Accept", "application/json"); try (Reader rd = new InputStreamReader(conn.getInputStream(), "UTF-8")) { Gson gson = new Gson(); SearchResult results = gson.fromJson(rd, SearchResult.class); if(results.repoDetails!=null && results.data !=null && results.repoDetails.length>0 && results.data.length>0){ NexusPomInfo pomInfo = results.data[0]; String repositoryUrl = null; if(results.repoDetails.length>1){ for(RepoDetail repoDetail:results.repoDetails){ if("hosted".equalsIgnoreCase(repoDetail.repositoryKind)){ repositoryUrl = repoDetail.repositoryURL; break; } } } if(repositoryUrl == null) { repositoryUrl = results.repoDetails[0].repositoryURL; } String pomUrl = repositoryUrl +"/content/"+pomInfo.groupId.replace(".","/")+"/"+pomInfo.artifactId+"/" +pomInfo.version+"/"; if(fileName == null){ ResourceResult resourceResult = HttpUtil.doGet(new URL(pomUrl), ResourceResult.class); for(ResourceInfo rinfo:resourceResult.data){ if(rinfo.text.endsWith(endsWith) && ( fileName == null || fileName.compareTo(rinfo.text)>0)){ fileName = rinfo.text; } } pomUrl += fileName; }else { pomUrl += fileName + endsWith; } logger.debug(pomUrl); HttpURLConnection pomConn = (HttpURLConnection) new URL(pomUrl).openConnection(); pomConn.setRequestMethod("GET"); rtn = pomConn.getInputStream(); } } }catch (Throwable e){ logger.warn("get pominfo by jar name["+av[0] + ' '+av[1]+"] failed",e); } return rtn; } @Override public InputStream getPomInfoByFileName(String[] av, String fileName) { try { return getContentByName(av, fileName); }catch (Throwable e){ logger.warn("getPomInfoByFileName failed!",e); return null; } } @Override public InputStream getSourceJarByFileName(String fileName) { try { return getContentByName(null,fileName); }catch (Throwable e){ logger.warn("getPomInfoByFileName failed!",e); return null; } } }<|fim▁end|>
RepoDetail[] repoDetails; NexusPomInfo[] data; }
<|file_name|>DefinitionImpl.java<|end_file_name|><|fim▁begin|>/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.auraframework.impl.system; import static org.auraframework.instance.AuraValueProviderType.LABEL; import java.io.Serializable; import java.util.Collection; import java.util.Map; import java.util.Set; import org.auraframework.Aura; import org.auraframework.builder.DefBuilder; import org.auraframework.def.DefDescriptor; import org.auraframework.def.Definition; import org.auraframework.def.DefinitionAccess; import org.auraframework.expression.PropertyReference; import org.auraframework.impl.DefinitionAccessImpl; import org.auraframework.instance.GlobalValueProvider; import org.auraframework.system.Location; import org.auraframework.system.SubDefDescriptor; import org.auraframework.throwable.AuraExceptionInfo; import org.auraframework.throwable.quickfix.InvalidDefinitionException; import org.auraframework.throwable.quickfix.QuickFixException; import org.auraframework.util.json.Serialization; import org.auraframework.util.json.Serialization.ReferenceScope; import org.auraframework.util.json.Serialization.ReferenceType; import org.auraframework.util.text.Hash; import com.google.common.collect.Maps; /** * The implementation for a definition. */ @Serialization(referenceType = ReferenceType.IDENTITY, referenceScope = ReferenceScope.REQUEST) public abstract class DefinitionImpl<T extends Definition> implements Definition, Serializable { private static final long serialVersionUID = 5836732915093913670L; protected final DefDescriptor<T> descriptor; protected final Location location; protected final Map<SubDefDescriptor<?, T>, Definition> subDefs; protected final String apiVersion; protected final String description; private final QuickFixException parseError; private final String ownHash; private final DefinitionAccess access; private boolean valid; protected DefinitionImpl(DefDescriptor<T> descriptor, Location location) { this(descriptor, location, null, null, null, null, null, null); } protected DefinitionImpl(RefBuilderImpl<T, ?> builder) { this(builder.getDescriptor(), builder.getLocation(), builder.subDefs, builder.apiVersion, builder.description, builder.getAccess(), builder.getOwnHash(), builder.getParseError()); } DefinitionImpl(DefDescriptor<T> descriptor, Location location, Map<SubDefDescriptor<?, T>, Definition> subDefs, String apiVersion, String description, DefinitionAccess access, String ownHash, QuickFixException parseError) { this.descriptor = descriptor; this.location = location; this.subDefs = subDefs; this.apiVersion = apiVersion; this.description = description; this.ownHash = ownHash; this.parseError = parseError; this.access = access == null ? DefinitionAccessImpl.defaultAccess(descriptor != null ? descriptor.getNamespace() : null) : access; } /**<|fim▁hole|> return descriptor; } /** * @see Definition#getLocation() */ @Override public Location getLocation() { return location; } @Override public DefinitionAccess getAccess() { return access; } /** * @see Definition#getName() */ @Override public String getName() { return descriptor == null ? getClass().getName() : descriptor.getName(); } @Override public String getOwnHash() { return ownHash; } /** * @throws QuickFixException * @see Definition#appendDependencies(java.util.Set) */ @Override public void appendDependencies(Set<DefDescriptor<?>> dependencies) { } /** * @throws QuickFixException * @see Definition#appendSupers(java.util.Set) */ @Override public void appendSupers(Set<DefDescriptor<?>> dependencies) throws QuickFixException { } /** * @throws QuickFixException * @see Definition#validateDefinition() */ @Override public void validateDefinition() throws QuickFixException { if (parseError != null) { throw parseError; } if (descriptor == null) { throw new InvalidDefinitionException("No descriptor", location); } } @Override public void markValid() { this.valid = true; } @Override public boolean isValid() { return this.valid; } /** * @throws QuickFixException * @see Definition#validateReferences() */ @Override public void validateReferences() throws QuickFixException { } @Override public String toString() { // getDescriptor is not always non-null (though is should be). Avoid // throwing a null pointer // exception when someone asks for a string representation. if (getDescriptor() != null) { return getDescriptor().toString(); } else { return "INVALID[" + this.location + "]: " + this.description; } } @SuppressWarnings("unchecked") @Override public <D extends Definition> D getSubDefinition(SubDefDescriptor<D, ?> sddesc) { if (subDefs == null) { return null; } return (D) subDefs.get(sddesc); } public abstract static class BuilderImpl<T extends Definition> extends RefBuilderImpl<T, T> { protected BuilderImpl(Class<T> defClass) { super(defClass); } }; public abstract static class RefBuilderImpl<T extends Definition, A extends Definition> implements DefBuilder<T, A> { private boolean descriptorLocked; public DefDescriptor<T> descriptor; public Location location; public Map<SubDefDescriptor<?, T>, Definition> subDefs; private final Class<T> defClass; public String apiVersion; public String description; public Hash hash; public String ownHash; private QuickFixException parseError; private DefinitionAccess access; protected RefBuilderImpl(Class<T> defClass) { this.defClass = defClass; //this.ownHash = String.valueOf(System.currentTimeMillis()); } public RefBuilderImpl<T, A> setAccess(DefinitionAccess access) { this.access = access; return this; } public DefinitionAccess getAccess() { return access; } @Override public RefBuilderImpl<T, A> setLocation(String fileName, int line, int column, long lastModified) { location = new Location(fileName, line, column, lastModified); return this; } @Override public RefBuilderImpl<T, A> setLocation(String fileName, long lastModified) { location = new Location(fileName, lastModified); return this; } @Override public RefBuilderImpl<T, A> setLocation(Location location) { this.location = location; return this; } public Location getLocation() { return this.location; } public RefBuilderImpl<T, A> addSubDef(SubDefDescriptor<?, T> sddesc, Definition inner) { if (this.subDefs == null) { this.subDefs = Maps.newHashMap(); } this.subDefs.put(sddesc, inner); return this; } public RefBuilderImpl<T, A> lockDescriptor(DefDescriptor<T> desc) { this.descriptorLocked = true; this.descriptor = desc; return this; } @Override public RefBuilderImpl<T, A> setDescriptor(String qualifiedName) { try { return this.setDescriptor(DefDescriptorImpl.getInstance(qualifiedName, defClass)); } catch (Exception e) { setParseError(e); return this; } } @Override public RefBuilderImpl<T, A> setDescriptor(DefDescriptor<T> desc) { if (!this.descriptorLocked) { this.descriptor = desc; } return this; } @Override public DefDescriptor<T> getDescriptor() { return descriptor; } @Override public RefBuilderImpl<T, A> setAPIVersion(String apiVersion) { this.apiVersion = apiVersion; return this; } @Override public RefBuilderImpl<T, A> setDescription(String description) { this.description = description; return this; } @Override public RefBuilderImpl<T,A> setOwnHash(Hash hash) { if (hash != null) { this.ownHash = null; } this.hash = hash; return this; } @Override public RefBuilderImpl<T,A> setOwnHash(String ownHash) { this.ownHash = ownHash; return this; } private String getOwnHash() { // // Try to make sure that we have a hash string. // if (ownHash == null && hash != null && hash.isSet()) { ownHash = hash.toString(); } return ownHash; } @Override public void setParseError(Throwable cause) { if (this.parseError != null) { return; } if (cause instanceof QuickFixException) { this.parseError = (QuickFixException)cause; } else { Location location = null; if (cause instanceof AuraExceptionInfo) { AuraExceptionInfo aei = (AuraExceptionInfo)cause; location = aei.getLocation(); } this.parseError = new InvalidDefinitionException(cause.getMessage(), location, cause); } } @Override public QuickFixException getParseError() { return parseError; } } @Override public void retrieveLabels() throws QuickFixException { } /** * A utility routine to get the full set of labels out of a set of property references. * * This is used everywhere that we parse javascript to get property references and want to * process them. But can be applied to literally anything. * * @param props the collection of properties to scan. */ protected void retrieveLabels(Collection<PropertyReference> props) throws QuickFixException { if (props != null && !props.isEmpty()) { GlobalValueProvider labelProvider = Aura.getContextService().getCurrentContext().getGlobalProviders().get(LABEL.getPrefix()); for (PropertyReference e : props) { if (e.getRoot().equals(LABEL.getPrefix())) { labelProvider.validate(e.getStem()); labelProvider.getValue(e.getStem()); } } } } @Override public String getAPIVersion() { return apiVersion; } @Override public String getDescription() { return description; } }<|fim▁end|>
* @see Definition#getDescriptor() */ @Override public DefDescriptor<T> getDescriptor() {
<|file_name|>geo.py<|end_file_name|><|fim▁begin|># !/usr/bin/python # -*- coding: utf-8 -*- # # Created on Oct 16, 2015 # @author: Bo Zhao # @email: [email protected] # @website: http://yenching.org # @organization: Harvard Kennedy School import urllib2 import json import sys from settings import BAIDU_AK from log import * reload(sys) sys.setdefaultencoding('utf-8') def geocode(loc): lat, lng = -1, -1 url = 'http://api.map.baidu.com/geocoder/v2/?address=%s&output=json&ak=%s' % (loc, BAIDU_AK) others = [u'其他', u'美国', u'英国', u'澳大利亚', u'伊朗', u'台湾', u'沙特阿拉伯', u'爱尔兰', u'印度', u'印尼', u'奥地利', u'挪威', u'乌克兰', u'瑞士', u'西班牙', u'古巴', u'挪威', u'德国', u'埃及', u'巴西', u'比利时'] if loc in others: pass else: try: response = urllib2.urlopen(url.replace(' ', '%20')) except urllib2.HTTPError, e: log(WARNING, e, 'geocode') try: loc_json = json.loads(response.read()) lat = loc_json[u'result'][u'location'][u'lat'] lng = loc_json[u'result'][u'location'][u'lng'] except ValueError: log(ERROR, "No JSON object was decoded", 'geocode') except KeyError, e: log(ERROR, e.message, 'geocode') return [lat, lng] # Estimate where a post was sent out based on the semantics of the user's name,<|fim▁hole|>def geocode_by_semantics(project, address, port): from pymongo import MongoClient client = MongoClient(address, port) db = client[project] search_json = {'$or': [{'latlng': [0, 0]}, {'latlng': [-1, -1]}], 'verified': True} users = db.users.find(search_json) count = db.users.find(search_json).count() print count i = 0 for user in users: i += 1 verified_info = user['verified_info'] username = user['username'] verified_info = verified_info.replace(u'主持人', '').replace(u'职员', '').replace(u'院长', '').replace(u'经理', '') verified_info = verified_info.split(u' ')[0] if verified_info == u'前' or u'www' in verified_info or u'律师' in verified_info or u'学者' in verified_info or u'作家' in verified_info or u'媒体人' in verified_info or u'诗人' in verified_info: verified_info = '' locational_info = verified_info if locational_info == '': locational_info = username if verified_info != '': latlng = geocode(verified_info) else: continue log(NOTICE, '#%d geocode the user by its semantic info %s. %d posts remain. latlng: %s ' % (i, verified_info.encode('gbk', 'ignore'), count - i, str(latlng))) if latlng[0] != -1 and latlng[0] != 0: db.users.update({'userid': user['userid']}, {'$set': {'latlng': latlng}}) log(NOTICE, "mission compeletes.") def geocode_locational_info(project, address, port): from pymongo import MongoClient client = MongoClient(address, port) db = client[project] search_json = {'$or': [{'latlng': [0, 0]}, {'latlng': [-1, -1]}], 'location': {'$ne': ''}} users = db.users.find(search_json) count = users.count() print count i = 0 for user in users: i += 1 if 'location' in user.keys(): latlng = geocode(user['location']) log(NOTICE, '#%d geocode the user by its locational info %s. %d posts remain. latlng: %s ' % (i, user['location'].encode('gbk', 'ignore'), count - i, str(latlng))) if latlng[0] != -1 and latlng[0] != 0: db.users.update({'userid': user['userid']}, {'$set': {'latlng': latlng}}) else: continue log(NOTICE, "mission compeletes.") # Estimate where a post was sent out based the path of its author. def estimate_location_by_path(user): est_latlng = [-1, -1] path = user['path'] latlng = user['latlng'] if user['path'] != [] and user['path'][0][0] != 0: if latlng != [0, 0] and latlng != [-1, -1]: path.append(latlng) avg_lat = 0 avg_lng = 0 for latlng in path: avg_lat += latlng[0] avg_lng += latlng[1] avg_lat /= float(len(path)) avg_lng /= float(len(path)) distances = [] for latlng in path: distances.append(abs(latlng[0] - avg_lat) + abs(latlng[1] - avg_lng)) est_latlng = path[distances.index(min(distances))][0:2] elif user['path'] == [] and latlng != [0, 0]: est_latlng = latlng else: pass return est_latlng # Estimate where a post was sent out by the locational information of its author. def georeference(project, address, port): from pymongo import MongoClient client = MongoClient(address, port) db = client[project] search_json = {'$or': [{'latlng': [0, 0]}, {'latlng': [-1, -1]}]} posts = db.posts.find(search_json) count = db.posts.find(search_json).count() i = 0 for post in posts: # userid = post['user']['userid'] username = post['user']['username'] user = db.users.find_one({'username': username}) i += 1 try: if abs(user['latlng'][0] - 0) < 0.001: pass elif abs(user['latlng'][0] + 1) < 0.001: pass else: try: db.posts.update_many({'mid': post['mid']}, {'$set': { 'latlng': user['latlng'] } }) log(NOTICE, 'georeferencing #%d, %d posts remain. latlng: %s ' % (i, count - i, str(user['latlng']))) except: log(NOTICE, 'the user latlng does not exit') except: print "user has been mistakenly deleted" log(NOTICE, "mission compeletes.")<|fim▁end|>
# verified inforamtion, and/or other contextual information.
<|file_name|>optionsFactory.ts<|end_file_name|><|fim▁begin|>import { IFilterOptionDef } from '../../interfaces/iFilter'; import { IScalarFilterParams } from './scalarFilter'; import { ISimpleFilterParams } from './simpleFilter'; import { every } from '../../utils/array'; /* Common logic for options, used by both filters and floating filters. */ export class OptionsFactory { protected customFilterOptions: { [name: string]: IFilterOptionDef; } = {}; protected filterOptions: (IFilterOptionDef | string)[]; protected defaultOption: string; public init(params: IScalarFilterParams, defaultOptions: string[]): void { this.filterOptions = params.filterOptions || defaultOptions; this.mapCustomOptions(); this.selectDefaultItem(params); } <|fim▁hole|> } private mapCustomOptions(): void { if (!this.filterOptions) { return; } this.filterOptions.forEach(filterOption => { if (typeof filterOption === 'string') { return; } const requiredProperties: (keyof IFilterOptionDef)[] = ['displayKey', 'displayName', 'test']; if (every(requiredProperties, key => { if (!filterOption[key]) { console.warn(`ag-Grid: ignoring FilterOptionDef as it doesn't contain a '${key}'`); return false; } return true; })) { this.customFilterOptions[filterOption.displayKey] = filterOption; } }); } private selectDefaultItem(params: ISimpleFilterParams): void { if (params.defaultOption) { this.defaultOption = params.defaultOption; } else if (this.filterOptions.length >= 1) { const firstFilterOption = this.filterOptions[0]; if (typeof firstFilterOption === 'string') { this.defaultOption = firstFilterOption; } else if (firstFilterOption.displayKey) { this.defaultOption = firstFilterOption.displayKey; } else { console.warn(`ag-Grid: invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'`); } } else { console.warn('ag-Grid: no filter options for filter'); } } public getDefaultOption(): string { return this.defaultOption; } public getCustomOption(name: string): IFilterOptionDef { return this.customFilterOptions[name]; } }<|fim▁end|>
public getFilterOptions(): (IFilterOptionDef | string)[] { return this.filterOptions;
<|file_name|>ResliceBSpline.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # this script tests vtkImageReslice with different interpolation modes, # with the wrap-pad feature turned on and with a rotation # Image pipeline reader = vtk.vtkImageReader() reader.ReleaseDataFlagOff() reader.SetDataByteOrderToLittleEndian() reader.SetDataExtent(0,63,0,63,1,93) reader.SetDataSpacing(3.2,3.2,1.5) reader.SetFilePrefix("" + str(VTK_DATA_ROOT) + "/Data/headsq/quarter") reader.SetDataMask(0x7fff) transform = vtk.vtkTransform() # rotate about the center of the image transform.Translate(+100.8,+100.8,+69.0) transform.RotateWXYZ(10,1,1,0) transform.Translate(-100.8,-100.8,-69.0) bspline3 = vtk.vtkImageBSplineInterpolator() bspline3.SetSplineDegree(3) bspline9 = vtk.vtkImageBSplineInterpolator() bspline9.SetSplineDegree(9) coeffs1 = vtk.vtkImageBSplineCoefficients() coeffs1.SetInputConnection(reader.GetOutputPort()) coeffs1.SetSplineDegree(3) coeffs2 = vtk.vtkImageBSplineCoefficients() coeffs2.SetInputConnection(reader.GetOutputPort()) coeffs2.SetSplineDegree(9) reslice1 = vtk.vtkImageReslice() reslice1.SetInputConnection(coeffs1.GetOutputPort()) reslice1.SetResliceTransform(transform) reslice1.SetInterpolator(bspline3) reslice1.SetOutputSpacing(2.0,2.0,1.5)<|fim▁hole|>reslice2.SetInputConnection(coeffs1.GetOutputPort()) reslice2.SetInterpolator(bspline3) reslice2.SetOutputSpacing(2.0,2.0,1.5) reslice2.SetOutputOrigin(-32,-32,40) reslice2.SetOutputExtent(0,127,0,127,0,0) reslice3 = vtk.vtkImageReslice() reslice3.SetInputConnection(coeffs2.GetOutputPort()) reslice3.SetResliceTransform(transform) reslice3.SetInterpolator(bspline9) reslice3.SetOutputSpacing(2.0,2.0,1.5) reslice3.SetOutputOrigin(-32,-32,40) reslice3.SetOutputExtent(0,127,0,127,0,0) reslice4 = vtk.vtkImageReslice() reslice4.SetInputConnection(coeffs2.GetOutputPort()) reslice4.SetInterpolator(bspline9) reslice4.SetOutputSpacing(2.0,2.0,1.5) reslice4.SetOutputOrigin(-32,-32,40) reslice4.SetOutputExtent(0,127,0,127,0,0) mapper1 = vtk.vtkImageMapper() mapper1.SetInputConnection(reslice1.GetOutputPort()) mapper1.SetColorWindow(2000) mapper1.SetColorLevel(1000) mapper1.SetZSlice(0) mapper2 = vtk.vtkImageMapper() mapper2.SetInputConnection(reslice2.GetOutputPort()) mapper2.SetColorWindow(2000) mapper2.SetColorLevel(1000) mapper2.SetZSlice(0) mapper3 = vtk.vtkImageMapper() mapper3.SetInputConnection(reslice3.GetOutputPort()) mapper3.SetColorWindow(2000) mapper3.SetColorLevel(1000) mapper3.SetZSlice(0) mapper4 = vtk.vtkImageMapper() mapper4.SetInputConnection(reslice4.GetOutputPort()) mapper4.SetColorWindow(2000) mapper4.SetColorLevel(1000) mapper4.SetZSlice(0) actor1 = vtk.vtkActor2D() actor1.SetMapper(mapper1) actor2 = vtk.vtkActor2D() actor2.SetMapper(mapper2) actor3 = vtk.vtkActor2D() actor3.SetMapper(mapper3) actor4 = vtk.vtkActor2D() actor4.SetMapper(mapper4) imager1 = vtk.vtkRenderer() imager1.AddActor2D(actor1) imager1.SetViewport(0.5,0.0,1.0,0.5) imager2 = vtk.vtkRenderer() imager2.AddActor2D(actor2) imager2.SetViewport(0.0,0.0,0.5,0.5) imager3 = vtk.vtkRenderer() imager3.AddActor2D(actor3) imager3.SetViewport(0.5,0.5,1.0,1.0) imager4 = vtk.vtkRenderer() imager4.AddActor2D(actor4) imager4.SetViewport(0.0,0.5,0.5,1.0) imgWin = vtk.vtkRenderWindow() imgWin.AddRenderer(imager1) imgWin.AddRenderer(imager2) imgWin.AddRenderer(imager3) imgWin.AddRenderer(imager4) imgWin.SetSize(256,256) imgWin.Render() # --- end of script --<|fim▁end|>
reslice1.SetOutputOrigin(-32,-32,40) reslice1.SetOutputExtent(0,127,0,127,0,0) reslice2 = vtk.vtkImageReslice()
<|file_name|>numbers.js<|end_file_name|><|fim▁begin|>// Math.extend v0.5.0 // Copyright (c) 2008-2009 Laurent Fortin // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Object.extend(Math, { sum: function(list) { var sum = 0; for(var i = 0, len = list.length; i < len; i++) sum += list[i];<|fim▁hole|> return sum; }, mean: function(list) { return list.length ? this.sum(list) / list.length : false; }, median: function(list) { if(!list.length) return false; list = this.sort(list); if(list.length.isEven()) { return this.mean([list[list.length / 2 - 1], list[list.length / 2]]); } else { return list[(list.length / 2).floor()]; } }, variance: function(list) { if(!list.length) return false; var mean = this.mean(list); var dev = []; for(var i = 0, len = list.length; i < len; i++) dev.push(this.pow(list[i] - mean, 2)); return this.mean(dev); }, stdDev: function(list) { return this.sqrt(this.variance(list)); }, sort: function(list, desc) { // we output a clone of the original array return list.clone().sort(function(a, b) { return desc ? b - a : a - b }); }, baseLog: function(n, base) { return this.log(n) / this.log(base || 10); }, factorize: function(n) { if(!n.isNatural(true) || n == 1) return false; if(n.isPrime()) return [n]; var sqrtOfN = this.sqrt(n); for(var i = 2; i <= sqrtOfN; i++) if((n % i).isNull() && i.isPrime()) return [i, this.factorize(n / i)].flatten(); }, sinh: function(n) { return (this.exp(n) - this.exp(-n)) / 2; }, cosh: function(n) { return (this.exp(n) + this.exp(-n)) / 2; }, tanh: function(n) { return this.sinh(n) / this.cosh(n); } }); Object.extend(Number.prototype, { isNaN: function() { return isNaN(this); }, isNull: function() { return this == 0; }, isEven: function() { if(!this.isInteger()) return false; return(this % 2 ? false : true); }, isOdd: function() { if(!this.isInteger()) return false; return(this % 2 ? true : false); }, isInteger: function(excludeZero) { // if this == NaN ... if(this.isNaN()) return false; if(excludeZero && this.isNull()) return false; return (this - this.floor()) ? false : true; }, isNatural: function(excludeZero) { return(this.isInteger(excludeZero) && this >= 0); }, isPrime: function() { var sqrtOfThis = Math.sqrt(this); var somePrimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]; if(!this.isNatural(true) || sqrtOfThis.isInteger()) { return false; } if(somePrimes.include(this)) return true; for(var i = 0, len = somePrimes.length; i < len; i++) { if(somePrimes[i] > sqrtOfThis) { return true; } if((this % somePrimes[i]).isNull()) { return false; } } for(var i = 103; i <= sqrtOfThis; i += 2) { if((this % i).isNull()) { return false; } } return true; }, compute: function(fn) { return fn(this); } }); Object.extend(Array.prototype, { swap: function(index1, index2) { var swap = this[index1]; this[index1] = this[index2]; this[index2] = swap; return this; }, shuffle: function(inline, times) { var list = (inline != false ? this : this.clone()); for(var i = 0, len = list.length * (times || 4); i < len; i++) { list.swap( (Math.random() * list.length).floor(), (Math.random() * list.length).floor() ); } return list; }, randomDraw: function(items) { items = Number(items) || 1; var list = this.shuffle(false); if (items >= list.length) { return list; } var sample = []; for(var i = 1; i <= items; i++) { if(list.length > 0) { sample.push(list.shift()); } else { return sample; } } return sample; } }); Object.extend(Object, { numericValues: function(object) { return Object.values(object).select(Object.isNumber); } });<|fim▁end|>
<|file_name|>LocalWatcher.java<|end_file_name|><|fim▁begin|>/* * Syncany, www.syncany.org * Copyright (C) 2011 Philipp C. Heckel <[email protected]> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.stacksync.desktop.watch.local; import java.io.File; import org.apache.log4j.Logger; import com.stacksync.desktop.Environment; import com.stacksync.desktop.Environment.OperatingSystem; import com.stacksync.desktop.config.Config; import com.stacksync.desktop.config.Folder; import com.stacksync.desktop.config.profile.Profile; import com.stacksync.desktop.index.Indexer; import com.stacksync.desktop.util.FileUtil; /** * * @author oubou68, pheckel */ public abstract class LocalWatcher { protected final Logger logger = Logger.getLogger(LocalWatcher.class.getName()); protected static final Environment env = Environment.getInstance(); protected static LocalWatcher instance; protected Config config; protected Indexer indexer; public LocalWatcher() { initDependencies(); logger.info("Creating watcher ..."); } private void initDependencies() { config = Config.getInstance(); indexer = Indexer.getInstance(); } public void queueCheckFile(Folder root, File file) { // Exclude ".ignore*" files from everything if (FileUtil.checkIgnoreFile(root, file)) { logger.debug("Watcher: Ignoring file "+file.getAbsolutePath()); return; } // File vanished! if (!file.exists()) { logger.warn("Watcher: File "+file+" vanished. IGNORING."); return; } // Add to queue logger.info("Watcher: Checking new/modified file "+file); indexer.queueChecked(root, file); } public void queueMoveFile(Folder fromRoot, File fromFile, Folder toRoot, File toFile) { // Exclude ".ignore*" files from everything if (FileUtil.checkIgnoreFile(fromRoot, fromFile) || FileUtil.checkIgnoreFile(toRoot, toFile)) { logger.info("Watcher: Ignoring file "+fromFile.getAbsolutePath()); return; } // File vanished! if (!toFile.exists()) { logger.warn("Watcher: File "+toFile+" vanished. IGNORING."); return; } // Add to queue logger.info("Watcher: Moving file "+fromFile+" TO "+toFile+""); <|fim▁hole|> indexer.queueMoved(fromRoot, fromFile, toRoot, toFile); } public void queueDeleteFile(Folder root, File file) { // Exclude ".ignore*" files from everything if (FileUtil.checkIgnoreFile(root, file)) { logger.info("Watcher: Ignoring file "+file.getAbsolutePath()); return; } // Add to queue logger.info("Watcher: Deleted file "+file+""); indexer.queueDeleted(root, file); } public static synchronized LocalWatcher getInstance() { if (instance != null) { return instance; } if (env.getOperatingSystem() == OperatingSystem.Linux || env.getOperatingSystem() == OperatingSystem.Windows || env.getOperatingSystem() == OperatingSystem.Mac) { instance = new CommonLocalWatcher(); return instance; } throw new RuntimeException("Your operating system is currently not supported: " + System.getProperty("os.name")); } public abstract void start(); public abstract void stop(); public abstract void watch(Profile profile); public abstract void unwatch(Profile profile); }<|fim▁end|>
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import { Widget, startAppLoop, Url, History } from 'cx/ui'; import { Timing, Debug } from 'cx/util';<|fim▁hole|> import "./index.scss"; let stop; const store = new Store(); if(module.hot) { // accept itself module.hot.accept(); // remember data on dispose module.hot.dispose(function (data) { data.state = store.getData(); if (stop) stop(); }); //apply data on hot replace if (module.hot.data) store.load(module.hot.data.state); } Url.setBaseFromScript('app.js'); History.connect(store, 'url'); Widget.resetCounter(); Timing.enable('app-loop'); Debug.enable('app-data'); stop = startAppLoop(document.getElementById('app'), store, Routes);<|fim▁end|>
import { Store } from 'cx/data'; import Routes from './routes'; import 'whatwg-fetch';
<|file_name|>peos_notify.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import os import re import sys import json import urllib import socket import subprocess import cgi, cgitb from os import listdir from os.path import isfile, join #http://178.62.51.54:13930/event=CREATE&login_name=henrik&pathway_name=test_commit.pml<|fim▁hole|> #Error constants ERROR_USER_NOT_EXIST = 1 ERROR_SCRIPT_FAIL = 2 os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir(EXECUTION_PATH) process = subprocess.Popen(["./peos", "-l", str(patient_id), "-u" ], stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, error = process.communicate() return output, error<|fim▁end|>
def peos_notify(patient_id): EXECUTION_PATH = "../peos/os/kernel/"
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import os import sys import argparse import configparser from utils.process import Process # They are imported as all lowercase # so it is case insensitive in the config file from modules.tuebl import Tuebl as tuebl from modules.itebooks import ItEbooks as itebooks from modules.wallhaven import Wallhaven as wallhaven parser = argparse.ArgumentParser() parser.add_argument('config', help='custom config file', nargs='?', default='./config.ini') args = parser.parse_args() config = configparser.ConfigParser() <|fim▁hole|>def stop(): """ Save any data before exiting """ for site in scrape: print(scrape[site].log("Exiting...")) scrape[site].stop() sys.exit(0) if __name__ == "__main__": # Read config file if not os.path.isfile(args.config): print("Invalid config file") sys.exit(0) config.read(args.config) # Parse config file scrape = {} for site in config.sections(): if config[site]['enabled'].lower() == 'true': try: # If it not a class skip it site_class = getattr(sys.modules[__name__], site.lower()) except AttributeError as e: print("\nThere is no module named " + site + "\n") continue dl_path = os.path.expanduser(config[site]['download_path']) num_files = int(config[site]['number_of_files']) threads = int(config[site]['threads']) scrape[site] = Process(site_class, dl_path, num_files, threads) # Start site parser try: for site in scrape: print("#### Scrapeing: " + site) scrape[site].start() except Exception as e: print("Exception [main]: " + str(e)) stop()<|fim▁end|>
<|file_name|>RuleDetailsProfiles.tsx<|end_file_name|><|fim▁begin|>/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { filter } from 'lodash'; import * as React from 'react'; import { Link } from 'react-router'; import { activateRule, deactivateRule, Profile } from '../../../api/quality-profiles'; import InstanceMessage from '../../../components/common/InstanceMessage'; import { Button } from '../../../components/controls/buttons'; import ConfirmButton from '../../../components/controls/ConfirmButton'; import Tooltip from '../../../components/controls/Tooltip'; import SeverityHelper from '../../../components/shared/SeverityHelper'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { getQualityProfileUrl } from '../../../helpers/urls'; import { Dict, RuleActivation, RuleDetails } from '../../../types/types'; import BuiltInQualityProfileBadge from '../../quality-profiles/components/BuiltInQualityProfileBadge'; import ActivationButton from './ActivationButton'; import RuleInheritanceIcon from './RuleInheritanceIcon'; interface Props { activations: RuleActivation[] | undefined; canWrite: boolean | undefined; onActivate: () => Promise<void>; onDeactivate: () => Promise<void>; referencedProfiles: Dict<Profile>; ruleDetails: RuleDetails; } export default class RuleDetailsProfiles extends React.PureComponent<Props> { handleActivate = () => this.props.onActivate(); handleDeactivate = (key?: string) => { if (key) { deactivateRule({ key, rule: this.props.ruleDetails.key }).then(this.props.onDeactivate, () => {}); } }; handleRevert = (key?: string) => { if (key) { activateRule({ key, rule: this.props.ruleDetails.key, reset: true }).then(this.props.onActivate, () => {}); } }; renderInheritedProfile = (activation: RuleActivation, profile: Profile) => { if (!profile.parentName) { return null; } const profilePath = getQualityProfileUrl(profile.parentName, profile.language); return ( <div className="coding-rules-detail-quality-profile-inheritance"> {(activation.inherit === 'OVERRIDES' || activation.inherit === 'INHERITED') && ( <> <RuleInheritanceIcon className="text-middle" inheritance={activation.inherit} /> <Link className="link-base-color little-spacer-left text-middle" to={profilePath}> {profile.parentName} </Link> </> )} </div> ); }; renderSeverity = (activation: RuleActivation, parentActivation?: RuleActivation) => ( <td className="coding-rules-detail-quality-profile-severity"> <Tooltip overlay={translate('coding_rules.activation_severity')}> <span> <SeverityHelper className="display-inline-flex-center" severity={activation.severity} /> </span> </Tooltip> {parentActivation !== undefined && activation.severity !== parentActivation.severity && ( <div className="coding-rules-detail-quality-profile-inheritance"> {translate('coding_rules.original')} {translate('severity', parentActivation.severity)} </div> )} </td> ); renderParameter = (param: { key: string; value: string }, parentActivation?: RuleActivation) => { const originalParam = parentActivation && parentActivation.params.find(p => p.key === param.key); const originalValue = originalParam && originalParam.value; return ( <div className="coding-rules-detail-quality-profile-parameter" key={param.key}> <span className="key">{param.key}</span> <span className="sep">: </span> <span className="value" title={param.value}> {param.value} </span> {parentActivation && param.value !== originalValue && ( <div className="coding-rules-detail-quality-profile-inheritance"> {translate('coding_rules.original')} <span className="value">{originalValue}</span> </div> )} </div> ); }; renderParameters = (activation: RuleActivation, parentActivation?: RuleActivation) => ( <td className="coding-rules-detail-quality-profile-parameters"> {activation.params.map(param => this.renderParameter(param, parentActivation))} </td> ); renderActions = (activation: RuleActivation, profile: Profile) => { const canEdit = profile.actions && profile.actions.edit && !profile.isBuiltIn; const { ruleDetails } = this.props; const hasParent = activation.inherit !== 'NONE' && profile.parentKey; return ( <td className="coding-rules-detail-quality-profile-actions"> {canEdit && ( <> {!ruleDetails.isTemplate && ( <ActivationButton activation={activation} buttonText={translate('change_verb')} className="coding-rules-detail-quality-profile-change" modalHeader={translate('coding_rules.change_details')} onDone={this.handleActivate} profiles={[profile]} rule={ruleDetails} /> )} {hasParent ? ( activation.inherit === 'OVERRIDES' && profile.parentName && ( <ConfirmButton confirmButtonText={translate('yes')} confirmData={profile.key} modalBody={translateWithParameters( 'coding_rules.revert_to_parent_definition.confirm', profile.parentName )} modalHeader={translate('coding_rules.revert_to_parent_definition')} onConfirm={this.handleRevert}> {({ onClick }) => ( <Button className="coding-rules-detail-quality-profile-revert button-red spacer-left" onClick={onClick}> {translate('coding_rules.revert_to_parent_definition')} </Button> )} </ConfirmButton> ) ) : ( <ConfirmButton confirmButtonText={translate('yes')} confirmData={profile.key} modalBody={translate('coding_rules.deactivate.confirm')} modalHeader={translate('coding_rules.deactivate')} onConfirm={this.handleDeactivate}> {({ onClick }) => ( <Button className="coding-rules-detail-quality-profile-deactivate button-red spacer-left" onClick={onClick}> {translate('coding_rules.deactivate')} </Button> )} </ConfirmButton> )} </> )} </td> ); }; renderActivation = (activation: RuleActivation) => { const { activations = [], ruleDetails } = this.props; const profile = this.props.referencedProfiles[activation.qProfile]; if (!profile) { return null; } const parentActivation = activations.find(x => x.qProfile === profile.parentKey); return ( <tr data-profile={profile.key} key={profile.key}> <td className="coding-rules-detail-quality-profile-name"> <Link to={getQualityProfileUrl(profile.name, profile.language)}>{profile.name}</Link> {profile.isBuiltIn && <BuiltInQualityProfileBadge className="spacer-left" />} {this.renderInheritedProfile(activation, profile)} </td> {this.renderSeverity(activation, parentActivation)} {!ruleDetails.templateKey && this.renderParameters(activation, parentActivation)} {this.renderActions(activation, profile)} </tr> ); }; <|fim▁hole|> ); return ( <div className="js-rule-profiles coding-rule-section"> <div className="coding-rules-detail-quality-profiles-section"> <div className="coding-rule-section-separator" /> <h3 className="coding-rules-detail-title"> <InstanceMessage message={translate('coding_rules.quality_profiles')} /> </h3> {canActivate && ( <ActivationButton buttonText={translate('coding_rules.activate')} className="coding-rules-quality-profile-activate spacer-left" modalHeader={translate('coding_rules.activate_in_quality_profile')} onDone={this.handleActivate} profiles={filter( this.props.referencedProfiles, profile => !activations.find(activation => activation.qProfile === profile.key) )} rule={ruleDetails} /> )} {activations.length > 0 && ( <table className="coding-rules-detail-quality-profiles width-100" id="coding-rules-detail-quality-profiles"> <tbody>{activations.map(this.renderActivation)}</tbody> </table> )} </div> </div> ); } }<|fim▁end|>
render() { const { activations = [], referencedProfiles, ruleDetails } = this.props; const canActivate = Object.values(referencedProfiles).some(profile => Boolean(profile.actions && profile.actions.edit && profile.language === ruleDetails.lang)