Пример #1
0
class FieldAnalysisController(object):
    """Popup for field analysis (definition domain and type guessing)"""
    def __init__(self, vocabularyController, field):
        self.vocabularyController = vocabularyController
        self._view = FieldAnalysisView(self)
        self.log = logging.getLogger(__name__)
        self.field = field

    @property
    def view(self):
        return self._view

    def run(self):
        self.populateData()
        self._view.run()

    #+----------------------------------------------
    #|  populateData:
    #|   Populate data in the popup
    #+----------------------------------------------
    def populateData(self):
        # Fieldname
        self.view.fieldName.set_text(self.field.getName())

        # Definition domain
        cells = self.field.getUniqValuesByField()
        tmpDomain = set()
        for cell in cells:
            tmpDomain.add(
                TypeConvertor.encodeNetzobRawToGivenType(
                    cell, self.field.getFormat()))
        domain = sorted(tmpDomain)
        for elt in domain:
            self.view.domainListstore.append([elt])

        # Type guessing
        types = self.field.getPossibleTypes()
        for t in types:
            self.view.typeListstore.append([t])

    def close_clicked_cb(self, widget):
        self.view.dialog.destroy()
class FieldAnalysisController(object):
    """Popup for field analysis (definition domain and type guessing)"""

    def __init__(self, vocabularyController, field):
        self.vocabularyController = vocabularyController
        self._view = FieldAnalysisView(self)
        self.log = logging.getLogger(__name__)
        self.field = field

    @property
    def view(self):
        return self._view

    def run(self):
        self.populateData()
        self._view.run()

    #+----------------------------------------------
    #|  populateData:
    #|   Populate data in the popup
    #+----------------------------------------------
    def populateData(self):
        # Fieldname
        self.view.fieldName.set_text(self.field.getName())

        # Definition domain
        cells = self.field.getUniqValuesByField()
        tmpDomain = set()
        for cell in cells:
            tmpDomain.add(TypeConvertor.encodeNetzobRawToGivenType(cell, self.field.getFormat()))
        domain = sorted(tmpDomain)
        for elt in domain:
            self.view.domainListstore.append([elt])

        # Type guessing
        types = self.field.getPossibleTypes()
        for t in types:
            self.view.typeListstore.append([t])

    def close_clicked_cb(self, widget):
        self.view.dialog.destroy()
Пример #3
0
 def __init__(self, vocabularyController, field):
     self.vocabularyController = vocabularyController
     self._view = FieldAnalysisView(self)
     self.log = logging.getLogger(__name__)
     self.field = field
 def __init__(self, vocabularyController, field):
     self.vocabularyController = vocabularyController
     self._view = FieldAnalysisView(self)
     self.log = logging.getLogger(__name__)
     self.field = field