@@ -86,11 +86,13 @@ def __init__(self, library: Library, driver: "QtDriver"):
86
86
self .open_file_action = QAction ("Open file" , self )
87
87
88
88
system = platform .system ()
89
- open_explorer_action = QAction ("Open in explorer" , self ) # Default (mainly going to be for linux)
89
+ self .open_explorer_action = QAction (
90
+ "Open in explorer" , self
91
+ ) # Default (mainly going to be for linux)
90
92
if system == "Darwin" :
91
- open_explorer_action = QAction ("Reveal in Finder" , self )
93
+ self . open_explorer_action = QAction ("Reveal in Finder" , self )
92
94
elif system == "Windows" :
93
- open_explorer_action = QAction ("Open in Explorer" , self )
95
+ self . open_explorer_action = QAction ("Open in Explorer" , self )
94
96
95
97
self .preview_img = QPushButtonWrapper ()
96
98
self .preview_img .setMinimumSize (* self .img_button_size )
@@ -842,7 +844,10 @@ def write_container(self, index, field, mixed=False):
842
844
# f'Are you sure you want to remove this \"{self.lib.get_field_attr(field, "name")}\" field?'
843
845
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
844
846
prompt = f'Are you sure you want to remove this "{ self .lib .get_field_attr (field , "name" )} " field?'
845
- callback = lambda : (self .remove_field (field ), self .update_widgets ())
847
+
848
+ def callback ():
849
+ return self .remove_field (field ), self .update_widgets ()
850
+
846
851
container .set_remove_callback (
847
852
lambda : self .remove_message_box (prompt = prompt , callback = callback )
848
853
)
@@ -887,7 +892,10 @@ def write_container(self, index, field, mixed=False):
887
892
)
888
893
container .set_edit_callback (modal .show )
889
894
prompt = f'Are you sure you want to remove this "{ self .lib .get_field_attr (field , "name" )} " field?'
890
- callback = lambda : (self .remove_field (field ), self .update_widgets ())
895
+
896
+ def callback ():
897
+ return self .remove_field (field ), self .update_widgets ()
898
+
891
899
container .set_remove_callback (
892
900
lambda : self .remove_message_box (prompt = prompt , callback = callback )
893
901
)
@@ -927,7 +935,10 @@ def write_container(self, index, field, mixed=False):
927
935
)
928
936
container .set_edit_callback (modal .show )
929
937
prompt = f'Are you sure you want to remove this "{ self .lib .get_field_attr (field , "name" )} " field?'
930
- callback = lambda : (self .remove_field (field ), self .update_widgets ())
938
+
939
+ def callback ():
940
+ return self .remove_field (field ), self .update_widgets ()
941
+
931
942
container .set_remove_callback (
932
943
lambda : self .remove_message_box (prompt = prompt , callback = callback )
933
944
)
@@ -954,7 +965,10 @@ def write_container(self, index, field, mixed=False):
954
965
# container.set_edit_callback(None)
955
966
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
956
967
prompt = f'Are you sure you want to remove this "{ self .lib .get_field_attr (field , "name" )} " field?'
957
- callback = lambda : (self .remove_field (field ), self .update_widgets ())
968
+
969
+ def callback ():
970
+ return self .remove_field (field ), self .update_widgets ()
971
+
958
972
container .set_remove_callback (
959
973
lambda : self .remove_message_box (prompt = prompt , callback = callback )
960
974
)
@@ -972,7 +986,7 @@ def write_container(self, index, field, mixed=False):
972
986
title = f"{ self .lib .get_field_attr (field , 'name' )} (Date)"
973
987
inner_container = TextWidget (title , date .strftime ("%D - %r" ))
974
988
container .set_inner_widget (inner_container )
975
- except :
989
+ except Exception :
976
990
container .set_title (self .lib .get_field_attr (field , "name" ))
977
991
# container.set_editable(False)
978
992
container .set_inline (False )
@@ -985,7 +999,10 @@ def write_container(self, index, field, mixed=False):
985
999
container .set_edit_callback (None )
986
1000
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
987
1001
prompt = f'Are you sure you want to remove this "{ self .lib .get_field_attr (field , "name" )} " field?'
988
- callback = lambda : (self .remove_field (field ), self .update_widgets ())
1002
+
1003
+ def callback ():
1004
+ return self .remove_field (field ), self .update_widgets ()
1005
+
989
1006
container .set_remove_callback (
990
1007
lambda : self .remove_message_box (prompt = prompt , callback = callback )
991
1008
)
@@ -1012,7 +1029,10 @@ def write_container(self, index, field, mixed=False):
1012
1029
container .set_edit_callback (None )
1013
1030
# container.set_remove_callback(lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets(item)))
1014
1031
prompt = f'Are you sure you want to remove this "{ self .lib .get_field_attr (field , "name" )} " field?'
1015
- callback = lambda : (self .remove_field (field ), self .update_widgets ())
1032
+
1033
+ def callback ():
1034
+ return self .remove_field (field ), self .update_widgets ()
1035
+
1016
1036
# callback = lambda: (self.lib.get_entry(item.id).fields.pop(index), self.update_widgets())
1017
1037
container .set_remove_callback (
1018
1038
lambda : self .remove_message_box (prompt = prompt , callback = callback )
@@ -1067,11 +1087,13 @@ def remove_message_box(self, prompt: str, callback: typing.Callable) -> None:
1067
1087
cancel_button = remove_mb .addButton (
1068
1088
"&Cancel" , QMessageBox .ButtonRole .DestructiveRole
1069
1089
)
1070
- remove_button = remove_mb .addButton (
1090
+ remove_button = remove_mb .addButton ( # noqa: F841
1071
1091
"&Remove" , QMessageBox .ButtonRole .RejectRole
1072
1092
)
1073
1093
# remove_mb.setStandardButtons(QMessageBox.StandardButton.Cancel)
1074
- remove_mb .setDefaultButton (cancel_button )
1094
+ remove_mb .setDefaultButton (
1095
+ cancel_button
1096
+ ) # TODO: is it supposed to be two cancel buttons? idk but i dont know either way so dont wanna change it
1075
1097
remove_mb .setEscapeButton (cancel_button )
1076
1098
result = remove_mb .exec_ ()
1077
1099
# logging.info(result)
0 commit comments