physicsLab 1.1.2__tar.gz → 1.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {physicsLab-1.1.2 → physicsLab-1.1.6}/PKG-INFO +2 -9
  2. {physicsLab-1.1.2 → physicsLab-1.1.6}/README.md +1 -8
  3. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/__init__.py +1 -1
  4. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/element.py +1 -1
  5. physicsLab-1.1.6/physicsLab/electricity/elementXYZ.py +77 -0
  6. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementsClass/_elementClassHead.py +5 -11
  7. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/experiment.py +30 -5
  8. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab.egg-info/PKG-INFO +2 -9
  9. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab.egg-info/SOURCES.txt +1 -2
  10. {physicsLab-1.1.2 → physicsLab-1.1.6}/setup.py +1 -1
  11. physicsLab-1.1.2/physicsLab/_utf_8.py +0 -15
  12. physicsLab-1.1.2/physicsLab/electricity/_elementPosition.py +0 -39
  13. {physicsLab-1.1.2 → physicsLab-1.1.6}/LICENSE.txt +0 -0
  14. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/__init__.py +0 -0
  15. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/_fileGlobals.py +0 -0
  16. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/astrophysics/__init__.py +0 -0
  17. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementPin.py +0 -0
  18. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementsClass/__init__.py +0 -0
  19. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementsClass/artificialCircuit.py +0 -0
  20. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementsClass/basicCircuit.py +0 -0
  21. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementsClass/logicCircuit.py +0 -0
  22. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/elementsClass/otherCircuit.py +0 -0
  23. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electricity/wire.py +0 -0
  24. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/electromagnetism/__init__.py +0 -0
  25. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/errors.py +0 -0
  26. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/unionElements/__init__.py +0 -0
  27. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/unionElements/unionLogic.py +0 -0
  28. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/unionElements/unionPin.py +0 -0
  29. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/unionElements/union_music.py +0 -0
  30. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab/userlog.py +0 -0
  31. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab.egg-info/dependency_links.txt +0 -0
  32. {physicsLab-1.1.2 → physicsLab-1.1.6}/physicsLab.egg-info/top_level.txt +0 -0
  33. {physicsLab-1.1.2 → physicsLab-1.1.6}/pyproject.toml +0 -0
  34. {physicsLab-1.1.2 → physicsLab-1.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: physicsLab
3
- Version: 1.1.2
3
+ Version: 1.1.6
4
4
  Summary: Doing experiments in the physics lab AR by python
5
5
  Home-page: https://gitee.com/script2000/physicsLab
6
6
  Author: Goodenough
@@ -25,17 +25,10 @@ License-File: LICENSE.txt
25
25
  ## 安装教程
26
26
 
27
27
  1. 请确保你的电脑有[Python](https://www.python.org)与[物理实验室PC版](https://www.turtlesim.com/)(也可以联系[开发者Jone-Chen](https://gitee.com/civitasjohn))
28
- 2. 打开physicsLab,克隆到本地
29
- 你也可以通过pip安装,在cmd或shell输入:
28
+ 2. 在cmd或shell输入:
30
29
  ```diff
31
30
  pip install physicsLab
32
31
  ```
33
- 3. 如果你的ide无法找到physicsLab,你可以在代码开头写
34
- ```python
35
- import sys
36
- sys.path.append('physicsLab的路径')
37
- ```
38
- 当然,你也可以通过IDE来解决这个问题
39
32
 
40
33
  ## 开发环境
41
34
  python 3.7, PyCharm, win7
@@ -8,17 +8,10 @@
8
8
  ## 安装教程
9
9
 
10
10
  1. 请确保你的电脑有[Python](https://www.python.org)与[物理实验室PC版](https://www.turtlesim.com/)(也可以联系[开发者Jone-Chen](https://gitee.com/civitasjohn))
11
- 2. 打开physicsLab,克隆到本地
12
- 你也可以通过pip安装,在cmd或shell输入:
11
+ 2. 在cmd或shell输入:
13
12
  ```diff
14
13
  pip install physicsLab
15
14
  ```
16
- 3. 如果你的ide无法找到physicsLab,你可以在代码开头写
17
- ```python
18
- import sys
19
- sys.path.append('physicsLab的路径')
20
- ```
21
- 当然,你也可以通过IDE来解决这个问题
22
15
 
23
16
  ## 开发环境
24
17
  python 3.7, PyCharm, win7
@@ -8,4 +8,4 @@ from physicsLab.electricity.elementsClass import *
8
8
  # 元件引脚类
9
9
  from physicsLab.electricity.elementPin import *
10
10
  # 元件坐标系
11
- from physicsLab.electricity._elementPosition import set_elementXYZ
11
+ from physicsLab.electricity.elementXYZ import *
@@ -1,7 +1,7 @@
1
1
  #coding=utf-8
2
2
  import physicsLab._fileGlobals as _fileGlobals
3
3
  from physicsLab.electricity.elementsClass import *
4
- import physicsLab.electricity._elementPosition as _elementPosition
4
+ import physicsLab.electricity.elementXYZ as _elementXYZ
5
5
 
6
6
  # 创建原件,本质上仍然是实例化
7
7
  def crt_Element(name: str, x : float = 0, y : float = 0, z : float = 0):
@@ -0,0 +1,77 @@
1
+ # Ԫ������ϵ
2
+ # һ�����ŵij�Ϊ0.15����Ϊ0.075
3
+ # һ�����ŵij������ΪԪ������ϵ��x, y�ĵ�λ����
4
+ # z��ĵ�λ������ԭ����ϵ��0.1
5
+ #
6
+ # ���λ�˷�������Ԫ����λ�ñ��뾭����������ʹԪ����������
7
+ # x, z�᲻������
8
+ # y�������Ϊ +0.045
9
+
10
+ # _elementClassHead���element_Init_HEAD�в��ִ���Ԫ������ϵ�Ĵ���
11
+ # crt_ExperimentҲ�в��ִ���
12
+
13
+ from typing import Union
14
+
15
+ ### define ###
16
+
17
+ # �Ƿ�ȫ������ΪԪ������ϵ
18
+ _elementXYZ = False
19
+
20
+ @property
21
+ def elementXYZ():
22
+ return _elementXYZ
23
+
24
+ @elementXYZ.setter
25
+ def set_elementXYZ(boolen: bool) -> None:
26
+ if not isinstance(boolen, bool):
27
+ raise TypeError
28
+ global _elementXYZ
29
+ _elementXYZ = bool(boolen)
30
+
31
+ # ��ʵ����ϵx, y, z��λ1
32
+ _xUnit = 0.16
33
+ _yUnit = 0.08
34
+ _zUnit = 0.1
35
+ # big_element��������
36
+ _xAmend = 0.04
37
+
38
+ # Ԫ������ϵԭ��
39
+ _xOrigin, _yOrigin, _zOrigin = 0, 0, 0
40
+ ### end define ###
41
+
42
+ # ��Ԫ������ϵת��Ϊ��ʵ֧�ֵ�����ϵ
43
+ def xyzTranslate(x: Union[int, float], y: Union[int, float], z: Union[int, float], isBigElement = False):
44
+ x *= _xUnit
45
+ y *= _yUnit
46
+ z *= _zUnit
47
+ # �޸�Ԫ������ϵԭ��
48
+ x += _xOrigin
49
+ y += _yOrigin
50
+ # �޸Ĵ�����߼���·ԭ��������
51
+ if isBigElement:
52
+ y += _xAmend
53
+ return x, y, z
54
+
55
+ # ����ʵ֧�ֵ�����ϵת��ΪԪ������ϵ
56
+ def translateXYZ(x: Union[int, float], y: Union[int, float], z: Union[int, float], isBigElement = False):
57
+ x /= _xUnit
58
+ y /= _yUnit
59
+ z /= _zUnit
60
+ # �޸�Ԫ������ϵԭ��
61
+ x -= _xOrigin
62
+ y -= _yOrigin
63
+ # �޸Ĵ�����߼���·ԭ��������
64
+ if isBigElement:
65
+ y -= _xAmend
66
+ return x, y, z
67
+
68
+ # ����Ԫ������ϵԭ��O������ֵΪ��ʵ����ϵ
69
+ def set_O(x: Union[int, float], y: Union[int, float], z: Union[int, float]) -> None:
70
+ if (isinstance(x, (int, float)) and
71
+ isinstance(y, (int, float)) and
72
+ isinstance(z, (int, float))
73
+ ):
74
+ global _xOrigin, _yOrigin, _zOrigin
75
+ _xOrigin, _yOrigin, _zOrigin = x, y, z
76
+ else:
77
+ raise TypeError
@@ -4,17 +4,10 @@ import string as _string
4
4
  from typing import Callable, Union
5
5
  import physicsLab._fileGlobals as _fileGlobals
6
6
  import physicsLab.electricity.elementPin as _elementPin
7
- import physicsLab.electricity._elementPosition as _elementPosition
7
+ import physicsLab.electricity.elementXYZ as _elementPosition
8
8
 
9
9
  # 所有元件的父类
10
10
  class elementObject:
11
- # 用来避免IDE报太多错的函数,无实际作用
12
- def __define(self):
13
- self._arguments = {'ModelID': '', 'Identifier': "", 'IsBroken': False, 'IsLocked': False, 'Properties': {},
14
- 'Statistics': {}, 'Position': "", 'Rotation': '', 'DiagramCached': False,
15
- 'DiagramPosition': {}, 'DiagramRotation': 0}
16
- self._index = None
17
-
18
11
  # 设置原件的角度
19
12
  def set_Rotation(self, xRotation: Union[int, float] = 0, yRotation: Union[int, float] = 0, zRotation: Union[int, float] = 180):
20
13
  if not (isinstance(xRotation, (int, float)) and isinstance(yRotation, (int, float)) and isinstance(zRotation, (int, float))):
@@ -68,15 +61,16 @@ def element_Init_HEAD(isBigElement = False) -> Callable:
68
61
  if not isinstance(x, (float, int)) and isinstance(y, (float, int)) and isinstance(z, (float, int)):
69
62
  raise TypeError('illegal argument')
70
63
  x, y, z = _fileGlobals.myRound(x), _fileGlobals.myRound(y), _fileGlobals.myRound(z)
64
+ self._position = (x, y, z)
71
65
  # 元件坐标系
72
66
  if elementXYZ == True or (_elementPosition.elementXYZ == True and elementXYZ is None):
73
- x, y, z = _elementPosition.translate(x, y, z, bool(isBigElement))
74
- self._position = (x, y, z)
67
+ x, y, z = _elementPosition.xyzTranslate(x, y, z, bool(isBigElement))
68
+ # 该坐标是否已存在
75
69
  if self._position in _fileGlobals.elements_Address.keys():
76
70
  raise RuntimeError("The position already exists")
77
71
  func(self, x, y, z)
78
72
  self._arguments["Identifier"] = ''.join(_random.choice(_string.ascii_letters + _string.digits) for _ in range(32))
79
- self._arguments["Position"] = f"{self._position[0]},{self._position[2]},{self._position[1]}"
73
+ self._arguments["Position"] = f"{x},{z},{y}"
80
74
  _fileGlobals.Elements.append(self._arguments)
81
75
  _fileGlobals.elements_Address[self._position] = self
82
76
  self.set_Rotation()
@@ -1,18 +1,19 @@
1
1
  #coding=utf-8
2
- import json as _json
2
+ import os as _os
3
3
  import sys as _sys
4
+ import json as _json
4
5
  import random as _random
5
6
  import string as _string
6
- import os as _os
7
7
 
8
- from ._utf_8 import utf8_coding as _utf8_coding
9
8
  import physicsLab._fileGlobals as _fileGlobals
10
9
  from physicsLab.electricity.element import crt_Element
11
- import physicsLab.electricity._elementPosition as _elementPosition
12
10
 
13
11
  ### define ###
14
12
 
13
+ # 是否已经有存档被打开或创建
15
14
  _ifndef_open_Experiment = False
15
+ # 打印write_Experiment的信息时是否使用彩色字
16
+ _printColor = True
16
17
 
17
18
  def print_Elements():
18
19
  print(_fileGlobals.Elements)
@@ -45,6 +46,27 @@ def old_open_Experiment(file: str) -> None:
45
46
  except:
46
47
  raise RuntimeError('Data errors in the file')
47
48
 
49
+ # 将import了physicsLab的文件的第一行添加上 #coding=utf-8
50
+ def _utf8_coding(func):
51
+ def result(string: str) -> None:
52
+ try: # 在cmd或者shell上无法执行该功能
53
+ import sys
54
+ s = ''
55
+ with open(sys.argv[0], encoding='utf-8') as f:
56
+ s = f.read()
57
+ if not s.replace('\n', '').startswith('#coding=utf-8'):
58
+ with open(sys.argv[0], 'w', encoding='utf-8') as f:
59
+ if s.startswith('\n'):
60
+ f.write(f'#coding=utf-8{s}')
61
+ else:
62
+ f.write(f'#coding=utf-8\n{s}')
63
+ except FileNotFoundError:
64
+ # 在cmd或IDLE上运行时会关闭打印彩字功能
65
+ global _printColor
66
+ _printColor = False
67
+ func(string)
68
+ return result
69
+
48
70
  # 打开一个指定的sav文件(支持输入本地实验的名字或sav文件名)
49
71
  @_utf8_coding
50
72
  def open_Experiment(file : str) -> None:
@@ -138,7 +160,10 @@ def write_Experiment() -> None:
138
160
  experiments.pop(0)
139
161
  with open(f'{_fileGlobals.savName[:len(_fileGlobals.savName) - 4:]}_rollBack_sav.txt', 'w', encoding='utf-8') as f:
140
162
  f.write(_json.dumps(experiments, indent=2, ensure_ascii=False))
141
- print(f'\nCompile successfully! {_fileGlobals.Elements.__len__()} elements, {_fileGlobals.Wires.__len__()} wires.')
163
+ if _printColor:
164
+ print(f'\033[32mSuccessfully compiled! {_fileGlobals.Elements.__len__()} elements, {_fileGlobals.Wires.__len__()} wires.\033[39m')
165
+ else:
166
+ print(f'Successfully compiled! {_fileGlobals.Elements.__len__()} elements, {_fileGlobals.Wires.__len__()} wires.')
142
167
 
143
168
  # 读取sav文件已有的原件与导线
144
169
  def read_Experiment() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: physicsLab
3
- Version: 1.1.2
3
+ Version: 1.1.6
4
4
  Summary: Doing experiments in the physics lab AR by python
5
5
  Home-page: https://gitee.com/script2000/physicsLab
6
6
  Author: Goodenough
@@ -25,17 +25,10 @@ License-File: LICENSE.txt
25
25
  ## 安装教程
26
26
 
27
27
  1. 请确保你的电脑有[Python](https://www.python.org)与[物理实验室PC版](https://www.turtlesim.com/)(也可以联系[开发者Jone-Chen](https://gitee.com/civitasjohn))
28
- 2. 打开physicsLab,克隆到本地
29
- 你也可以通过pip安装,在cmd或shell输入:
28
+ 2. 在cmd或shell输入:
30
29
  ```diff
31
30
  pip install physicsLab
32
31
  ```
33
- 3. 如果你的ide无法找到physicsLab,你可以在代码开头写
34
- ```python
35
- import sys
36
- sys.path.append('physicsLab的路径')
37
- ```
38
- 当然,你也可以通过IDE来解决这个问题
39
32
 
40
33
  ## 开发环境
41
34
  python 3.7, PyCharm, win7
@@ -4,7 +4,6 @@ pyproject.toml
4
4
  setup.py
5
5
  physicsLab/__init__.py
6
6
  physicsLab/_fileGlobals.py
7
- physicsLab/_utf_8.py
8
7
  physicsLab/errors.py
9
8
  physicsLab/experiment.py
10
9
  physicsLab/userlog.py
@@ -14,9 +13,9 @@ physicsLab.egg-info/dependency_links.txt
14
13
  physicsLab.egg-info/top_level.txt
15
14
  physicsLab/astrophysics/__init__.py
16
15
  physicsLab/electricity/__init__.py
17
- physicsLab/electricity/_elementPosition.py
18
16
  physicsLab/electricity/element.py
19
17
  physicsLab/electricity/elementPin.py
18
+ physicsLab/electricity/elementXYZ.py
20
19
  physicsLab/electricity/wire.py
21
20
  physicsLab/electricity/elementsClass/__init__.py
22
21
  physicsLab/electricity/elementsClass/_elementClassHead.py
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
6
6
 
7
7
  setuptools.setup(
8
8
  name="physicsLab", # 用自己的名替换其中的YOUR_USERNAME_
9
- version="1.1.2", # 包版本号,便于维护版本
9
+ version="1.1.6", # 包版本号,便于维护版本
10
10
  author="Goodenough", # 作者,可以写自己的姓名
11
11
  author_email="2381642961@qq.com", # 作者联系方式,可写自己的邮箱地址
12
12
  description="Doing experiments in the physics lab AR by python", # 包的简述
@@ -1,15 +0,0 @@
1
- # 将import了physicsLab的文件的第一行添加上 #coding=utf-8
2
- def utf8_coding(func):
3
- def result(string: str) -> None:
4
- import sys
5
- s = ''
6
- with open(sys.argv[0], encoding='utf-8') as f:
7
- s = f.read()
8
- if not s.startswith('#coding=utf-8'):
9
- with open(sys.argv[0], 'w', encoding='utf-8') as f:
10
- if s.startswith('\n'):
11
- f.write(f'#coding=utf-8{s}')
12
- else:
13
- f.write(f'#coding=utf-8\n{s}')
14
- func(string)
15
- return result
@@ -1,39 +0,0 @@
1
- # Ԫ������ϵ
2
- # һ�����ŵij�Ϊ0.15����Ϊ0.075
3
- # һ�����ŵij������ΪԪ������ϵ��x, y�ĵ�λ����
4
- # z��ĵ�λ������ԭ����ϵ��0.1
5
- #
6
- # ���λ�˷�������Ԫ����λ�ñ��뾭����������ʹԪ����������
7
- # x, z�᲻������
8
- # y�������Ϊ +0.045
9
-
10
- # _elementClassHead���element_Init_HEAD�в��ִ���Ԫ������ϵ�Ĵ���
11
- # crt_ExperimentҲ�в��ִ���
12
-
13
- from typing import Union
14
-
15
- ### define ###
16
- elementXYZ = False
17
- ### end define ###
18
-
19
- # ��Ԫ������ϵת��Ϊ��ʵ֧�ֵ�����ϵ
20
- def translate(x: Union[int, float], y: Union[int, float], z: Union[int, float], isBigElement = False):
21
- x *= 0.15
22
- y *= 0.075
23
- z *= 0.1
24
- if isBigElement:
25
- y += 0.045
26
- return x, y, z
27
-
28
- # ����ʵ֧�ֵ�����ϵת��ΪԪ������ϵ
29
- def change(x: Union[int, float], y: Union[int, float], z: Union[int, float], isBigElement = False):
30
- x /= 0.15
31
- y /= 0.075
32
- z /= 0.1
33
- if isBigElement:
34
- y -= 0.045
35
- return x, y, z
36
-
37
- def set_elementXYZ(boolen: bool):
38
- global elementXYZ
39
- elementXYZ = bool(boolen)
File without changes
File without changes
File without changes