コード例 #1
0
DashboardsManagerDialog::DashboardsManagerDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    new HelpButton(this, buttonBox, "23331370");
    buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
    buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));

    setupList();

    connect(checkButton, SIGNAL(clicked()), SLOT(sl_check()));
    connect(uncheckButton, SIGNAL(clicked()), SLOT(sl_uncheck()));
    connect(allButton, SIGNAL(clicked()), SLOT(sl_selectAll()));
    connect(removeButton, SIGNAL(clicked()), SLOT(sl_remove()));
}
コード例 #2
0
InnerWidget::InnerWidget(
	QWidget *parent,
	not_null<Controller*> controller,
	not_null<UserData*> user)
: RpWidget(parent)
, _controller(controller)
, _user(user)
, _listController(std::make_unique<ListController>(controller, _user))
, _list(setupList(this, _listController.get())) {
	setContent(_list.data());
	_listController->setDelegate(static_cast<PeerListDelegate*>(this));

	_controller->searchFieldController()->queryValue(
	) | rpl::start_with_next([this](QString &&query) {
		peerListScrollToTop();
		content()->searchQueryChanged(std::move(query));
	}, lifetime());
}
コード例 #3
0
void buildingShape::draw(){

	if (energy < 0.01f) return;

	ofSetColor(myColor.x, myColor.y, myColor.z, powf(energy,3)*255*(0.25 + peakEnergy*0.65));
	/*ofFill();
	//ofRect(boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height);
	ofBeginShape();
	for (int i= 0; i < nPts; i++){
		ofVertex(pts[i].x, pts[i].y);
	}
	ofEndShape(true);
	*/

	if (!DL.ready()){
		setupList();
	} else {
		DL.draw();
	}

	ofSetColor(255, 255, 255, energy*255);

	int posInArray = MAX(MIN(animator * nPts, nPts-1),0);
	ofSetColor(myColor.x, myColor.y, myColor.z, energy*255);

	ofFill();
	ofPoint temp = pts[posInArray];
	//ofCircle(temp.x, temp.y, 8);

	ofNoFill();
	ofPushStyle();
	glLineWidth(BUILDING_HIGHLIGHT_SIZE * OFFSCREEN_SCALE);
	ofBeginShape();
	for (int i = 0; i < trail.size(); i++){
		ofVertex(trail[i].x, trail[i].y);
	}
	ofEndShape();
	ofPopStyle();

}
コード例 #4
0
ファイル: types.cpp プロジェクト: wangxianke/pyston
void setupRuntime() {
    HiddenClass::getRoot();

    object_cls = new BoxedClass(NULL, 0, sizeof(Box), false);
    type_cls = new BoxedClass(object_cls, offsetof(BoxedClass, attrs), sizeof(BoxedClass), false);
    type_cls->cls = type_cls;
    object_cls->cls = type_cls;

    none_cls = new BoxedClass(object_cls, 0, sizeof(Box), false);
    None = new Box(&none_flavor, none_cls);

    str_cls = new BoxedClass(object_cls, 0, sizeof(BoxedString), false);

    // It wasn't safe to add __base__ attributes until object+type+str are set up, so do that now:
    type_cls->giveAttr("__base__", object_cls);
    str_cls->giveAttr("__base__", object_cls);
    none_cls->giveAttr("__base__", object_cls);
    object_cls->giveAttr("__base__", None);


    tuple_cls = new BoxedClass(object_cls, 0, sizeof(BoxedTuple), false);
    EmptyTuple = new BoxedTuple({});
    gc::registerStaticRootObj(EmptyTuple);


    module_cls = new BoxedClass(object_cls, offsetof(BoxedModule, attrs), sizeof(BoxedModule), false);

    // TODO it'd be nice to be able to do these in the respective setupType methods,
    // but those setup methods probably want access to these objects.
    // We could have a multi-stage setup process, but that seems overkill for now.
    bool_cls = new BoxedClass(object_cls, 0, sizeof(BoxedBool), false);
    int_cls = new BoxedClass(object_cls, 0, sizeof(BoxedInt), false);
    float_cls = new BoxedClass(object_cls, 0, sizeof(BoxedFloat), false);
    function_cls = new BoxedClass(object_cls, offsetof(BoxedFunction, attrs), sizeof(BoxedFunction), false);
    instancemethod_cls = new BoxedClass(object_cls, 0, sizeof(BoxedInstanceMethod), false);
    list_cls = new BoxedClass(object_cls, 0, sizeof(BoxedList), false);
    slice_cls = new BoxedClass(object_cls, 0, sizeof(BoxedSlice), false);
    dict_cls = new BoxedClass(object_cls, 0, sizeof(BoxedDict), false);
    file_cls = new BoxedClass(object_cls, 0, sizeof(BoxedFile), false);
    set_cls = new BoxedClass(object_cls, 0, sizeof(BoxedSet), false);
    member_cls = new BoxedClass(object_cls, 0, sizeof(BoxedMemberDescriptor), false);

    STR = typeFromClass(str_cls);
    BOXED_INT = typeFromClass(int_cls);
    BOXED_FLOAT = typeFromClass(float_cls);
    BOXED_BOOL = typeFromClass(bool_cls);
    NONE = typeFromClass(none_cls);
    LIST = typeFromClass(list_cls);
    SLICE = typeFromClass(slice_cls);
    MODULE = typeFromClass(module_cls);
    DICT = typeFromClass(dict_cls);
    SET = typeFromClass(set_cls);
    BOXED_TUPLE = typeFromClass(tuple_cls);

    object_cls->giveAttr("__name__", boxStrConstant("object"));
    object_cls->giveAttr("__new__", new BoxedFunction(boxRTFunction((void*)objectNew, UNKNOWN, 1, 0, true, false)));
    object_cls->freeze();

    auto typeCallObj = boxRTFunction((void*)typeCall, UNKNOWN, 1, 0, true, false);
    typeCallObj->internal_callable = &typeCallInternal;
    type_cls->giveAttr("__call__", new BoxedFunction(typeCallObj));

    type_cls->giveAttr("__name__", boxStrConstant("type"));
    type_cls->giveAttr("__new__", new BoxedFunction(boxRTFunction((void*)typeNew, UNKNOWN, 2)));
    type_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)typeRepr, STR, 1)));
    type_cls->giveAttr("__str__", type_cls->getattr("__repr__"));
    type_cls->freeze();

    none_cls->giveAttr("__name__", boxStrConstant("NoneType"));
    none_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)noneRepr, STR, 1)));
    none_cls->giveAttr("__str__", none_cls->getattr("__repr__"));
    none_cls->giveAttr("__hash__", new BoxedFunction(boxRTFunction((void*)noneHash, UNKNOWN, 1)));
    none_cls->freeze();

    module_cls->giveAttr("__name__", boxStrConstant("module"));
    module_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)moduleRepr, STR, 1)));
    module_cls->giveAttr("__str__", module_cls->getattr("__repr__"));
    module_cls->freeze();

    member_cls->giveAttr("__name__", boxStrConstant("member"));
    member_cls->freeze();

    setupBool();
    setupInt();
    setupFloat();
    setupStr();
    setupList();
    setupDict();
    setupSet();
    setupTuple();
    setupFile();

    function_cls->giveAttr("__name__", boxStrConstant("function"));
    function_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)functionRepr, STR, 1)));
    function_cls->giveAttr("__str__", function_cls->getattr("__repr__"));
    function_cls->freeze();

    instancemethod_cls->giveAttr("__name__", boxStrConstant("instancemethod"));
    instancemethod_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)instancemethodRepr, STR, 1)));
    instancemethod_cls->freeze();

    slice_cls->giveAttr("__name__", boxStrConstant("slice"));
    slice_cls->giveAttr("__new__",
                        new BoxedFunction(boxRTFunction((void*)sliceNew, UNKNOWN, 4, 2, false, false), { NULL, None }));
    slice_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)sliceRepr, STR, 1)));
    slice_cls->giveAttr("__str__", slice_cls->getattr("__repr__"));
    slice_cls->giveAttr("start", new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, SLICE_START_OFFSET));
    slice_cls->giveAttr("stop", new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, SLICE_STOP_OFFSET));
    slice_cls->giveAttr("step", new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, SLICE_STEP_OFFSET));
    slice_cls->freeze();

    // sys is the first module that needs to be set up, due to modules
    // being tracked in sys.modules:
    setupSys();

    setupBuiltins();
    setupMath();
    setupTime();
    setupThread();

    setupCAPI();

    TRACK_ALLOCATIONS = true;
}
コード例 #5
0
ファイル: types.cpp プロジェクト: Bassem450/pyston
void setupRuntime() {
    HiddenClass::getRoot();

    type_cls = new BoxedClass(true, NULL);
    type_cls->cls = type_cls;

    none_cls = new BoxedClass(false, NULL);
    None = new Box(&none_flavor, none_cls);
    gc::registerStaticRootObj(None);

    module_cls = new BoxedClass(true, NULL);

    bool_cls = new BoxedClass(false, NULL);
    int_cls = new BoxedClass(false, NULL);
    float_cls = new BoxedClass(false, NULL);
    str_cls = new BoxedClass(false, (BoxedClass::Dtor)str_dtor);
    function_cls = new BoxedClass(true, NULL);
    instancemethod_cls = new BoxedClass(false, (BoxedClass::Dtor)instancemethod_dtor);
    list_cls = new BoxedClass(false, (BoxedClass::Dtor)list_dtor);
    slice_cls = new BoxedClass(true, NULL);
    dict_cls = new BoxedClass(false, (BoxedClass::Dtor)dict_dtor);
    tuple_cls = new BoxedClass(false, (BoxedClass::Dtor)tuple_dtor);
    file_cls = new BoxedClass(false, (BoxedClass::Dtor)file_dtor);

    STR = typeFromClass(str_cls);
    BOXED_INT = typeFromClass(int_cls);
    BOXED_FLOAT = typeFromClass(float_cls);
    BOXED_BOOL = typeFromClass(bool_cls);
    NONE = typeFromClass(none_cls);
    LIST = typeFromClass(list_cls);
    SLICE = typeFromClass(slice_cls);
    MODULE = typeFromClass(module_cls);
    DICT = typeFromClass(dict_cls);
    BOXED_TUPLE = typeFromClass(tuple_cls);

    type_cls->giveAttr("__name__", boxStrConstant("type"));
    type_cls->giveAttr("__call__", new BoxedFunction(boxRTFunction((void*)typeCall, NULL, 1, true)));
    type_cls->giveAttr("__new__", new BoxedFunction(boxRTFunction((void*)typeNew, NULL, 2, true)));
    type_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)typeRepr, NULL, 1, true)));
    type_cls->setattr("__str__", type_cls->peekattr("__repr__"), NULL, NULL);
    type_cls->freeze();

    none_cls->giveAttr("__name__", boxStrConstant("NoneType"));
    none_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)noneRepr, NULL, 1, false)));
    none_cls->setattr("__str__", none_cls->peekattr("__repr__"), NULL, NULL);
    none_cls->freeze();

    module_cls->giveAttr("__name__", boxStrConstant("module"));
    module_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)moduleRepr, NULL, 1, false)));
    module_cls->setattr("__str__", module_cls->peekattr("__repr__"), NULL, NULL);
    module_cls->freeze();

    setupBool();
    setupInt();
    setupFloat();
    setupStr();
    setupList();
    setupDict();
    setupTuple();
    setupFile();

    function_cls->giveAttr("__name__", boxStrConstant("function"));
    function_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)functionRepr, NULL, 1, false)));
    function_cls->setattr("__str__", function_cls->peekattr("__repr__"), NULL, NULL);
    function_cls->freeze();

    instancemethod_cls->giveAttr("__name__", boxStrConstant("instancemethod"));
    instancemethod_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)instancemethodRepr, NULL, 1, true)));
    instancemethod_cls->freeze();

    slice_cls->giveAttr("__name__", boxStrConstant("slice"));
    slice_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)sliceRepr, NULL, 1, true)));
    slice_cls->setattr("__str__", slice_cls->peekattr("__repr__"), NULL, NULL);
    slice_cls->freeze();

    setupMath();
    gc::registerStaticRootObj(math_module);
    setupTime();
    gc::registerStaticRootObj(time_module);
    setupBuiltins();
    gc::registerStaticRootObj(builtins_module);


    setupCAPI();

    TRACK_ALLOCATIONS = true;
}