def update_commits(self): r = None try: r = requests.get( 'https://api.github.com/repos/iGio90/dwarf/commits') except: pass if r is None or r.status_code != 200: q = NotEditableListWidgetItem( 'Failed to fetch commit list. Try later.') q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) return most_recent_remote_commit = '' most_recent_local_commit = utils.do_shell_command( 'git log -1 master --pretty=format:%H') most_recent_date = '' for commit in r.json(): if most_recent_remote_commit == '': most_recent_remote_commit = commit['sha'] if most_recent_remote_commit != most_recent_local_commit: self.dwarf_update_button.setVisible(True) q = NotEditableListWidgetItem('') q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) commit = commit['commit'] date = commit['committer']['date'].split('T') if most_recent_date != date[0]: if most_recent_date != '': q = NotEditableListWidgetItem('') q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) q = NotEditableListWidgetItem(date[0]) q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) most_recent_date = date[0] q = NotEditableListWidgetItem( '%s - %s (%s)' % (date[1][:-1], commit['message'], commit['author']['name'])) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.white) self.commit_list.addItem(q)
def update_commits(self): data = self.app.get_dwarf().get_git().get_dwarf_commits() if data is None: q = NotEditableListWidgetItem( 'Failed to fetch commit list. Try later.') q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) return most_recent_remote_commit = '' most_recent_local_commit = utils.do_shell_command( 'git log -1 master --pretty=format:%H') most_recent_date = '' for commit in data: if most_recent_remote_commit == '': most_recent_remote_commit = commit['sha'] if most_recent_remote_commit != most_recent_local_commit: self.dwarf_update_button.setVisible(True) q = NotEditableListWidgetItem('') q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) commit = commit['commit'] date = commit['committer']['date'].split('T') if most_recent_date != date[0]: if most_recent_date != '': q = NotEditableListWidgetItem('') q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) q = NotEditableListWidgetItem(date[0]) q.setFlags(Qt.NoItemFlags) self.commit_list.addItem(q) most_recent_date = date[0] q = NotEditableListWidgetItem( '%s - %s (%s)' % (date[1][:-1], commit['message'], commit['author']['name'])) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.white) self.commit_list.addItem(q)
def on_dwarf_commit(self, com_text, color=False): q = NotEditableListWidgetItem(com_text) q.setFlags(Qt.NoItemFlags) if color: q.setForeground(QColor('#ef5350')) self.commit_list.addItem(q)
def on_emulator_memory_range_mapped(self, address, size): q = NotEditableListWidgetItem(hex(address)) q.setForeground(Qt.red) self.ranges_list.addItem(q) self.ranges_list.sortItems()