예제 #1
0
    def _updateView(self):
        if self.needLocalizationUpdate:
            session = self.kernel.session()
            _caption = "#aaaaaaunknown"
            # get question class
            it = session.create_iterator(
                session.sc_constraint_new(
                    sc_core.constants.CONSTR_3_a_a_f, sc_core.pm.SC_N_CONST,
                    sc_core.pm.SC_A_CONST | sc_core.pm.SC_POS,
                    self._getScAddr()), True)
            while not it.is_over():
                _class = it.value(0)
                if sc_utils.checkIncToSets(session, _class,
                                           [keynodes.questions._class],
                                           sc_core.pm.SC_CONST):
                    _caption = sc_utils.getLocalizedIdentifier(
                        core.Kernel.session(), _class)[0]
                    if len(_caption) == 0:
                        _caption = "#aaaaaaunknown"
                    break

                it.next()
            self.setText(_caption)
            self.needLocalizationUpdate = False

        objects.ObjectOverlay._updateView(self)
예제 #2
0
 def parse(self, input, question_node):
     #производим поиск всех связок отношения координаты* в ответе
     coord_sheafs = []
     res_list = session.search3_f_a_a(input, sc.SC_A_CONST|sc.SC_POS, sc.SC_CONST|sc.SC_NODE)
     if res_list is not None:
         for res in res_list:
             sheaf_node = res[2]
             is_coord_rel_sheaf = sc_utils.checkIncToSets(session, sheaf_node, [sc_coord_rel_node], sc.SC_A_CONST|sc.SC_POS)
             if is_coord_rel_sheaf:
                 coord_sheafs.append(sheaf_node)
     
     #элементы связки отношения и запоминаем название географического
     for sheaf in coord_sheafs:
         obj_node = sc_utils.searchOneShot(session.search5_f_a_a_a_f(sheaf, sc.SC_A_CONST|sc.SC_POS, sc.SC_CONST|sc.SC_NODE, sc.SC_A_CONST|sc.SC_POS, sc_keys.n_1))[2]
         obj_name = sc_utils.getLocalizedIdentifier(session, obj_node)[0]
         
         """obj_class_node = session.search3_a_a_f(sc.SC_CONST|sc.SC_ELMNCLASS, sc.SC_A_CONST|sc.SC_POS, obj_node)
         if obj_class_node is not None:
             for el_set in obj_class_node:
                 print sc_utils.getLocalizedIdentifier(session, el_set[0])[0]                    
         obj_class_name = sc_utils.getLocalizedIdentifier(session, obj_class_node)[0]"""
         
         obj_class_name = "geo_obj"
         
         coord_node = sc_utils.searchOneShot(session.search5_f_a_a_a_f(sheaf, sc.SC_A_CONST|sc.SC_POS, sc.SC_CONST|sc.SC_NODE, sc.SC_A_CONST|sc.SC_POS, sc_keys.n_2))[2]
         #получаем координаты из содержимого узла
         _cont = session.get_content_const(coord_node)
         _cont_data = _cont.convertToCont()
         coords_str = str(_cont_data.d.ptr)
         
         #сохраняем сведения об географическом объекте в карту
         self.parsed_data[obj_class_name + " " + obj_name] = coords_str     
예제 #3
0
파일: sc2scs.py 프로젝트: dreding/pyUI
def translate_node(_session, _el, _type):
    """Translate sc-node into SCs
    """

    # Check have node content or not
    _cnt_type = sc_utils.getContentFormat(_session, _el)

    if _cnt_type is not None:
        # I don't find any info about view content of nodes in scs
        pass
    else:
        _const = getConstStr(_type)
        if _const == "var":
            return "$_%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
        elif _const == "meta":
            return "$__%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
        return "$%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
예제 #4
0
파일: sc2scs.py 프로젝트: dreding/pyUI
def translate_pair(_session, _el, _type):
    """Translate sc-pair into SCs
    """
    type_name = "pair/-/-/-/-"

    _const = getConstStr(_type)
    _pos = getPosStr(_type)
    _orient = "orient"

    assert _pos is not None and _const is not None

    if _type & sc.SC_TEMPORARY:
        type_name = "pair/%s/time/%s/%s" % (_pos, _orient, _const)
    else:
        type_name = "pair/%s/-/%s/%s" % (_pos, _orient, _const)

    # obj = scg_alphabet.createSCgPair(type_name)
    # obj._setScAddr(_el)
    # return obj
    return "$%s" % (sc_utils.getLocalizedIdentifier(_session, _el))
예제 #5
0
    def _updateView(self):
        if self.needLocalizationUpdate:
            session = self.kernel.session()
            _caption = "#aaaaaaunknown"
            # get question class
            it = session.create_iterator(session.sc_constraint_new(sc_core.constants.CONSTR_3_a_a_f,
                                                               sc_core.pm.SC_N_CONST,
                                                               sc_core.pm.SC_A_CONST | sc_core.pm.SC_POS,
                                                               self._getScAddr()), True)
            while not it.is_over():
                _class = it.value(0)
                if sc_utils.checkIncToSets(session, _class, [keynodes.questions._class], sc_core.pm.SC_CONST):
                    _caption = sc_utils.getLocalizedIdentifier(core.Kernel.session(), _class)[0]
                    if len(_caption) == 0:
                        _caption = "#aaaaaaunknown"
                    break

                it.next()
            self.setText(_caption)
            self.needLocalizationUpdate = False

        objects.ObjectOverlay._updateView(self)