Material and FEM: card reader and writer, make sure to import the same in all modules
This commit is contained in:
@@ -609,7 +609,7 @@ class _TaskPanelFemMaterial:
|
||||
def add_cards_from_a_dir(self, mat_dir, icon):
|
||||
import glob
|
||||
import os
|
||||
import Material
|
||||
from importFCMat import read
|
||||
mat_file_extension = ".FCMat"
|
||||
ext_len = len(mat_file_extension)
|
||||
dir_path_list = glob.glob(mat_dir + '/*' + mat_file_extension)
|
||||
@@ -617,7 +617,7 @@ class _TaskPanelFemMaterial:
|
||||
card_name_list = []
|
||||
for a_path in dir_path_list:
|
||||
card_name = os.path.basename(a_path[:-ext_len])
|
||||
self.materials[a_path] = Material.importFCMat(a_path)
|
||||
self.materials[a_path] = read(a_path)
|
||||
card_name_list.append([card_name, a_path])
|
||||
card_name_list.sort()
|
||||
for mat in card_name_list:
|
||||
|
||||
@@ -187,8 +187,8 @@ class MaterialEditor:
|
||||
if k:
|
||||
if k in self.cards:
|
||||
|
||||
import importFCMat
|
||||
d = importFCMat.read(self.cards[k])
|
||||
from importFCMat import read
|
||||
d = read(self.cards[k])
|
||||
if d:
|
||||
self.updateContents(d)
|
||||
|
||||
@@ -416,9 +416,9 @@ class MaterialEditor:
|
||||
filetuple = QtGui.QFileDialog.getOpenFileName(QtGui.QApplication.activeWindow(), 'Open FreeCAD Material file', self.directory, '*.FCMat')
|
||||
filename = filetuple[0] # a tuple of two empty strings returns True, so use the filename directly
|
||||
if filename:
|
||||
import importFCMat
|
||||
from importFCMat import read
|
||||
self.directory = os.path.dirname(filename)
|
||||
d = importFCMat.read(filename)
|
||||
d = read(filename)
|
||||
if d:
|
||||
self.updateContents(d)
|
||||
|
||||
@@ -446,8 +446,8 @@ class MaterialEditor:
|
||||
d = self.getDict()
|
||||
# self.outputDict(d)
|
||||
if d:
|
||||
import importFCMat
|
||||
importFCMat.write(filename, d)
|
||||
from importFCMat import write
|
||||
write(filename, d)
|
||||
self.updateCards()
|
||||
|
||||
def show(self):
|
||||
|
||||
Reference in New Issue
Block a user