def load_local_updates(self): sort_list = [] for update in self.updates: update_get = update.get item = QtGui.QTreeWidgetItem() sort_list.append( uf.get_version(sort_sum=True, **update_get('version'))) # print(uf.get_version(string=True, **update_get('version'))) # print(uf.get_version(sort_sum=True, **update_get('version'))) item.setText( 0, uf.get_version(string=True, **update_get('version')).replace('_', '.')) item.setText(1, update_get('date')) item.setText(2, update_get('changes')) item.setText(3, update_get('misc')) self.versionsTreeWidget.addTopLevelItem(item) if self.updates: self.last_version = self.updates[-1].get('version') # print(sorted(sort_list)) self.versionsTreeWidget.sortByColumn(3, QtCore.Qt.DescendingOrder) self.versionsTreeWidget.scrollToBottom()
def check_current_version(self): current_version = uf.get_version(string=True, **self.current_version) if self.last_version: last_version = uf.get_version(string=True, **self.last_version) else: last_version = current_version if current_version == last_version: self.updateToLastPushButton.setEnabled(False) self.currentVersionlabel.setText('<span style=" color:#00ff00;">{0} (up to date)</span>'.format( current_version.replace('_', '.'))) else: self.updateToLastPushButton.setEnabled(True) self.currentVersionlabel.setText('<span style=" color:#ff0000;">{0} (new version available)</span>'.format( current_version.replace('_', '.')))
def commit_update_to_json(self): args = self.majorSpinBox.text(),\ self.minorSpinBox.text(),\ self.buildSpinBox.text(),\ self.revisionSpinBox.text() current_ver_dict = uf.get_version(*args) current_ver_str = uf.get_version(*args, string=True) data_dict = { 'version': current_ver_dict, 'date': self.dateEdit.text(), 'changes': self.changesPlainTextEdit.toPlainText(), 'misc': self.miscPlainTextEdit.toPlainText(), 'remove_list': [], 'update_archive': '{0}.zip'.format(current_ver_str) } uf.save_json_to_path('{0}/updates/{1}.json'.format(env_mode.get_current_path(), current_ver_str), data_dict) uf.create_updates_list() uf.save_current_version(current_ver_dict) uf.create_update_archive('{0}/updates/{1}.zip'.format(env_mode.get_current_path(), current_ver_str)) self.close()