kweather::kweather(const TQString& configFile, Type t, int actions, TQWidget *parent, const char *name): KPanelApplet(configFile, t, actions, parent, name), weatherIface(), mFirstRun( false ), mReport( 0 ), mClient( 0 ), mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 ), mTextColor(TQt::black) { kdDebug(12004) << "Constructor " << endl; setObjId("weatherIface"); setBackgroundOrigin( TQWidget::AncestorOrigin ); loadPrefs(); initContextMenu(); initDCOP(); dockWidget = new dockwidget(reportLocation, this, "dockwidget"); connect(dockWidget, TQT_SIGNAL(buttonClicked()), TQT_SLOT(doReport())); dockWidget->setViewMode(mViewMode); setLabelColor(); timeOut = new TQTimer(this, "timeOut" ); connect(timeOut, TQT_SIGNAL(timeout()), TQT_SLOT(timeout())); timeOut->start(10*60*1000); if(mFirstRun) preferences(); else timeout(); }
void kweather::initContextMenu() { mContextMenu = new TDEPopupMenu(this); mContextMenu->insertTitle(i18n("KWeather - %1").arg( reportLocation ), -1, 0); mContextMenu->insertItem(SmallIcon("viewmag"), i18n("Show &Report"), this, TQT_SLOT(doReport()), 0, -1, 1); mContextMenu->insertItem(SmallIcon("reload"), i18n("&Update Now"), this, TQT_SLOT(slotUpdateNow()), 0, -1, 2); mContextMenu->insertSeparator(); mContextMenu->insertItem(SmallIcon("kweather"), i18n("&About KWeather"), this, TQT_SLOT(about())); mContextMenu->insertItem(SmallIcon("configure"), i18n("&Configure KWeather..."), this, TQT_SLOT(preferences())); setCustomMenu(mContextMenu); }
/** Executes the algorithm. Reading in the file and creating and populating * the output workspace * * @throw Exception::FileError If the Nexus file cannot be found/opened * @throw std::invalid_argument If the optional properties are set to invalid *values */ void LoadTOFRawNexus::exec() { // The input properties std::string filename = getPropertyValue("Filename"); m_signalNo = getProperty("Signal"); m_spec_min = getProperty("SpectrumMin"); m_spec_max = getProperty("SpectrumMax"); // Find the entry name we want. std::string entry_name = LoadTOFRawNexus::getEntryName(filename); // Count pixels and other setup auto prog = new Progress(this, 0.0, 1.0, 10); prog->doReport("Counting pixels"); std::vector<std::string> bankNames; countPixels(filename, entry_name, bankNames); g_log.debug() << "Workspace found to have " << m_numPixels << " pixels and " << m_numBins << " bins" << std::endl; prog->setNumSteps(bankNames.size() + 5); prog->doReport("Creating workspace"); // Start with a dummy WS just to hold the logs and load the instrument MatrixWorkspace_sptr WS = WorkspaceFactory::Instance().create( "Workspace2D", m_numPixels, m_numBins + 1, m_numBins); // Load the logs prog->doReport("Loading DAS logs"); g_log.debug() << "Loading DAS logs" << std::endl; int nPeriods = 1; // Unused std::unique_ptr<const TimeSeriesProperty<int>> periodLog( new const TimeSeriesProperty<int>("period_log")); // Unused LoadEventNexus::runLoadNexusLogs<MatrixWorkspace_sptr>( filename, WS, *this, false, nPeriods, periodLog); // Load the instrument prog->report("Loading instrument"); g_log.debug() << "Loading instrument" << std::endl; LoadEventNexus::runLoadInstrument<MatrixWorkspace_sptr>(filename, WS, entry_name, this); // Load the meta data, but don't stop on errors prog->report("Loading metadata"); g_log.debug() << "Loading metadata" << std::endl; try { LoadEventNexus::loadEntryMetadata(filename, WS, entry_name); } catch (std::exception &e) { g_log.warning() << "Error while loading meta data: " << e.what() << std::endl; } // Set the spectrum number/detector ID at each spectrum. This is consistent // with LoadEventNexus for non-ISIS files. prog->report("Building Spectra Mapping"); g_log.debug() << "Building Spectra Mapping" << std::endl; WS->rebuildSpectraMapping(false); // And map ID to WI g_log.debug() << "Mapping ID to WI" << std::endl; const auto id_to_wi = WS->getDetectorIDToWorkspaceIndexMap(); // Load each bank sequentially // PARALLEL_FOR1(WS) for (auto bankName : bankNames) { // PARALLEL_START_INTERUPT_REGION prog->report("Loading bank " + bankName); g_log.debug() << "Loading bank " << bankName << std::endl; loadBank(filename, entry_name, bankName, WS, id_to_wi); // PARALLEL_END_INTERUPT_REGION } // PARALLEL_CHECK_INTERUPT_REGION // Set some units if (m_xUnits == "Ang") WS->getAxis(0)->setUnit("dSpacing"); else if (m_xUnits == "invAng") WS->getAxis(0)->setUnit("MomentumTransfer"); else // Default to TOF for any other string WS->getAxis(0)->setUnit("TOF"); WS->setYUnit("Counts"); // Set to the output setProperty("OutputWorkspace", WS); delete prog; }
void bezier_anything(t_bezier *x, t_symbol *s, short ac, t_atom *av) { t_atom *coords; short i; coords = x->b_coords; for (i=0; i < ac; i++) { switch (av[i].a_type) { case A_LONG: av[i].a_w.w_float = (double)av[i].a_w.w_long; break; case A_SYM: error("wrong argument type for anything"); break; } } if (s == gensym("report")) { doReport(x); } else if(s == gensym("set")) { if (ac == 8){ x->b_mode = 0; } else if (ac == 12){ x->b_mode = 1; } else if (ac == 6){ x->b_mode = 2; } else if (ac == 9){ x->b_mode = 3; } for (i=0; i < ac; i++){ x->b_coords[i].a_w.w_float = av[i].a_w.w_float; } } else if(s == gensym("steps")) { if (av[0].a_w.w_float <= 2){ x->b_steps = 2; } else if(av[0].a_w.w_float >= 2){ x->b_steps = (long)av[0].a_w.w_float; } } else if(s == gensym("mode")) { if (av[0].a_w.w_float == 0){ x->b_mode = 0; } else if(av[0].a_w.w_float != 0){ x->b_mode = 1; } } else if(s == gensym("last")) { if (av[0].a_w.w_float == 0){ x->b_last = 0; } else if(av[0].a_w.w_float != 0){ x->b_last = 1; } } }