1
0
Fork 0
Commit graph

13560 commits

Author SHA1 Message Date
Florent Rougon
9a044a474b Add-ons: new Addon methods to access the storage area beneath $FG_HOME/Export
New methods Addon::createStorageDir() and Addon::getStoragePath() with
corresponding Nasal bindings in the addons.Addon ghost:

  createStorageDir() method (returns the dir, doesn't fail if it already
                     exists)
  storagePath        read-only attribute to get the dir

The directory reserved for each add-on is
$FG_HOME/Export/Addons/ADDON_ID, but please use the above methods (or
the corresponding C++ ones) to avoid hardcoding such paths in your code.

Also create directory $FG_HOME/Export/Addons in fgInitConfig() as a way
of reserving the namespace, in order to prevent future failures in case
someone would have the strange idea to create it as a file...
2018-03-11 11:30:05 +01:00
Richard Harrison
10caef48b1 Change YASim solution failure message to display as an alert; but not to call exit().
It is the call to exit that causes FG to lock up and become a zombie.

Alternative is to throw an exception, i.e.:
       throw sg_error(std::string("YASim SOLUTION FAILURE:") + a->getFailureMsg(););
2018-03-07 03:09:45 +01:00
James Turner
7b7e50741f Launcher: fix preview image aspect ratio
Accidentally left in a hard-coded 16:9 ratio, no wonder some images got
squished. Shuttle is now re-elongated verticallitaly :)
2018-03-06 18:34:54 +00:00
Richard Harrison
ab8ca2d832 Merge remote-tracking branch 'main-source/next' into next 2018-03-05 23:34:28 +01:00
Richard Harrison
e953951820 Merge remote-tracking branch 'jsb/yasim' into next
This adds the fix for non converging aircraft. Henning has performed a thorough analysis of all of FGAddon and other repositories and there are a few models that fail, however there have always been a few that fail - but with this patch this situation is improving.
2018-03-05 23:32:06 +01:00
James Turner
5020e4655e Launcher: explicit sizes in aircraft list
Fix some scaling issues when mixing pixel- and point- sized fonts,
especially on Windows
2018-03-05 10:49:30 +00:00
Henning Stahlke
12b2022503 YASim add error message, solver shall not quit silently. 2018-03-04 22:18:45 +01:00
James Turner
7f815c4c51 Remove non-functional transparency from PUI map
This alpha blending never worked, and now it really doesn’t work, so
remove it (PUI map is not long for this world, anyway)
2018-03-01 15:55:41 +00:00
James Turner
6e6fafd5b4 Launcher: fix on-disk aircraft variant previews
This fixes e.g the issue with the Shuttle reported by Thorsten, variant
previews are now shown correctly.
2018-03-01 15:39:46 +00:00
James Turner
e571564c59 Launcher: tweak to be compatible with older Qt 2018-03-01 11:34:53 +00:00
James Turner
f760b8cd8f Launcher: fixes for invalid catalog handling 2018-02-28 17:56:40 +00:00
Florent Rougon
f2c050d476 Add-ons: re-add implementation of Addon::getUrls()
The implementation of Addon::getUrls() was mistakenly removed in commit
a137aed541, re-add it.
2018-02-27 13:17:42 +01:00
Florent Rougon
a9084ac561 Add-ons: make NewGUI read dialogs from $addon_dir/gui/dialogs
As for aircraft, an add-on can now add its custom dialogs in
$addon_dir/gui/dialogs. This commit makes NewGUI consider this directory
as a dialog-providing one for each registered add-on.
2018-02-27 13:17:42 +01:00
Florent Rougon
30cfbd1f91 Add-ons: load add-on-specific menu bar items from addon-menubar-items.xml
If an add-on has a file named addon-menubar-items.xml in its base
directory, load it and add its items to the FG menubar.

Logically, fgStartNewReset() should call
flightgear::addons::AddonManager::instance()->addAddonMenusToFGMenubar()
in order to re-add the items, however doing so would cause the
add-on-specific menus to be added one more time on every reset, because
for some reason, commit 45ea8b5daa added
the PRESERVE attribute to /sim/menubar (apparently to preserve the state
of menu entries upon reset?).

Note: the addon-menubar-items.xml files are reloaded during reset,
      however the menu bar doesn't reflect this, since adding the
      reloaded items to the menu bar in fgStartNewReset() would cause
      the add-on-specific menus to appear several times in the menu bar,
      as explained above.
2018-02-27 13:17:42 +01:00
James Turner
4f96039e70 Fix a crash when package data is missing
This may explain some of the erratic startup crashes, due to the
master catalog being out of date for 2018.*
2018-02-27 11:33:40 +00:00
Richard Harrison
a6718cc73d 2018.1: fix default Airport.
As it says in the comments this really shouldn't be hardcoded...
2018-02-27 05:09:11 +01:00
Thomas Geymayer
82078b632b canvas GUI: Cleanup and trigger dragstart/end events 2018-02-25 14:59:56 +01:00
Henning Stahlke
25e34cc49c YASim solver convergence workaround 2018-02-21 07:47:04 +01:00
Thomas Geymayer
e295d991a6 Canvas/PUI: Fix interfering drag 2018-02-21 07:31:47 +01:00
Henning Stahlke
c2e7842110 YASim: attempt to fix MAC calculation for multiple wing sections. 2018-02-20 11:03:40 +01:00
Torsten Dreyer
1727af3638 new version: 2018.2.0 2018-02-18 21:22:57 +01:00
Torsten Dreyer
10e7708e9d new version: 2018.1.1 2018-02-18 21:22:57 +01:00
Florent Rougon
c7f6c55423 terrasync.py: user-friendly error message when no 'path' found in .dirindex
During the recent SourceForge migration, the TerraSync server hosted
there used to send .dirindex files with the following contents:

  Project web is currently offline pending the final migration of its
  data to our new datacenter.

Make sure terrasync.py aborts with a user-understandable error in such a
case.
2018-02-18 20:22:58 +01:00
Florent Rougon
5cca99bbae virtual_path.py: add more functions and properties to VirtualPath
Add more functions and properties to VirtualPath that directly
correspond to functions and properties of pathlib.PurePath, except that
types are adapted of course, and that for API consistency, VirtualPath
methods use mixedCaseStyle whereas those of pathlib.PurePath use
underscore_style.
2018-02-18 19:04:58 +01:00
Florent Rougon
dd4fc36a9d terrasync.py: make assert statements more useful
When the second argument of an assert statement is a string, using
repr() is more helpful than relying on the default representation.
2018-02-18 19:04:58 +01:00
Richard Harrison
48563acdd2 Multiplayer: lag adjustment clock mode initialization.
Ensure the property is initialized to zero during AI MP model binding.
2018-02-17 12:22:14 +01:00
Richard Harrison
40a602d732 Multiplayer: lag adjustment.
Preparation for work on the synchronisation and lag prediction filters that jano has underway - firstly by adding a property to indicate the mode of the clock being used. Pre 2018.1 will be mode 0.
2018-02-16 23:49:27 +01:00
James Turner
234320fe9d Launcher: basic aircraft state selection
Automatic selection in the launcher is disabled for now, since
it needs more testing before release, but the basic UI for selection
is straightforward enough to throw in.
2018-02-11 21:28:25 +00:00
James Turner
a05cdce793 Telent protocol Nasal command 2018-02-11 21:15:45 +00:00
James Turner
bd66bfb696 Fixes spotted by Florent 2018-02-11 21:08:02 +00:00
Henning Stahlke
3bac8b93f2 YASim: revert max solver iterations back to 10000 2018-02-11 16:38:19 +01:00
Henning Stahlke
59c059ddb6 YASim: export wing section MACs 2018-02-11 00:46:10 +01:00
Henning Stahlke
1b21f85c52 YASim CLI tool refactoring 2018-02-11 00:46:10 +01:00
Florent Rougon
da961b97f2 Add-ons: more specific file names for the interface between FG core and add-ons
The add-on framework now uses the following files in each add-on
directory:
  - addon-config.xml (previously: config.xml)
  - addon-main.nas   (previously: main.nas)

This is consistent with the addon-metadata.xml file that is already part
of the interface between FG core and add-ons. The goal is to make it
clearer, when browsing an add-on directory, which files belong to the
"FG core <-> add-on" interface and which files belong to the add-on
proper. This will be beneficial also when more files are added to the
"FG core <-> add-on" interface, such as possibly addon-events.xml in the
future.

This change is incompatible, thus it is the right time to do *before*
2018.2.1 is out, especially considering that this upcoming release
already has incompatible changes in the add-on API, namely the
requirement of the addon-metadata.xml file and the type of the argument
passed to each add-on's main() function. We'll try harder not to break
compatibility in the add-on API once 2018.2.1 is out. For now, it is
still a good time to try to get the API as clean as possible.
2018-02-10 19:49:02 +01:00
Florent Rougon
5aae639a0d terrasync.py: print full URL in exception messages, pass full URL to callback
Due to some misleading 'url' variable name, network error messages used
to contain things such as '/scenery/Airports/N/E/4/.dirindex' (i.e., the
path on the server) instead of the full URL. For the same reason, the
callback function of HTTPGetCallback objects was passed this
path-on-server instead of the URL. This should all be fixed now.
2018-02-08 00:10:18 +01:00
Florent Rougon
1ae1ecc6c2 terrasync.py: accept paths using backslash separators for --only-subdir
We don't lose anything by accepting this, because using backslashes in
file or dir names is out of question, as Windows users can't see them.
2018-02-07 23:31:38 +01:00
Florent Rougon
cb6b267430 terrasync.py: fix a small formatting issue with --report
Remove unneeded blank lines between listed files or dirs when using
--report.
2018-02-07 11:38:41 +01:00
Florent Rougon
c30298ffce terrasync.py: add option --only-subdir
Option --only-subdir allows one to restrict terrasync.py processing[1]
to a chosen subdirectory of the TerraSync repository. Example:

  terrasync.py --target=/your/TerraSync/repo --only-subdir="Airports/L/F/P"

[1] This works in both 'check' and 'sync' modes.
2018-02-07 11:38:41 +01:00
Florent Rougon
c0e1f29a75 terrasync.py: add and use a VirtualPath class; also add MutableVirtualPath
Add classes VirtualPath and MutableVirtualPath (the latter derived from
the former) to manipulate slash-separated paths where the root '/'
represents the TerraScenery root. This makes it clear what a function
expects when you see that one of its arguments is a VirtualPath
instance: you don't have to ask yourself whether it can start or end
with a slash, how to interpret it, etc. Operating on these paths is also
easy[1], be it to assemble URLs in order to retrieve files or to join
their relative part with a local directory path in order to obtain a
real (deeper) local path.

VirtualPath and MutableVirtualPath are essentially the same; the former
is hashable and therefore has to be immutable, whereas the latter can be
modified in-place with the /= operator (used to append path components),
and therefore can't be hashable. As a consequence, MutableVirtualPath
instances can't be used as dictionary keys, elements of a set or
frozenset, etc.

VirtualPath and MutableVirtualPath use the pathlib.PurePath API where
applicable (part of this API has been implemented in
[Mutable]VirtualPath; more can be added, of course). These classes have
no assumptions related to TerraSync and thus should be fit for use in
other projects.

To convert a [Mutable]VirtualPath instance to a string, just use str()
on it. The result is guaranteed to start with a '/' and not to end with
a '/', except for the virtual root '/'. Upon construction, the given
string is interpreted relatively to the virtual root, i.e.:

  VirtualPath("") == VirtualPath("/")
  VirtualPath("abc/def/ghi") == VirtualPath("/abc/def/ghi")
  etc.

VirtualPath and MutableVirtualPath instances sort like the respective
strings str() converts them too. The __hash__() method of VirtualPath is
based on the type and this string representation, too. Such objects can
only compare equal (using ==) if they have the same type. If you want to
compare the underlying virtual paths inside a VirtualPath and a
MutableVirtualPath, use the samePath() method of either class.

For more info, see scripts/python/TerraSync/terrasync/virtual_path.py
and unit tests in scripts/python/TerraSync/tests/test_virtual_path.py.

[1] Most useful is the / operator, which works as for SGPath:

      VirtualPath("/abc/def/ghi") == VirtualPath("/abc") / "def" / "ghi"
      VirtualPath("/abc/def/ghi") == VirtualPath("/abc") / "def/ghi"
2018-02-07 11:38:41 +01:00
Florent Rougon
e613c81b4c terrasync.py: move custom exception classes to a separate module
Add new module 'terrasync.exceptions' for our custom exception classes.
2018-02-07 11:38:41 +01:00
Florent Rougon
c72de824d2 terrasync.py: more modular code layout
- New directory scripts/python/TerraSync/terrasync.

- Move scripts/python/terrasync.py to
  scripts/python/TerraSync/terrasync/main.py (main module in the new
  structure).

- Add empty __init__.py file to scripts/python/TerraSync/terrasync/ to
  make this directory a Python package.

- Wrap the main code from previous terrasync.py in a main() function of
  the terrasync.main module. Also move command-line arguments parsing to
  a separate parseCommandLine() function.

- Add an executable script scripts/python/TerraSync/terrasync.py for end
  users, that just calls terrasync.main.main().

For end users, the only difference is that they now have to use
scripts/python/TerraSync/terrasync.py instead of
scripts/python/terrasync.py (which doesn't exist anymore, since all this
lives under the scripts/python/TerraSync directory from now on).

This structure will allow to cleanly split the code into modules and to
add unit tests.
2018-02-07 11:38:41 +01:00
Henning Stahlke
365d68891f fix windows compile error 2018-02-04 19:16:09 +01:00
James Turner
a723111903 Prevent Nasal modifying certain properties
(Requires a corresponding SimGear change)
2018-02-04 17:25:32 +00:00
James Turner
b96d4bf315 Limit props/telnet subscription send rate
Prevent FDM-derived properties being sent at full speed (120Hz) which
overloads telnet connections. Instead track dirty properties and
send them at the protocol’s update rate (which is presumably what
the user expects)
2018-02-04 17:07:21 +00:00
James Turner
e4e5cc9394 Merge /u/jsb1685/flightgear/ branch yasim into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/124/
2018-02-04 09:09:40 +00:00
Henning Stahlke
c985c19735 YASim: add variables for solver parameters 2018-02-03 21:27:26 +01:00
Florent Rougon
eb23f8906d terrasync.py: use os.path.abspath() in TerraSync.setTarget()
Using os.path.abspath() here in TerraSync.setTarget() adds a safety
layer in case the process later calls os.chdir() or similar[1], which
would change the meaning of the "." directory. Also remove the strip()
call which I don't consider useful here, see my message at:

  https://sourceforge.net/p/flightgear/mailman/message/36208140/

[1] Not the case currently, but who knows what will happen in the
    future...
2018-02-03 11:22:56 +01:00
Florent Rougon
77513a2498 terrasync.py: update script header
In particular, terrasync.py appears *not* to require dnspython. :-)
2018-02-03 11:22:56 +01:00
Florent Rougon
8693e442d7 terrasync.py: add options --mode and --report
You may now call terrasync.py with --mode=sync or --mode=check. 'sync'
mode is the default and corresponds to terrasync.py's usual behavior.

In 'check' mode, terrasync.py never writes to disk and aborts at the
first mismatch between local and remote data. The exit status in 'check'
mode is:
  - 0 if the program terminated successfully and no mismatch was found
    between the local and remote repositories;
  - 1 in case an error was encountered;
  - 2 if there was a mismatch between local and remote data.

In 'sync' mode, the exit status is:
  - 0 if the program terminated successfully;
  - 1 in case an error was encountered.

A mismatch in 'check' mode is *not* an error, it is just one of the two
expected results. An error is a worse condition (uncaught exception,
network retrieval aborted after retrying failed, stuff like that).

Additionally, calling terrasync.py with --report causes it to print
lists of:
  - files and dirs that were missing or had mismatching hashes (this is
    okay in 'sync' mode: these things have been "fixed" in the target
    directory before the report was printed);
  - files and dirs that have been found to be orphaned (i.e., found
    under the target directory but not mentioned in the corresponding
    .dirindex file). These are the ones removed in 'sync' mode when
    --remove-orphan is passed.
2018-02-03 11:22:56 +01:00
Florent Rougon
6d323bbbdc terrasync.py: prepare the terrain for --mode and --report
- Add computeHash() utility function that can work with any file-like
  object (e.g., a connected socket).

- Rename hash_of_file() to hashForFile(), and of course implement it
  using our new computeHash().

- Add class HTTPSocketRequest derived from HTTPGetCallback. It allows
  one to process data from the network without storing it to a file (it
  uses the file-like interface provided by http.client.HTTPResponse).

  The callback returns the http.client.HTTPResponse object, which can be
  conveniently used in a 'with' statement.

- Simplify the API of TerraSync.updateDirectory(): its 'dirIndexHash'
  argument must now be a hash (a string); the None object is not allowed
  anymore (with the soon-to-come addition of --mode=check, having to
  deal with this special case in updateDirectory() would make the logic
  too difficult to follow, or we would have to really completely
  separate check-only mode from update mode, which would entail code
  duplication).

  Since TerraSync.updateDirectory() must now always have a hash to work
  with, compute the hash of the root '.dirindex' file from the server in
  TerraSync.start(), using our new HTTPSocketRequest class---which was
  written for this purpose, since that will have to work in check-only
  mode (but not only), where we don't want to write any file to disk.

- TerraSync.updateFile(): correctly handle the case where a directory
  inside the TerraSync repository is (now) a file according to the
  server: the directory must be recursively removed before the file can
  be downloaded in the place formerly occupied by the directory.

- Add stub class Report. Its methods do nothing for now, but are already
  called in a couple of appropriate places. The class will be completed
  in a future commit, of course.
2018-02-03 11:22:56 +01:00