Skip to content

Commit

Permalink
Updates in Scripting Engine and scripts
Browse files Browse the repository at this point in the history
* Added new method in ConstellationMgr class -
getConstellationsEnglishNames() to get English names of all
constellations in the loaded sky culture;
* The old script 'Constellations Tour' was renamed to the 'Western
Constellations Tour' and updated (fixed behaviour of script);
* Added new one script 'Constellations Tour' to organize the tour around
constellations on the loaded sky culture;
* Fixed documents for core.clear() method;
* Extract new lines for translation.
  • Loading branch information
alex-w committed Dec 23, 2018
1 parent 2cfdb70 commit 73bc649
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 174 deletions.
337 changes: 173 additions & 164 deletions po/stellarium/stellarium.pot

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions scripts/constellations_tour.ssc
Expand Up @@ -2,16 +2,13 @@
// Name: Constellations Tour
// License: Public Domain
// Author: Alexander Wolf
// Shortcut: Ctrl+D,1
// Version: 1.1
// Description: A tour of the western constellations.

include("common_objects.inc");
// Version: 1.0
// Description: A tour of the constellations of the selected sky culture.

core.clear("starchart");
var skyculture = core.getSkyCulture();
core.setSkyCulture("western");
GridLinesMgr.setFlagEquatorGrid(false);
NebulaMgr.setFlagHints(false);
var constellations = ConstellationMgr.getConstellationsEnglishNames();
ConstellationMgr.setFlagArt(false);
ConstellationMgr.setFlagBoundaries(false);
ConstellationMgr.setFlagLines(false);
Expand Down Expand Up @@ -39,4 +36,6 @@ for (i=0; i<constellations.length; i++)
core.wait(10);
ConstellationMgr.setFlagArt(false);
}
core.setSkyCulture(skyculture);

core.setGuiVisible(true);
core.clear("natural");
45 changes: 45 additions & 0 deletions scripts/western_constellations_tour.ssc
@@ -0,0 +1,45 @@
//
// Name: Western Constellations Tour
// License: Public Domain
// Author: Alexander Wolf
// Shortcut: Ctrl+D,1
// Version: 1.2
// Description: A tour of the western constellations.

include("common_objects.inc");

core.clear("starchart");
var skyculture = core.getSkyCulture();
core.setSkyCulture("western");
GridLinesMgr.setFlagEquatorGrid(false);
NebulaMgr.setFlagHints(false);
ConstellationMgr.setFlagArt(false);
ConstellationMgr.setFlagBoundaries(false);
ConstellationMgr.setFlagLines(false);
ConstellationMgr.setFlagLabels(false);
core.setGuiVisible(false);
var id = LabelMgr.labelScreen("Press Ctrl+T to un-hide the toolbar", 100,100, false, 20);
LabelMgr.setLabelShow(id, true);
core.wait(4);
LabelMgr.setLabelShow(id, false);
LabelMgr.deleteLabel(id);
ConstellationMgr.setFlagBoundaries(true);
ConstellationMgr.setFlagLines(true);
ConstellationMgr.setFlagLabels(true);
ConstellationMgr.setFlagIsolateSelected(true);

for (i=0; i<constellations.length; i++)
{
objName = constellations[i];
core.selectConstellationByName(objName);
StelMovementMgr.autoZoomIn(6);
core.wait(1);
StelMovementMgr.zoomTo(40,8);
core.wait(1);
ConstellationMgr.setFlagArt(true);
core.wait(10);
ConstellationMgr.setFlagArt(false);
}
core.setSkyCulture(skyculture);
core.setGuiVisible(true);
core.clear("natural");
9 changes: 9 additions & 0 deletions src/core/modules/ConstellationMgr.cpp
Expand Up @@ -725,6 +725,8 @@ void ConstellationMgr::loadNames(const QString& namesFile)
return;
}

constellationsEnglishNames.clear();

// Now parse the file
// lines to ignore which start with a # or are empty
QRegExp commentRx("^(\\s*#.*|\\s*)$");
Expand Down Expand Up @@ -781,6 +783,8 @@ void ConstellationMgr::loadNames(const QString& namesFile)
// Some skycultures already have empty nativeNames. Fill those.
if (aster->nativeName.isEmpty())
aster->nativeName=aster->englishName;

constellationsEnglishNames << aster->englishName;
}
else
{
Expand All @@ -792,6 +796,11 @@ void ConstellationMgr::loadNames(const QString& namesFile)
qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellation names";
}

QStringList ConstellationMgr::getConstellationsEnglishNames()
{
return constellationsEnglishNames;
}

void ConstellationMgr::loadSeasonalRules(const QString& rulesFile)
{
// Constellation not loaded yet
Expand Down
4 changes: 4 additions & 0 deletions src/core/modules/ConstellationMgr.hpp
Expand Up @@ -275,6 +275,8 @@ public slots:
//! Select all constellations
void selectAllConstellations(void);

QStringList getConstellationsEnglishNames();

signals:
void artDisplayedChanged(const bool displayed) const;
void artFadeDurationChanged(const float duration) const;
Expand Down Expand Up @@ -382,6 +384,8 @@ private slots:

QString lastLoadedSkyCulture; // Store the last loaded sky culture directory name

QStringList constellationsEnglishNames;

//! this controls how constellations (and also star names) are printed: Abbreviated/as-given/translated
ConstellationDisplayStyle constellationDisplayStyle;

Expand Down
2 changes: 1 addition & 1 deletion src/scripting/StelMainScriptAPI.cpp
Expand Up @@ -1090,7 +1090,7 @@ void StelMainScriptAPI::clear(const QString& state)
lmgr->setFlagAtmosphere(false);
lmgr->setFlagFog(false);
zl->setFlagShow(false);
}
}
else if (state.toLower() == "deepspace")
{
movmgr->setMountMode(StelMovementMgr::MountEquinoxEquatorial);
Expand Down
3 changes: 2 additions & 1 deletion src/scripting/StelMainScriptAPI.hpp
Expand Up @@ -215,9 +215,10 @@ public slots:
//! - natural : azimuthal mount, atmosphere, landscape,
//! no lines, labels or markers
//! - starchart : equatorial mount, constellation lines,
//! no landscape, atmosphere etc. labels & markers on.
//! no landscape, atmosphere etc. labels & markers on.
//! - deepspace : like starchart, but no planets, no eq.grid, no markers, no lines.
//! - galactic : like deepspace, but in galactic coordinate system.
//! - supergalactic : like deepspace, but in supergalactic coordinate system.
//! @param state the name of a preset state.
void clear(const QString& state="natural");

Expand Down
3 changes: 3 additions & 0 deletions src/translations.h
Expand Up @@ -586,6 +586,8 @@ class Translations
// TRANSLATORS: Name of script
N_("Constellations Tour");
// TRANSLATORS: Name of script
N_("Western Constellations Tour");
// TRANSLATORS: Name of script
N_("Sun from different planets");
// TRANSLATORS: Name of script
N_("Earth best views from other bodies");
Expand Down Expand Up @@ -657,6 +659,7 @@ class Translations
N_("Phobos races ahead of Mars and transits the sun, passes through it and then retrogrades back towards the sun and just partially transits it again (only seen in the southern hemisphere of Deimos), then Mars totally eclipses the sun while Phobos transits in darkness between Mars and Deimos. When Phobos emerges from Mars it is still eclipsed and dimmed in Mars' shadow, only to light up later.");
N_("Screensaver of various happenings in the Solar System. 300 events in all!");
N_("A tour of the western constellations.");
N_("A tour of the constellations of the selected sky culture.");
N_("Look at the Sun from big planets of Solar System and Pluto.");
N_("Best views of Earth from other Solar System bodies in the 21st Century.");
N_("Transit of Venus as seen from Sydney Australia, 6th June 2012.");
Expand Down

0 comments on commit 73bc649

Please sign in to comment.