def cli(): args = sys.argv[1:] settings = Preflight() settings.write_preflight_settings() try: if args.count('--help') != 0: help_dialog() sys.exit() elif len(args) == 0: raise IndexError prettyJson = PrettyJson(args) prettyJson.structure_data() prettyJson.write_pretty_json() if ',' in args[0] and len(args[0].split(',')) > 1: user = input('open all files? (y/N) ') if user.lower() == 'y': prettyJson.open_pretty_json() else: print('Multiple files have been saved.') else: prettyJson.open_pretty_json() except AttributeError as ae: print(ae) except IndexError: print('at least one argument is required. type --help for details') except (FileNotFoundError, ValueError) as ee: print(f'{args[0]} not found')
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 load(self, host="localhost", port=6499): print "Tuner.load " + str(port) # Recalibrate page self.recalibrate = Recalibrate(changefunc=self.onChange, host=host, port=port) self.tabs.addTab( self.recalibrate.get_widget(), "Recalibrate" ) # 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" )
class Tuner(QtGui.QWidget): def __init__(self, host="localhost", port=6499): super(Tuner, self).__init__() self.default_title = "Aura Tasks" #self.chirp = None #self.circle = None #self.land = None self.initUI() self.load(host=host, port=port) self.clean = True def initUI(self): self.setWindowTitle(self.default_title) layout = QtGui.QVBoxLayout() self.setLayout(layout) # Main work area self.tabs = QtGui.QTabWidget() layout.addWidget(self.tabs) #self.overview = Overview(changefunc=self.onChange) #self.tabs.addTab( self.overview.get_widget(), "Overview" ); # 'File' button bar file_group = QtGui.QFrame() layout.addWidget(file_group) file_layout = QtGui.QHBoxLayout() file_group.setLayout(file_layout) save = QtGui.QPushButton('Save') save.clicked.connect(self.save) file_layout.addWidget(save) quit = QtGui.QPushButton('Quit') quit.clicked.connect(self.quit) file_layout.addWidget(quit) file_layout.addStretch(1) self.resize(800, 700) self.show() 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 save(self): print "called for save, but does nothing yet" def quit(self): QtCore.QCoreApplication.instance().quit() def onChange(self): #print "parent onChange() called!" #result = self.rebuildTabNames() #if result: # self.rebuildWingLists() self.clean = False def isClean(self): return self.clean def setClean(self): self.clean = True
class Tuner(QtGui.QWidget): def __init__(self, host="localhost", port=6499): super(Tuner, self).__init__() self.default_title = "Aura Tasks" #self.chirp = None #self.circle = None #self.land = None self.initUI() self.load(host=host, port=port) self.clean = True def initUI(self): self.setWindowTitle( self.default_title ) layout = QtGui.QVBoxLayout() self.setLayout(layout) # Main work area self.tabs = QtGui.QTabWidget() layout.addWidget( self.tabs ) #self.overview = Overview(changefunc=self.onChange) #self.tabs.addTab( self.overview.get_widget(), "Overview" ); # 'File' button bar file_group = QtGui.QFrame() layout.addWidget(file_group) file_layout = QtGui.QHBoxLayout() file_group.setLayout( file_layout ) save = QtGui.QPushButton('Save') save.clicked.connect(self.save) file_layout.addWidget(save) quit = QtGui.QPushButton('Quit') quit.clicked.connect(self.quit) file_layout.addWidget(quit) file_layout.addStretch(1) self.resize(800, 700) self.show() def load(self, host="localhost", port=6499): print "Tuner.load " + str(port) # Recalibrate page self.recalibrate = Recalibrate(changefunc=self.onChange, host=host, port=port) self.tabs.addTab( self.recalibrate.get_widget(), "Recalibrate" ) # 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 save(self): print "called for save, but does nothing yet" def quit(self): global data_fetcher_quit data_fetcher_quit = True QtCore.QCoreApplication.instance().quit() def onChange(self): #print "parent onChange() called!" #result = self.rebuildTabNames() #if result: # self.rebuildWingLists() self.clean = False def isClean(self): return self.clean def setClean(self): self.clean = True