self.globalCtx = globalCtx
- # __str__ : Return a string representation of the object, for
- # nice printing.
- def __str__(self) :
- return self.exec_string
-
- def p(self) :
- print str(self)
-
def append_stmt(self, stmt) :
self.exec_code_valid = 0
self.line += 1
- if (stmt != "\n"):
- for x in range(0,self.indent_level):
- self.exec_string = self.exec_string + ' '
- self.exec_string = self.exec_string + stmt + "\t\t# l:" + str(self.line) + '\n'
- else:
- if (stmt == "\n"):
- self.exec_string = self.exec_string + "# l:" + str(self.line) + '\n'
- else:
- self.exec_string = self.exec_string + stmt + "\t\t# l:" + str(self.line) + '\n'
+ for x in range(0,self.indent_level):
+ self.exec_string = self.exec_string + ' '
+ self.exec_string = self.exec_string + stmt + '\n'
def indent(self) :
self.indent_level = self.indent_level + self.indent_increment
self.class_code.indent_increment = 4
self.class_code.append_stmt("import dbus")
self.class_code.append_stmt("\n")
- self.class_code.append_stmt("\n")
self.class_code.append_stmt("class " + self.className + "(dbus.service.Object):")
self.class_code.indent()
self.add_stmt("self.bus = bus")
self.add_stmt("self.objName = objName")
self.add_stmt("self.callback = callback")
-# self.add_stmt("dbus.service.Object.__init__(self, conn=bus, object_path=objName, bus_name=busName)")
self.add_stmt("dbus.service.Object.__init__(self, conn=bus, bus_name=busName)")
self.end_method()
def end_method(self):
self.class_code.append_stmt("\n")
- self.class_code.append_stmt("\n")
self.class_code.dedent()
def add_dbus_method(self):
def add_body_method(self):
if (self.methodToAdd != None):
- self.class_code.append_stmt("print 'In " + self.methodToAdd + "()'")
if (self.args_str != str()):
self.class_code.append_stmt("self.callback('" + self.methodToAdd + "', dbus_async_cb, dbus_async_err_cb, %s)" % self.args_str)
else:
def declare(self) :
self.class_code.execute()
-
- def __str__(self) :
- return self.class_code.exec_string
-
- # p : Since it is often useful to be able to look at the code
- # that is generated interactively, this function provides
- # a shorthand for "print str(some_exec_code_instance)", which
- # gives a reasonable nice look at the contents of the
- # exec_code object.
- def p(self) :
- print str(self)