Skip to content

Commit

Permalink
Add DLFS Browser to Main GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Apr 19, 2024
1 parent 46fd9cf commit 6fe5e97
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
Binary file added convex-gui/docs/images/filesystem-hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion convex-gui/src/main/java/convex/gui/MainGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import convex.gui.components.AbstractGUI;
import convex.gui.components.ActionPanel;
import convex.gui.components.Toast;
import convex.gui.dlfs.DLFSBrowser;
import convex.gui.manager.mainpanels.HomePanel;
import convex.gui.tools.HackerTools;
import convex.gui.utils.Toolkit;
Expand All @@ -49,6 +50,9 @@ public MainGUI() {
JComponent testNet=createLaunchButton("Launch TestNet",Toolkit.TESTNET_ICON,this::launchTestNet);
actionPanel.add(testNet);

JComponent latticeFS=createLaunchButton("Lattice Filesystem",Toolkit.DLFS_ICON,this::launchDLFS);
actionPanel.add(latticeFS);

JComponent terminal=createLaunchButton("Convex Terminal",Toolkit.TERMINAL_ICON,this::launchTerminalClient);
actionPanel.add(terminal);

Expand All @@ -64,6 +68,10 @@ public MainGUI() {
add(actionPanel,"dock south");
}

public void launchDLFS() {
new DLFSBrowser().run();
}

public void launchTestNet() {
JPanel pan=new JPanel();
pan.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
Expand Down Expand Up @@ -182,7 +190,6 @@ public JPanel createLaunchButton(String label, ImageIcon icon, Runnable cmd) {
* @param args Command line args
*/
public static void main(String[] args) {
// call to set up Look and Feel
Toolkit.init();
new MainGUI().run();
}
Expand Down
8 changes: 5 additions & 3 deletions convex-gui/src/main/java/convex/gui/PeerGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import convex.core.init.Init;
import convex.core.store.AStore;
import convex.core.store.Stores;
import convex.core.util.ThreadUtils;
import convex.core.util.Utils;
import convex.gui.components.AbstractGUI;
import convex.gui.components.models.StateModel;
Expand Down Expand Up @@ -176,17 +177,18 @@ public PeerGUI(int peerCount, AKeyPair genesis) {

});

updateThread.start();
ThreadUtils.runVirtual(updateThread);
}

private boolean updateRunning = true;

private long cp = 0;
private long maxBlock=0;

private Thread updateThread = new Thread(new Runnable() {
private Runnable updateThread = new Runnable() {
@Override
public void run() {
Thread.currentThread().setName("PeerGUI update thread");
while (updateRunning) {
try {
Thread.sleep(100);
Expand Down Expand Up @@ -226,7 +228,7 @@ public void run() {
}
log.debug("GUI Peer Manager update thread ended");
}
}, "GUI Manager state update thread");
};

public DefaultListModel<ConvexLocal> peerList = new DefaultListModel<ConvexLocal>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class AbstractGUI extends JPanel implements Runnable {

@Override
public void run() {
// call to set up Look and Feel
Toolkit.init();

EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
Expand Down
9 changes: 7 additions & 2 deletions convex-gui/src/main/java/convex/gui/dlfs/DLFSBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public DLFSBrowser(DLFSLocal drive) {
getFrame().setJMenuBar(menuBar);

}


public DLFSBrowser() {
this(createDemoDrive());
}


protected JMenuItem makeMenu(String name,Runnable op) {
JMenuItem mi= new JMenuItem(name);
Expand Down Expand Up @@ -125,8 +131,7 @@ public static void main(String[] args) {
// call to set up Look and Feel
Toolkit.init();

DLFSLocal demoDrive=createDemoDrive();
DLFSBrowser gui=new DLFSBrowser(demoDrive);
DLFSBrowser gui=new DLFSBrowser();
gui.run();
}

Expand Down
1 change: 1 addition & 0 deletions convex-gui/src/main/java/convex/gui/utils/Toolkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class Toolkit {
public static final ImageIcon TERMINAL_ICON = scaledIcon(128, "/images/terminal.png");
public static final ImageIcon ECOSYSTEM_ICON = scaledIcon(128, "/images/ecosystem.png");
public static final ImageIcon WALLET_ICON = scaledIcon(128, "/images/wallet.png");
public static final ImageIcon DLFS_ICON = scaledIcon(128, "/images/filesystem.png");

public static ImageIcon scaledIcon(int size, String resourcePath) {
java.net.URL imgURL = Toolkit.class.getResource(resourcePath);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6fe5e97

Please sign in to comment.