Commit f6e0e5f8 authored by sumpfralle's avatar sumpfralle

moved "setproctitle" to pycam.Utils


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@737 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 088f08ab
...@@ -36,12 +36,11 @@ import pycam.Importers ...@@ -36,12 +36,11 @@ import pycam.Importers
import pycam.Exporters.GCodeExporter import pycam.Exporters.GCodeExporter
import pycam.Toolpath.Generator import pycam.Toolpath.Generator
import pycam.Utils.threading import pycam.Utils.threading
import pycam.Utils
from pycam.Toolpath import Bounds, Toolpath from pycam.Toolpath import Bounds, Toolpath
from pycam import VERSION from pycam import VERSION
import pycam.Utils.log import pycam.Utils.log
from optparse import OptionParser from optparse import OptionParser
# setproctitle is (optionally) imported later
#import setproctitle
import logging import logging
import time import time
...@@ -139,11 +138,7 @@ def get_output_handler(destination): ...@@ -139,11 +138,7 @@ def get_output_handler(destination):
def execute(opts, args, pycam): def execute(opts, args, pycam):
# try to change the process name # try to change the process name
try: pycam.Utils.setproctitle("pycam")
import setproctitle
setproctitle.setproctitle("pycam")
except ImportError:
pass
if len(args) > 0: if len(args) > 0:
inputfile = os.path.expanduser(args[0]) inputfile = os.path.expanduser(args[0])
...@@ -591,6 +586,7 @@ if __name__ == "__main__": ...@@ -591,6 +586,7 @@ if __name__ == "__main__":
+ "This program is required for importing SVG files.") + "This program is required for importing SVG files.")
(opts, args) = parser.parse_args() (opts, args) = parser.parse_args()
try:
if opts.profile_destination: if opts.profile_destination:
import cProfile import cProfile
cProfile.run('execute(opts, args, pycam)', opts.profile_destination) cProfile.run('execute(opts, args, pycam)', opts.profile_destination)
...@@ -598,5 +594,7 @@ if __name__ == "__main__": ...@@ -598,5 +594,7 @@ if __name__ == "__main__":
# We need to add the parameter "pycam" to avoid weeeeird namespace # We need to add the parameter "pycam" to avoid weeeeird namespace
# issues. Any idea how to fix this? # issues. Any idea how to fix this?
execute(opts, args, pycam) execute(opts, args, pycam)
except KeyboardInterrupt:
log.info("Quit requested")
pycam.Utils.threading.cleanup() pycam.Utils.threading.cleanup()
...@@ -27,6 +27,13 @@ import os ...@@ -27,6 +27,13 @@ import os
#import win32com #import win32com
#import win32api #import win32api
# setproctitle is (optionally) imported
try:
from setproctitle import setproctitle
except ImportError:
# silently ignore name change requests
setproctitle = lambda name: None
def get_external_program_location(key): def get_external_program_location(key):
extensions = ["", ".exe"] extensions = ["", ".exe"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment