QAxWidgetPropertySheet::QAxWidgetPropertySheet(QDesignerAxWidget *object, QObject *parent) : QDesignerPropertySheet(object, parent), m_controlProperty(controlPropertyName), m_propertyGroup(QLatin1String("QAxWidget")) { if (!axWidget()->loaded()) { // For some obscure reason.... const int controlIndex = QDesignerPropertySheet::indexOf(m_controlProperty); setPropertyGroup(controlIndex, m_propertyGroup); } }
/** Add Box-controller-specific properties to this algorithm * * @param SplitInto :: default parameter value * @param SplitThreshold :: default parameter value * @param MaxRecursionDepth :: default parameter value */ void BoxControllerSettingsAlgorithm::initBoxControllerProps( const std::string &SplitInto, int SplitThreshold, int MaxRecursionDepth) { auto mustBePositive = boost::make_shared<BoundedValidator<int>>(); mustBePositive->setLower(0); auto mustBeMoreThen1 = boost::make_shared<BoundedValidator<int>>(); mustBeMoreThen1->setLower(1); // Split up comma-separated properties std::vector<int> value; typedef Poco::StringTokenizer tokenizer; tokenizer values(SplitInto, ",", tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM); value.clear(); value.reserve(values.count()); for (tokenizer::Iterator it = values.begin(); it != values.end(); ++it) value.push_back(boost::lexical_cast<int>(*it)); declareProperty( new ArrayProperty<int>("SplitInto", value), "A comma separated list of into how many sub-grid elements each " "dimension should split; " "or just one to split into the same number for all dimensions. Default " + SplitInto + "."); declareProperty( new PropertyWithValue<int>("SplitThreshold", SplitThreshold, mustBePositive), "How many events in a box before it should be split. Default " + Strings::toString(SplitThreshold) + "."); declareProperty(new PropertyWithValue<int>( "MaxRecursionDepth", MaxRecursionDepth, mustBeMoreThen1), "How many levels of box splitting recursion are allowed. " "The smallest box will have each side length :math:`l = " "(extents) / (SplitInto^{MaxRecursionDepth}).` " "Default " + Strings::toString(MaxRecursionDepth) + "."); std::string grp = getBoxSettingsGroupName(); setPropertyGroup("SplitInto", grp); setPropertyGroup("SplitThreshold", grp); setPropertyGroup("MaxRecursionDepth", grp); }
LayoutPropertySheet::LayoutPropertySheet(QLayout *l, QObject *parent) : QDesignerPropertySheet(l, parent), m_layout(l) { const QString layoutGroup = QLatin1String("Layout"); int pindex = createFakeProperty(QLatin1String(leftMargin), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(topMargin), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(rightMargin), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(bottomMargin), 0); setPropertyGroup(pindex, layoutGroup); const int visibleMask = LayoutProperties::visibleProperties(m_layout); if (visibleMask & LayoutProperties::HorizSpacingProperty) { pindex = createFakeProperty(QLatin1String(horizontalSpacing), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(verticalSpacing), 0); setPropertyGroup(pindex, layoutGroup); setAttribute(indexOf(QLatin1String(spacing)), true); } setAttribute(indexOf(QLatin1String(margin)), true); #ifdef USE_LAYOUT_SIZE_CONSTRAINT // SizeConstraint cannot possibly be handled as a real property // as it affects the layout parent widget and thus // conflicts with Designer's special layout widget. // It will take effect on the preview only. pindex = createFakeProperty(QLatin1String(sizeConstraint)); setPropertyGroup(pindex, layoutGroup); #endif }
/** * Initialise the algorithm. Declare properties which can be set before * execution (input) or * read from after the execution (output). */ void LoadBBY::init() { // Specify file extensions which can be associated with a specific file. std::vector<std::string> exts; // Declare the Filename algorithm property. Mandatory. Sets the path to the // file to load. exts.clear(); exts.emplace_back(".tar"); declareProperty(Kernel::make_unique<API::FileProperty>( FilenameStr, "", API::FileProperty::Load, exts), "The input filename of the stored data"); // mask exts.clear(); exts.emplace_back(".xml"); declareProperty(Kernel::make_unique<API::FileProperty>( MaskStr, "", API::FileProperty::OptionalLoad, exts), "The input filename of the mask data"); // OutputWorkspace declareProperty( Kernel::make_unique<API::WorkspaceProperty<API::IEventWorkspace>>( "OutputWorkspace", "", Kernel::Direction::Output)); // FilterByTofMin declareProperty(Kernel::make_unique<Kernel::PropertyWithValue<double>>( FilterByTofMinStr, 0, Kernel::Direction::Input), "Optional: To exclude events that do not fall within a range " "of times-of-flight. " "This is the minimum accepted value in microseconds. Keep " "blank to load all events."); // FilterByTofMax declareProperty(Kernel::make_unique<Kernel::PropertyWithValue<double>>( FilterByTofMaxStr, EMPTY_DBL(), Kernel::Direction::Input), "Optional: To exclude events that do not fall within a range " "of times-of-flight. " "This is the maximum accepted value in microseconds. Keep " "blank to load all events."); // FilterByTimeStart declareProperty( Kernel::make_unique<Kernel::PropertyWithValue<double>>( FilterByTimeStartStr, 0.0, Kernel::Direction::Input), "Optional: To only include events after the provided start time, in " "seconds (relative to the start of the run)."); // FilterByTimeStop declareProperty( Kernel::make_unique<Kernel::PropertyWithValue<double>>( FilterByTimeStopStr, EMPTY_DBL(), Kernel::Direction::Input), "Optional: To only include events before the provided stop time, in " "seconds (relative to the start of the run)."); // period and phase declareProperty(Kernel::make_unique<Kernel::PropertyWithValue<double>>( PeriodMasterStr, EMPTY_DBL(), Kernel::Direction::Input), "Optional"); declareProperty(Kernel::make_unique<Kernel::PropertyWithValue<double>>( PeriodSlaveStr, EMPTY_DBL(), Kernel::Direction::Input), "Optional"); declareProperty(Kernel::make_unique<Kernel::PropertyWithValue<double>>( PhaseSlaveStr, EMPTY_DBL(), Kernel::Direction::Input), "Optional"); std::string grpOptional = "Filters"; setPropertyGroup(FilterByTofMinStr, grpOptional); setPropertyGroup(FilterByTofMaxStr, grpOptional); setPropertyGroup(FilterByTimeStartStr, grpOptional); setPropertyGroup(FilterByTimeStopStr, grpOptional); std::string grpPhaseCorrection = "Phase Correction"; setPropertyGroup(PeriodMasterStr, grpPhaseCorrection); setPropertyGroup(PeriodSlaveStr, grpPhaseCorrection); setPropertyGroup(PhaseSlaveStr, grpPhaseCorrection); }
LayoutPropertySheet::LayoutPropertySheet(QLayout *l, QObject *parent) : QDesignerPropertySheet(l, parent), m_layout(l) { const QString layoutGroup = QLatin1String("Layout"); int pindex = createFakeProperty(QLatin1String(leftMargin), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(topMargin), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(rightMargin), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(bottomMargin), 0); setPropertyGroup(pindex, layoutGroup); const int visibleMask = LayoutProperties::visibleProperties(m_layout); if (visibleMask & LayoutProperties::HorizSpacingProperty) { pindex = createFakeProperty(QLatin1String(horizontalSpacing), 0); setPropertyGroup(pindex, layoutGroup); pindex = createFakeProperty(QLatin1String(verticalSpacing), 0); setPropertyGroup(pindex, layoutGroup); setAttribute(indexOf(QLatin1String(spacing)), true); } setAttribute(indexOf(QLatin1String(margin)), true); // Stretch if (visibleMask & LayoutProperties::BoxStretchProperty) { pindex = createFakeProperty(QLatin1String(boxStretchPropertyC), QByteArray()); setPropertyGroup(pindex, layoutGroup); setAttribute(pindex, true); } else { // Add the grid per-row/column stretch and size limits if (visibleMask & LayoutProperties::GridColumnStretchProperty) { const QByteArray empty; pindex = createFakeProperty(QLatin1String(gridRowStretchPropertyC), empty); setPropertyGroup(pindex, layoutGroup); setAttribute(pindex, true); pindex = createFakeProperty(QLatin1String(gridColumnStretchPropertyC), empty); setPropertyGroup(pindex, layoutGroup); setAttribute(pindex, true); pindex = createFakeProperty(QLatin1String(gridRowMinimumHeightPropertyC), empty); setPropertyGroup(pindex, layoutGroup); setAttribute(pindex, true); pindex = createFakeProperty(QLatin1String(gridColumnMinimumWidthPropertyC), empty); setPropertyGroup(pindex, layoutGroup); setAttribute(pindex, true); } } #ifdef USE_LAYOUT_SIZE_CONSTRAINT // SizeConstraint cannot possibly be handled as a real property // as it affects the layout parent widget and thus // conflicts with Designer's special layout widget. // It will take effect on the preview only. pindex = createFakeProperty(QLatin1String(sizeConstraint)); setPropertyGroup(pindex, layoutGroup); #endif }
/** Initialize the algorithm, i.e, declare properties */ void LoadEventPreNexus2::init() { // which files to use vector<string> eventExts(EVENT_EXTS, EVENT_EXTS + NUM_EXT); declareProperty( Kernel::make_unique<FileProperty>(EVENT_PARAM, "", FileProperty::Load, eventExts), "The name of the neutron event file to read, including its full or " "relative path. In most cases, the file typically ends in " "neutron_event.dat (N.B. case sensitive if running on Linux)."); vector<string> pulseExts(PULSE_EXTS, PULSE_EXTS + NUM_EXT); declareProperty(Kernel::make_unique<FileProperty>( PULSEID_PARAM, "", FileProperty::OptionalLoad, pulseExts), "File containing the accelerator pulse information; the " "filename will be found automatically if not specified."); declareProperty( Kernel::make_unique<FileProperty>(MAP_PARAM, "", FileProperty::OptionalLoad, ".dat"), "File containing the pixel mapping (DAS pixels to pixel IDs) file " "(typically INSTRUMENT_TS_YYYY_MM_DD.dat). The filename will be found " "automatically if not specified."); // which pixels to load declareProperty(Kernel::make_unique<ArrayProperty<int64_t>>(PID_PARAM), "A list of individual spectra (pixel IDs) to read, specified " "as e.g. 10:20. Only used if set."); auto mustBePositive = boost::make_shared<BoundedValidator<int>>(); mustBePositive->setLower(1); declareProperty("ChunkNumber", EMPTY_INT(), mustBePositive, "If loading the file by sections ('chunks'), this is the " "section number of this execution of the algorithm."); declareProperty("TotalChunks", EMPTY_INT(), mustBePositive, "If loading the file by sections ('chunks'), this is the " "total number of sections."); // TotalChunks is only meaningful if ChunkNumber is set // Would be nice to be able to restrict ChunkNumber to be <= TotalChunks at // validation setPropertySettings("TotalChunks", make_unique<VisibleWhenProperty>( "ChunkNumber", IS_NOT_DEFAULT)); std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", boost::make_shared<StringListValidator>(propOptions), "Use multiple cores for loading the data?\n" " Auto: Use serial loading for small data sets, parallel " "for large data sets.\n" " Serial: Use a single core.\n" " Parallel: Use all available cores."); // the output workspace name declareProperty(Kernel::make_unique<WorkspaceProperty<IEventWorkspace>>( OUT_PARAM, "", Direction::Output), "The name of the workspace that will be created, filled " "with the read-in " "data and stored in the [[Analysis Data Service]]."); declareProperty(Kernel::make_unique<WorkspaceProperty<MatrixWorkspace>>( "EventNumberWorkspace", "", Direction::Output, PropertyMode::Optional), "Workspace with number of events per pulse"); // Some debugging options auto mustBeNonNegative = boost::make_shared<BoundedValidator<int>>(); mustBeNonNegative->setLower(0); declareProperty("DBOutputBlockNumber", EMPTY_INT(), mustBeNonNegative, "Index of the loading block for debugging output. "); declareProperty("DBNumberOutputEvents", 40, mustBePositive, "Number of output events for debugging purpose. Must be " "defined with DBOutputBlockNumber."); declareProperty("DBNumberOutputPulses", EMPTY_INT(), mustBePositive, "Number of output pulses for debugging purpose. "); std::string dbgrp = "Investigation Use"; setPropertyGroup("EventNumberWorkspace", dbgrp); setPropertyGroup("DBOutputBlockNumber", dbgrp); setPropertyGroup("DBNumberOutputEvents", dbgrp); setPropertyGroup("DBNumberOutputPulses", dbgrp); }