def createContext(self): msg = ipc_pb2.Message() msg.type = 0x0020 msg.reply_mode = 1 msg.source = self.source print(msg) rep = Send(msg) print(rep) self.icid = rep.icid
def hideToolBar(self): ### hide tool bar msg = ipc_pb2.Message() msg.type = 0x0205 msg.reply_mode = 1 msg.source = self.source print(msg) rep = Send(msg) print(rep)
def showToolBar(self): ### show tool bar msg = ipc_pb2.Message() msg.type = 0x0204 msg.reply_mode = 1 msg.source = self.source print(msg) rep = Send(msg) print(rep)
def Send(msg): pack = msg.SerializeToString() data = struct.pack('I', len(pack) + 4) win32file.WriteFile(handle, data + pack) if msg.reply_mode == 1: rc, resp = win32file.ReadFile(handle, 1024) res = ipc_pb2.Message() res.ParseFromString(resp[4:]) return res
def reg(self): ### register componet message msg = ipc_pb2.Message() msg.type = 1 #0x0204 msg.reply_mode = 1 component_info = ipc_pb2.ComponentInfo() component_info.string_id = 'input_in_python' component_info.produce_message.append(0x0020) component_info.produce_message.append(0x0200) component_info.produce_message.append(0x0201) component_info.produce_message.append(0x0204) component_info.produce_message.append(0x0205) msg.payload.component_info.append(component_info) rep = Send(msg) print(rep) self.source = rep.payload.component_info[0].id
msg.reply_mode = 1 msg.source = self.source print(msg) rep = Send(msg) print(rep) self.icid = rep.icid def attachContext(self): pass comp = MyComponet() comp.reg() comp.showToolBar() quit() comp.createContext() time.sleep(3) quit() ### show composition ui msg = ipc_pb2.Message() msg.type = 0x0200 msg.reply_mode = 1 msg.source = source print(msg) rep = Send(msg) print(rep) #while True: handle.close()