I’ve written a small app that creates a GUI for setting up uShare. Currently it depends heavily on the ‘w’ (write) and ‘a’ (append) functions to generate/edit ushare.conf file. But I’ve been trying to find a way for the app to store all the changes until a save button is pressed, and only then committing them to the actual file. I think that would be the best way of getting around having the user press enter every time they change any field (and indeed allow for GtkCheckButton).
The code giving me errors, (and any code where I use StringIO has the same result:
def on_userinput_activate(self, widget):
usrinpt = widget.get_text()
global output
output = StringIO.StringIO()
output.write(usrinpt)
def on_savetofile_clicked(self, widget):
global output
output = StringIO.StringIO()
global inserttofile
inserttofile = output.getvalue()
logfile = open('/home/boywithaxe/Desktop/test.txt', 'w')
logfile.write(inserttofile)
Build up a
StringIO“pseudo-file” and write that to disk when finished.