mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
* Options > Data Fields > Processors & Automation (renamed from
"Processing")
* Modernized the UI
* Added UI to set Automation (None, On Import, On Save) for all
processors
* Added UI to set Automated execution only for all processors
* Showing the processors description
* Showing the processors setting (if available) in a more userfriendly
way
* Added option to add / delete / edit custom Python processors
* Enabled editing of Python processors via double click
* Added option to hide code processors
* Removed the submenu to manage Python Fixes from the Edit-menu
* Renamed the Edit-menu to "Process"
* Hiding "automated only"-processors from Process-menu and
Batchprocessing-dialog
* DataProcessors
* Turned configuration of all core processors into forms
* Changed the technical name of all core processors to match their
classname
* Added legacy technical name to all core processors to support existing
scripts
* Moved description from config-class to DataProcessor
* Implemented a migration path for existing persisted processor
configurations
* GSettings
* Added method to remove settings by key
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
#include "FixPyDataProcessor.h"
|
|
#include "FixPyRunner.h"
|
|
#include "Athlete.h"
|
|
|
|
// Config widget used by the Preferences/Options config panes
|
|
class FixPyDataProcessorConfig : public DataProcessorConfig
|
|
{
|
|
Q_DECLARE_TR_FUNCTIONS(FixPyDataProcessorConfig)
|
|
|
|
public:
|
|
// there is no config
|
|
FixPyDataProcessorConfig(QWidget *parent) : DataProcessorConfig(parent) {}
|
|
void readConfig() {}
|
|
void saveConfig() {}
|
|
};
|
|
|
|
FixPyDataProcessor::FixPyDataProcessor(FixPyScript *pyScript)
|
|
: pyScript(pyScript)
|
|
{
|
|
}
|
|
|
|
bool FixPyDataProcessor::postProcess(RideFile *rideFile, DataProcessorConfig *settings, QString op)
|
|
{
|
|
Q_UNUSED(settings);
|
|
|
|
QString errText;
|
|
bool useNewThread = op != "PYTHON";
|
|
Context* context = (rideFile) ? rideFile->context : nullptr;
|
|
RideItem* rideItem = nullptr;
|
|
if (context && rideFile) {
|
|
// get RideItem from RideFile for Python functions using it
|
|
foreach(RideItem *item, context->athlete->rideCache->rides()) {
|
|
if (item->dateTime == rideFile->startTime()) {
|
|
rideItem = item;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
FixPyRunner pyRunner(context, rideFile, rideItem, useNewThread);
|
|
return pyRunner.run(pyScript->source, pyScript->iniKey, errText) == 0;
|
|
}
|
|
|
|
DataProcessorConfig *FixPyDataProcessor::processorConfig(QWidget *parent, const RideFile* ride) const
|
|
{
|
|
Q_UNUSED(ride);
|
|
return new FixPyDataProcessorConfig(parent);
|
|
}
|
|
|
|
|
|
QString
|
|
FixPyDataProcessor::explain
|
|
() const
|
|
{
|
|
return tr("Custom Python Data Processor");
|
|
}
|