Ejemplo n.º 1
0
    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("&", "&amp;")
            tmp_html = tmp_html.replace("<", "&lt;")
            tmp_html = tmp_html.replace(">", "&gt;")
            html += title + tmp_html + "</p>"
        ui.setHtml(html)
        ui.exec_()
Ejemplo n.º 2
0
    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("&", "&amp;")
            tmp_html = tmp_html.replace("<", "&lt;")
            tmp_html = tmp_html.replace(">", "&gt;")
            html += title + tmp_html + "</p>"
        ui.setHtml(html)
        ui.exec_()