def _choose_place_to_save_data(self, dataframe): paths = QStandardPaths.standardLocations(0) if len(paths) > 0: path = paths[0] else: path = "" filename = QFileDialog.getSaveFileName( self, Messages.save_weatherdata_csv(), path + "/weather_data.csv", "Comma separated values CSV (*.csv);;All files (*)") if filename[0] != "": self._save_to_csv(dataframe, filename[0])
def save_data_to_csv(self, dataframe, request_params): start_date = datetime.strftime(request_params['starttime'], '%Y-%m-%d') end_date = datetime.strftime(request_params['endtime'], '%Y-%m-%d') paths = QStandardPaths.standardLocations(0) if len(paths) > 0: path = paths[0] else: path = "" filename = QFileDialog.getSaveFileName( self.app, Messages.save_weatherdata_csv(), "{}/fmisid-{}_{}_to_{}_weather_data.csv".format( path, request_params['fmisid'], start_date, end_date), "Comma separated values CSV (*.csv);;All files (*)") if filename[0] != "": self._save_to_csv(dataframe, filename[0])