bugfix. fill_areas is not interfering when only gcodes are placed. slicing_in_progress flag is set correct.

This commit is contained in:
Teja 2015-11-14 14:10:47 +01:00
parent 0e041ed4a9
commit 2059a16848
3 changed files with 15 additions and 24 deletions

View file

@ -204,23 +204,7 @@ class FileManager(object):
source_meta = self.get_metadata(source_location, source_path)
hash = source_meta["hash"]
#<<<<<<< HEAD
# class Wrapper(object):
# def __init__(self, stl_name, temp_path, hash):
# self.stl_name = stl_name
# self.temp_path = temp_path
# self.hash = hash
#
# def save(self, absolute_dest_path):
# with open(absolute_dest_path, "w") as d:
# d.write("; Generated from\n; {stl_name}\n; {hash}\r".format(**vars(self)))
# with open(tmp_path, "r") as s:
# import shutil
# shutil.copyfileobj(s, d)
#
#=======
import io
#>>>>>>> upstream/maintenance
links = [("model", dict(name=source_path))]
_, stl_name = self.split_path(source_location, source_path)
file_obj = StreamWrapper(os.path.basename(dest_path),

View file

@ -42,7 +42,7 @@ $(function(){
// preset values are a good start for wood engraving
self.images_placed = ko.observable(false);
self.show_image_parameters = ko.computed(function(){
return self.images_placed() || self.fill_areas();
return self.images_placed() || (self.fill_areas() && self.show_vector_parameters());
});
self.imgIntensityWhite = ko.observable(0);
self.imgIntensityBlack = ko.observable(500);
@ -107,6 +107,13 @@ $(function(){
self.convert();
}
};
self.cancel_conversion = function(){
if(self.slicing_in_progress()){
console.log('cancel slicing', self.slicing_in_progress());
// TODO cancel slicing properly
}
};
self.create_gcode_filename = function(placedDesigns){
if(placedDesigns.length > 0){
@ -236,10 +243,10 @@ $(function(){
};
self.convert = function() {
self.slicing_in_progress(true);
if(self.gcodeFilesToAppend.length === 1 && self.svg === undefined){
self.files.startGcodeWithSafetyWarning(self.gcodeFilesToAppend[0]);
} else {
self.slicing_in_progress(true);
self.workingArea.getCompositionSVG(self.fill_areas(), function(composition){
self.svg = composition;
var filename = self.gcodeFilename() + self.settingsString() + '.gco';
@ -302,29 +309,29 @@ $(function(){
};
self.onEventSlicingStarted = function(payload){
self.slicing_in_progress(true);
console.log("onSlicingDone" , payload);
};
self.onEventSlicingDone = function(payload){
// payload
// gcode: "angelina_20091211_0193_11more_i1000s300.gco"
// gcode: "ex_11more_i1000s300.gco"
// gcode_location: "local"
// stl: "local/angelina_jolie_20091211_0193_11more_i1000s300.svg"
// stl: "local/ex_11more_i1000s300.svg"
// time: 30.612739086151123
self.gcodeFilename(undefined);
self.svg = undefined;
$("#dialog_vector_graphics_conversion").modal("hide");
self.slicing_in_progress(false);
//console.log("onSlicingDone" , payload);
};
self.onEventSlicingCancelled = function(payload){
self.gcodeFilename(undefined);
self.svg = undefined;
self.slicing_in_progress(false);
$("#dialog_vector_graphics_conversion").modal("hide");
console.log("onSlicingCancelled" , payload);
//console.log("onSlicingCancelled" , payload);
};
self.onEventSlicingFailed = function(payload){
self.slicing_in_progress(false);
console.log("onSlicingFailed" , payload);
//console.log("onSlicingFailed" , payload);
};
self._configureIntensitySlider = function() {

View file

@ -182,7 +182,7 @@
</label>
</div>
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Cancel') }}</a>
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true" data-bind="click: $root.cancel_conversion()">{{ _('Cancel') }}</a>
<a href="#" class="btn btn-primary" data-bind="click: function() { if ($root.enableConvertButton()) { $root.convert() } }, enabled: enableConvertButton, css: {disabled: !$root.enableConvertButton()}">{{ _('Convert') }}</a>
</div>
</div>