-
Notifications
You must be signed in to change notification settings - Fork 84
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
Conversation
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
Fixes wpilibsuite#270 Adds a few helper methods to Registry to register collections of items and a non-throwing registerIfAbsent() method
What's going on with SendableChooserAdapter here? seems to have disappeared? |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch-all?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gets or creates??
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
has merge conflicts |
Codecov Report
@@ 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
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