91
91
CFG_KEY_SHOW_TOOLTIPS_INFO = 'show_tooltips_info'
92
92
CFG_KEY_SHOW_TOOLTIPS_HELP = 'show_tooltips_help'
93
93
CFG_KEY_PREVIEW_AUTO_UPDATE = 'preview_auto_update'
94
+ CFG_KEY_AUTO_MARK = 'auto_mark'
94
95
CFG_KEY_FULL_PATHS = 'show_full_paths'
95
96
CFG_KEY_SHOW_MODE = 'show_mode'
96
97
CFG_KEY_REL_SYMLINKS = 'relative_symlinks'
138
139
CFG_KEY_SHOW_TOOLTIPS_INFO :True ,
139
140
CFG_KEY_SHOW_TOOLTIPS_HELP :True ,
140
141
CFG_KEY_PREVIEW_AUTO_UPDATE :True ,
142
+ CFG_KEY_AUTO_MARK :True ,
141
143
CFG_KEY_FULL_PATHS :False ,
142
144
CFG_KEY_SHOW_MODE :'0' ,
143
145
CFG_KEY_REL_SYMLINKS :True ,
@@ -627,6 +629,8 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
627
629
628
630
for name in themes_names :
629
631
for darkness ,darknesscode in (('' ,0 ),('Dark' ,1 )):
632
+ if name == 'Vista' and darknesscode == 1 :
633
+ continue
630
634
full_name = name + ((' ' + darkness ) if darknesscode else '' )
631
635
self .themes_combos [full_name ]= name .lower (),darknesscode
632
636
@@ -1813,6 +1817,7 @@ def get_settings_dialog(self):
1813
1817
self .show_tooltips_info = BooleanVar ()
1814
1818
self .show_tooltips_help = BooleanVar ()
1815
1819
self .preview_auto_update = BooleanVar ()
1820
+ self .auto_mark = BooleanVar ()
1816
1821
1817
1822
self .show_full_paths = BooleanVar ()
1818
1823
self .show_mode = StringVar ()
@@ -1839,6 +1844,7 @@ def get_settings_dialog(self):
1839
1844
(self .show_tooltips_info ,CFG_KEY_SHOW_TOOLTIPS_INFO ),
1840
1845
(self .show_tooltips_help ,CFG_KEY_SHOW_TOOLTIPS_HELP ),
1841
1846
(self .preview_auto_update ,CFG_KEY_PREVIEW_AUTO_UPDATE ),
1847
+ (self .auto_mark ,CFG_KEY_AUTO_MARK ),
1842
1848
(self .show_full_paths ,CFG_KEY_FULL_PATHS ),
1843
1849
(self .create_relative_symlinks ,CFG_KEY_REL_SYMLINKS ),
1844
1850
(self .erase_empty_directories ,CFG_ERASE_EMPTY_DIRS ),
@@ -1911,6 +1917,10 @@ def get_settings_dialog(self):
1911
1917
(preview_auto_update_cb := Checkbutton (label_frame , text = ' ' + STR ('Preview auto update' ), variable = self .preview_auto_update )).grid (row = 4 ,column = 0 ,sticky = 'wens' ,padx = 3 ,pady = 2 )
1912
1918
self_widget_tooltip (preview_auto_update_cb ,STR ('TOOLTIP_PAU' ))
1913
1919
1920
+ (auto_mark_cb := Checkbutton (label_frame , text = ' ' + STR ('Auto-mark behavior' ), variable = self .auto_mark )).grid (row = 5 ,column = 0 ,sticky = 'wens' ,padx = 3 ,pady = 2 )
1921
+ self_widget_tooltip (auto_mark_cb ,STR ('TOOLTIP_AMB' ))
1922
+
1923
+
1914
1924
label_frame = LabelFrame (self .settings_dialog .area_main , text = STR ("Confirmation dialogs" ),borderwidth = 2 ,bg = self .bg_color )
1915
1925
label_frame .grid (row = row ,column = 0 ,sticky = 'wens' ,padx = 3 ,pady = 3 ) ; row += 1
1916
1926
@@ -3233,7 +3243,8 @@ def preview_focusin(self):
3233
3243
3234
3244
def show_preview (self ,user_action = True ):
3235
3245
self_preview = self .preview
3236
- self .preview_photo_image_cache = Image_Cache ()
3246
+ if not self .preview_photo_image_cache :
3247
+ self .preview_photo_image_cache = Image_Cache ()
3237
3248
3238
3249
if self .preview_shown :
3239
3250
self_preview .lift ()
@@ -3308,19 +3319,24 @@ def update_preview(self):
3308
3319
elif ext_lower in TEXT_EXTENSIONS :
3309
3320
self .preview_label_img .pack_forget ()
3310
3321
self .preview_text .delete (1.0 , 'end' )
3311
- try :
3312
- with open (path ,'rt' , encoding = 'utf-8' , errors = 'ignore' ) as file :
3322
+ if file_size < 1024 * 1024 * 10 :
3323
+ try :
3324
+ with open (path ,'rt' , encoding = 'utf-8' , errors = 'ignore' ) as file :
3313
3325
3314
- cont_lines = file .readlines ()
3315
- self .preview_label_txt_configure (text = STR ('lines:' ) + f'{ fnumber (len (cont_lines ))} ' )
3316
- self .preview_text .insert ('end' , '' .join (cont_lines ))
3317
- except Exception as e :
3318
- self .preview_label_txt_configure (text = str (e ))
3319
- self .preview .title (path )
3320
- self .preview_frame_txt .pack_forget ()
3326
+ cont_lines = file .readlines ()
3327
+ self .preview_label_txt_configure (text = STR ('lines:' ) + f'{ fnumber (len (cont_lines ))} ' )
3328
+ self .preview_text .insert ('end' , '' .join (cont_lines ))
3329
+ except Exception as e :
3330
+ self .preview_label_txt_configure (text = str (e ))
3331
+ self .preview .title (path )
3332
+ self .preview_frame_txt .pack_forget ()
3333
+ else :
3334
+ self .preview_frame_txt .pack (fill = 'both' ,expand = 1 )
3335
+ self .preview .title (path )
3321
3336
else :
3322
- self .preview_frame_txt . pack ( fill = 'both' , expand = 1 )
3337
+ self .preview_label_txt_configure ( text = 'file size > 10MB' )
3323
3338
self .preview .title (path )
3339
+ self .preview_frame_txt .pack_forget ()
3324
3340
3325
3341
elif file_size < 1024 * 1024 * 10 :
3326
3342
self .preview_label_img .pack_forget ()
@@ -3366,7 +3382,8 @@ def hide_preview(self,user_action=True):
3366
3382
self .cfg .set_bool (CFG_KEY_SHOW_PREVIEW ,False )
3367
3383
3368
3384
self .preview_photo_image_cache .end ()
3369
- del self .preview_photo_image_cache
3385
+
3386
+ #del self.preview_photo_image_cache
3370
3387
self .preview_photo_image_cache = None
3371
3388
3372
3389
self .preview_label_txt_configure (text = '' )
@@ -4660,6 +4677,9 @@ def settings_ok(self):
4660
4677
self .cfg .set_bool (CFG_KEY_PREVIEW_AUTO_UPDATE ,self .preview_auto_update .get ())
4661
4678
self .preview_auto_update_bool = self .cfg_get_bool (CFG_KEY_PREVIEW_AUTO_UPDATE )
4662
4679
4680
+ if self .cfg_get_bool (CFG_KEY_AUTO_MARK )!= self .auto_mark .get ():
4681
+ self .cfg .set_bool (CFG_KEY_AUTO_MARK ,self .auto_mark .get ())
4682
+
4663
4683
if self .cfg_get_bool (CFG_KEY_FULL_PATHS )!= self .show_full_paths .get ():
4664
4684
self .cfg .set_bool (CFG_KEY_FULL_PATHS ,self .show_full_paths .get ())
4665
4685
update1 = True
@@ -5702,6 +5722,20 @@ def file_check_state(self,item):
5702
5722
5703
5723
return None
5704
5724
5725
+ def check_and_auto_mark (self ,action ,tree ):
5726
+ #auto mark if nothing is selected
5727
+ if not self .tagged and action != HARDLINK and self .cfg_get_bool (CFG_KEY_AUTO_MARK ):
5728
+ item = self .sel_item
5729
+
5730
+ try :
5731
+ kind ,size ,crc , (pathnr ,path ,file ,ctime ,dev ,inode ) = self .groups_tree_item_to_data [item ]
5732
+ print (kind )
5733
+ if inode :
5734
+ self .tag_toggle_selected (tree ,item )
5735
+ except :
5736
+ #akcja na dolnym panelu na pliku "pojedynczym"
5737
+ pass
5738
+
5705
5739
@block_and_log
5706
5740
def process_files_in_groups_wrapper (self ,action ,all_groups ):
5707
5741
processed_items = defaultdict (dict )
@@ -5714,6 +5748,8 @@ def process_files_in_groups_wrapper(self,action,all_groups):
5714
5748
self_sel_crc = self .sel_crc
5715
5749
self_tagged = self .tagged
5716
5750
5751
+ self .check_and_auto_mark (action ,self .groups_tree )
5752
+
5717
5753
self_tree_children_sub = self .tree_children_sub
5718
5754
5719
5755
for crc in self .tree_children [self .groups_tree ]:
@@ -5749,6 +5785,8 @@ def process_files_in_folder_wrapper(self,action,on_dir_action=False):
5749
5785
else :
5750
5786
scope_title = STR ('Selected Directory.' )
5751
5787
5788
+ self .check_and_auto_mark (action ,self .folder_tree )
5789
+
5752
5790
self_current_folder_items_tagged = self .current_folder_items_tagged
5753
5791
self_groups_tree_item_to_data = self .groups_tree_item_to_data
5754
5792
index = defaultdict (int )
@@ -6527,7 +6565,6 @@ def process_files(self,action,processed_items,scope_title):
6527
6565
#kind,size_item,crc_item, (pathnr,path,file,ctime,dev,inode) = self_groups_tree_item_to_data[item] for index,item in items_dict.items()
6528
6566
self .process_files_total_size = sum ([self_groups_tree_item_to_data [item ][1 ] for group ,items_dict in processed_items .items () for item in items_dict .values ()])
6529
6567
else :
6530
-
6531
6568
self .process_files_total_size = sum ([self .crc_to_size [crc ] for crc ,items_dict in processed_items .items () for item in items_dict .values ()])
6532
6569
6533
6570
self .process_files_total_size_str = bytes_to_str (self .process_files_total_size )
0 commit comments