Commit eaff4fcb authored by dovahkiin's avatar dovahkiin

修改程序保存文件时路径错误以及*号不能作为保存文件的名字的问题。

parent 8d26d7e9
......@@ -220,13 +220,14 @@ def extractLayerImge(lay_info:lay_item, psd_name:str):
layer_name = layer_name.replace('|', "&")
pos_type = check_path(psd_name)
if pos_type == 2:
layer_name = ".\\" + psd_name[:-4] + '\\' + layer_name + '.png'
if pos_type == 1:
layer_name = psd_name[:-4] + '\\' + layer_name + '.png'
# 空格替换为下划线
layer_name = layer_name.replace(' ', '_')
layer_name = layer_name.replace('*', 'x')
if pos_type == 2:
layer_name = ".\\" + psd_name[:-4] + '/' + layer_name + '.png'
if pos_type == 1:
layer_name = psd_name[:-4] + '/' + layer_name + '.png'
x1 = lay_info.x
y1 = lay_info.y
......@@ -235,7 +236,10 @@ def extractLayerImge(lay_info:lay_item, psd_name:str):
pos = (x1, y1, x2, y2)
xywh = (lay_info.x , lay_info.y, lay_info.w, lay_info.h)
if lay_info.x != 0 or lay_info.y != 0:
layer_image = psd.composite(viewport = pos, force=True)
# layer_image.show(layer_name)
print("[# layer_image #]:", layer_image, "xywh:", xywh)
# temp_psd_show = psd.compose(True)
......
......@@ -5,7 +5,7 @@ import time
def to_exe():
# 改这两个
# 主要的py,py入口
main_py = "agasdfa.py"
main_py = "ui_main.py"
# 其他导入的py文件
# secondary = [
# "comm_class.py",
......
......@@ -76,7 +76,7 @@ class Pyqt5_Cut_psd(QtWidgets.QMainWindow, Ui_Form):
# 读取文件地址
def __read_file_path(self):
file_path = QFileDialog.getOpenFileName(self, "选择PSD文件", os.getcwd(), '表格文件(*.psd)')
file_path = QFileDialog.getOpenFileName(self, "选择PSD文件", os.getcwd(), 'PSD文件(*.psd)')
if (file_path != ''):
self.let_psd_name.setText(file_path[0])
print(file_path)
......
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