예제 #1
0
    def __init__(self, action,project, *args):
        super(CursorTableModel,self).__init__(*args)
        from pineboolib.qsaglobals import aqtt

        self._action = action
        self._prj = project
        if action and action.table:
            self._table = project.tables[action.table]
        else:
            raise AssertionError
        cur = self._prj.conn.cursor()
        self.sql_fields = []
        self.field_aliases = []
        for field in self._table.fields:
            self.sql_fields.append(field.name)
            self.field_aliases.append(aqtt(field.alias))
            
        cur.execute("""SELECT %s FROM %s """ % (", ".join(self.sql_fields),self._table.name))

        self.modules = {}
        self.cols = len(self.sql_fields)
        self.rows = cur.rowcount
        self.data = []
        for row in cur:
            self.data.append(row)
예제 #2
0
 def __init__(self, xmlobj):
     self._attrs = []
     if xmlobj is not None:
         self.__name__ = xmlobj.tag
         for child in xmlobj:
             if child.tag == "property":
                 key, text = qt3ui.loadProperty(child)
             else:
                 text = aqtt(child.text)
                 key = child.tag
             if isinstance(text, basestring): text = text.strip()
             setattr(self, key, text)
             self._attrs.append(key)
예제 #3
0
    def __init__(self, action,project, *args):
        super(CursorTableModel,self).__init__(*args)
        from pineboolib.qsaglobals import aqtt

        self._action = action
        self._prj = project
        if action and action.table:
            self._table = project.tables[action.table]
        else:
            raise AssertionError
        self.sql_fields = []
        self.field_aliases = []
        for field in self._table.fields:
            self.sql_fields.append(field.name)
            self.field_aliases.append(aqtt(field.alias))

        self._data = []
        self.cols = len(self.sql_fields)
        self.rows = 0
        self.where_filters = {}
        self.refresh()
예제 #4
0
    def __init__(self, action, project, *args):
        super(CursorTableModel, self).__init__(*args)
        from pineboolib.qsaglobals import aqtt

        self._action = action
        self._prj = project
        if action and action.table:
            self._table = project.tables[action.table]
        else:
            raise AssertionError
        self.sql_fields = []
        self.field_aliases = []
        for field in self._table.fields:
            self.sql_fields.append(field.name)
            self.field_aliases.append(aqtt(field.alias))

        self._data = []
        self.cols = len(self.sql_fields)
        self.rows = 0
        self.where_filters = {}
        self.refresh()