def get_text(self, servername, username, password, callnumber):
def is_valid(value):
if value != '' and len(value) != 0:
return True
else:
return False
if is_valid(servername) and is_valid(username) and is_valid(password) and is_valid(callnumber):
self.app.config.update_setting('ConnectionDetails', 'server', servername)
self.app.config.update_setting('ConnectionDetails', 'user', username)
self.app.config.update_setting('ConnectionDetails', 'password', password)
self.app.config.update_setting('ConnectionDetails', 'call_no', callnumber)
connection_details = {'server': servername, 'user': username, 'password': password, 'call_no': callnumber}
else:
connection_details = self.app.config.get_section('ConnectionDetails')
# TODO: All of this code needs to be moved to another screen
# The generation of connection strings should occur in a completely different screen
# that is accessible from the main screen. The producer should be able to enter in the 4 values
# and it should output a connection string
# conn_string = username + ';' + password + ";" + servername + ";" + callnumber
# encoded = base64.b64encode(conn_string)
# self.app.config.update_setting('ConnectionDetails', 'conn_string', encoded)
# self.parent.current = 'session'
#
# # Make BoxLayout for multiple items
# popup_box = BoxLayout(orientation='vertical')
# # Make "Connection String" TextInput
# popup_text = TextInput(text=encoded, size_hint=(1, .8))
# popup_box.add_widget(popup_text)
# # Make "Close" button for popup
# close_button = Button(text='Close', size_hint=(.4, .2), pos_hint={'center_x': .5})
# popup_box.add_widget(close_button)
# popup = Popup(title='Connection String',
# content=popup_box,
# size_hint=(None, None), size=(400, 400),
# auto_dismiss=False)
# close_button.bind(on_press=popup.dismiss)
# # Open the popup
# popup.open()
self.parent.current = 'producer_session'
file_name = 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'], file_name)
self.app.lq_audio = self.app.phone.recording_start
print "passing lq_audio to gui: " + self.app.lq_audio
评论列表
文章目录