Yes, on F3 (ctrl-F). I use it a lot. After the dust clears on how to
correct this implementation, I'll give ConfigObj more consideration.
(I think a subsequent post I made with two images in it showing the
layout of the program in action got side tracked here. I got a msg from
the list, saying the moderator had to approve something--probably it.
Whatever I said in it might be somewhat irrelevant here. So I continue.
See whoops at end!) Ok, let's see how this works. I've defined this function and the config_var_list. stop time is the last entry shown. It is part of the constructor for mainloop, Sentinel_GUI. and loads sdict as shown. def Set_ConfigDictionary(): config_var_list = (['config_file_name', ['Initial.sen', STR]], ['mask_file_name', ['xyz', STR]], ... ['stop_time', ['datetime.time(6, 0, 0)', DAT]], ... ) # load sdict sdict = {} for j in range(0, len(config_var_list)): # print "j: ", j, "str part: ", str(config_var_list[j][0]), config_var_list[j][1] sdict[str(config_var_list[j][0])] = config_var_list[j][1][0] ... self.sdict = sdict self.config_var_list = config_var_list ... sdict and config_var_list become global to Sentinel_GUI. The first index of conf_var_list maintains order for sdict. That is, when I want to output the config file, I use to to fetch from sdict what I need, which is a value and the "user" type, i.e., STR, DAT, BOO, etc. Now in SaveConfigFile, I go merrily along thusly: ... # SAVE CONFIG FILE items = self.sdict.keys() items.sort() for (j, conf_entry) in enumerate(self.config_var_list): varName = conf_entry[0] varType = self.config_var_list[j][1][1] # Note, date-time vars are in hh:mm:ss varValue = eval('self.' + varName) var_assignment = varName + "=" + str(varValue) <<--- Beep, beep config_file.write(var_assignment + "\n") ... "Beep, beep" shows the likely problem. I had coded this loop earlier to try (and not succeeding) to take into consideration DAT, BOO, ..., etc, but put aside how to handle the var_assignment statement (Note, Strictly speaking I should be using TIM and not DAT, for clarity.). Here, I suspect that I should put out something like datetime.time(11, 20, 10). The time being 11:00:10. Instead I chose, to put 11:00:10 in the file. I'm still a bit confused about what the file entry should be here. However! I think I may have drifted into the realm of : :-) UCFformLength = integer(min=50, max=80, default=66) FIformLength = integer(min=50, max=80, default=64) Maybe things are looking up for ConfigObj!!! Whoops footnote: I think I got you and Kent confused, but I think I'm on track here with thinking of the right person. I posted the two pix to him. Marc Tompkins wrote:
--
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor