Skip to content

Commit

Permalink
[24.2.13]
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdWindScholar committed Feb 13, 2024
1 parent 042b957 commit 1ab12e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pyscripts/sdat2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, TRANSFER_LIST_FILE, NEW_DATA_FILE, OUTPUT_IMAGE_FILE):
for block in command[1]:
begin = block[0]
block_count = block[1] - begin
print('\rCopying {} blocks into position {}...'.format(block_count, begin), end="")
print('Copying {} blocks into position {}...'.format(block_count, begin))

# Position output file
output_img.seek(begin * block_size)
Expand All @@ -55,15 +55,15 @@ def __init__(self, TRANSFER_LIST_FILE, NEW_DATA_FILE, OUTPUT_IMAGE_FILE):
output_img.write(new_data_file.read(block_size))
block_count -= 1
else:
print('\rSkipping command {}...'.format(command[0]), end="")
print('Skipping command {}...'.format(command[0]))

# Make file larger if necessary
if output_img.tell() < max_file_size:
output_img.truncate(max_file_size)

output_img.close()
new_data_file.close()
print('\nDone! Output image: {}'.format(os.path.realpath(output_img.name)))
print('Done! Output image: {}'.format(os.path.realpath(output_img.name)))

@staticmethod
def rangeset(src):
Expand Down
9 changes: 5 additions & 4 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(self):
@staticmethod
def write(info):
text.configure(state='normal')
if info != '\n':
if info not in ['\n', '\r\n', '']:
text.insert(END, "[%s]%s\n" % (time.strftime('%H:%M:%S'), info))
text.update()
text.yview('end')
Expand Down Expand Up @@ -587,7 +587,7 @@ def __repackerofsimage():
directoryname = askdirectory(title="选择你要打包的目录 例如 : .\\NH4_test\\vendor\\vendor")
filecontexts_path, fsconfig_path = find_fs_con(directoryname)
with cartoon():
mkdir(WorkDir+os.sep+'output')
mkdir(WorkDir + os.sep + 'output')
fspatch.main(directoryname, fsconfig_path)
cmd = "mkfs.erofs.exe %s/output/%s.img %s -z\"%s\" -T\"1230768000\" --mount-point=/%s --fs-config-file=%s --file-contexts=%s" % (
WorkDir, os.path.basename(directoryname), directoryname.replace("\\", "/"),
Expand Down Expand Up @@ -811,14 +811,15 @@ def setting():
type_value = StringVar(value=settings.extrepacktype)
ttk.Label(area1_custom_type, text="MKE2FS打包格式:").pack(side=LEFT)
Entry(area1_custom_type, textvariable=type_value).pack(padx=10, pady=10, side=LEFT)
Button(area1_custom_type, text="确定", command=lambda: settings.change('extrepacktype',type_value.get())).pack(padx=10, pady=10, side=LEFT)
Button(area1_custom_type, text="确定", command=lambda: settings.change('extrepacktype', type_value.get())).pack(
padx=10, pady=10, side=LEFT)
area1_custom_type.pack(fill=X)
area1_block_size = ttk.Frame(area1)
ttk.Label(area1_block_size, text="BLOCK大小:").pack(side=LEFT)
block_size = StringVar(value=settings.extblocksize)
Entry(area1_block_size, textvariable=block_size).pack(padx=10, pady=10, side=LEFT)
Button(area1_block_size, text="确定", command=lambda: settings.change('extblocksize',
block_size.get() if block_size.get().isdigit() else settings.extblocksize)).pack(
block_size.get() if block_size.get().isdigit() else settings.extblocksize)).pack(
padx=10, pady=10, side=LEFT)
area1_block_size.pack(fill=X)
area1.pack(fill=BOTH, padx=10, pady=10)
Expand Down

0 comments on commit 1ab12e3

Please sign in to comment.