Skip to content

Commit 4127d6a

Browse files
committed
voxec.SILENT flag to silence progress print during commands
1 parent c007af6 commit 4127d6a

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

module/__init__.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
from .voxec import *
1+
from .voxec import *
2+
3+
import multiprocessing
4+
5+
default_VOXELSIZE = 0.05
6+
default_CHUNKSIZE = 16
7+
default_THREADS = multiprocessing.cpu_count()
8+
SILENT = False
9+
10+
def run(name, *args, **kwargs):
11+
ctx = context()
12+
ctx.set('VOXELSIZE', default_VOXELSIZE)
13+
ctx.set('CHUNKSIZE', default_CHUNKSIZE)
14+
ctx.set('THREADS', default_THREADS)
15+
return run_(name, args, kwargs, ctx, SILENT)

wrap/wrapper.i

+2-17
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,14 @@ struct context {
295295
}
296296
};
297297

298-
symbol_value run_(const std::string& name, PyObject *args, PyObject *kwargs, context* ctx = nullptr) {
298+
symbol_value run_(const std::string& name, PyObject *args, PyObject *kwargs, context* ctx = nullptr, bool silent=false) {
299299
scope_map scope;
300300
if (ctx) {
301301
scope = ctx->scope;
302302
}
303303

304304
voxel_operation* op = voxel_operation_map::create(name);
305+
op->silent = silent;
305306

306307
// Process positional arguments
307308
auto it = op->arg_names().begin();
@@ -333,21 +334,5 @@ symbol_value run_(const std::string& name, PyObject *args, PyObject *kwargs, con
333334

334335
%}
335336

336-
%pythoncode %{
337-
338-
import multiprocessing
339-
340-
default_VOXELSIZE = 0.05
341-
default_CHUNKSIZE = 16
342-
default_THREADS = multiprocessing.cpu_count()
343-
344-
def run(name, *args, **kwargs):
345-
ctx = context()
346-
ctx.set('VOXELSIZE', default_VOXELSIZE)
347-
ctx.set('CHUNKSIZE', default_CHUNKSIZE)
348-
ctx.set('THREADS', default_THREADS)
349-
return run_(name, args, kwargs, ctx)
350-
%}
351-
352337
%module voxec %{
353338
%}

0 commit comments

Comments
 (0)