class OutputConfig(QWidget): ''' Panel where the user can decide if he wants the output of the base acquisition to be sent to the rover through a cloud (NTRIP or TCP) If yes, the user can set the parameters for the connection to the caster Has default parameters Inherits from QWidget Parameters: Core : private Boolean output_flag : wether the output shall be transmited through a cloud private list output_type : choose between NTRIP and TCP protocol private int output_index_type private liste output_format : wich format shall be applied (rtcm or ubx) private int output_index_format private String output_user : gives the user name to connect with private String output_addr : gives the cloud address to connect to private String output_port : gives the port to connect to private String output_pw : gives the password to connect with private String output_mp : gives the mountpoint to connect to UI : private QCheckBox output_b private QComboBox type_list private QComboBox format_list private MyLineEdit addr_edit private MyLineEdit mp_edit private MyLineEdit user_edit private MyLineEdit pw_edit ''' def __init__(self,parent=None): super().__init__() # Default Input stream configuration self.__output_flag = False self.__output_type=(['tcpcli','ntripcli']) self.__output_index_type = 1 self.__output_format=(['ubx','rtcm3']) self.__output_index_format = 0 self.__output_user = '******' self.__output_addr = 'rgp-ip.ign.fr' self.__output_port = '2101' self.__output_pw = 's3YfJx54C7' self.__output_mp = 'FORC2' # Setting the elements on the layout self.__output_b = QCheckBox("Enable",self) self.__output_b.setChecked(self.__output_flag) self.__type_list=QComboBox(self) self.__type_list.addItems(['TCP Server','NTRIP Server']) self.__type_list.setCurrentIndex(self.__output_index_type) self.__format_list=QComboBox(self) self.__format_list.addItems(['UBX','RTCM3']) self.__format_list.setCurrentIndex(self.__output_index_format) self.__addr_edit=MyLineEdit(self.__output_addr,self) self.__port_edit=MyLineEdit(self.__output_port,self) self.__mp_edit=MyLineEdit(self.__output_mp,self) self.__user_edit=MyLineEdit(self.__output_user,self) self.__pw_edit=MyLineEdit(self.__output_pw,self) # default activated parameters self.typeChanged() self.__output_b.stateChanged.connect(partial(self.typeChanged)) self.__type_list.currentIndexChanged.connect(self.typeChanged) #Setting the Layout grid=QGridLayout() grid.addWidget(self.__output_b,0,0) grid.addWidget(QLabel('Type/Format'),0,1) grid.addWidget(self.__type_list,0,2) grid.addWidget(self.__format_list,0,3) grid.addWidget(QLabel('Address'),1,0) grid.addWidget(self.__addr_edit,1,1,1,4) grid.addWidget(QLabel('Port'),2,0) grid.addWidget(self.__port_edit,2,1) grid.addWidget(QLabel('Mountpoint'),2,2) grid.addWidget(self.__mp_edit,2,3) grid.addWidget(QLabel('User-ID'),3,0) grid.addWidget(self.__user_edit,3,1) grid.addWidget(QLabel('Password'),3,2) grid.addWidget(self.__pw_edit,3,3) self.setLayout(grid) ###### FUNCTIONS ####### def typeChanged(self): ''' Check the transmission type selected and disables/displays the corresponding parameters on the UI ''' if self.__output_b.isChecked() == True: self.__type_list.setDisabled(False) self.__format_list.setDisabled(False) self.__port_edit.setDisabled(False) self.__addr_edit.setDisabled(False) if self.__type_list.currentIndex() == 0: # TCP Server self.__addr_edit.setText(self.getIpAddress()) self.__output_addr = self.getIpAddress() self.__mp_edit.setDisabled(True) self.__user_edit.setDisabled(True) self.__pw_edit.setDisabled(True) if self.__type_list.currentIndex() == 1: # NTRIP Server self.__mp_edit.setDisabled(False) self.__user_edit.setDisabled(False) self.__pw_edit.setDisabled(False) else: self.__type_list.setDisabled(True) self.__format_list.setDisabled(True) self.__addr_edit.setDisabled(True) self.__mp_edit.setDisabled(True) self.__user_edit.setDisabled(True) self.__pw_edit.setDisabled(True) self.__port_edit.setDisabled(True) def getIpAddress(self): ''' Return IP adress of the system returns: String IP address ''' host=check_output(['hostname', '-I']) hosts=host.split() if len(hosts)==0: return '127.0.0.1' else: return hosts[0].decode() def apply(self): ''' Changes values to those selected in the UI ''' self.__output_flag = self.__output_b.isChecked() self.__output_index_type = self.__type_list.currentIndex() self.__output_index_format = self.__format_list.currentIndex() self.__output_user = self.__user_edit.text() self.__output_addr = self.__addr_edit.text() self.__output_port = self.__port_edit.text() self.__output_pw = self.__pw_edit.text() self.__output_mp = self.__mp_edit.text() def getOptions(self): ''' Returns Input options ''' self.apply() return (self.__output_flag, self.__output_type[self.__output_index_type], self.__output_format[self.__output_index_format], self.__output_user, self.__output_addr, self.__output_port, self.__output_pw, self.__output_mp)
class ConfConfig(QWidget): def __init__(self, parent=None): print(1) super().__init__() self.__save_conf_flag = True self.__conf_flag = False self.__filepath = None #directory where conf file are saved self.__directory = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir)) + '/saved_conf/' #file name as year-month-day hour:minute:second in UTC self.__save_conf_filename = strftime('%Y-%m-%d_%H-%M-%S', gmtime()) + '.conf' # setting the elements on the layout self.__conf_b = QCheckBox("Enable", self) self.__conf_b.setChecked(self.__conf_flag) self.__save_conf_b = QCheckBox("Enable", self) self.__save_conf_b.setChecked(self.__save_conf_flag) self.__browse_b = QPushButton('Browse', self) self.__browse_b.clicked.connect(self.getfiles) self.__filename_edit = MyLineEdit(self.__save_conf_filename) # default activated parameters self.typeChanged() self.__conf_b.stateChanged.connect(partial(self.typeChanged)) self.__save_conf_b.stateChanged.connect(partial(self.typeChanged)) #setting the layout grid = QGridLayout() grid.addWidget(QLabel('Use existing conf file ?'), 0, 0) grid.addWidget(self.__conf_b, 0, 1) grid.addWidget(QLabel('Select the conf file to be used'), 1, 0) grid.addWidget(self.__browse_b, 1, 1) grid.addWidget(QLabel('Save created conf file ?'), 2, 0) grid.addWidget(self.__save_conf_b, 2, 1) grid.addWidget(QLabel('Filename'), 3, 0) grid.addWidget(self.__filename_edit, 3, 1) self.setLayout(grid) def getfiles(self): ''' Opens the os file browser at the saved_conf/ directory Sets the filepath as the path to the selected file ''' self.__filepath, _ = QFileDialog.getOpenFileName( self, 'Single File', self.__directory, '*.conf') def typeChanged(self): ''' Check wether the solution is enabled ''' # use existing conf file if self.__conf_b.isChecked() == True: self.__browse_b.setDisabled(False) self.__save_conf_b.setChecked(False) self.__save_conf_b.setDisabled(True) self.__filename_edit.setDisabled(True) else: self.__browse_b.setDisabled(True) self.__save_conf_b.setDisabled(False) self.__filename_edit.setDisabled(False) # save creadted conf file if self.__save_conf_b.isChecked() == True: self.__filename_edit.setDisabled(False) else: self.__filename_edit.setDisabled(True) def apply(self): ''' Changes values to those selected in the UI ''' self.__conf_flag = self.__conf_b.isChecked() self.__save_conf_flag = self.__save_conf_b.isChecked() self.__save_conf_filename = self.__filename_edit.text() def getOptions(self): ''' Returns Solution options ''' self.apply() return (self.__conf_flag, self.__save_conf_flag, self.__filepath, self.__directory + self.__save_conf_filename)
class LogConfig(QWidget): ''' Panel where the user can decide wether to save or not the log files Inherits from QWIdget Attributes: Core : private Boolean log_flag : wether logs shall be saved or not private String log_filename : name of the file where logs shall be saved private String logDirectory : path of the file where logs shall be saved UI : private QCheckBox log_b private MyLineEdit output_edit ''' def __init__(self, parent=None): super().__init__() self.__log_flag = True dirtrs = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir)) self.__logDirectory = dirtrs + '/Results/Logs/' self.__log_filename = strftime('%Y-%m-%d_%H-%M-%S', gmtime( )) + '.ubx' #file name as year-month-day hour:minute:second in UTC # Setting the elements on the layout self.__log_b = QCheckBox("Enable", self) self.__log_b.setChecked(self.__log_flag) self.__output_edit = MyLineEdit(self.__log_filename) # default activated parameters self.typeChanged() self.__log_b.stateChanged.connect(partial(self.typeChanged)) #Setting the Layout grid = QGridLayout() grid.addWidget(self.__log_b, 0, 0) grid.addWidget(QLabel('Output File name'), 1, 0) grid.addWidget(self.__output_edit, 1, 1) self.setLayout(grid) def typeChanged(self): ''' Check wether the log is enabled ''' if self.__log_b.isChecked() == True: self.__output_edit.setDisabled(False) else: self.__output_edit.setDisabled(True) def apply(self): ''' Changes values to those selected in the UI ''' self.__log_flag = self.__log_b.isChecked() self.__log_filename = self.__output_edit.text() def getOptions(self): ''' Returns Logs options ''' self.apply() return (self.__log_flag, self.__logDirectory + self.__log_filename)
class CorrectionConfig(QWidget): ''' Panel where the user can set the parameters of the correction of a cloud (NTRIP or TCP) transmission from the base if he is using it. Otherwise he can disable it !!!! those parameters shall be equal to those set on the Output option for the base Has default parameters Inherits from QWidget Attributes: Core : private Boolean corr_flag : wether correction from the base are transmitted to a NTRIP or TCP protocol private list corr_type : wether it follows a NTRIP or TCP protocol private int corr_index_type private list corr_format : in wich format is it sent (rtcm or ubx) private int corr_index_format private String output_user : gives the user name to connect with private String output_addr : gives the cloud address to connect to private String output_port : gives the port to connect to private String output_pw : gives the password to connect with private String output_mp : gives the mountpoint to connect to UI : private QCheckBox corr_b private QComboBox type_list private QComboBox format_list private MyLineEdit addr_edit private MyLineEdit port_edit private MyLineEdit mp_edit private MyLineEdit pw_edit private MyLineEdit user_edit ''' def __init__(self, parent=None): super().__init__() # Possible values for Correction stream configuration self.__corr_flag = False self.__corr_type = (['ntripcli', 'tcpcli']) self.__corr_index_type = 0 self.__corr_format = (['rtcm2', 'rtcm3', 'binex', 'ubx']) self.__corr_index_format = 1 self.__corr_user = '******' self.__corr_addr = 'adresse.com' self.__corr_port = '2101' self.__corr_pw = 's3YfJx54C7' self.__corr_mp = 'TRS' #Mountpoint #Setting elements of the layout self.__corr_b = QCheckBox("Enable", self) self.__corr_b.setChecked(self.__corr_flag) self.__type_list = QComboBox(self) self.__type_list.addItems(['NTRIP Client', 'TCP Client']) self.__type_list.setCurrentIndex(self.__corr_index_type) self.__type_list.currentIndexChanged.connect(self.typeChanged) self.__format_list = QComboBox(self) self.__format_list.addItems(['RTCM2', 'RTCM3', 'BINEX', 'UBX']) self.__format_list.setCurrentIndex(self.__corr_index_format) self.__addr_edit = MyLineEdit(self.__corr_addr, self) self.__port_edit = MyLineEdit(self.__corr_port, self) self.__mp_edit = MyLineEdit(self.__corr_mp, self) self.__user_edit = MyLineEdit(self.__corr_user, self) self.__pw_edit = MyLineEdit(self.__corr_pw, self) # default activated parameters self.typeChanged() self.__corr_b.stateChanged.connect(partial(self.typeChanged)) self.__type_list.currentIndexChanged.connect(self.typeChanged) ###### SETTING THE LAYOUT ####### grid = QGridLayout() grid.addWidget(self.__corr_b, 0, 0) grid.addWidget(QLabel('Type/Format'), 0, 1) grid.addWidget(self.__type_list, 0, 2) grid.addWidget(self.__format_list, 0, 3) grid.addWidget(QLabel('Address'), 1, 0) grid.addWidget(self.__addr_edit, 1, 1, 1, 4) grid.addWidget(QLabel('Port'), 2, 0) grid.addWidget(self.__port_edit, 2, 1) grid.addWidget(QLabel('Mountpoint'), 2, 2) grid.addWidget(self.__mp_edit, 2, 3) grid.addWidget(QLabel('User-ID'), 3, 0) grid.addWidget(self.__user_edit, 3, 1) grid.addWidget(QLabel('Password'), 3, 2) grid.addWidget(self.__pw_edit, 3, 3) self.setLayout(grid) def typeChanged(self): ''' Check wether the correction is enabled If yes, check wether TCP or NTRIP is chosen for correction and activate/deactivate corresponding parameters arg ind : int (index of the corr_type parameter) ''' if self.__corr_b.isChecked() == True: self.__type_list.setDisabled(False) self.__format_list.setDisabled(False) self.__addr_edit.setDisabled(False) self.__port_edit.setDisabled(False) if self.__type_list.currentIndex() == 0: # NTRIP Client self.__mp_edit.setDisabled(False) self.__user_edit.setDisabled(False) self.__pw_edit.setDisabled(False) elif self.__type_list.currentIndex() == 1: # TCP Client self.__mp_edit.setDisabled(True) self.__user_edit.setDisabled(True) self.__pw_edit.setDisabled(True) else: self.__mp_edit.setDisabled(True) self.__user_edit.setDisabled(True) self.__pw_edit.setDisabled(True) self.__type_list.setDisabled(True) self.__format_list.setDisabled(True) self.__addr_edit.setDisabled(True) self.__port_edit.setDisabled(True) def apply(self): ''' Changes values to those selected in the UI ''' self.__corr_flag = self.__corr_b.isChecked() self.__corr_index_type = self.__type_list.currentIndex() self.__corr_index_format = self.__format_list.currentIndex() self.__corr_addr = self.__addr_edit.text() self.__corr_port = self.__port_edit.text() self.__corr_mp = self.__mp_edit.text() self.__corr_user = self.__user_edit.text() self.__corr_pw = self.__pw_edit.text() def getOptions(self): ''' Returns Corrections options in a list ''' self.apply() return (self.__corr_flag, self.__corr_type[self.__corr_index_type], self.__corr_format[self.__corr_index_format], self.__corr_user, self.__corr_pw, self.__corr_port, self.__corr_mp, self.__corr_addr)
class SolConfig(QWidget): ''' Panel where the user can decide wether to save or not the solutions files And to wich format, type and location Inherits from QWIdget Attributes: Core : private Boolean sol_flag : wether solutions shall be saved or not private list sol_type : type of the coordinates in the solution file private int sol_index_type private list sol_mode : all or single lines in the solution file private int sol_index_mode private String sol_filename : name of the file where solutions shall be saved private String solDirectory : path of the file where solutions shall be saved private String sol_format : format of the solutions (llh,xyz,enu) UI : private QCheckBox sol_b private QComboBox type_list private QComboBox type_mode private MyLineEdit output_edit ''' def __init__(self, parent=None): super().__init__() self.__sol_flag = True dirtrs = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir)) self.__solDirectory = dirtrs + '/Results/Solutions/' #file name as year-month-day hour:minute:second in UTC self.__sol_filename = strftime('%Y-%m-%d_%H-%M-%S', gmtime()) + '.pos' # Settings of the output solution file self.__sol_type = ['llh', 'xyz', 'enu'] self.__sol_index_type = 1 self.__sol_mode = ['all', 'single'] self.__sol_index_mode = 0 # Setting the elements on the layout self.__sol_b = QCheckBox("Enable", self) self.__sol_b.setChecked(self.__sol_flag) self.__type_list = QComboBox(self) self.__type_list.addItems(['LLH', 'XYZ', 'ENU']) self.__type_list.setCurrentIndex(self.__sol_index_type) self.__type_mode = QComboBox(self) self.__type_mode.addItems(['ALL', 'SINGLE']) self.__type_mode.setCurrentIndex(self.__sol_index_mode) self.__output_edit = MyLineEdit(self.__sol_filename) # default activated parameters self.typeChanged() self.__sol_b.stateChanged.connect(partial(self.typeChanged)) #Setting the Layout grid = QGridLayout() grid.addWidget(self.__sol_b, 0, 0) grid.addWidget(QLabel('Coordinates type'), 1, 0) grid.addWidget(self.__type_list, 1, 1) grid.addWidget(QLabel('Coordinates format'), 2, 0) grid.addWidget(self.__type_mode, 2, 1) grid.addWidget(QLabel('Output File name'), 3, 0) grid.addWidget(self.__output_edit, 3, 1) self.setLayout(grid) def typeChanged(self): ''' Check wether the solution is enabled ''' if self.__sol_b.isChecked() == True: self.__type_list.setDisabled(False) self.__type_mode.setDisabled(False) self.__output_edit.setDisabled(False) else: self.__type_list.setDisabled(True) self.__type_mode.setDisabled(True) self.__output_edit.setDisabled(True) def apply(self): ''' Changes values to those selected in the UI ''' self.__sol_flag = self.__sol_b.isChecked() self.__sol_index_type = self.__type_list.currentIndex() self.__sol_index_mode = self.__type_mode.currentIndex() self.__sol_filename = self.__output_edit.text() def getOptions(self): ''' Returns Solution options ''' self.apply() return (self.__sol_flag, self.__sol_type[self.__sol_index_type], self.__sol_mode[self.__sol_index_mode], self.__solDirectory + self.__sol_filename)