# Path: importerUtils.py
# def logInfo(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo",    Console.PrintMessage, msg, args)
# 
# def getIconPath(fileName):
# 	return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName)
# 
# def getTableValue(table, col, row):
# 	try:
# 		return table.get(getCellRef(col, row))
# 	except:
# 		return None
# 
# def setTableValue(table, col, row, val):
# 	if (type(val) == str):
# 		table.set(getCellRef(col, row), val)
# 	else:
# 		if ((sys.version_info.major <= 2) and (type(val) == unicode)):
# 			table.set(getCellRef(col, row), "%s" %(val.encode("utf8")))
# 		else:
# 			table.set(getCellRef(col, row), str(val))
# 
# def logInfo(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo",    Console.PrintMessage, msg, args)
# 
# def logWarning(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args)
# 
# def logError(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkError", True)):    _log("logError",   Console.PrintError,   msg, args)
# 
# def getCellRef(col, row):
# 	if (isString(col)):
# 		return u"%s%d" %(col, row)
# 	return u"%s%d" %(int2col(col), row)
# 
# def setTableValue(table, col, row, val):
# 	if (type(val) == str):
# 		table.set(getCellRef(col, row), val)
# 	else:
# 		if ((sys.version_info.major <= 2) and (type(val) == unicode)):
# 			table.set(getCellRef(col, row), "%s" %(val.encode("utf8")))
# 		else:
# 			table.set(getCellRef(col, row), str(val))
# 
# def calcAliasname(name):
# 	alias = name.replace(':', '_')
# 	if (IS_CELL_REF.search(name)):
# 		return '%s_' %(alias)
# 	# 45, 48..57, 65..90, 97..122
# 	result = ''
# 	for c in alias:
# 		i = ord(c)
# 		if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123):
# 			result += c
# 		else:
# 			result += '_'
# 	if (result[0] == '_'):
# 		return 'd' + result
# 	return result
# 
# Path: importerClasses.py
# class ParameterTableModel(TableModel):
# 	def __init__(self, parent, mylist, *args):
# 		TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args)
# 	def flags(self, index):
# 		if (index.column() == 0):
# 			return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable
# 		if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only!
# 			return Qt.ItemIsEnabled
# 		return Qt.ItemIsEnabled |Qt.ItemIsEditable
# 
# class VariantTableModel(TableModel):
# 	def __init__(self, parent, values, *args):
# 		TableModel.__init__(self, parent, values[1:], values[0], *args)
# 	def flags(self, index):
# 		return Qt.ItemIsEnabled | Qt.ItemIsEditable
# 
# Path: importerConstants.py
# DIR_X  = VEC(1, 0, 0)
# 
# DIR_Y  = VEC(0, 1, 0)
# 
# DIR_Z  = VEC(0, 0, 1)


import os, re, sys, Part, FreeCAD, FreeCADGui
from importerUtils   import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname
from FreeCAD         import Vector as VEC
from importerClasses import ParameterTableModel, VariantTableModel
from math            import degrees, radians, pi, sqrt, cos, sin, atan
from PySide.QtCore   import *
from PySide.QtGui    import *
from importerConstants import DIR_X, DIR_Y, DIR_Z
class _ViewProvider(object):
	def __init__(self, vp):
		vp.Proxy = self

	def attach(self, vp):
		self.ViewObject = vp
		self.Object = vp.Object

	def onChanged(self, vp, prop):   return

	def setEdit(self, vp, mode):     return False

	def unsetEdit(self, vp, mode):   return

	def __getstate__(self):          return None

	def __setstate__(self,state):    return None

	def getDisplayModes(self, vp):   return ["Shaded", "Wireframe", "Flat Lines"]

	def getDefaultDisplayMode(self): return "Shaded"

	def setDisplayMode(self, mode):  return mode


class _ViewProviderBoundaryPatch(_ViewProvider):
	def __init__(self, vp):
		super(_ViewProviderBoundaryPatch, self).__init__(vp)

	def getIcon(self):

# Path: importerUtils.py
# def logInfo(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo",    Console.PrintMessage, msg, args)
# 
# def getIconPath(fileName):
# 	return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName)
# 
# def getTableValue(table, col, row):
# 	try:
# 		return table.get(getCellRef(col, row))
# 	except:
# 		return None
# 
# def setTableValue(table, col, row, val):
# 	if (type(val) == str):
# 		table.set(getCellRef(col, row), val)
# 	else:
# 		if ((sys.version_info.major <= 2) and (type(val) == unicode)):
# 			table.set(getCellRef(col, row), "%s" %(val.encode("utf8")))
# 		else:
# 			table.set(getCellRef(col, row), str(val))
# 
# def logInfo(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo",    Console.PrintMessage, msg, args)
# 
# def logWarning(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args)
# 
# def logError(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkError", True)):    _log("logError",   Console.PrintError,   msg, args)
# 
# def getCellRef(col, row):
# 	if (isString(col)):
# 		return u"%s%d" %(col, row)
# 	return u"%s%d" %(int2col(col), row)
# 
# def setTableValue(table, col, row, val):
# 	if (type(val) == str):
# 		table.set(getCellRef(col, row), val)
# 	else:
# 		if ((sys.version_info.major <= 2) and (type(val) == unicode)):
# 			table.set(getCellRef(col, row), "%s" %(val.encode("utf8")))
# 		else:
# 			table.set(getCellRef(col, row), str(val))
# 
# def calcAliasname(name):
# 	alias = name.replace(':', '_')
# 	if (IS_CELL_REF.search(name)):
# 		return '%s_' %(alias)
# 	# 45, 48..57, 65..90, 97..122
# 	result = ''
# 	for c in alias:
# 		i = ord(c)
# 		if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123):
# 			result += c
# 		else:
# 			result += '_'
# 	if (result[0] == '_'):
# 		return 'd' + result
# 	return result
# 
# Path: importerClasses.py
# class ParameterTableModel(TableModel):
# 	def __init__(self, parent, mylist, *args):
# 		TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args)
# 	def flags(self, index):
# 		if (index.column() == 0):
# 			return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable
# 		if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only!
# 			return Qt.ItemIsEnabled
# 		return Qt.ItemIsEnabled |Qt.ItemIsEditable
# 
# class VariantTableModel(TableModel):
# 	def __init__(self, parent, values, *args):
# 		TableModel.__init__(self, parent, values[1:], values[0], *args)
# 	def flags(self, index):
# 		return Qt.ItemIsEnabled | Qt.ItemIsEditable
# 
# Path: importerConstants.py
# DIR_X  = VEC(1, 0, 0)
# 
# DIR_Y  = VEC(0, 1, 0)
# 
# DIR_Z  = VEC(0, 0, 1)


# Path: InventorViewProviders.py
import os, re, sys, Part, FreeCAD, FreeCADGui
from importerUtils   import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname
from FreeCAD         import Vector as VEC
from importerClasses import ParameterTableModel, VariantTableModel
from math            import degrees, radians, pi, sqrt, cos, sin, atan
from PySide.QtCore   import *
from PySide.QtGui    import *
from importerConstants import DIR_X, DIR_Y, DIR_Z

class _ViewProvider(object):
	def __init__(self, vp):
		vp.Proxy = self

	def attach(self, vp):
		self.ViewObject = vp
		self.Object = vp.Object

	def onChanged(self, vp, prop):   return

	def setEdit(self, vp, mode):     return False

	def unsetEdit(self, vp, mode):   return

	def __getstate__(self):          return None

	def __setstate__(self,state):    return None

	def getDisplayModes(self, vp):   return ["Shaded", "Wireframe", "Flat Lines"]

	def getDefaultDisplayMode(self): return "Shaded"

	def setDisplayMode(self, mode):  return mode


class _ViewProviderBoundaryPatch(_ViewProvider):
	def __init__(self, vp):
		super(_ViewProviderBoundaryPatch, self).__init__(vp)

	def getIcon(self):

		return getIconPath('FxBoundaryPatch.xpm')