On 29/03/2017 at 07:04, xxxxxxxx wrote:
Hi guys,
I am trying to save UI data to a .txt file and load UI settings back by the .txt file for the UI.
so for example:
If I have four GeDialog.AddEditText with different names in each one. and I have a save button and press it and save it right to the .txt file, which is good. now I have a Load button, but how you load the .txt file and read it, so it can fill in the four GeDialog.AddEditText with the data from .txt file.
This is how I am saving the .txt file and it works, but how to go about loading it back when I open it?
def Save_UI_Settings_Data(self) :
ChrName = self.GetString(self.ChrName)
Save_file = p.join(p.split(__file__)[0], ChrName+'_Data.txt')
doc = c4d.documents.GetActiveDocument()
SubN1 = self.GetString(self.UI_SN_1)
SubN2 = self.GetString(self.UI_SN_2)
SubN3 = self.GetString(self.UI_SN_3)
SubN4 = self.GetString(self.UI_SN_4)
if ChrName:
with open(Save_file,'a') as type_file:
type_file.write(p.split('Slot1')[1]+';'+SubN1+'\n')
type_file.write(p.split('Slot2')[1]+';'+SubN2+'\n')
type_file.write(p.split('Slot3')[1]+';'+SubN3+'\n')
type_file.write(p.split('Slot4')[1]+';'+SubN4+'\n')
return
Note!
This is new to me when saving data for a plugin, so plz help , a tip or example on this that I can find online to help me.
Cheers,
Ashton