def get_text(self, conn_string):
if conn_string is not None and len(conn_string) != 0: # Use the provided connection string
connection_details = self.app.config.parse_conn_string()
if not connection_details['server'] \
and not connection_details['user'] \
and not connection_details['password'] \
and not connection_details['call_no']:
self.app.config.update_setting('ConnectionDetails', 'server', connection_details['server'])
self.app.config.update_setting('ConnectionDetails', 'user', connection_details['user'])
self.app.config.update_setting('ConnectionDetails', 'password', connection_details['password'])
self.app.config.update_setting('ConnectionDetails', 'call_no', connection_details['call_no'])
else:
print "Bad connection string"
error_message = 'Sorry, that string is not valid'
popup = Popup(title='Connection String Error',
content=Label(text=error_message),
size_hint=(None, None), size=(400, 400))
popup.open()
else: # Use the saved config values
connection_details = self.app.config.get_section('ConnectionDetails')
def is_valid(value):
if value != '' and value != 'None' and value is not None:
return True
return False
if not is_valid(connection_details['server']) \
or not is_valid(connection_details['user']) \
or not is_valid(connection_details['password']) \
or not is_valid(connection_details['call_no']):
# If the stored values aren't valid, nogood
print "No connection string and bad config values"
error_message = 'Sorry, the configuration is not valid'
popup = Popup(title='Connection String Error',
content=Label(text=error_message),
size_hint=(None, None), size=(400, 400))
popup.open()
if self.app.config.get('ChatSettings', 'role') == "ARTIST":
self.parent.current = 'artist_session'
else:
self.parent.current = 'listener_session'
filename = self.app.config.get_file_name(self.app.session_name, datetime.now().strftime(constants.DATETIME_LQ))
self.app.phone.make_call(connection_details['call_no'], connection_details['server'], filename)
评论列表
文章目录