Hi,
Im working a little command line diff app that lets you edit the final results before saving it out. I think npyscreen is definitely the way to go, it really looks elegant.
I have all of the backend logic done, and what I kind of envisioned is being able to open two files side by side on the top half of the screen, and when they are merged, the output will be on the bottom half of the screen and be editable before saving it out. I have been concentrating on setting it up using npyscreen.NPSAppManaged and I have a menu that I plan to use to open the files, and fire off other functionality.
I figured out how to convert my lists of strings into a string and get it into the MultiLineEdit , and I can manage to get widgets onto the main form, but I was looking for a way to create a divide between the left and right side of the Form on only the top half, where the contents of file A and file B would be shown. I was able to get the SplitForm to work, but didn't see anything to split the screen vertically. Basically this is how I was approaching it.
class FormObject(npyscreen.ActionForm, npyscreen.FormWithMenus):
def create(self):
'''All of my widgets, Menu additions, and defs for button presses were in this class here
But its kind of messy because im trying all sorts of stuff and have no idea what im doing
and embarrassed to show it here :)'''
class EasyDiffApplication(npyscreen.NPSAppManaged):
def onStart(self):
self.addForm('MAIN', FormObject, name = 'Easy Diff')
if __name__ == '__main__':
myApp = EasyDiffApplication()
myApp.run()
I believe a good way to do it may be to use two identical sized boxed for the left and right side, and one larger box on the lower half perhaps, and then put my widgets in each of those boxes. I tried doing something with BasicBox, and I could get it to show up in the Main Form, but I was not able to get any widgets to show up in it. I have a feeling I am not supposed to use it like this? I also attempted to create another class that inherits npyscreen.ActionForm and tried to add that to the main form without success.
My question is, what is the appropriate way to get the Main Form divided visually in to three sections? Do I create separate classes of Forms with their own widgets added and somehow overlay that on the main form with positioning? Is that even possible? Or is there some other type of way to kind of containerize the three sections visually and everything is still written in the MAIN Form?
I see something similar to what I think I want to do in the Doga app https://raw.githubusercontent.com/pravj/Doga/master/docs/Doga.png , but I see they are using self.window.add(npyscreen.BoxTitle, name="Alert History", max_width=75, relx=52, rely=7), but their main Class inherits from class WindowForm(npyscreen.ActionForm): and they are not using NPSAppManaged.
The way I have it so far, window.add does not seem to be available for me to use in my MAIN form.
Just hoping for advice on the best route to pursue,
Thanks in advance for any advice someone can give,
Jeremy