def run(self): # if os.name=="posix": if self.sockettype == BeeSocketTypes.python: # under linux Qt sockets aren't working correctly for me self.server = BeeTCPServer(BeeSocketTypes.python, self.port, self, self.master) self.server.start() else: self.exec_()
def started(self): # under linux Qt sockets aren't working correctly for me # if os.name=="posix": if self.sockettype == BeeSocketTypes.python: return # needs to be done here because this is running in the proper thread self.server = BeeTCPServer(BeeSocketTypes.qt, self.port, self, self.master) self.server.start()
class HiveServerThread(qtcore.QThread): def __init__(self, master, port=8333, sockettype=BeeSocketTypes.python): qtcore.QThread.__init__(self, master) self.threads = [] self.port = port self.master = master self.sockettype = sockettype # connect the signals we want qtcore.QObject.connect(self, qtcore.SIGNAL("finished()"), self.finished) qtcore.QObject.connect(self, qtcore.SIGNAL("started()"), self.started) def started(self): # under linux Qt sockets aren't working correctly for me # if os.name=="posix": if self.sockettype == BeeSocketTypes.python: return # needs to be done here because this is running in the proper thread self.server = BeeTCPServer(BeeSocketTypes.qt, self.port, self, self.master) self.server.start() def stopServerThread(self): self.server.stop() if os.name == "posix": self.terminate() else: self.quit() self.wait() def finished(self): print_debug("server thread has finished") def run(self): # if os.name=="posix": if self.sockettype == BeeSocketTypes.python: # under linux Qt sockets aren't working correctly for me self.server = BeeTCPServer(BeeSocketTypes.python, self.port, self, self.master) self.server.start() else: self.exec_()