Skip to content

Commit

Permalink
Merge pull request #602 from retiutut/development
Browse files Browse the repository at this point in the history
Dev 4.1.6-beta.0 PR 2
  • Loading branch information
retiutut authored Sep 28, 2019
2 parents cb5a0e7 + c1cc975 commit eb2228d
Show file tree
Hide file tree
Showing 16 changed files with 367 additions and 135 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# v4.1.6
Use OpenBCIHub v2.0.9 please.
Use OpenBCIHub v2.1.0 please.

## Beta 0

### Improvements
* Cyton+Dongle AutoConnect Button!
* GUI error message when using old Cyton firmware #597
* Update Focus widget help button
* Console Log window UI/UX update
* Add GUI Troublshooting Guide button to "Help" dropdown in TopNav.pde

### Bug Fixes
* Cyton+WiFi unable to start session #555 #590
* Networking start/stop stream #593
* Networking: Start/Stop stream button behavior #593
* Networking: Only show Pulse datatype for Cyton(Live)
* Show error when loading empty playback file and delete file from history

# v4.1.5
Use OpenBCIHub v2.0.9 please.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ If you're new to Git and want to learn how to fork this repo, make your own addi

### Community

This project is maintained by the [OpenBCI](www.openbci.com) community. Join the [OpenBCI Forum](http://openbci.com/index.php/forum/), where discussions about OpenBCI takes place.
This project is maintained by the [OpenBCI](https://openbci.com) community. Join the [OpenBCI Forum](https://openbci.com/forum/), where discussions about OpenBCI takes place.

## How can I contribute?

This is currently a small, humble project so our contribution process is rather casual. If there's a feature you'd be interested in building, go ahead! Let us know on the [OpenBCI Forum](http://openbci.com/index.php/forum/) or [open an issue](../../issues) so others can follow along and we'll support you as much as we can. When you're finished submit a pull request to the master branch referencing the specific issue you addressed.
This is currently a small, humble project so our contribution process is rather casual. If there's a feature you'd be interested in building, go ahead! Let us know on the [OpenBCI Forum](https://openbci.com/forum/) or [open an issue](../../issues) so others can follow along and we'll support you as much as we can. When you're finished submit a pull request to the master branch referencing the specific issue you addressed.

If you find a bug, or have a suggestion on how to improve the project, just fill out a [Github issue](../../issues)
If you find a bug, or have a suggestion on how to improve the project, please fill out a [Github issue](../../issues).

### Steps to Contribute

Expand Down
111 changes: 85 additions & 26 deletions OpenBCI_GUI/ConsoleLog.pde
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@ import java.awt.Desktop;
static class ConsoleWindow extends PApplet {
private static ConsoleWindow instance = null;

PApplet logApplet;

private ControlP5 cp5;
private Textarea consoleTextArea;
private ClipHelper clipboardCopy;

private final int headerHeight = 42;
private final int defaultWidth = 620;
private final int defaultHeight = 500;
private final int buttonWidth = 170;
private final int buttonWidth = 142;
private final int buttonHeight = 34;
private int previousWidth = defaultWidth;

//for screen resizing
private boolean screenHasBeenResized = false;
private float timeOfLastScreenResize = 0;
private int widthOfLastScreen = defaultWidth;
private int heightOfLastScreen = defaultHeight;

public static void display() {
// enforce only one Console Window
Expand All @@ -45,6 +52,9 @@ static class ConsoleWindow extends PApplet {
}

void setup() {

logApplet = this;

surface.setAlwaysOnTop(true);
surface.setResizable(true);

Expand All @@ -53,6 +63,7 @@ static class ConsoleWindow extends PApplet {

consoleTextArea = cp5.addTextarea("ConsoleWindow")
.setPosition(0, headerHeight)
.setSize(width, height - headerHeight)
.setFont(createFont("arial", 14))
.setLineHeight(18)
.setColor(color(242))
Expand All @@ -65,13 +76,15 @@ static class ConsoleWindow extends PApplet {
// register this console's Textarea with the output stream object
outputStream.registerTextArea(consoleTextArea);

int cW = int(width/3);
int cW = int(width/4);
int bX = int((cW - buttonWidth) / 2);
createConsoleLogButton("openLogFileAsText", "Open Log as Text (F)", bX);
bX += cW;
createConsoleLogButton("copyFullTextToClipboard", "Copy Full Log Text (C)", bX);
createConsoleLogButton("copyFullTextToClipboard", "Copy Full Text (C)", bX);
bX += cW;
createConsoleLogButton("copyLastLineToClipboard", "Copy Last Line (L)", bX);
bX += cW;
createConsoleLogButton("jumpToLastLine", "Jump to Last Line (J)", bX);
}

void createConsoleLogButton (String bName, String bText, int x) {
Expand All @@ -84,21 +97,45 @@ static class ConsoleWindow extends PApplet {
.setColorBackground(color(144, 100));
cp5.getController(bName)
.getCaptionLabel()
.setFont(createFont("Arial",16,true))
.setFont(createFont("Arial",14,true))
.toUpperCase(false)
.setSize(16)
.setSize(14)
.setText(bText);
}

void draw() {
// dynamically resize text area to fit widget
consoleTextArea.setSize(width, height - headerHeight);
// update button positions when screen width changes
updateButtonPositions();

clear();
scene();
cp5.draw();
//checks if the screen is resized, similar to main GUI window
screenResized();
}

void screenResized() {
if (this.widthOfLastScreen != width || this.heightOfLastScreen != height) {
//println("ConsoleLog: RESIZED");
this.screenHasBeenResized = true;
this.timeOfLastScreenResize = millis();
this.widthOfLastScreen = width;
this.heightOfLastScreen = height;
}
if (this.screenHasBeenResized) {
//setGraphics() is very important, it lets the cp5 elements know where the origin is.
//Without this, cp5 elements won't work after screen is resized.
//This also happens in most widgets when the main GUI window is resized.
logApplet = this;
cp5.setGraphics(logApplet, 0, 0);

imposeMinConsoleLogDimensions();
// dynamically resize text area to fit widget
consoleTextArea.setSize(width, height - headerHeight);
// update button positions when screen width changes
updateButtonPositions();
}
//re-initialize console log if screen has been resized and it's been more than 1 seccond (to prevent reinitialization happening too often)
if (this.screenHasBeenResized == true && (millis() - this.timeOfLastScreenResize) > 1000) {
this.screenHasBeenResized = false;
}
}

void scene() {
Expand All @@ -110,14 +147,23 @@ static class ConsoleWindow extends PApplet {
void keyReleased() {
if (key == 'c') {
copyFullTextToClipboard();
}

if (key == 'f') {
} else if (key == 'f') {
openLogFileAsText();
} else if (key == 'l') {
copyLastLineToClipboard();
} else if (key == 'j' ) {
jumpToLastLine();
}

}

if (key == 'l') {
copyLastLineToClipboard();
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
consoleTextArea.scrolled(-5);
} else if (keyCode == DOWN) {
consoleTextArea.scrolled(5);
}
}
}

Expand Down Expand Up @@ -154,17 +200,30 @@ static class ConsoleWindow extends PApplet {
println("ConsoleLog: Previous line copied to clipboard.");
}

void jumpToLastLine() {
consoleTextArea.scroll(1.0);
}

void updateButtonPositions() {
if (width != previousWidth) {
int cW = width / 3;
int bX = (cW - 170) / 2;
int bY = 4;
cp5.getController("openLogFileAsText").setPosition(bX, bY);
bX += cW;
cp5.getController("copyFullTextToClipboard").setPosition(bX, bY);
bX += cW;
cp5.getController("copyLastLineToClipboard").setPosition(bX, bY);
previousWidth = width;
int cW = width / 4;
int bX = (cW - buttonWidth) / 2;
int bY = 4;
cp5.getController("openLogFileAsText").setPosition(bX, bY);
bX += cW;
cp5.getController("copyFullTextToClipboard").setPosition(bX, bY);
bX += cW;
cp5.getController("copyLastLineToClipboard").setPosition(bX, bY);
bX += cW;
cp5.getController("jumpToLastLine").setPosition(bX, bY);
}

void imposeMinConsoleLogDimensions() {
//impose minimum gui dimensions
int minHeight = int(defaultHeight/2);
if (width < defaultWidth || height < minHeight) {
int _w = (width < defaultWidth) ? defaultWidth : width;
int _h = (height < minHeight) ? minHeight : height;
surface.setSize(_w, _h);
}
}

Expand Down
4 changes: 2 additions & 2 deletions OpenBCI_GUI/Containers.pde
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void drawContainers() {
println("OpenBCI_GUI: setup: RESIZED");
setupContainers();
//setupVizs(); //container extension example (more below)
widthOfLastScreen = width;
heightOfLastScreen = height;
settings.widthOfLastScreen = width;
settings.heightOfLastScreen = height;
}
}

Expand Down
Loading

0 comments on commit eb2228d

Please sign in to comment.