Пример #1
0
 def _create_template_roster_file(self, guild):
     roster_dir = os.path.join(self.tmp_dir, guild, 'roster')
     roster_path = os.path.join(roster_dir, 'roster.json')
     FileHandler().make_directory(roster_dir)
     roster = JSON(roster_path)
     roster.values = {'roster': []}
     roster.save_setting()
Пример #2
0
 def _update_saved_variables(self):
     spreadsheet = str(self.spreadsheet_line_edit.text())
     credentials = str(self.credentials_line_edit.text())
     saved_variables = JSON(self.saved_variables_path)
     saved_variables.load_setting()
     saved_variables.values['spreadsheet'] = spreadsheet
     saved_variables.values['credentials'] = credentials
     saved_variables.save_setting()
Пример #3
0
 def _save_info(self, dungeon_name, data, char_name, realm_slug):
     path = os.path.join(Path.home(), 'Kugar\'s Guild Management Tool',
                         self.guild, char_name + '_' + realm_slug,
                         'mythic_plus')
     FileHandler().make_directory(path)
     path = os.path.join(path, dungeon_name + '.json')
     file = JSON(path)
     file.values = data
     file.save_setting()
Пример #4
0
 def _add_new_character(self, armory_link):
     guild = str(self.guild_comboBox.currentText())
     roster_path = os.path.join(self.tmp_dir, guild, 'roster',
                                'roster.json')
     if not os.path.isfile(roster_path):
         self._create_template_roster_file(guild)
     roster = JSON(roster_path)
     roster.load_setting()
     roster.values['roster'].append(armory_link)
     roster.save_setting()
Пример #5
0
 def _delete_roster_entries(self, delete_list):
     guild = str(self.guild_comboBox.currentText())
     roster_path = os.path.join(self.tmp_dir, guild, 'roster',
                                'roster.json')
     roster = JSON(roster_path)
     roster.load_setting()
     for _ in delete_list:
         for link in roster.values['roster']:
             if _.lower() in link:
                 index = roster.values['roster'].index(link)
                 roster.values['roster'].pop(index)
                 break
     roster.save_setting()
     return True
Пример #6
0
 def download_data(self, category=None):
     """
     Downloads the data requested in the C://Users/currentuser/Imminent
     The folder Imminent and the individual character folders are created
     """
     if category is None:
         url_path = ResourceHandler().get_resource('urls.json')
         url = JSON(url_path)
         url.load_setting()
         for _ in url.values.keys():
             self.download_data(_)
         return
     FileHandler().make_directory(self._tmp_dir)
     path = os.path.join(self._tmp_dir, category + '.json')
     file = JSON(path)
     url = self._get_url(category)
     response = self._request_data(url)
     file.values = json.loads(response.text)
     file.save_setting()
Пример #7
0
 def _create_saved_variables_template(self):
     saved_variables = JSON(self.saved_variables_path)
     saved_variables.load_setting()
     saved_variables.values = {'spreadsheet': '', 'credentials': ''}
     saved_variables.save_setting()