Rethinking the Places Tab
Jan 12, 2024 23:50:30 GMT -8
Post by Uncle Buddy on Jan 12, 2024 23:50:30 GMT -8
I'm back to the places tab after many months of detours.
Last time I was ready to get back to the places tab, I made a split decision to do GEDCOM first. That was maybe a 6 month detour.
What made me so unenthusiastic about getting back to finishing this simple GUI tab? Take a look at this code:
This was one of brainstorms that seemed clever at the time, but in programming, clever ideas often lead to convoluted code, and convoluted code can be nearly impossible to finish. In this case, there are twelve different functionalities that can appear in a dialog such as "add place", "delete place", "make a note about a place" etc. Instead of doing the normal thing and making widgets for twelve different dialogs, I pre-made a bunch of widgets that were named after the column and row where they'd be appearing (instead of naming them after what they do), and then when a widget in a certain position is needed for something, it is gridded on the dialog and given something to do based on which functionality the user has chosen. For each functionality, only some of the widgets would be needed, and they'd have a different task depending on what the user wanted to do.
The result is a masterpiece of confusion. A whirlwind of "I'll fix this bug when/if I figure out the widget references" mixed with interweaving sets of possible arrangements. A multi-dimensional moving target.
Of the twelve functionalities, I'd only gotten a good start on four of them. This is the perfect time to start over, instead of two weeks from now when I'd be wishing I'd never seen the places tab.
Last time I was ready to get back to the places tab, I made a split decision to do GEDCOM first. That was maybe a 6 month detour.
What made me so unenthusiastic about getting back to finishing this simple GUI tab? Take a look at this code:
self.ent_c1_r2 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r3 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r3 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r4 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r4 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r5 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r5 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r6 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r6 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r7 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r7 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r8 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r8 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r9 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r9 = tk.Entry(self.selected_inputs, width=24)
self.lab_c0_r10 = tk.Label(self.selected_inputs, text="")
self.ent_c1_r10 = tk.Entry(self.selected_inputs, width=24)
This was one of brainstorms that seemed clever at the time, but in programming, clever ideas often lead to convoluted code, and convoluted code can be nearly impossible to finish. In this case, there are twelve different functionalities that can appear in a dialog such as "add place", "delete place", "make a note about a place" etc. Instead of doing the normal thing and making widgets for twelve different dialogs, I pre-made a bunch of widgets that were named after the column and row where they'd be appearing (instead of naming them after what they do), and then when a widget in a certain position is needed for something, it is gridded on the dialog and given something to do based on which functionality the user has chosen. For each functionality, only some of the widgets would be needed, and they'd have a different task depending on what the user wanted to do.
The result is a masterpiece of confusion. A whirlwind of "I'll fix this bug when/if I figure out the widget references" mixed with interweaving sets of possible arrangements. A multi-dimensional moving target.
Of the twelve functionalities, I'd only gotten a good start on four of them. This is the perfect time to start over, instead of two weeks from now when I'd be wishing I'd never seen the places tab.