Пример #1
0
void GuiTemplate::render()
{
    if (!_templatesLoaded)
    {
        loadTemplates();
        _templatesLoaded = true;
    }

    if (_textures.size() == 0)
        return;

    if (ImGui::CollapsingHeader(_name.c_str()))
    {
        bool firstTemplate = true;
        for (auto& name : _names)
        {
            if (!firstTemplate)
                ImGui::SameLine(0.f, 2.f);
            firstTemplate = false;

            if (ImGui::ImageButton((void*)(intptr_t)_textures[name]->getTexId(), ImVec2(128, 128)))
            {
                string configPath = string(DATADIR) + "templates/" + name + ".json";
#if HAVE_OSX
                if (!ifstream(configPath, ios::in | ios::binary))
                    configPath = "../Resources/templates/" + name + ".json";
#endif
                setWorldAttribute("loadConfig", {configPath});
            }

            if (ImGui::IsItemHovered())
                ImGui::SetTooltip("%s", _descriptions[name].data());
        }
    }
}
Пример #2
0
PropertiesDock::PropertiesDock(MainWindow* aParent)
: MDockAncestor(aParent), Main(aParent), CurrentUi(0),
    theTemplates(0), CurrentTagView(0), CurrentMembersView(0), NowShowing(NoUiShowing)
{
    setMinimumSize(220,100);
    switchToNoUi();
    setObjectName("propertiesDock");
    theModel = new TagModel(aParent);
    delegate = new EditCompleterDelegate(aParent);

    // Set up the shortcut event filter for the tableviews
    // This allows them to react to keys already bound to
    // application wide shortcuts
    shortcutFilter = new ShortcutOverrideFilter();
    shortcutFilter->addOverride(Qt::Key_Up);
    shortcutFilter->addOverride(Qt::Key_Down);
    shortcutFilter->addOverride(Qt::Key_Left);
    shortcutFilter->addOverride(Qt::Key_Right);
    shortcutFilter->addOverride(Qt::Key_F2);
    shortcutFilter->addOverride(Qt::Key_Delete);

    centerAction = new QAction(NULL, this);
    connect(centerAction, SIGNAL(triggered()), this, SLOT(on_centerAction_triggered()));
    centerZoomAction = new QAction(NULL, this);
    connect(centerZoomAction, SIGNAL(triggered()), this, SLOT(on_centerZoomAction_triggered()));
    selectAction = new QAction(NULL, this);
    connect(selectAction, SIGNAL(triggered()), this, SLOT(on_Member_selected()));

    loadTemplates();

    retranslateUi();
}
Пример #3
0
SimpleMessageStyle::SimpleMessageStyle(const QString &AStylePath, QNetworkAccessManager *ANetworkAccessManager, QObject *AParent) : QObject(AParent)
{
	if (FSharedPath.isEmpty())
	{
		if (QDir::isRelativePath(SHARED_STYLE_PATH))
			FSharedPath = qApp->applicationDirPath()+"/"SHARED_STYLE_PATH;
		else
			FSharedPath = SHARED_STYLE_PATH;
	}

	FStylePath = AStylePath;
	FInfo = styleInfo(AStylePath);
	FVariants = styleVariants(AStylePath);
	FNetworkAccessManager=ANetworkAccessManager;

	initStyleSettings();
	loadTemplates();
	loadSenderColors();

	FScrollTimer.setSingleShot(true);
	FScrollTimer.setInterval(SCROLL_TIMEOUT);
	connect(&FScrollTimer,SIGNAL(timeout()),SLOT(onScrollAfterResize()));

	connect(AParent,SIGNAL(styleWidgetAdded(IMessageStyle *, QWidget *)),SLOT(onStyleWidgetAdded(IMessageStyle *, QWidget *)));
}
Пример #4
0
CRmgTemplateStorage::CRmgTemplateStorage()
{
	auto jsonLoader = make_unique<CJsonRmgTemplateLoader>();
	jsonLoader->loadTemplates();

	const auto & tpls = jsonLoader->getTemplates();
	templates.insert(tpls.begin(), tpls.end());
}
Пример #5
0
CCharTemplates::CCharTemplates(irr::db::IDatabase* database)
: DataBase(database)
{
	loadTemplates();
};
Пример #6
0
// this function is called once at construction time, after the object is constructed.
void LLNotifications::initSingleton()
{
	loadTemplates();
	createDefaultChannels();
}
// this function is called once at construction time, after the object is constructed.
void LLNotificationTemplates::initSingleton()
{
	loadTemplates();
}
Пример #8
0
void getSyst(){

    TFile *output = new TFile("sysforshape.root","recreate");
    const int Nsys = 10;
    TH1F *hSumSys[Ncate][Nregion];
    for(int irg = 0; irg < Nregion ; irg ++){

        loadTemplates(RegionsName[irg]);
        for(int icate=0;icate<Ncate;icate++){
            sprintf(buffer_,"SumSys_cate%i%s",icate,RegionsName[irg].c_str());
            hSumSys[icate][irg] = new TH1F(buffer_,"", htemplates[icate][Normal]->GetXaxis()->GetNbins(), 
                    htemplates[icate][Normal]->GetXaxis()->GetXmin(), 
                    htemplates[icate][Normal]->GetXaxis()->GetXmax());
            TH1F *hUncs[Nsys];

            printf("[  Cate %i loop]\n", icate);
            hUncs[0] = hdiff("XsecUnc", htemplates[icate][Normal], htemplates[icate][UncXsecPlus], 
                    htemplates[icate][UncXsecMinus]);
            hUncs[1] = hdiff("PUUnc", htemplates[icate][Normal], htemplates[icate][UncPUPlus], 
                    htemplates[icate][UncPUMinus]);
            hUncs[2] = hdiff("JESUnc", htemplates[icate][Normal], htemplates[icate][UncJESPlus], 
                    htemplates[icate][UncJESMinus]);
            hUncs[3] = hdiff("JERUnc", htemplates[icate][Normal], htemplates[icate][UncJERPlus], 
                    htemplates[icate][UncJERMinus]);
            hUncs[4] = hdiff("TrigUnc", htemplates[icate][Normal], htemplates[icate][UncTrigPlus], 
                    htemplates[icate][UncTrigMinus]);
            hUncs[5] = hdiff("PhoIDUnc", htemplates[icate][Normal], htemplates[icate][UncPhoIDPlus], 
                    htemplates[icate][UncPhoIDMinus]);
            hUncs[6] = hdiff("LepIDUnc", htemplates[icate][Normal], htemplates[icate][UncLepIDPlus], 
                    htemplates[icate][UncLepIDMinus]);
            hUncs[7] = hdiff("TopPtUnc", htemplates[icate][Normal], htemplates[icate][UncTopPtPlus], 
                    htemplates[icate][UncTopPtMinus]);
            hUncs[8] = hdiff("QsquareUnc", htemplates[icate][Normal], htemplates[icate][UncQsquarePlus], 
                    htemplates[icate][UncQsquareMinus]);
            hUncs[9] = hdiff("MatchingUnc", htemplates[icate][Normal], htemplates[icate][UncMatchingPlus], 
                    htemplates[icate][UncMatchingMinus]);

            getallsys(hSumSys[icate][irg], Nsys, hUncs, irg);
            TCanvas *c1 = new TCanvas("c1","",640,640);
            c1->Divide(5,2);

            for(int iu = 0;iu < Nsys;iu++){
                c1->cd(iu+1);
                hUncs[iu]->Draw();
            }
            sprintf(buffer_,"Merge%i%s_sys.pdf",icate,RegionsName[irg].c_str());
            c1->SaveAs(buffer_);

            delete c1;
        }

        TCanvas *c1 = new TCanvas("c1","",640,640);
        c1->Divide(3,2);
        for(int icate=0;icate < Ncate;icate++){
            c1->cd(icate + 1);
            hSumSys[icate][irg]->Draw();
            output->cd();
            hSumSys[icate][irg]->Write();

        }
        sprintf(buffer_,"SumSys%s.pdf", RegionsName[irg].c_str());
        c1->SaveAs(buffer_);
    }

    output->Close();
}
Пример #9
0
int main(int argc, char *argv[])
{
    CApplication	app(argc, argv);
    QPixmap			pixmap(":/res/icons/app-start.png");
	QSplashScreen	*splash = NULL;
	QString			tpl = "\n          %1";
    QColor			c(0, 0, 0, 168);
    CWorkbench		*bench = NULL;

    QCoreApplication::setOrganizationName("JetMind");
    QCoreApplication::setOrganizationDomain("jetmind.com");
    QCoreApplication::setApplicationName("JetMind");

    app.setWindowIcon(QIcon(QString::fromUtf8(":/res/icons/app-logo.png")));

#if defined(__APPLE__) && defined(__MACH__)
	app.setFont( QFont("Arial", 12) );
#else
	app.setFont( QFont("Arial", 9) );
#endif //

	splash = new QSplashScreen(pixmap);
	splash->setMask(pixmap.mask());
	splash->show();
	app.processEvents();

	splash->showMessage(tpl.arg( QObject::tr("Initing Environment...") ), Qt::AlignBottom | Qt::AlignRight , c);
	app.processEvents();
	initEnvironment();

	splash->showMessage(tpl.arg( QObject::tr("Loading Templates...") ), Qt::AlignBottom | Qt::AlignRight , c);
	app.processEvents();
    loadTemplates();

	splash->showMessage(tpl.arg( QObject::tr("Starting Workbench...") ), Qt::AlignBottom | Qt::AlignRight , c);
	app.processEvents();

	bench = new CWorkbench();
    bench->setWindowTitle("JetMind");
	bench->resize(800, 600);
	bench->show();
    bench->loadStyleSheet();
	app.setWorkbench(bench);
	CDiagramContext::env()->setMainUI(bench);

	splash->finish(bench);

	// set url handler
	QDesktopServices::setUrlHandler("topic", (QObject*)bench, "onOpenUrl");
	QDesktopServices::setUrlHandler("sheet", (QObject*)bench, "onOpenUrl");

#if defined(__APPLE__) && defined(__MACH__)
    bench->createFile();
#else
	QStringList args;
	args = app.arguments();
	if (args.length() > 1)
	{
		bench->loadFile(args.at(1));
	}
	else
	{
		bench->createFile();
	}
#endif //

	return app.exec();
}