def coded_media(self, data): """ Display all coded media for this code. Coded media comes from ALL files and ALL coders. """ ui = DialogInformation("Coded text : " + self.data['name'], "") cur = self.settings['conn'].cursor() CODENAME = 0 COLOR = 1 SOURCE_NAME = 2 POS0 = 3 POS1 = 4 SELTEXT = 5 OWNER = 6 sql = "select code_name.name, color, source.name, pos0, pos1, seltext, code_text.owner from " sql += "code_text " sql += " join code_name on code_name.cid = code_text.cid join source on fid = source.id " sql += " where code_name.cid =" + str(self.data['cid']) + " " sql += " order by source.name, pos0, code_text.owner " cur.execute(sql) results = cur.fetchall() # Text for row in results: title = '<span style=\"background-color:' + row[COLOR] + '\">' title += " File: <em>" + row[SOURCE_NAME] + "</em></span>" title += ", Coder: <em>" + row[OWNER] + "</em> " title += ", " + str(row[POS0]) + " - " + str(row[POS1]) ui.ui.textEdit.insertHtml(title) ui.ui.textEdit.append(row[SELTEXT] + "\n\n") # Images sql = "select code_name.name, color, source.name, x1, y1, width, height," sql += "code_image.owner, source.mediapath, source.id, code_image.memo " sql += " from code_image join code_name " sql += "on code_name.cid = code_image.cid join source on code_image.id = source.id " sql += "where code_name.cid =" + str(self.data['cid']) + " " sql += " order by source.name, code_image.owner " cur.execute(sql) results = cur.fetchall() for counter, row in enumerate(results): ui.ui.textEdit.insertHtml('<span style=\"background-color:' + row[COLOR] + '\">File: ' + row[8] + '</span>') ui.ui.textEdit.insertHtml('<br />Coder: ' + row[7] + '<br />') img = {'mediapath': row[8], 'x1': row[3], 'y1': row[4], 'width': row[5], 'height': row[6]} self.put_image_into_textedit(img, counter, ui.ui.textEdit) ui.ui.textEdit.append("Memo: " + row[10] + "\n\n") # Media sql = "select code_name.name, color, source.name, pos0, pos1, code_av.memo, " sql += "code_av.owner, source.mediapath, source.id from code_av join code_name " sql += "on code_name.cid = code_av.cid join source on code_av.id = source.id " sql += "where code_name.cid = " + str(self.data['cid']) + " " sql += " order by source.name, code_av.owner " cur.execute(sql) results = cur.fetchall() for row in results: ui.ui.textEdit.insertHtml('<span style=\"background-color:' + row[COLOR] + '\">File: ' + row[7] + '</span>') start = msecs_to_mins_and_secs(row[3]) end = msecs_to_mins_and_secs(row[4]) ui.ui.textEdit.insertHtml('<br />[' + start + ' - ' + end + '] Coder: ' + row[6]) ui.ui.textEdit.append("Memo: " + row[5] + "\n\n") ui.exec_()
def coded_text(self, data): ''' Display all coded text for this code. Coded text comes from ALL files and ALL coders ''' ui = DialogInformation("Coded text : " + self.data['name'], "") cur = self.settings['conn'].cursor() CODENAME = 0 COLOR = 1 SOURCE_NAME = 2 POS0 = 3 POS1 = 4 SELTEXT = 5 OWNER = 6 sql = "select code_name.name, color, source.name, pos0, pos1, seltext, code_text.owner from " sql += "code_text " sql += " join code_name on code_name.cid = code_text.cid join source on fid = source.id " sql += " where code_name.cid =" + str(self.data['cid']) + " " sql += " order by source.name, pos0, code_text.owner " '''sql += " and source.id in (" + str(self.fileIDs) + ") " if coder != "": sql += " and code_text.owner=? " parameters.append(coder) if searchText != "": sql += " and seltext like ? " parameters.append("%" + str(searchText) + "%")''' cur.execute(sql) results = cur.fetchall() html = "" for row in results: color = row[COLOR] title = '<br /><span style=\"background-color:' + color + '\">' title += " File: <em>" + row[SOURCE_NAME] + "</em>" title += ", Coder: <em>" + row[OWNER] + "</em> " title += ", " + str(row[POS0]) + " - " + str(row[POS1]) title += "</span><br />" tmp_html = row[SELTEXT].replace("&", "&") tmp_html = tmp_html.replace("<", "<") tmp_html = tmp_html.replace(">", ">") html += title + tmp_html + "</p>" ui.setHtml(html) ui.exec_()
def case_text(self, data): ''' Display all coded text for this code. Coded text comes from ALL files and ALL coders ''' ui = DialogInformation("Coded text : " + self.data['name'], "") cur = self.settings['conn'].cursor() CODENAME = 0 COLOR = 1 CASE_NAME = 2 POS0 = 3 POS1 = 4 SELTEXT = 5 OWNER = 6 sql = "select code_name.name, color, cases.name, " sql += "code_text.pos0, code_text.pos1, seltext, code_text.owner from code_text " sql += " join code_name on code_name.cid = code_text.cid " sql += " join (case_text join cases on cases.caseid = case_text.caseid) on " sql += " code_text.fid = case_text.fid " sql += " where code_name.cid=" + str(self.data['cid']) + " " sql += " order by cases.name, code_text.pos0, code_text.owner " cur.execute(sql) results = cur.fetchall() html = "" for row in results: color = row[COLOR] title = '<br /><span style=\"background-color:' + color + '\">' title += " Case: <em>" + row[CASE_NAME] + "</em>" title += ", Coder: <em>" + row[OWNER] + "</em> " title += ", " + str(row[POS0]) + " - " + str(row[POS1]) title += "</span><br />" tmp_html = row[SELTEXT].replace("&", "&") tmp_html = tmp_html.replace("<", "<") tmp_html = tmp_html.replace(">", ">") html += title + tmp_html + "</p>" ui.setHtml(html) ui.exec_()
def case_media(self, data): """ Display all coded text and media for this code. Codings come from ALL files and ALL coders. """ ui = DialogInformation("Coded media for cases: " + self.data['name'], "") cur = self.settings['conn'].cursor() CODENAME = 0 COLOR = 1 CASE_NAME = 2 POS0 = 3 POS1 = 4 SELTEXT = 5 OWNER = 6 # Text sql = "select code_name.name, color, cases.name, " sql += "code_text.pos0, code_text.pos1, seltext, code_text.owner from code_text " sql += " join code_name on code_name.cid = code_text.cid " sql += " join (case_text join cases on cases.caseid = case_text.caseid) on " sql += " code_text.fid = case_text.fid " sql += "and (code_text.pos0 between case_text.pos0 and case_text.pos1) " sql += "and (code_text.pos1 between case_text.pos0 and case_text.pos1) " sql += " where code_name.cid=" + str(self.data['cid']) sql += " order by cases.name, code_text.pos0, code_text.owner " cur.execute(sql) results = cur.fetchall() for row in results: color = row[COLOR] title = '<br /><span style=\"background-color:' + color + '\">' title += " Case: <em>" + row[CASE_NAME] + "</em></span>" title += ", Coder: <em>" + row[OWNER] + "</em> " title += ", " + str(row[POS0]) + " - " + str(row[POS1]) title += "<br />" tmp_html = row[SELTEXT].replace("&", "&") tmp_html = tmp_html.replace("<", "<") tmp_html = tmp_html.replace(">", ">") html = title + tmp_html + "</p><br />" ui.ui.textEdit.insertHtml(html) # Images sql = "select code_name.name, color, cases.name, " sql += "x1, y1, width, height, code_image.owner,source.mediapath, source.id, " sql += "code_image.memo from " sql += "code_image join code_name on code_name.cid = code_image.cid " sql += "join (case_text join cases on cases.caseid = case_text.caseid) on " sql += "code_image.id = case_text.fid " sql += " join source on case_text.fid = source.id " sql += "where code_name.cid = " + str(self.data['cid']) + " " sql += " order by cases.name, code_image.owner " cur.execute(sql) results = cur.fetchall() for counter, row in enumerate(results): color = row[COLOR] title = '<br /><span style=\"background-color:' + color + '\">' title += " Case: <em>" + row[CASE_NAME] + "</em></span>, File:" + row[8] + ", " title += "Coder: " + row[7] ui.ui.textEdit.insertHtml(title) img = {'mediapath': row[8], 'x1': row[3], 'y1': row[4], 'width': row[5], 'height': row[6]} self.put_image_into_textedit(img, counter, ui.ui.textEdit) ui.ui.textEdit.append("Memo: " + row[10] + "\n\n") # A/V Media sql = "select code_name.name, color, cases.name, " sql += "code_av.pos0, code_av.pos1, code_av.memo, code_av.owner,source.mediapath, " sql += "source.id from " sql += "code_av join code_name on code_name.cid = code_av.cid " sql += "join (case_text join cases on cases.caseid = case_text.caseid) on " sql += "code_av.id = case_text.fid " sql += " join source on case_text.fid = source.id " sql += "where code_name.cid = " + str(self.data['cid']) sql += " order by source.name, code_av.owner " cur.execute(sql) results = cur.fetchall() for row in results: html = '<span style=\"background-color:' + row[COLOR] + '\">Case: ' + row[CASE_NAME] html += ', File: ' + row[7] + '</span>' ui.ui.textEdit.insertHtml(html) start = msecs_to_mins_and_secs(row[3]) end = msecs_to_mins_and_secs(row[4]) ui.ui.textEdit.insertHtml('<br />[' + start + ' - ' + end + '] Coder: ' + row[6]) ui.ui.textEdit.append("Memo: " + row[5] + "\n\n") ui.exec_()