Skip to content

Commit

Permalink
Merge pull request #988 from mrbeam/mrbeam2-beta
Browse files Browse the repository at this point in the history
v0.7.4
  • Loading branch information
khaledsherkawi authored Sep 9, 2020
2 parents f185f37 + fb0fbc6 commit 6a35b63
Show file tree
Hide file tree
Showing 30 changed files with 1,072 additions and 681 deletions.
8 changes: 6 additions & 2 deletions octoprint_mrbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,11 @@ def on_settings_save(self, data):
data['gcode_nextgen']['clip_working_area'])
if "machine" in data and isinstance(data['machine'], collections.Iterable):
if "backlash_compensation_x" in data['machine']:
self._settings.set_float(["machine", "backlash_compensation_x"],
data['machine']['backlash_compensation_x'])
min_mal = -1.0
max_val = 1.0
val = data['machine']['backlash_compensation_x']
val = max(min(max_val, val), min_mal)
self._settings.set_float(["machine", "backlash_compensation_x"], val)
if "analyticsEnabled" in data:
self.analytics_handler.analytics_user_permission_change(analytics_enabled=data['analyticsEnabled'])
if "focusReminder" in data:
Expand Down Expand Up @@ -2500,6 +2503,7 @@ def __plugin_load__():
order=dict(
wizard=["plugin_mrbeam_wifi", "plugin_mrbeam_acl", "plugin_mrbeam_lasersafety",
"plugin_mrbeam_whatsnew_0", "plugin_mrbeam_whatsnew_1", "plugin_mrbeam_whatsnew_2", "plugin_mrbeam_whatsnew_3", "plugin_mrbeam_whatsnew_4",
"plugin_mrbeam_beta_news_0",
"plugin_mrbeam_analytics"],
settings=['plugin_mrbeam_about', 'plugin_softwareupdate', 'accesscontrol', 'plugin_mrbeam_maintenance',
'plugin_netconnectd', 'plugin_findmymrbeam', 'plugin_mrbeam_conversion',
Expand Down
2 changes: 1 addition & 1 deletion octoprint_mrbeam/__version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.2"
__version__ = "0.7.4"
10 changes: 6 additions & 4 deletions octoprint_mrbeam/iobeam/lid_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ def onEvent(self, event, payload):
self._logger.debug("onEvent() CLIENT_OPENED sending client lidClosed: %s", self._lid_closed)
self._client_opened = True
self._startStopCamera(event)
elif event == OctoPrintEvents.CLIENT_CLOSED:
self._client_opened = False
self._startStopCamera(event)
# Please re-enable when the OctoPrint is more reliable at
# detecting when a user actually disconnected.
# elif event == OctoPrintEvents.CLIENT_CLOSED:
# self._client_opened = False
# self._startStopCamera(event)
elif event == OctoPrintEvents.SHUTDOWN:
self.shutdown()
elif event == IoBeamEvents.ONEBUTTON_RELEASED \
Expand Down Expand Up @@ -751,9 +753,9 @@ def serve_pictures(self, cam, pic_settings=None, cam_params=None, out_pic_size=N
self.send_last_img_to_analytics(
trigger='dev_auto', force_upload=(pic_counter%10==0)
)
self.last_shutter_speed = cam.shutter_speed
self.save_camera_settings(markers=self.last_markers, shutter_speed=self.last_shutter_speed)

self.last_shutter_speed = cam.shutter_speed
cam.stop_preview()
if session_details['num_pics'] > 0:
session_details.update({
Expand Down
4 changes: 2 additions & 2 deletions octoprint_mrbeam/iobeam/onebutton_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def onEvent(self, event, payload):
self._logger.debug("onEvent() FILE_SELECTED set_ready_to_laser filename: %s:", 'filename' in payload)
try:
# OctoPrint 1.3.4 doesn't provide the file name anymore
filename = payload['filename'] if 'filename' in payload else None
self.set_ready_to_laser(filename)
path = payload['path'] if 'path' in payload else None
self.set_ready_to_laser(path)
except Exception as e:
self._logger.exception("Error while going into state ReadyToLaser: {}".format(e))

Expand Down
8 changes: 8 additions & 0 deletions octoprint_mrbeam/static/css/svgtogcode.css
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,14 @@ g#camera_markers.markerSW circle#markerSW {
animation: blinker 2s linear infinite;
}

g#camera_markers.markerNE.gray circle#markerNE,
g#camera_markers.markerSE.gray circle#markerSE,
g#camera_markers.markerNW.gray circle#markerNW,
g#camera_markers.markerSW.gray circle#markerSW {
opacity: .6;
animation: none;
}

@keyframes blinker {
50% {
opacity: 0;
Expand Down
40 changes: 40 additions & 0 deletions octoprint_mrbeam/static/css/wizard.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,44 @@ input[type="radio"]{
margin: 50px 0 0 170px;
}

/*
* === What's new dialog ===
*/
.beta-news-ds-use-case-grid {
display: grid;
grid-gap: 10px;
grid-template-columns: 1.4fr 0.3fr 0.8fr;
width: 90%;
margin: 20px 0 0 5px;
}

.beta-news-ds-info-grid {
display: grid;
grid-gap: 10px;
grid-template-columns: 1fr 10fr;
width: 90%;
margin: 20px 0 0 5px;
}

.beta-news-ds-info-icon {
transform: scaleY(0.7);
-ms-transform: scaleY(0.7);
-moz-transform: scaleY(0.7);
-webkit-transform: scaleY(0.7);
-o-transform: scaleY(0.7);
}

.beta-news-arrow {
margin: auto;
transform: rotate(180deg) scaleY(0.7);
-ms-transform: rotate(180deg) scaleY(0.7);
-moz-transform: rotate(180deg) scaleY(0.7);
-webkit-transform: rotate(180deg) scaleY(0.7);
-o-transform: rotate(180deg) scaleY(0.7);
filter: invert(41%) sepia(50%) saturate(6758%) hue-rotate(12deg) brightness(99%) contrast(98%);
}

#ds_title_stars {
height: 50px;
filter: invert(41%) sepia(50%) saturate(6758%) hue-rotate(12deg) brightness(99%) contrast(98%);
}
29 changes: 29 additions & 0 deletions octoprint_mrbeam/static/img/beta_dialog/beam_coin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions octoprint_mrbeam/static/img/beta_dialog/question_mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions octoprint_mrbeam/static/img/beta_dialog/stars.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 24 additions & 8 deletions octoprint_mrbeam/static/js/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ $(function(){
self.isCamCalibrated = false;
self.firstImageLoaded = false;
self.countImagesLoaded = ko.observable(0);
self.imagesInSession = ko.observable(0);

self.markersFound = ko.observable(new Map(MARKERS.map(elm => [elm, undefined])));

Expand All @@ -42,6 +43,20 @@ $(function(){
// event listener callbacks //

self.onAllBound = function () {
self.cameraActive = ko.computed(function() {
// Needs the motherViewModel to set the interlocks
// Output not used yet -
// Function updates self.imageInSession (Which is used)
let ret = self.firstRealimageLoaded()
&& self.state.isOperational()
&& !self.state.isPrinting()
&& !self.state.isLocked()
&& !self.state.interlocksClosed();
if (!ret) {
self.imagesInSession(0);
}
return ret;
})
self.webCamImageElem = $("#beamcam_image_svg");
self.cameraMarkerElem = $("#camera_markers");
// self.webCamImageElem.removeAttr('onerror');
Expand Down Expand Up @@ -103,16 +118,21 @@ $(function(){
return self.countImagesLoaded() >= 2;
})

self.cameraActive = ko.computed(function() {
return self.firstRealimageLoaded() && self.state.isOperational() && !self.state.isPrinting() && !self.state.isLocked();
})

self.markerMissedClass = ko.computed(function() {
var ret = '';
MARKERS.forEach(function(m){
if ((self.markersFound()[m] !== undefined) && !self.markersFound()[m])
ret = ret + ' marker' + m;
});
if (self.cameraMarkerElem !== undefined){
if (self.imagesInSession() == 0) {
ret = ret + ' gray'
// Somehow the filter in css doesn't work
self.cameraMarkerElem.attr({style:"filter: url(#grayscale_filter)"});
} else
self.cameraMarkerElem.attr({style:""});
}
return ret;
})

Expand Down Expand Up @@ -152,11 +172,6 @@ $(function(){
}
self.loadImage(self.croppedUrl);
}

// If camera is not active (lid closed), all marker(NW|NE|SW|SE) classes should be removed.
if('interlocks_closed' in data && data.interlocks_closed === true){
self.cameraMarkerElem.attr('class', '');
}
};

self.loadImage = function (url) {
Expand All @@ -179,6 +194,7 @@ $(function(){
} else {
OctoPrint.simpleApiCommand("mrbeam", "on_camera_picture_transfer", {})
}
self.imagesInSession(self.imagesInSession()+1)
});
if (!self.firstImageLoaded) {
img.error(function () {
Expand Down
2 changes: 1 addition & 1 deletion octoprint_mrbeam/static/js/design_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $(function () {
self.settings = params[3];

self.onUserLoggedIn = function () {
if (window.mrbeam.isDev()) {
if (window.mrbeam.isDev() || window.mrbeam.isBeta()) {
self.prepareDesignStoreTab();
}
};
Expand Down
4 changes: 2 additions & 2 deletions octoprint_mrbeam/static/js/ready_to_laser_viewmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $(function () {
self.dialogTimeoutId = -1;
self.gcodeFile = undefined;

self.interlocks_closed = ko.observable(true);
self.state.interlocksClosed = ko.observable(false)
self.is_cooling_mode = ko.observable(false);
self.is_fan_connected = ko.observable(true);
self.is_rtl_mode = ko.observable(false);
Expand Down Expand Up @@ -218,7 +218,7 @@ $(function () {
self.is_pause_mode(mrb_state['pause_mode']);
}
if ('interlocks_closed' in mrb_state) {
self.interlocks_closed(mrb_state['interlocks_closed']);
self.state.interlocksClosed(mrb_state['interlocks_closed']);
}
if ('lid_fully_open' in mrb_state) {
self.lid_fully_open(mrb_state['lid_fully_open']);
Expand Down
19 changes: 10 additions & 9 deletions octoprint_mrbeam/static/js/wizard_general.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@ $(function() {
self.analytics = parameters[1];
self.tour = parameters[2];

self.isWhatsnew = MRBEAM_WIZARD_TO_SHOW === 'WHATSNEW';
self.isWelcome = MRBEAM_WIZARD_TO_SHOW === 'WELCOME';
self.isWhatsnew = MRBEAM_WIZARD_TO_SHOW === 'WHATSNEW';
self.isBetaNews = MRBEAM_WIZARD_TO_SHOW === 'BETA_NEWS';
self.aboutToStart = true;

self.onAfterBinding = function(){
$('#wizard_dialog div.modal-footer button.button-finish').text(gettext("Let's go!"));
$('#wizard_dialog div.modal-footer div.text-center').hide();

if (self.isWhatsnew) {
if (!window.mrbeam.isBeta()) {
$('#wizard_dialog div.modal-header h3').text(gettext("What's New"));
} else {
$('#wizard_dialog div.modal-header h3').text(gettext("What's New in the Stable Channel"));
}
} else if (self.isWelcome) {
if (self.isWelcome) {
$('#wizard_dialog div.modal-header h3').text(gettext("Welcome dialog"));
}else if (self.isWhatsnew) {
$('#wizard_dialog div.modal-header h3').text(gettext("What's New"));
} else if (self.isBetaNews) {
$('#wizard_dialog div.modal-header h3').text(gettext("What's New in Beta"));
}
};

Expand All @@ -64,9 +63,11 @@ $(function() {
let links = response.mrbeam.details.links;
self._changeNavDesignForAllTabsInitialState(links);

// For the whatsnew we have to manually set the first tab to active
// For the whatsnew and beta news we have to manually set the first tab to active
if(self.isWhatsnew) {
$('#wizard_plugin_corewizard_whatsnew_0_link').attr('class', 'wizard-nav-list-active')
} else if (self.isBetaNews) {
$('#wizard_plugin_corewizard_beta_news_0_link').attr('class', 'wizard-nav-list-active')
}
}
};
Expand Down
5 changes: 3 additions & 2 deletions octoprint_mrbeam/static/js/working_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -2049,8 +2049,9 @@ $(function(){
});

// opens preview pane on the left if hovered over one of the pink markers on the working area
$('#camera_markers circle').mouseenter(function(){
if (!$('#wa_view_settings_body').hasClass('in')) {
$('#camera_markers circle').mouseenter(function(e){
if (!$('#wa_view_settings_body').hasClass('in')
&& !self.camera.markersFound()[$(e.target).attr('id').replace('marker', '')]) {
$('#wa_view_settings_body').collapse('toggle');
}
});
Expand Down
2 changes: 1 addition & 1 deletion octoprint_mrbeam/templates/mrbeam_ui_index.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<li class="active"><a href="#workingarea" data-toggle="tab" id="wa_tab_btn">{{ _('working area') }}</a></li>
{# Translatots: Name of the tab #}
<li><a href="#designlib" data-toggle="tab" id="designlib_tab_btn">{{ _('design library') }}</a></li>
<li class="experimental_feature_dev"><a href="#designstore" data-toggle="tab" id="designstore_tab_btn" onclick="window.mrbeam.viewModels.designStore.goToStore()">{{ _('design store') }}</a></li>
<li class="experimental_feature_beta"><a href="#designstore" data-toggle="tab" id="designstore_tab_btn" onclick="window.mrbeam.viewModels.designStore.goToStore()">{{ _('design store') }}</a></li>
{% if not enableFocus %}
<li><a href="#focus" data-toggle="tab" id="focus_tab_btn">{{ _('focus') }}</a></li>
{% endif %}
Expand Down
Loading

0 comments on commit 6a35b63

Please sign in to comment.