def set_default_value(self): lastType = self.ini.get_last_type() if lastType in self.typeList: typeIndex = self.typeList.index(lastType) self.typeRb.SetSelection(typeIndex) self.on_select_type(None) if len(self.ini.get_last_lowercase()) > 0: lowercase = self.ini.get_last_lowercase().lower() == "true" self.lowercaseCb.SetValue(lowercase) self.classNameCtrl.SetValue(self.ini.get_last_classname()) self.authorCtrl.Clear() for author in self.ini.get_authors(): self.authorCtrl.Append(author) self.authorCtrl.SetValue(self.ini.get_last_author()) self.emailCtrl.Clear() for email in self.ini.get_emails(): self.emailCtrl.Append(email) self.emailCtrl.SetValue(self.ini.get_last_email()) self.licCtrl.Clear() for lic in common.get_licenses(): self.licCtrl.Append(lic) licIndex = self.licCtrl.FindString(self.ini.get_last_license()) self.licCtrl.Select(licIndex) self.select_license(self.ini.get_last_license())
def set_default_value(self): lastType = self.ini.get_last_type() if lastType == "C++": self.on_click_type1(None) self.typeRb1.select() if lastType == "C": self.on_click_type2(None) self.typeRb2.select() if lastType == "Python": self.on_click_type3(None) self.typeRb3.select() if lastType == "Java": self.on_click_type4(None) self.typeRb4.select() if lastType == "ObjectiveC": self.on_click_type5(None) self.typeRb5.select() if (len(self.ini.get_last_lowercase()) > 0): lowercase = (self.ini.get_last_lowercase().lower() == "true") self.lowercase.set(1 if lowercase else 0) self.classNameCtrl.delete(0, Tkinter.END) self.classNameCtrl.insert(0, self.ini.get_last_classname()) self.authorCtrl.delete(0, Tkinter.END) self.authorCtrl.insert(0, self.ini.get_last_author()) self.emailCtrl.delete(0, Tkinter.END) self.emailCtrl.insert(0, self.ini.get_last_email()) self.licCtrl.delete(0, Tkinter.END) licIndex = -1 i = 0 for lic in common.get_licenses(): self.licCtrl.insert(Tkinter.END, lic) if lic == self.ini.get_last_license(): licIndex = i i = i + 1 self.licCtrl.selection_clear(0, Tkinter.END) self.licCtrl.see(licIndex) # in MacOS X, call selection_set() will cause Listbox's position error. if sys.platform != "darwin": self.licCtrl.selection_set(licIndex) self.select_license(self.ini.get_last_license())