-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathsay.py
More file actions
73 lines (53 loc) · 1.36 KB
/
say.py
File metadata and controls
73 lines (53 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- coding: utf-8 -*-
#-------------------------------------------------
#-- Animation workbench
#--
#-- microelly 2016
#--
#-- GNU Lesser General Public License (LGPL)
#-------------------------------------------------
import FreeCAD
import FreeCADGui
App=FreeCAD
Gui=FreeCADGui
import PySide
from PySide import QtCore, QtGui
import Draft
import Part
import Animation
import numpy as np
#import matplotlib
#import matplotlib.pyplot as plt
#from matplotlib.pyplot import cm
import os,random,time,sys,traceback
def log(s):
logon = False
if logon:
f = open('/tmp/log.txt', 'a')
f.write(str(s) +'\n')
f.close()
def sayd(s):
if hasattr(FreeCAD,'animation_debug'):
pass
log(str(s))
FreeCAD.Console.PrintMessage(str(s)+"\n")
def say(s):
log(str(s))
FreeCAD.Console.PrintMessage(str(s)+"\n")
def sayErr(s):
log(str(s))
FreeCAD.Console.PrintError(str(s)+"\n")
def sayW(s):
log(str(s))
FreeCAD.Console.PrintWarning(str(s)+"\n")
def errorDialog(msg):
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",msg )
diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)
diag.exec_()
def sayexc(mess=''):
exc_type, exc_value, exc_traceback = sys.exc_info()
ttt=repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
lls=eval(ttt)
l=len(lls)
l2=lls[(l-3):]
FreeCAD.Console.PrintError(mess + "\n" +"--> ".join(l2))