def connect_database(self,*event): global host,user,password,database,connected self.change_button(False) if self.check_fields(): if dbconnect.connect_to_db(str(self.host_field.get()),str(self.user_field.get()),str(self.pass_field.get()),str(self.db_field.get()),input_observer=observer): host = str(self.host_field.get()) user = str(self.user_field.get()) password = str(self.pass_field.get()) database = str(self.db_field.get()) # save_settings() connected = True self.master.destroy() else: showwarning('Unable to connect','Incorrect credentials or database.') self.change_button(self.check_fields()) else: showwarning('Incorrect input','Incorrect input, please check the fields.') self.change_button(self.check_fields())
engine_thread.start() # Don't return any value here, as DUI.py will interpret any # returned value as an error. except Exception as e: return 'Rule engine did not start due to an unknown error! ' + str(e) return def get_rule_engine(): return engine_thread def stop_rule_engine(): if engine_thread: engine_thread.stop() def debug_produce_function(message): decoded = actions.decode(message) print('TO-BROWSER: '+str(decoded)) # Test function. Run this file (in interactive mode) to parse the standaard.ECA in the same folder. if __name__ == '__main__': dbconnect.connect_to_db( '130.89.10.35','antwan','batatweets','anton_tweets' ) #print(load_file(os.path.join(os.getcwd(),'f.ECA'))) #print(load_file(os.path.join(os.getcwd(),'small.ECA'))) #print(load_file(os.path.join(os.getcwd(),'standaard.ECA'))) #print(load_file(os.path.join(os.getcwd(),'mcall.ECA'))) print(load_file(os.path.join(os.getcwd(),'fourgadgetdemo.ECA'))) #print(load_file(os.path.join(os.getcwd(),'simple_wordcloud.ECA'))) #print(load_file(os.path.join(os.getcwd(),'complex_wordcloud.ECA'))) start_rule_engine(speed=100000000) # start_rule_engine(speed=100000000, produce=debug_produce_function)
return def get_rule_engine(): return engine_thread def stop_rule_engine(): if engine_thread: engine_thread.stop() def debug_produce_function(message): decoded = actions.decode(message) print('TO-BROWSER: ' + str(decoded)) # Test function. Run this file (in interactive mode) to parse the standaard.ECA in the same folder. if __name__ == '__main__': dbconnect.connect_to_db('130.89.10.35', 'antwan', 'batatweets', 'anton_tweets') #print(load_file(os.path.join(os.getcwd(),'f.ECA'))) #print(load_file(os.path.join(os.getcwd(),'small.ECA'))) #print(load_file(os.path.join(os.getcwd(),'standaard.ECA'))) #print(load_file(os.path.join(os.getcwd(),'mcall.ECA'))) print(load_file(os.path.join(os.getcwd(), 'fourgadgetdemo.ECA'))) #print(load_file(os.path.join(os.getcwd(),'simple_wordcloud.ECA'))) #print(load_file(os.path.join(os.getcwd(),'complex_wordcloud.ECA'))) start_rule_engine(speed=100000000) # start_rule_engine(speed=100000000, produce=debug_produce_function)