def load(self, host="localhost", port=6499): print "Tuner.load " + str(port) # Calibrate page self.calibrate = Calibrate(changefunc=self.onChange, host=host, port=port) self.tabs.addTab(self.calibrate.get_widget(), "Calibrate") # Preflight page self.preflight = Preflight(changefunc=self.onChange, host=host, port=port) self.tabs.addTab(self.preflight.get_widget(), "Preflight") # Launch page self.launch = Launch(changefunc=self.onChange, host=host, port=port) self.tabs.addTab(self.launch.get_widget(), "Launch") # Circle hold page self.circle = Circle(changefunc=self.onChange, host=host, port=port) self.tabs.addTab(self.circle.get_widget(), "Circle") # Chirp page self.chirp = Chirp(changefunc=self.onChange, host=host, port=port) self.tabs.addTab(self.chirp.get_widget(), "Chirp") # Land page self.land = Land(changefunc=self.onChange, host=host, port=port) self.tabs.addTab(self.land.get_widget(), "Land")
def __init__(self, root): self.root = root self.manifest = PackageXML(self.root + '/package.xml') self.name = self.manifest.name self.cmake = parse_file(self.root + '/CMakeLists.txt') package_structure = get_package_structure(root) self.source_code = SourceCode(package_structure['source'], self.name) self.source_code.setup_tags(self.cmake) self.launches = [] self.plugin_configs = [] for rel_fn, file_path in package_structure['launch'].iteritems(): self.launches.append(Launch(rel_fn, file_path)) for rel_fn, file_path in package_structure['plugin_config'].iteritems( ): self.plugin_configs.append(PluginXML(rel_fn, file_path)) self.setup_py = None if 'setup.py' in package_structure['key']: self.setup_py = SetupPy(self.name, package_structure['key']['setup.py']) self.generators = collections.defaultdict(list) for rel_fn, path in package_structure['generators'].iteritems(): gen = ROSGenerator(rel_fn, path) self.generators[gen.type].append(gen) self.dynamic_reconfigs = package_structure['cfg'].keys() self.misc_files = package_structure[None].keys()
def launches(update, context): pass j = requests.get('https://fdo.rocketlaunch.live/json/launches/next/5') n_results = 5 api_json = json.loads(j.text)['result'] txts = [] livestream = "" for i in range(0, n_results): padlocation = str( api_json[i]['pad']['location']['statename']) + ', ' + str( api_json[i]['pad']['location']['country']) print(str(api_json[i]['pad']['location']['statename'])) if str(api_json[i]['pad']['location']['statename']) == "None": padlocation = str(api_json[i]['pad']['location']['country']) print(padlocation) launch_date = str(api_json[i]['win_open']) if launch_date == "None": if str(api_json[i]['est_date']['month']) != "None": day = '0' month = '0' if int(api_json[i]['est_date']['month']) < 10: month = month + str(api_json[i]['est_date']['month']) else: month = str(api_json[i]['est_date']['month']) if str(api_json[i]['est_date']['day']) != "None": if int(api_json[i]['est_date']['day']) < 10: day = day + str(api_json[i]['est_date']['day']) else: day = str(api_json[i]['est_date']['day']) else: day = "??" launch_date = month + '-' + day + '-' + str( api_json[i]['est_date']['year']) l = Launch(str(api_json[i]['name']), str(api_json[i]['provider']['name']), str(api_json[i]['vehicle']['name']), str(api_json[i]['pad']['location']['name']), padlocation, 'nodescforlist', launch_date, livestream) txts.append(rocket + ' /' + str(i+1) + ' - <i>' + str(api_json[i]['name']) + '</i> ' + rocket \ + '\n' + l.getFormattedText()) endtext = "" for i in range(0, len(txts)): endtext = endtext + txts[i] context.bot.send_message(chat_id=update.effective_chat.id, text=endtext, disable_web_page_preview=True, parse_mode=ParseMode.HTML)
def process_launch(self, launch_obj, conf, testItems): return Launch( str(launch_obj["_id"]), launch_obj["projectRef"], launch_obj["name"], launch_obj["description"] if "description" in launch_obj else "", conf, launch_obj["statistics"] if "statistics" in launch_obj else {}, launch_obj["start_time"], launch_obj["end_time"] if "end_time" in launch_obj else None, launch_obj["last_modified"] if "last_modified" in launch_obj else None, launch_obj["number"] if "number" in launch_obj else 0, testItems)
def test20_execute_feedback(self): self.ctl = Control(db='sqlite.db') self.ctl.initialize() self.ctl.reserve() self.lnc = Launch(db='sqlite.db', feedpath='/tmp', taskid=1, info1='INFO1', info2='INFO2', info3='INFO3', timeout=10, debug=True) command = "tests/testprog.py --scenario progressing --feedback /tmp/feedback_1.log --delay 0.002 --debug" result = self.lnc.execute(command=command) print("test20 result={}".format(result)) self.assertTrue(result)
def test10_execute_nofeedback(self): self.lnc = Launch(db='sqlite.db', debug=True) command = "tests/testprog.py --scenario sleeping --sleep 1 --debug" result = self.lnc.execute(command=command) print("test10 result={}".format(result)) self.assertTrue(result)
def nextLaunch(n_results): pass providers_list = [ "spacex", "ula", "nasa", "roscosmos", "jaxa", "china", "astra", "virgin", "rocketlab", "grumman" ] selected = "" j = requests.get('https://fdo.rocketlaunch.live/json/launches/next/5') #change this to select the right launch if n_results > 0 and n_results < 6: api_json = json.loads(j.text)['result'] txts = [] livestream = "" for i in range(n_results - 1, n_results): padlocation = str( api_json[i]['pad']['location']['statename']) + ', ' + str( api_json[i]['pad']['location']['country']) print(str(api_json[i]['pad']['location']['statename'])) if str(api_json[i]['pad']['location']['statename']) == "None": padlocation = str(api_json[i]['pad']['location']['country']) print(padlocation) launch_date = str(api_json[i]['win_open']) if launch_date == "None": if str(api_json[i]['est_date']['month']) != "None": day = '0' month = '0' if int(api_json[i]['est_date']['month']) < 10: month = month + str(api_json[i]['est_date']['month']) else: month = str(api_json[i]['est_date']['month']) if str(api_json[i]['est_date']['day']) != "None": if int(api_json[i]['est_date']['day']) < 10: day = day + str(api_json[i]['est_date']['day']) else: day = str(api_json[i]['est_date']['day']) else: day = "??" launch_date = month + '-' + day + '-' + str( api_json[i]['est_date']['year']) if str(api_json[i]['quicktext']) != "None": parts = str(api_json[i]['quicktext']).split('- ') for x in parts: if "https" in x: livestream = x print("Livestream link: " + livestream) l = Launch(str(api_json[i]['name']), str(api_json[i]['provider']['name']), str(api_json[i]['vehicle']['name']), str(api_json[i]['pad']['location']['name']), padlocation, str(api_json[i]['launch_description']), launch_date, livestream) txts.append(rocket + ' #' + str(i+1) + ' - <i>' + str(api_json[i]['name']) + '</i> ' + rocket \ + '\n' + l.getFormattedText()) for k in range(0, len(providers_list)): print("Lower data: " + str(api_json[i]['provider']['name']).lower()) print("Item in list: " + providers_list[k]) if providers_list[k] in str( api_json[i]['provider']['name']).lower(): selected = providers_list[k] + '.jpg' break return txts[0], selected, livestream #button_list = [ # InlineKeyboardButton("Watch Livestream (if available)", url=livestream) #] #reply_markup = InlineKeyboardMarkup(build_menu(button_list, n_cols=1)) #if selected == "": # context.bot.send_message(chat_id=update.effective_chat.id, # text=txts[0], # parse_mode=ParseMode.HTML) #else: # context.bot.send_photo(chat_id=update.effective_chat.id, # photo=open('imgs/' + selected, 'rb'), # caption=txts[0], # parse_mode=ParseMode.HTML, # reply_markup=reply_markup) else: print("param not in range\nn_results: " + str(n_results) + "\n")