Ejemplo n.º 1
0
def setPointByFormat(point, type_pt, value=None):
    if type_pt == 'list.append':
        con = NetP('.[i]').con(point, value)
        con.m_permission = 0
    elif type_pt == 'list.+=':
        for pt in value:
            con = NetP('.[i]').con(point, pt)
            con.m_permission = 0
    elif type_pt == 'list.clear':
        list_del = []
        for con in point.m_con:
            if con.m_name == '.[i]' and con.m_db[
                    0] == point and con.m_db[1] != None:
                list_del.append(con)
        for pt in list_del:
            pt.delete()
        del list_del[:]
    elif type_pt == 'list.pop':
        list_pt = getPointByFormat(point, 'list')
        pt = list_pt[-1]
        for con in pt.m_con:
            if con.m_name == '.[i]' and con.m_db[0] == point and con.m_db[
                    1] == pt:
                con.delete()
                del con
        del pt
    elif type_pt == 'list.remove':
        list_pt = getPointByFormat(point, 'list')
        if value in list_pt:
            for con in value.m_con:
                if con.m_name == '.[i]' and con.m_db[0] == point and con.m_db[
                        1] == value:
                    con.delete()
                    del con
Ejemplo n.º 2
0
    def initialize(self, point):
        if point == None:
            point = NetP('editor')
        self.m_self = point
        point.m_dev = self
        point.m_permission = 0

        pt_text = tools_basic.getPoint(point, 'm_plainText', 'text')
        pt_pool = tools_basic.getPoint(point, 'm_pool', 'pool')
        pt_motor = tools_basic.getPoint(point, 'm_motor', 'compiler')
        pt_debugger = tools_basic.getPoint(point, 'm_debugger', 'debugger')
        pt_screen = tools_basic.getPoint(point, 'm_screen', 'screen')

        self.modifyPtStruct(pt_debugger, pt_motor, pt_pool)

        self.m_plainText = pt_text
        self.setReadPtr(pt_text)
        self.m_pool = Pool(pt_pool)
        self.m_motor = Motor(pt_motor)
        self.m_debugger = Debugger(pt_debugger)
        self.m_screen = Brain(pt_screen)
        self.m_pool.register(self.m_screen.m_self)
        self.m_pool.register(self.m_debugger.m_self)

        self.updateByPts()
        self.setFont(QFont('宋体'))
        self.setStyleSheet('font: 20px;')
        self.show()
Ejemplo n.º 3
0
def getPoint(point, key, default=''):
    dict_pt = ptToDict(point)
    con = dict_pt.get(key, None)
    if con == None:
        con = NetP(key).con(point, NetP(default))
    con.m_permission = 0
    pt = con.m_db[1]
    pt.m_permission = 0
    return pt
Ejemplo n.º 4
0
    def initialize(self, point):
        if point == None:
            point = NetP('screen')
        self.m_self = point
        point.m_permission = 0
        point.m_dev = self

        pt_select = tools_basic.getPoint(point, 'm_select', 'list')
        self.m_select = tools_basic.getPointByFormat(pt_select, 'list')
Ejemplo n.º 5
0
    def initialize(self, point):
        if point == None:
            point = NetP('debugger')
        self.m_self = point
        point.m_dev = self
        point.m_permission = 0

        pt_motor = tools_basic.getPoint(point, 'm_motor', 'compiler')
        if pt_motor.m_dev == None:
            self.m_motor = Motor(pt_motor)
        else:
            self.m_motor = pt_motor.m_dev
Ejemplo n.º 6
0
    def initialize(self, point):
        if point == None:
            point = NetP('compiler')
        self.m_self = point
        point.m_dev = self
        point.m_permission = 0

        pt_source = tools_basic.getPoint(point, 'm_source', 'incomingPool')
        pt_terms = tools_basic.getPoint(point, 'm_terms', 'list')
        self.m_inputs = pt_source.m_dev.m_pool
        self.m_terms = tools_basic.getPointByFormat(pt_terms, 'list')
        for term in self.m_terms:
            term.m_permission = 0

        print(self.info())
Ejemplo n.º 7
0
    def initialize(self, point):
        if point == None:
            point = NetP('library')
        self.m_self = point
        point.m_dev = self
        point.m_permission = 0

        pt_motor = tools_basic.getPoint(point, 'm_motor', 'compiler')
        pt_terms = tools_basic.getPoint(point, 'm_terms', 'list')

        self.m_motor = pt_motor.m_dev
        self.m_terms = tools_basic.getPointByFormat(pt_terms, 'list')
        for term in self.m_terms:
            term.m_permission = 0

        print(self.info())
Ejemplo n.º 8
0
    def initialize(self,point):
        if point==None:
            point=NetP('pool')
        self.m_self=point
        point.m_dev=self
        point.m_permission=0

        pt_lib=tools_basic.getPoint(point,'m_lib','actions')
        pt_contain=tools_basic.getPoint(point,'m_contain','points')
        pt_pool=tools_basic.getPoint(point,'m_pool','list')

        pt_lib.m_permission=0
        pt_contain.m_permission=0
        pt_pool.m_permission=0

        self.m_lib=Library(pt_lib)
        self.m_contain=pt_contain
        self.m_pool=tools_basic.getPointByFormat(pt_pool,'list')