Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General housekeeping cleanup #306

Merged
merged 10 commits into from
Dec 21, 2017
Merged

Conversation

SamCarlberg
Copy link
Member

Fixes lots of minor issues:

Also improves performance of previewing tiles from dropped sources by caching the size rather than creating and computing the size of a new widget/layout EVERY time the mouse is moved while dragging

Replaces most instances of "Smartdashboard" to "Shuffleboard", except for the Smartdashboard tab since that contains stuff in the Smartdashboard table from the robot
Fixes wpilibsuite#44
Also improves performance of previewing tiles from dropped sources by caching the size of the widget rather than creating a new widget/layout EVERY time the mouse is moved while dragging
Fixes wpilibsuite#115
@SamCarlberg SamCarlberg added bugfix Fixes one or more bugs housekeeping labels Nov 21, 2017
Fixes wpilibsuite#270
Adds a few helper methods to Registry to register collections of items and a non-throwing registerIfAbsent() method
@nightpool
Copy link
Contributor

What's going on with SendableChooserAdapter here? seems to have disappeared?

@SamCarlberg
Copy link
Member Author

It was unused so it was removed. Serializers for FRC data types should be all-or-nothing; having just one adapter for one data type out of many just isn't good. It implies that we support serializing FRC data not from NetworkTables, which we don't

/**
* Registry of data types in shuffleboard. This class also provides data types for various "wildcard" types, as well as
* types for primitive and arrays of primitive data. These types are always registered and may not be unregistered.
*/
public class DataTypes extends Registry<DataType> {

// TODO replace with DI eg Guice
private static DataTypes defaultInstance = null;

// Catchall or wildcard types
Copy link
Member

@JLLeitschuh JLLeitschuh Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catch-all?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just an alternate spelling.

* The default data types. None of these may be unregistered.
*/
private static final ImmutableCollection<DataType<?>> defaultTypes = ImmutableSet.of(
// catchall
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch-all

@@ -17,6 +19,16 @@

static {
Runtime.getRuntime().addShutdownHook(new Thread(Serializers::cleanUpAll));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level, can you explain why this is necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleans up serializers eg by closing file handles or finalizing recorded video files. Otherwise recorded video files would be unreadable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. So this only works if the app fails "gracefully" then (instead of via force-quit).

@@ -409,6 +409,9 @@ public boolean isOverlapping(int col, int row, int tileWidth, int tileHeight, Pr
return false;
}

/**
* Gets the layout of a tile in this tile pane.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gets or creates??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It computes the layout and stores it in a data object? It only "creates" a layout in the very narrow sense that a new data object is created to contain it


public static final Predicate<Node> isResizedTile = n -> n instanceof Tile && isResizedTile((Tile) n);

private static final AtomicReference<Tile<?>> currentTile = new AtomicReference<>(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit concerning. Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's so that the widget pane can ignore the tile being resized when previewing its layout. Otherwise the highlight would always be red/"invalid" instead of only when it intersects with another tile

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this but I don't have a better solution that doesn't involve some sort of DI framework.

Eg. The GRIP Drag service: https://github.com/WPIRoboticsProjects/GRIP/blob/1c1a5f6faa310dfd82b576632c46f2e9e00dc728/ui/src/main/java/edu/wpi/grip/ui/dragging/DragService.java

import static org.junit.jupiter.api.Assertions.assertEquals;


public class SendableChooserAdapterTest extends AbstractAdapterTest<SendableChooserData> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you not supporting SenableChooser's anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All data recording for FRC data types is currently done by the NetworkTableSourceType to reduce file size. See #306 (comment)

@bradamiller
Copy link

has merge conflicts

@codecov-io
Copy link

Codecov Report

Merging #306 into master will increase coverage by 1.16%.
The diff coverage is 32.25%.

@@             Coverage Diff              @@
##             master     #306      +/-   ##
============================================
+ Coverage     20.55%   21.72%   +1.16%     
- Complexity      434      464      +30     
============================================
  Files           203      203              
  Lines          5292     5334      +42     
  Branches        407      413       +6     
============================================
+ Hits           1088     1159      +71     
+ Misses         4141     4103      -38     
- Partials         63       72       +9

Lower minimum size to 32px
Set minimum sizes for various widgets
FXML was missing the root ID tag
Also add a sanity check to avoid similar regressions in the future
@bradamiller bradamiller merged commit ead9bfb into wpilibsuite:master Dec 21, 2017
@SamCarlberg SamCarlberg deleted the housekeeping branch December 21, 2017 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes one or more bugs housekeeping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants