Skip to content

Commit 87734e8

Browse files
committed
headers config, layout fixes, themes fixes
1 parent a22ab0b commit 87734e8

File tree

1 file changed

+82
-61
lines changed

1 file changed

+82
-61
lines changed

src/dude.py

+82-61
Original file line numberDiff line numberDiff line change
@@ -619,15 +619,17 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
619619

620620
themes_names= ['Clam', 'Alt']
621621
if windows:
622-
themes_names = ['Vista','Winnative','Xpnative'] + themes_names
623-
else:
624-
themes_names = themes_names + ['Classic','Default']
622+
themes_names = ['Vista','Winnative'] + themes_names
623+
624+
#print('themes_names:',themes_names)
625625

626626
for name in themes_names:
627627
for darkness,darknesscode in (('',0),('Dark',1)):
628-
full_name = name + ' ' + darkness
628+
full_name = name + ((' ' + darkness) if darknesscode else '')
629629
self.themes_combos[full_name]=name.lower(),darknesscode
630630

631+
#print('themes_combos:',self.themes_combos)
632+
631633
self.default_theme='vista' if windows else 'clam'
632634

633635
theme_name,black_theme=self.themes_combos.get(self.cfg_get(CFG_THEME),(self.default_theme,0))
@@ -767,19 +769,22 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
767769
####################################################################
768770
style = Style()
769771

770-
parent_them = theme_name
771-
772772
try:
773773
style.theme_create( "dummy", parent=theme_name )
774774
except Exception as e:
775+
print("cannot set theme - setting default")
775776
print(e)
776777

777-
try:
778-
style.theme_create( "dummy", parent=self.default_theme )
779-
except Exception as e2:
780-
print(e2)
778+
self.cfg.set(CFG_THEME,self.default_theme)
779+
780+
sys_exit(1)
781781

782-
sys_exit(1)
782+
#try:
783+
# style.theme_create( "dummy", parent=self.default_theme )
784+
#except Exception as e2:
785+
# print(e2)
786+
787+
# sys_exit(1)
783788

784789
bg_color = self.bg_color = style.lookup('TFrame', 'background')
785790
preview.configure(bg=bg_color)
@@ -794,7 +799,7 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
794799
style_map('Treeview', background=[('focus',bg_focus),('selected',bg_sel),('',self.bg_content)] )
795800
style_map('semi_focus.Treeview', background=[('focus',bg_focus),('selected',bg_focus_off),('',self.bg_content)])
796801
#works but not for every theme
797-
style_configure("Treeview", fieldbackground=self.bg_content)
802+
style_configure("Treeview", fieldbackground=self.bg_content,background = bg_color,borderwidth=0)
798803

799804
style_map("TCheckbutton",indicatorbackground=[("disabled",self.bg_color),('','white')],indicatorforeground=[("disabled",'darkgray'),('','black')],foreground=[('disabled',"gray"),('',"black")])
800805
style_map("TEntry", foreground=[("disabled",'darkgray'),('','black')],fieldbackground=[("disabled",self.bg_color),('','white')])
@@ -815,11 +820,50 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
815820
style_configure("Treeview",rowheight=18)
816821
style_configure("TButton", anchor = "center")
817822
style_configure("TCheckbutton",anchor='center',padding=(4, 0, 4, 0) )
823+
818824
if windows:
819825
#fix border problem ...
820826
style_configure("TCombobox",padding=1)
821827

828+
#######################################################################
829+
830+
style.element_create("Treeheading.border", "from", "default")
831+
style.layout("Treeview.Heading", [
832+
("Treeheading.cell", {'sticky': 'nswe'}),
833+
("Treeheading.border", {'sticky':'nswe', 'children': [
834+
("Treeheading.padding", {'sticky':'nswe', 'children': [
835+
("Treeheading.image", {'side':'right', 'sticky':''}),
836+
("Treeheading.text", {'sticky':'we'})
837+
]})
838+
]}),
839+
])
840+
841+
style_configure("Treeview.Heading",background=self.bg_color, foreground="black", relief="groove")
842+
style_map("Treeview.Heading",relief=[('active','raised'),('pressed','sunken')])
822843

844+
style_configure("Treeview",background=self.bg_color, relief="flat",borderwidth=0)
845+
846+
#######################################################################
847+
#style.element_create("Vertical.Scrollbar.trough", "from", "default")
848+
#style.element_create("Vertical.Scrollbar.thumb", "from", "default")
849+
#style.element_create("Vertical.Scrollbar.grip", "from", "default")
850+
#style.element_create("Vertical.Scrollbar.uparrow", "from", "default")
851+
#style.element_create("Vertical.Scrollbar.downarrow", "from", "default")
852+
853+
854+
#style.layout("Vertical.TScrollbar", [
855+
# ("Vertical.Scrollbar.uparrow", {"side": "top", "sticky": "news"}),
856+
# ("Vertical.Scrollbar.downarrow", {"side": "bottom", "sticky": "news"}),
857+
# ("Vertical.Scrollbar.trough", {"sticky": "news", "children": [
858+
# ("Vertical.Scrollbar.thumb", {"sticky": "nswe", "children": [
859+
# ("Vertical.Scrollbar.grip", {"sticky": "news"})
860+
# ]})
861+
# ]})
862+
#])
863+
864+
# Konfiguracja stylu Scrollbara
865+
#style_configure("Vertical.TScrollbar",background=self.bg_color,troughcolor=self.bg_color,bordercolor='black',relief="raised")
866+
#style_map("Vertical.TScrollbar", background=[("active", "lightgray")],relief=[("pressed", "sunken")])
823867

824868
#######################################################################
825869
self.menubar = Menu(self_main,bg=bg_color)
@@ -856,24 +900,24 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
856900
self.status_all_quant=Label(status_frame_groups,width=10,borderwidth=2,bg=bg_color,relief='groove',foreground='red',anchor='w')
857901
self.status_all_quant_configure = self.status_all_quant.configure
858902

859-
self.status_all_quant.pack(fill='x',expand=0,side='right')
860-
Label(status_frame_groups,width=16,text=STR("All marked files # "),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='x',expand=0,side='right')
903+
self.status_all_quant.pack(fill='both',expand=0,side='right')
904+
Label(status_frame_groups,width=16,text=STR("All marked files # "),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='both',expand=0,side='right')
861905
self.status_all_size=Label(status_frame_groups,width=10,borderwidth=2,bg=bg_color,relief='groove',foreground='red',anchor='w')
862-
self.status_all_size.pack(fill='x',expand=0,side='right')
906+
self.status_all_size.pack(fill='both',expand=0,side='right')
863907
self.status_all_size_configure=self.status_all_size.configure
864908

865-
Label(status_frame_groups,width=20,text=STR('All marked files size: '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='x',expand=0,side='right')
909+
Label(status_frame_groups,width=20,text=STR('All marked files size: '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='both',expand=0,side='right')
866910
self.status_groups=Label(status_frame_groups,text='0',image=self.ico_empty,width=80,compound='right',borderwidth=2,bg=bg_color,relief='groove',anchor='e')
867911
self.status_groups_configure = self.status_groups.configure
868912

869-
self.status_groups.pack(fill='x',expand=0,side='right')
913+
self.status_groups.pack(fill='both',expand=0,side='right')
870914

871915
self.widget_tooltip(self.status_groups,STR('Number of groups with consideration of\n"Cross paths" or "Same directory" mode'))
872916

873-
Label(status_frame_groups,width=10,text=STR('Groups: '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='x',expand=0,side='right')
917+
Label(status_frame_groups,width=10,text=STR('Groups: '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='both',expand=0,side='right')
874918

875-
self.status_path = Label(status_frame_groups,text='',relief='flat',borderwidth=1,bg=bg_color,anchor='w')
876-
self.status_path.pack(fill='x',expand=1,side='left')
919+
self.status_path = Label(status_frame_groups,text='',relief='flat',borderwidth=3,bg=bg_color,anchor='w')
920+
self.status_path.pack(fill='both',expand=1,side='left')
877921
self.widget_tooltip(self.status_path,STR('The full path of a directory\nshown in the bottom panel.'))
878922

879923
self.status_path_configure=self.status_path.configure
@@ -882,20 +926,20 @@ def __init__(self,cwd,paths_to_add=None,exclude=None,exclude_regexp=None,norun=N
882926
(status_frame_folder := Frame(frame_folder,bg=bg_color)).pack(side='bottom',fill='both')
883927

884928
self.status_line_lab=Label(status_frame_folder,width=30,image=self_ico['expression'],compound= 'left',text='',borderwidth=2,bg=bg_color,relief='groove',anchor='w')
885-
self.status_line_lab.pack(fill='x',expand=1,side='left')
929+
self.status_line_lab.pack(fill='both',expand=1,side='left')
886930
self.status_line_lab_configure = self.status_line_lab.configure
887931
self.status_line_lab_update = self.status_line_lab.update
888932

889933
self.status_folder_quant=Label(status_frame_folder,width=10,borderwidth=2,bg=bg_color,relief='groove',foreground='red',anchor='w')
890-
self.status_folder_quant.pack(fill='x',expand=0,side='right')
934+
self.status_folder_quant.pack(fill='both',expand=0,side='right')
891935
self.status_folder_quant_configure=self.status_folder_quant.configure
892936

893-
Label(status_frame_folder,width=16,text=STR('Marked files # '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='x',expand=0,side='right')
894-
self.status_folder_size=Label(status_frame_folder,width=10,borderwidth=2,bg=bg_color,relief='groove',foreground='red',anchor='w')
937+
Label(status_frame_folder,width=16,text=STR('Marked files # '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='both',expand=0,side='right')
938+
self.status_folder_size=Label(status_frame_folder,width=80,image=self.ico_empty,compound='right',borderwidth=2,bg=bg_color,relief='groove',foreground='red',anchor='w')
895939
self.status_folder_size.pack(expand=0,side='right')
896940
self.status_folder_size_configure=self.status_folder_size.configure
897941

898-
Label(status_frame_folder,width=20,text=STR('Marked files size: '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='x',expand=0,side='right')
942+
Label(status_frame_folder,width=20,text=STR('Marked files size: '),relief='groove',borderwidth=2,bg=bg_color,anchor='e').pack(fill='both',expand=0,side='right')
899943

900944
self_main_unbind_class = self.main_unbind_class = self_main.unbind_class
901945

@@ -1046,47 +1090,24 @@ def self_folder_tree_yview(*args):
10461090
self_groups_tree_tag_configure = self_groups_tree.tag_configure
10471091
self_folder_tree_tag_configure = self_folder_tree.tag_configure
10481092

1049-
if black_theme:
1050-
self_groups_tree_tag_configure(self.NOTAG,foreground='white')
1051-
#self_groups_tree_tag_configure(self.FILE, foreground='white')
1052-
self_groups_tree_tag_configure(self.MARK, foreground='tomato')
1053-
#self_groups_tree_tag_configure(self.MARK, background='red')
1054-
1055-
self_groups_tree_tag_configure(self.CRC, foreground='white')
1056-
1057-
1058-
self_folder_tree_tag_configure(self.DIR,foreground='white',font="TkDefaultFont 10 bold")
1059-
self_folder_tree_tag_configure(self.DIRLINK,foreground='white',font="TkDefaultFont 10 bold")
1060-
self_folder_tree_tag_configure(self.UPDIR,foreground='white',font="TkDefaultFont 10 bold")
1061-
1062-
self_folder_tree_tag_configure(self.NOTAG,foreground='white')
1063-
self_folder_tree_tag_configure(self.LINK,foreground='white')
1064-
self_folder_tree_tag_configure(self.SINGLEHARDLINKED,foreground='white')
1065-
1066-
self_folder_tree_tag_configure(self.MARK, foreground='tomato')
1067-
self_folder_tree_tag_configure(self.MARK, background='tomato')
1068-
1069-
self_folder_tree_tag_configure(self.SINGLE, foreground='white')
1070-
self_folder_tree_tag_configure(self.DIR, foreground='white',font="TkDefaultFont 10 bold")
1071-
self_folder_tree_tag_configure(self.DIRLINK, foreground='white',font="TkDefaultFont 10 bold")
1072-
self_folder_tree_tag_configure(self.LINK, foreground='darkgray')
1073-
else:
1074-
self_groups_tree_tag_configure(self.NOTAG,foreground='black')
1093+
self_groups_tree_tag_configure(self.NOTAG,foreground=self.fg_content)
1094+
self_folder_tree_tag_configure(self.NOTAG,foreground=self.fg_content)
1095+
self_groups_tree_tag_configure(self.CRC, foreground='gray')
1096+
self_folder_tree_tag_configure(self.LINK, foreground='darkgray')
1097+
self_folder_tree_tag_configure(self.SINGLEHARDLINKED,foreground='darkgray')
10751098

1076-
self_groups_tree_tag_configure(self.MARK, foreground='red')
1077-
self_groups_tree_tag_configure(self.MARK, background='red')
1078-
self_groups_tree_tag_configure(self.CRC, foreground='gray')
1099+
mark_color = 'tomato' if black_theme else 'red'
1100+
folder_color = 'wheat1' if black_theme else 'wheat4'
10791101

1080-
self_folder_tree_tag_configure = self_folder_tree.tag_configure
1102+
self_groups_tree_tag_configure(self.MARK, foreground = mark_color)
10811103

1082-
self_folder_tree_tag_configure(self.MARK, foreground='red')
1083-
self_folder_tree_tag_configure(self.MARK, background='red')
1104+
self_folder_tree_tag_configure(self.DIR,foreground=folder_color,font="TkDefaultFont 10 bold")
1105+
self_folder_tree_tag_configure(self.DIRLINK,foreground=folder_color,font="TkDefaultFont 10 bold")
1106+
self_folder_tree_tag_configure(self.UPDIR,foreground=folder_color,font="TkDefaultFont 10 bold")
10841107

1085-
self_folder_tree_tag_configure(self.SINGLE, foreground='gray')
1086-
self_folder_tree_tag_configure(self.DIR, foreground='sienna4',font="TkDefaultFont 10 bold")
1087-
self_folder_tree_tag_configure(self.DIRLINK, foreground='sienna4',font="TkDefaultFont 10 bold")
1088-
self_folder_tree_tag_configure(self.LINK, foreground='darkgray')
1108+
self_folder_tree_tag_configure(self.MARK, foreground=mark_color)
10891109

1110+
self_folder_tree_tag_configure(self.SINGLE, foreground='gray')
10901111

10911112
#bind_class breaks columns resizing
10921113
self_folder_tree.bind('<ButtonPress-1>', self.tree_on_mouse_button_press)

0 commit comments

Comments
 (0)