Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/run.yml
  • Loading branch information
piotrj committed Mar 2, 2024
2 parents 95bc4c6 + 0c675d5 commit 7d5448f
Show file tree
Hide file tree
Showing 11 changed files with 795 additions and 339 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ jobs:
path: ./

- name: rename windows distro
run: mv ./librer.win.zip ./librer.${{ steps.version.outputs.version }}.nuitka.portable.windows.zip
run: mv ./librer.win.zip ./librer.${{ steps.version.outputs.version }}.portable.windows.nuitka.zip


#####################################
- name: download linux nuitka distro
Expand All @@ -248,7 +249,7 @@ jobs:
path: ./

- name: rename linux distro
run: mv ./librer.lin.zip ./librer.${{ steps.version.outputs.version }}.nuitka.portable.linux.zip
run: mv ./librer.lin.zip ./librer.${{ steps.version.outputs.version }}.portable.linux.nuitka.zip

#####################################
- name: Create GitHub release
Expand All @@ -262,7 +263,8 @@ jobs:
prerelease: false
files: |
librer.${{ steps.version.outputs.version }}.portable.linux.zip
librer.${{ steps.version.outputs.version }}.portable.linux.nuitka.zip
librer.${{ steps.version.outputs.version }}.portable.windows.zip
librer.${{ steps.version.outputs.version }}.nuitka.portable.linux.zip
librer.${{ steps.version.outputs.version }}.nuitka.portable.windows.zip
librer.${{ steps.version.outputs.version }}.portable.windows.nuitka.zip
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ psutil==5.9.8
pympler==1.0.1
ciso8601==2.3.1
pywin32==306; sys.platform == 'win32'
nuitka==2.0.2
nuitka==2.0.6
513 changes: 331 additions & 182 deletions src/core.py

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ def __init__(self,parent,icon,bg_color,pre_show=None,post_close=None,min_width=1
self.area_main.grid_columnconfigure(0, weight=1)

self.cancel_button=Button(self.area_buttons, text='Close', width=14, command=super().hide )
self.cancel_button.pack(side='right', anchor='e',padx=2,pady=5)
self.cancel_button.pack(side='right', anchor='e',padx=2,pady=5,fill='both')

self.copy_button=Button(self.area_buttons, text='Copy', width=14, command=self.clip_copy_message )
self.copy_button.pack(side='right', anchor='w',padx=2,pady=5)
self.copy_button.pack(side='right', anchor='w',padx=2,pady=5,fill='both')

self.find_next_butt=Button(self.area_mark, command=lambda : self.find_next_prev(1), width=1)
self.find_next_butt.pack(side='right', anchor='w',padx=2,pady=5,fill='both')
Expand All @@ -372,6 +372,10 @@ def __init__(self,parent,icon,bg_color,pre_show=None,post_close=None,min_width=1
self.find_prev_butt=Button(self.area_mark, command=lambda : self.find_next_prev(-1), width=1)
self.find_prev_butt.pack(side='right', anchor='w',padx=2,pady=5,fill='both')

self.find_cs_var=BooleanVar()
self.find_cs=Checkbutton(self.area_mark,text='C.S.',variable=self.find_cs_var, command=lambda : self.find_key_binding() )
self.find_cs.pack(side='right', anchor='e',padx=5,pady=5,expand='yes', fill='both')

self.find_var=StringVar()
self.find_entry=Entry(self.area_mark, textvariable=self.find_var, width=22)
self.find_entry.pack(side='right', anchor='w',padx=2,pady=5,fill='both')
Expand All @@ -384,7 +388,7 @@ def __init__(self,parent,icon,bg_color,pre_show=None,post_close=None,min_width=1
self.text_search_pool_index=0

self.find_lab=Label(self.area_mark)
self.find_lab.pack(side='right', anchor='e',padx=5,pady=5)
self.find_lab.pack(side='right', anchor='e',padx=5,pady=5,expand='yes', fill='both')

try:
self.find_lab.configure(text='Mark:',compound='left')
Expand Down Expand Up @@ -459,7 +463,7 @@ def find_key_binding(self,event=None):
len_search_str = len(search_str)

while True:
start_index = self_text_search(search_str, start_index, 'end')
start_index = self_text_search(search_str, start_index, 'end',nocase=0 if self.find_cs_var.get() else 1)
if not start_index:
break
end_index = f"{start_index}+{len_search_str}c"
Expand Down Expand Up @@ -505,7 +509,7 @@ def __init__(self,parent,icon,bg_color,pre_show=None,post_close=None,min_width=8
self.cancel_button.pack(side='left', anchor='n',padx=5,pady=5)

self.ok_button=Button(self.area_buttons, text='OK', width=14, command=self.ok,image=image, compound='left' )
self.ok_button.pack(side='right', anchor='n',padx=5,pady=5)
self.ok_button.pack(side='right', anchor='n',padx=5,pady=5,fill='both')

self.focus=self.cancel_button

Expand Down
Binary file added src/icons/cd_aborted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/cd_empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/icons/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/icons/right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/icons/up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
551 changes: 425 additions & 126 deletions src/librer.py

Large diffs are not rendered by default.

44 changes: 23 additions & 21 deletions src/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,21 @@ def caretaker(signal_file):
sys_stdout_flush = sys.stdout.flush
lines_non_stop=0

json_dumps_loc = json_dumps
stdout_data_queue_loc = stdout_data_queue
path_exists_loc = path_exists

def flush_last_data_not_printed(flush):
nonlocal last_data_not_printed
if last_data_not_printed:
print(json_dumps(last_data_not_printed),flush=flush)
print(json_dumps_loc(last_data_not_printed),flush=flush)
last_data_not_printed=None

while True:
now=perf_counter()
now_grater_than_next_time_print = bool(now>next_time_print)

if stdout_data_queue:
if stdout_data_queue_loc:
data,always=stdout_data_queue_get()

if data==True:
Expand All @@ -146,7 +150,7 @@ def flush_last_data_not_printed(flush):
flush_last_data_not_printed(False)

if always or now_grater_than_next_time_print:
print(json_dumps(data),flush=True)
print(json_dumps_loc(data),flush=True)
next_time_print=now+print_min_time_period
lines_non_stop+=1
last_data_not_printed=None
Expand All @@ -163,7 +167,7 @@ def flush_last_data_not_printed(flush):

if now>next_signal_file_check:
next_signal_file_check=now+signal_file_check_period
if path_exists(signal_file):
if path_exists_loc(signal_file):
try:
with open(signal_file,'r') as sf:
got_int = int(sf.read().strip())
Expand All @@ -174,7 +178,7 @@ def flush_last_data_not_printed(flush):
except Exception as pe:
print_info(f'check_abort error:{pe}')

sleep(0.01)
sleep(0.001)

sys.exit(0) #thread

Expand Down Expand Up @@ -265,20 +269,20 @@ def proper_exit(code):
cd_glob=bool(find_cd_search_kind=='glob')
cd_fuzzy=bool(find_cd_search_kind=='fuzzy')
cd_error=bool(find_cd_search_kind=='error')
cd_empty=bool(find_cd_search_kind=='empty')
cd_aborted=bool(find_cd_search_kind=='aborted')
cd_without=bool(find_cd_search_kind=='without')
cd_ok=bool(find_cd_search_kind=='any')

if cd_regexp:
custom_data_needed=True
cd_search_kind='regexp'
if res := test_regexp(cd_expr):
proper_exit(res)
re_obj_cd=re_compile(cd_expr, MULTILINE | DOTALL)
cd_func_to_call = lambda x : re_obj_cd.match(x)

elif cd_glob:
custom_data_needed=True
cd_search_kind='glob'
if cd_case_sens:
re_obj_cd=re_compile(translate(cd_expr), MULTILINE | DOTALL)
cd_func_to_call = lambda x : re_obj_cd.match(x)
Expand All @@ -287,19 +291,17 @@ def proper_exit(code):
cd_func_to_call = lambda x : re_obj_cd.match(x)
elif cd_fuzzy:
custom_data_needed=True
cd_search_kind='fuzzy'
cd_func_to_call = lambda x : bool(SequenceMatcher(None,cd_expr, x).ratio()>cd_fuzzy_threshold)
elif cd_without:
cd_search_kind='without'
cd_func_to_call = None
elif cd_empty:
cd_func_to_call = None
elif cd_error:
cd_search_kind='error'
cd_func_to_call = None
elif cd_ok:
cd_search_kind='any'
cd_func_to_call = None
else:
cd_search_kind='dont'
#cd_search_kind='dont'
cd_func_to_call = None

#####################################################################
Expand All @@ -319,7 +321,7 @@ def proper_exit(code):
size_min,size_max,
t_min,t_max,
name_search_kind,name_func_to_call,
cd_search_kind,cd_func_to_call,
find_cd_search_kind,cd_func_to_call,
print_info)
except Exception as fe:
print_info(f'find_items error:{fe}')
Expand All @@ -334,32 +336,32 @@ def proper_exit(code):
with open(sep.join([comm_dir,SCAN_DAT_FILE]),"rb") as f:
create_list = loads(ZstdDecompressor().decompress(f.read()))

label,path_to_scan,check_dev,cde_list = create_list
label,path_to_scan,check_dev,compression_level,threads,cde_list = create_list
except Exception as e:
print_info(f'create error:{e}')
proper_exit(2)
else:
new_record = LibrerRecord(label=label,scan_path=path_to_scan)

try:
print_func(['stage',0],True)
print_func(('stage',0),True)
new_record.scan(print_func,abort_list,tuple(cde_list),check_dev)
except Exception as fe:
print_info(f'scan error:{fe}')
else:
if not abort_list[0]:
if cde_list :
try:
print_func(['stage',1],True)
new_record.extract_customdata(print_func,abort_list)
print_func(('stage',1),True)
new_record.extract_customdata(print_func,abort_list,threads=threads)
except Exception as cde:
print_info(f'cde error:{cde}')

print_func(['stage',2],True)
print_func(('stage',2),True)
new_record.pack_data(print_func)
print_func(['stage',3],True)
new_record.save(print_func,file_path=args.file,compression_level=9)
print_func(['stage',4],True)
print_func(('stage',3),True)
new_record.save(print_func,file_path=args.file,compression_level=compression_level)
print_func(('stage',4),True)

#####################################################################
else:
Expand Down

0 comments on commit 7d5448f

Please sign in to comment.