-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de7d7a9
commit 2e2ad47
Showing
15 changed files
with
496 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 31 additions & 27 deletions
58
EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/EOCVSimIconLibrary.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
package com.github.serivesmejia.eocvsim.gui | ||
|
||
object EOCVSimIconLibrary { | ||
|
||
val icoEOCVSim by icon("ico_eocvsim", "/images/icon/ico_eocvsim.png", false) | ||
|
||
val icoImg by icon("ico_img", "/images/icon/ico_img.png") | ||
val icoCam by icon("ico_cam", "/images/icon/ico_cam.png") | ||
val icoVid by icon("ico_vid", "/images/icon/ico_vid.png") | ||
|
||
val icoConfig by icon("ico_config", "/images/icon/ico_config.png") | ||
val icoSlider by icon("ico_slider", "/images/icon/ico_slider.png") | ||
val icoTextbox by icon("ico_textbox", "/images/icon/ico_textbox.png") | ||
val icoColorPick by icon("ico_colorpick", "/images/icon/ico_colorpick.png") | ||
|
||
val icoArrowDropdown by icon("ico_arrow_dropdown", "/images/icon/ico_arrow_dropdown.png") | ||
|
||
val icoFlag by icon("ico_flag", "/images/icon/ico_flag.png") | ||
val icoNotStarted by icon("ico_not_started", "/images/icon/ico_not_started.png") | ||
val icoPlay by icon("ico_play", "/images/icon/ico_play.png") | ||
val icoStop by icon("ico_stop", "/images/icon/ico_stop.png") | ||
|
||
val icoGears by icon("ico_gears", "/images/icon/ico_gears.png") | ||
val icoHammer by icon("ico_hammer", "/images/icon/ico_hammer.png") | ||
|
||
val icoColorPickPointer by icon("ico_colorpick_pointer", "/images/icon/ico_colorpick_pointer.png") | ||
|
||
package com.github.serivesmejia.eocvsim.gui | ||
|
||
object EOCVSimIconLibrary { | ||
|
||
val icoEOCVSim by icon("ico_eocvsim", "/images/icon/ico_eocvsim.png", false) | ||
|
||
val icoImg by icon("ico_img", "/images/icon/ico_img.png") | ||
val icoCam by icon("ico_cam", "/images/icon/ico_cam.png") | ||
val icoVid by icon("ico_vid", "/images/icon/ico_vid.png") | ||
|
||
val icoConfig by icon("ico_config", "/images/icon/ico_config.png") | ||
val icoSlider by icon("ico_slider", "/images/icon/ico_slider.png") | ||
val icoTextbox by icon("ico_textbox", "/images/icon/ico_textbox.png") | ||
val icoColorPick by icon("ico_colorpick", "/images/icon/ico_colorpick.png") | ||
|
||
val icoArrowDropdown by icon("ico_arrow_dropdown", "/images/icon/ico_arrow_dropdown.png") | ||
|
||
val icoFlag by icon("ico_flag", "/images/icon/ico_flag.png") | ||
val icoNotStarted by icon("ico_not_started", "/images/icon/ico_not_started.png") | ||
val icoPlay by icon("ico_play", "/images/icon/ico_play.png") | ||
val icoStop by icon("ico_stop", "/images/icon/ico_stop.png") | ||
|
||
val icoGears by icon("ico_gears", "/images/icon/ico_gears.png") | ||
val icoHammer by icon("ico_hammer", "/images/icon/ico_hammer.png") | ||
|
||
val icoColorPickPointer by icon("ico_colorpick_pointer", "/images/icon/ico_colorpick_pointer.png") | ||
|
||
val icoFirstRobotics by icon("ico_first_robotics", "/images/icon/ico_firstrobotics.png", false) | ||
val icoPaperVision by icon("ico_paper_vision", "/images/icon/ico_ezv.png", false) | ||
val icoUser by icon("ico_user", "/images/icon/ico_user.png") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmA.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package com.github.serivesmejia.eocvsim.gui.dialog.iama | ||
|
||
import com.github.serivesmejia.eocvsim.gui.EOCVSimIconLibrary | ||
import com.github.serivesmejia.eocvsim.gui.Visualizer | ||
import java.awt.Dimension | ||
import java.awt.GridBagConstraints | ||
import java.awt.GridBagLayout | ||
import java.awt.GridLayout | ||
import javax.swing.JButton | ||
import javax.swing.JDialog | ||
import javax.swing.JFrame | ||
import javax.swing.JLabel | ||
import javax.swing.JPanel | ||
|
||
class IAmA( | ||
val parent: JFrame, | ||
val visualizer: Visualizer | ||
) { | ||
|
||
val dialog = JDialog(parent) | ||
|
||
init { | ||
dialog.isModal = true | ||
dialog.title = "Welcome !" | ||
|
||
dialog.contentPane.layout = GridBagLayout() | ||
|
||
val text = """ | ||
<b>Welcome to EOCV-Sim! We'll start with a walkthrough.</b><br> | ||
Please select the option that best describes you.<br><br> | ||
<b>I am..</b> | ||
""".trimIndent() | ||
|
||
dialog.contentPane.add(JLabel("<html><div style='text-align: center;'>$text</div></html>").apply { | ||
font = font.deriveFont(14f) | ||
}, GridBagConstraints().apply { | ||
gridx = 0 | ||
gridy = 0 | ||
weightx = 1.0 | ||
weighty = 1.0 | ||
}) | ||
|
||
val buttonsPanel = JPanel().apply { | ||
layout = GridLayout(1, 3, 10, 10) | ||
} | ||
|
||
buttonsPanel.add(JButton( | ||
"<html><div style='text-align: center;'>A FIRST Robotics Team</div></html>", | ||
EOCVSimIconLibrary.icoFirstRobotics.scaleToFit(60, 60) | ||
).apply { | ||
font = font.deriveFont(14f) | ||
horizontalTextPosition = JButton.CENTER | ||
verticalTextPosition = JButton.BOTTOM | ||
|
||
addActionListener { | ||
dialog.dispose() | ||
IAmAFirstRobotics(this@IAmA.parent, visualizer) | ||
} | ||
}) | ||
|
||
buttonsPanel.add(JButton( | ||
"<html><div style='text-align: center;'>A General Public User</div></html>", | ||
EOCVSimIconLibrary.icoUser.scaleToFit(60, 60) | ||
).apply { | ||
font = font.deriveFont(14f) | ||
horizontalTextPosition = JButton.CENTER | ||
verticalTextPosition = JButton.BOTTOM | ||
|
||
addActionListener { | ||
dialog.dispose() | ||
IAmAGeneralPublic(this@IAmA.parent, visualizer) | ||
} | ||
}) | ||
|
||
buttonsPanel.add(JButton( | ||
"<html><div style='text-align: center;'>Specifically Interested<br>in PaperVision</div></html>", | ||
EOCVSimIconLibrary.icoPaperVision.scaleToFit(60, 60) | ||
).apply { | ||
font = font.deriveFont(14f) | ||
horizontalTextPosition = JButton.CENTER | ||
verticalTextPosition = JButton.BOTTOM | ||
|
||
addActionListener { | ||
dialog.dispose() | ||
IAmAPaperVision(this@IAmA.parent, visualizer) | ||
} | ||
}) | ||
|
||
dialog.contentPane.add(buttonsPanel, GridBagConstraints().apply { | ||
gridx = 0 | ||
gridy = 1 | ||
weightx = 1.0 | ||
weighty = 1.0 | ||
}) | ||
|
||
dialog.size = Dimension(600, 250) | ||
dialog.isResizable = false | ||
|
||
dialog.defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE | ||
dialog.setLocationRelativeTo(null) | ||
dialog.isVisible = true | ||
} | ||
|
||
} |
115 changes: 115 additions & 0 deletions
115
EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmAFirstRobotics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package com.github.serivesmejia.eocvsim.gui.dialog.iama | ||
|
||
import com.github.serivesmejia.eocvsim.gui.Visualizer | ||
import java.awt.Desktop | ||
import java.awt.GridBagConstraints | ||
import java.awt.GridBagLayout | ||
import java.net.URI | ||
import javax.swing.BorderFactory | ||
import javax.swing.Box | ||
import javax.swing.BoxLayout | ||
import javax.swing.JButton | ||
import javax.swing.JDialog | ||
import javax.swing.JFrame | ||
import javax.swing.JLabel | ||
import javax.swing.JPanel | ||
|
||
class IAmAFirstRobotics( | ||
parent: JFrame, | ||
visualizer: Visualizer | ||
) { | ||
|
||
private val dialog = JDialog(parent).apply { | ||
isModal = true | ||
title = "Welcome !" | ||
contentPane.layout = GridBagLayout() | ||
|
||
isResizable = false | ||
setSize(520, 230) | ||
setLocationRelativeTo(null) | ||
} | ||
|
||
init { | ||
// Create the contents panel | ||
val contentsPanel = JPanel(GridBagLayout()) | ||
|
||
contentsPanel.border = BorderFactory.createEmptyBorder(10, 0, 0, 0) | ||
|
||
val contentText = """ | ||
<b>Hey FTC teams! EOCV-Sim helps you develop EasyOpenCV pipelines<br> | ||
without needing to always have the robot hardware at hand.</b><br><br> | ||
Work with code identical to the FtcRobotController, iterate with tools like the<br> | ||
variable tuner, and quickly visualize your code changes using workspaces.<br><br> | ||
<b>Click on "Open Docs"</b> to learn more about EOCV-Sim and workspaces.<br> | ||
""".trimIndent() | ||
|
||
// Add a descriptive JLabel to the contents panel | ||
contentsPanel.add( | ||
JLabel("<html><div style='text-align: center;'>$contentText</div></html>").apply { | ||
font = font.deriveFont(14f) | ||
horizontalAlignment = JLabel.CENTER | ||
}, | ||
GridBagConstraints().apply { | ||
gridx = 0 | ||
gridy = 0 | ||
weightx = 1.0 | ||
weighty = 1.0 | ||
fill = GridBagConstraints.BOTH | ||
} | ||
) | ||
|
||
// Create the buttons panel | ||
val buttonsPanel = JPanel().apply { | ||
layout = BoxLayout(this, BoxLayout.X_AXIS) | ||
|
||
add(Box.createHorizontalGlue()) // Align the button to the right | ||
|
||
add(JButton("Open Docs").apply { | ||
addActionListener { | ||
// open webpage | ||
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { | ||
Desktop.getDesktop().browse(URI("https://docs.deltacv.org/eocv-sim")); | ||
} | ||
} | ||
}) | ||
|
||
add(Box.createHorizontalStrut(10)) // Add some space between the buttons | ||
|
||
add(JButton("Next").apply { | ||
addActionListener { | ||
dialog.dispose() // Close the dialog on click | ||
IAmAPaperVision(parent, visualizer) | ||
} | ||
}) | ||
|
||
border = BorderFactory.createEmptyBorder(0, 10, 10, 10) | ||
} | ||
|
||
// Add the contents panel to the dialog | ||
dialog.contentPane.add( | ||
contentsPanel, | ||
GridBagConstraints().apply { | ||
gridx = 0 | ||
gridy = 0 | ||
weightx = 1.0 | ||
weighty = 1.0 | ||
fill = GridBagConstraints.BOTH | ||
} | ||
) | ||
|
||
// Add the buttons panel to the dialog | ||
dialog.contentPane.add( | ||
buttonsPanel, | ||
GridBagConstraints().apply { | ||
gridx = 0 | ||
gridy = 1 | ||
weightx = 1.0 | ||
weighty = 0.0 | ||
fill = GridBagConstraints.HORIZONTAL | ||
} | ||
) | ||
|
||
// Make the dialog visible | ||
dialog.isVisible = true | ||
} | ||
} |
Oops, something went wrong.