Skip to content

Commit

Permalink
bugs fixed - RC
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrj committed Jan 11, 2024
1 parent aebc9a1 commit 68f5351
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 190 deletions.
72 changes: 15 additions & 57 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

if windows:
from subprocess import CREATE_NO_WINDOW
from signal import SIGBREAK
else:
from os import getpgid, killpg

Expand Down Expand Up @@ -202,10 +201,11 @@ def get_command(executable,parameters,full_file_path,shell):

#'ignore','replace','backslashreplace'
def popen_win(command,shell,stdin=DEVNULL):
return Popen(command, stdout=PIPE, stderr=STDOUT,stdin=stdin,shell=shell,text=True,universal_newlines=True,creationflags=CREATE_NO_WINDOW,close_fds=False,errors='ignore')
return Popen(command, stdout=PIPE, stderr=STDOUT,stdin=stdin,shell=shell,text=True,universal_newlines=True,bufsize=-1,errors='ignore',creationflags=CREATE_NO_WINDOW)
#,close_fds=False

def popen_lin(command,shell,stdin=DEVNULL):
return Popen(command, stdout=PIPE, stderr=STDOUT,stdin=stdin,shell=shell,text=True,universal_newlines=True,start_new_session=True,errors='ignore')
return Popen(command, stdout=PIPE, stderr=STDOUT,stdin=stdin,shell=shell,text=True,universal_newlines=True,bufsize=-1,errors='ignore',start_new_session=True)

uni_popen = (lambda command,shell=False,stdin=DEVNULL : popen_win(command,shell,stdin)) if windows else (lambda command,shell=False,stdin=DEVNULL : popen_lin(command,shell,stdin))

Expand Down Expand Up @@ -682,9 +682,9 @@ def threaded_cde(timeout_semi_list):
output_list_append = output_list.append

while True:
line = subprocess_stdout_readline().rstrip()
line = subprocess_stdout_readline()

output_list_append(line)
output_list_append(line.rstrip())

if not line and subprocess_poll() is not None:
returncode=subprocess.returncode
Expand Down Expand Up @@ -759,8 +759,11 @@ def threaded_cde(timeout_semi_list):
kill_subprocess(subprocess,print_func)
self.killed=True
abort_list[1]=False
sleep(0.2)
else:
sleep(0.5)
sleep(0.4)

print_func( ('info','custom data extraction finished.'),True)

cde_thread.join()

Expand Down Expand Up @@ -975,7 +978,7 @@ def find_items(self,
#katalog moze spelniac kryteria naazwy pliku ale nie ma rozmiaru i custom data
if name_func_to_call:
if name_func_to_call(name):
print_func([search_progress,size,mtime,*next_level])
print_func( (search_progress,size,mtime,*next_level) )
#search_progress_update_quant=0
#progress_update_time = perf_counter()

Expand Down Expand Up @@ -1043,11 +1046,12 @@ def find_items(self,
else:
continue

print_func([search_progress,size,mtime,*next_level])
print_func( (search_progress,size,mtime,*next_level) )
#search_progress_update_quant=0
#progress_update_time = perf_counter()

print_func([search_progress])
#print_func((search_progress))

#t_now = perf_counter()
#if t_now>progress_update_time+1.0:
# progress_update_time = t_now
Expand All @@ -1057,7 +1061,7 @@ def find_items(self,
#else:
# search_progress_update_quant+=1

print_func([search_progress])
print_func( [search_progress] )
#print_func(True)

def find_items_sort(self,what,reverse):
Expand Down Expand Up @@ -1739,10 +1743,7 @@ def find_items_in_records(self,
find_cd_search_kind,cd_expr,cd_case_sens,
filename_fuzzy_threshold,cd_fuzzy_threshold):

self.log.info(f'find_items_in_records {size_min},{size_max},\
{find_filename_search_kind},{name_expr},{name_case_sens},\
{find_cd_search_kind},{cd_expr},{cd_case_sens},\
{filename_fuzzy_threshold},{cd_fuzzy_threshold}')
self.log.info(f'find_items_in_records:{size_min},{size_max},{find_filename_search_kind},{name_expr},{name_case_sens},{find_cd_search_kind},{cd_expr},{cd_case_sens},{filename_fuzzy_threshold},{cd_fuzzy_threshold}')

self.find_results_clean()

Expand All @@ -1764,53 +1765,10 @@ def find_items_in_records(self,
print(e)

record_command_list={}
is_frozen = bool(getattr(sys, 'frozen', False))

for record_nr,record in enumerate(records_to_process):
curr_command_list = record_command_list[record_nr] = self.record_exe()

curr_command_list.extend(['search',record.file_path,temp_dir])

if t_min:
curr_command_list.extend( ['--timestamp_min',str(t_min) ] )

if t_max:
curr_command_list.extend( ['--timestamp_max',str(t_max)] )

if size_min:
curr_command_list.extend( ['--size_min',str(size_min).replace(' ','') ] )

if size_max:
curr_command_list.extend( ['--size_max',str(size_max).replace(' ','')] )

if name_expr:
if find_filename_search_kind == 'regexp':
curr_command_list.extend(['--file_regexp',name_expr])
elif find_filename_search_kind == 'glob':
curr_command_list.extend(['--file_glob',name_expr])
if name_case_sens:
curr_command_list.append('--file_case_sensitive')
elif find_filename_search_kind == 'fuzzy':
curr_command_list.extend(['--file_fuzzy',name_expr,'--file_fuzzy_threshold',filename_fuzzy_threshold])
elif find_filename_search_kind == 'error':
curr_command_list.append('--file_error')

if cd_expr:
if find_cd_search_kind == 'regexp':
curr_command_list.extend( ['--cd_regexp',cd_expr] )
elif find_cd_search_kind == 'glob':
curr_command_list.extend( ['--cd_glob',cd_expr] )
if cd_case_sens:
curr_command_list.append('--cd_case_sensitive')
elif find_cd_search_kind == 'fuzzy':
curr_command_list.extend( ['--cd_fuzzy',cd_expr,'--cd_fuzzy_threshold',cd_fuzzy_threshold] )
elif find_cd_search_kind == 'without':
curr_command_list.append('--cd_without')
elif find_cd_search_kind == 'any':
curr_command_list.append('--cd_ok')
elif find_cd_search_kind == 'error':
curr_command_list.append('--cd_error')

self.log.info(f'curr_command_list: {curr_command_list}')

self.find_res_quant = 0
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def __init__(self,parent,icon,bg_color,pre_show=None,post_close=None,min_width=1
self.find_info_var=StringVar()
self.find_info_var.set('-/-')
self.find_info_lab=Label(self.area_mark, textvariable=self.find_info_var, width=8,relief='groove',bd=2,bg=self.bg_color)
self.find_info_lab.pack(side='right', anchor='w',padx=2,pady=5,expand=1)
self.find_info_lab.pack(side='right', anchor='w',padx=2,pady=5,expand=1,fill='both')

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')
Expand Down
1 change: 0 additions & 1 deletion src/librer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
if windows:
from os import startfile
from win32api import GetVolumeInformation
from signal import SIGBREAK

#l_debug = logging.debug
l_info = logging.info
Expand Down
Loading

0 comments on commit 68f5351

Please sign in to comment.