def get_new_conversion (self, *args): unit=self.get_choice(self.unitChoiceWidget) amt = self.amountWidget.get_text() try: amt = float(amt) except: de.show_message(label='Invalid Amount',sublabel='Amount %s is not a number.'%amt) self.amountWidget.grab_focus() self.amount=amt self.unit = unit self.usdaChangedCB()
def ok_cb (self, *args): if not self.current_db: de.show_message(label='No database selected.', sublabel='You need to select a database system.') else: self.retdic = {'db_backend':self.current_db} if self.current_db in self.need_connection_info: for e in self.connection_widgets: if e.find('Entry') >= 0: self.retdic[e[0:e.find('Entry')]]=getattr(self,e).get_text() self.retdic['store_pw']=self.pwCheckButton.get_active() if self.current_db in self.need_file_info: fi = self.fileEntry.get_text() if fi and fi.find(os.path.sep) < 0: fi = os.path.join(self.default_file_directory,fi) self.retdic['file']=fi self.window.hide() self.window.destroy() if self._okcb: self._okcb(self.retdic) if self.modal: gtk.mainquit() return self.retdic