sharemouse.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @Contact : liuyuqi.gov@msn.cn
  5. @Time : 2022/10/30 19:18:53
  6. @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
  7. @Desc :
  8. 实现逻辑:
  9. pc1: 启动sharemouse, 启动server,启动client去search是否有server
  10. pc2: 启动sharemouse,同理,成功发现server1,
  11. '''
  12. import os
  13. import sys
  14. import re
  15. import argparse
  16. from turtle import st
  17. from sharemouse.server import Server
  18. from sharemouse.client import Client
  19. import logging as log
  20. class ShareMouse(object):
  21. def __init__(self):
  22. super().__init__()
  23. self.parser = argparse.ArgumentParser(
  24. description="config for sharemouse")
  25. self.parser.add_argument(
  26. "--port", type=str, default="6555", help="server port")
  27. self.parser.add_argument(
  28. "--username", type=str, default="", help="register and login your account.")
  29. self.parser.add_argument(
  30. "--pwd", type=str, default=None, help="The password of connecting to server.")
  31. self.parser.add_argument("--token", type=str, default="", help="token")
  32. def run(self):
  33. # start server
  34. server = Server(port=self.parser.get_default("port"))
  35. server.start()
  36. log.info("-----------start-------")
  37. # start client and search server
  38. client = Client()
  39. client.connect()
  40. def stop(self):
  41. pass
  42. def syncAction(self):
  43. '''同步操作,鼠标移动,点击,键盘按键'''
  44. pass
  45. if __name__ == "__main__":
  46. ShareMouse().run()