harnice 0.3.0__tar.gz → 0.3.2__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 (48) hide show
  1. {harnice-0.3.0 → harnice-0.3.2}/PKG-INFO +2 -1
  2. {harnice-0.3.0 → harnice-0.3.2}/pyproject.toml +3 -2
  3. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/fileio.py +53 -9
  4. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/instances_list.py +41 -39
  5. harnice-0.3.2/src/harnice/lists/rev_history.py +541 -0
  6. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/harness.py +8 -8
  7. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/part.py +1 -3
  8. harnice-0.3.2/src/harnice/products/system.py +297 -0
  9. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/state.py +4 -0
  10. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/feature_tree_utils.py +1 -1
  11. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/formboard_utils.py +5 -11
  12. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/library_utils.py +8 -2
  13. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/system_utils.py +40 -18
  14. {harnice-0.3.0 → harnice-0.3.2}/src/harnice.egg-info/PKG-INFO +2 -1
  15. {harnice-0.3.0 → harnice-0.3.2}/src/harnice.egg-info/requires.txt +1 -0
  16. harnice-0.3.0/src/harnice/lists/rev_history.py +0 -325
  17. harnice-0.3.0/src/harnice/products/system.py +0 -125
  18. {harnice-0.3.0 → harnice-0.3.2}/LICENSE +0 -0
  19. {harnice-0.3.0 → harnice-0.3.2}/README.md +0 -0
  20. {harnice-0.3.0 → harnice-0.3.2}/setup.cfg +0 -0
  21. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/__init__.py +0 -0
  22. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/__main__.py +0 -0
  23. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/cli.py +0 -0
  24. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/gui/launcher.py +0 -0
  25. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/channel_map.py +0 -0
  26. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/circuits_list.py +0 -0
  27. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/disconnect_map.py +0 -0
  28. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/formboard_graph.py +0 -0
  29. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/library_history.py +0 -0
  30. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/manifest.py +0 -0
  31. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/post_harness_instances_list.py +0 -0
  32. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/lists/signals_list.py +0 -0
  33. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/__init__.py +0 -0
  34. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/cable.py +0 -0
  35. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/chtype.py +0 -0
  36. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/device.py +0 -0
  37. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/disconnect.py +0 -0
  38. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/flagnote.py +0 -0
  39. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/macro.py +0 -0
  40. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/products/tblock.py +0 -0
  41. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/appearance.py +0 -0
  42. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/circuit_utils.py +0 -0
  43. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/note_utils.py +0 -0
  44. {harnice-0.3.0 → harnice-0.3.2}/src/harnice/utils/svg_utils.py +0 -0
  45. {harnice-0.3.0 → harnice-0.3.2}/src/harnice.egg-info/SOURCES.txt +0 -0
  46. {harnice-0.3.0 → harnice-0.3.2}/src/harnice.egg-info/dependency_links.txt +0 -0
  47. {harnice-0.3.0 → harnice-0.3.2}/src/harnice.egg-info/entry_points.txt +0 -0
  48. {harnice-0.3.0 → harnice-0.3.2}/src/harnice.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: harnice
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Electrical System CAD
5
5
  Author-email: Kenyon Shutt <harnice.io@gmail.com>
6
6
  Project-URL: Documentation, https://harnice.io/
@@ -18,6 +18,7 @@ Requires-Dist: Pillow
18
18
  Requires-Dist: PyYAML
19
19
  Requires-Dist: xlwt
20
20
  Requires-Dist: webcolors
21
+ Requires-Dist: prompt_toolkit
21
22
  Dynamic: license-file
22
23
 
23
24
  Harnice is a free, open source electrical system CAD tool.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "harnice"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  authors = [
5
5
  { name="Kenyon Shutt", email="harnice.io@gmail.com" },
6
6
  ]
@@ -19,7 +19,8 @@ dependencies = [
19
19
  "Pillow",
20
20
  "PyYAML",
21
21
  "xlwt",
22
- "webcolors"
22
+ "webcolors",
23
+ "prompt_toolkit"
23
24
  ]
24
25
 
25
26
  [project.urls]
@@ -41,13 +41,15 @@ def path(target_value, structure_dict=None, base_directory=None):
41
41
 
42
42
  # returns the filepath/filename of a filekey.
43
43
  """
44
- Recursively searches for a value in a nested JSON structure and returns the path to the element containing that value.
44
+ Recursively searches for a value in a nested JSON structure and returns the path to the element containing that value.
45
45
 
46
- Args:
47
- target_value (str): The value to search for.
46
+ It's complicated ... check out https://harnice.io/commands/fileio/ for more information.
47
+
48
+ Args:
49
+ target_value (str): The value to search for.
48
50
 
49
- Returns:
50
- list: A list of container names leading to the element containing the target value, or None if not found.
51
+ Returns:
52
+ list: A list of container names leading to the element containing the target value, or None if not found.
51
53
  """
52
54
 
53
55
  # FILES NOT DEPENDENT ON PRODUCT TYPE
@@ -65,7 +67,20 @@ def path(target_value, structure_dict=None, base_directory=None):
65
67
  harnice_root = os.path.dirname(
66
68
  os.path.dirname(os.path.dirname(harnice.__file__))
67
69
  )
68
- return os.path.join(harnice_root, "library_locations.csv")
70
+
71
+ library_locations_path = os.path.join(harnice_root, "library_locations.csv")
72
+
73
+ if not os.path.exists(library_locations_path):
74
+ from harnice import cli
75
+ answer = cli.prompt(f"Library locations file not found at {library_locations_path}. Create it?", default="y")
76
+ if answer.lower() not in ("y", "yes", ""):
77
+ exit()
78
+
79
+ with open(library_locations_path, "w") as f:
80
+ f.write("repo_url,local_path\n")
81
+ f.write(f"https://github.com/harnice/harnice,{os.path.join(harnice_root, 'library_public')}\n")
82
+
83
+ return library_locations_path
69
84
 
70
85
  if target_value == "project locations":
71
86
  import harnice
@@ -73,6 +88,17 @@ def path(target_value, structure_dict=None, base_directory=None):
73
88
  harnice_root = os.path.dirname(
74
89
  os.path.dirname(os.path.dirname(harnice.__file__))
75
90
  )
91
+ project_locations_path = os.path.join(harnice_root, "project_locations.csv")
92
+ if not os.path.exists(project_locations_path):
93
+ from harnice import cli
94
+ answer = cli.prompt(f"Project locations file not found at {project_locations_path}. Create it?", default="y")
95
+ if answer.lower() not in ("y", "yes", ""):
96
+ exit()
97
+
98
+ with open(project_locations_path, "w") as f:
99
+ f.write("traceable_key,local_path\n")
100
+ f.write("your project part number,local path to your project\n")
101
+
76
102
  return os.path.join(harnice_root, "project_locations.csv")
77
103
 
78
104
  if target_value == "drawnby":
@@ -81,7 +107,24 @@ def path(target_value, structure_dict=None, base_directory=None):
81
107
  harnice_root = os.path.dirname(
82
108
  os.path.dirname(os.path.dirname(harnice.__file__))
83
109
  )
84
- return os.path.join(harnice_root, "drawnby.json")
110
+
111
+ drawnby_path = os.path.join(harnice_root, "drawnby.json")
112
+ if not os.path.exists(drawnby_path):
113
+ from harnice import cli
114
+ answer = cli.prompt(f"Drawnby file not found at {drawnby_path}. Create it?", default="y")
115
+ if answer.lower() not in ("y", "yes", ""):
116
+ exit()
117
+
118
+ name = cli.prompt("Enter your name: (recommended: first inital, last name, all caps: K SHUTT)")
119
+
120
+ while not name:
121
+ print("Name cannot be empty. Please try again.")
122
+ name = cli.prompt("Enter your name")
123
+
124
+ with open(drawnby_path, "w") as f:
125
+ f.write(f"{name}\n")
126
+
127
+ return drawnby_path
85
128
 
86
129
  # FILES INSIDE OF A STRUCURE DEFINED BY FILEIO
87
130
  # look up from default structure state if not provided
@@ -209,12 +252,13 @@ def verify_revision_structure():
209
252
  f"Harnice only renders revisions with a blank status."
210
253
  )
211
254
 
212
- print(f"Working on PN: {state.pn}, Rev: {state.rev}")
255
+ print(f"Rendering PN: {state.pn}, Rev: {state.rev}")
213
256
  rev_history.update_datemodified()
214
257
 
215
258
 
216
259
  def today():
217
- return datetime.date.today().strftime("%-m/%-d/%y")
260
+ d = datetime.date.today()
261
+ return f"{d.month}/{d.day}/{d.year % 100}"
218
262
 
219
263
 
220
264
  def get_git_hash_of_harnice_src():
@@ -5,23 +5,25 @@ from threading import Lock
5
5
  from harnice import fileio, state
6
6
 
7
7
  COLUMNS = [
8
- "net", #documentation needed
9
- "instance_name", #documentation needed
10
- "print_name", #documentation needed
11
- "bom_line_number", #documentation needed
12
- "mfg", #documentation needed
13
- "mpn", # unique part identifier (manufacturer + part number concatenated)
8
+ "net", # the physical harness (represented by a net in Kicad) that this instance is part of
9
+ "instance_name", # the unique name of this instance
10
+ "print_name", # the non-unique, human-readable name of this instance, used for printing on output documents
11
+ "bom_line_number", # if this instance represents a physical procurable good, it gets assigned a line number on a bill of materials
12
+ "mfg", # manufacturer of this instance
13
+ "mpn", # manufacturer part number
14
14
  "item_type", # connector, backshell, whatever
15
15
  "parent_instance", # general purpose reference
16
16
  "location_type", # each instance is either better represented by one or ther other
17
17
  "segment_group", # the group of segments that this instance is part of
18
18
  "segment_order", # the sequential id of this item in its segment group
19
19
  "connector_group", # a group of co-located parts (connectors, backshells, nodes)
20
- "channel_group", #documentation needed
20
+ "channel_group", # other instances associated with this one because they are part of the same channel will share this value
21
21
  "circuit_id", # which signal this component is electrically connected to
22
22
  "circuit_port_number", # the sequential id of this item in its signal chain
23
23
  "node_at_end_a", # derived from formboard definition
24
24
  "node_at_end_b", # derived from formboard definition
25
+ "print_name_at_end_a", # human-readable name of this instance if needed, associated with 'node_at_end_a'
26
+ "print_name_at_end_b", # human-readable name of this instance if needed, associated with 'node_at_end_b'
25
27
  "parent_csys_instance_name", # the other instance upon which this instance's location is based
26
28
  "parent_csys_outputcsys_name", # the specific output coordinate system of the parent that this instance's location is based
27
29
  "translate_x", # derived from parent_csys and parent_csys_name
@@ -29,9 +31,9 @@ COLUMNS = [
29
31
  "rotate_csys", # derived from parent_csys and parent_csys_name
30
32
  "absolute_rotation", # manual add, not nominally used unless it's a flagnote, segment, or node
31
33
  "csys_children", # imported csys children from library attributes file
32
- "cable_group", #documentation needed
33
- "cable_container", #documentation needed
34
- "cable_identifier", #documentation needed
34
+ "cable_group", # other instances associated with this one because they are part of the same cable will share this value
35
+ "cable_container", # which cable is this instance physically bundled inside of
36
+ "cable_identifier", # cable unique identifier
35
37
  "length", # derived from formboard definition, the length of a segment
36
38
  "diameter", # apparent diameter of a segment <---------- change to print_diameter
37
39
  "appearance", # see harnice.utils.appearance for details
@@ -40,39 +42,39 @@ COLUMNS = [
40
42
  "note_parent", # the instance the note applies to. typically don't use this in the instances list, just note_utils
41
43
  "note_text", # the content of the note
42
44
  "note_affected_instances", # list of instances that are affected by the note
43
- "lib_repo", #documentation needed
44
- "lib_subpath", #documentation needed
45
- "lib_desc", #documentation needed
46
- "lib_latest_rev", #documentation needed
47
- "lib_rev_used_here", #documentation needed
48
- "lib_status", #documentation needed
45
+ "lib_repo", # publically-traceable URL of the library this instance is from
46
+ "lib_subpath", # path to the instance within the library (directories between the product type and the part number)
47
+ "lib_desc", # description of the instance per the library's revision history
48
+ "lib_latest_rev", # the latest revision of the instance that exists in the remote library
49
+ "lib_rev_used_here", # the revision of the instance that is currently used in this project
50
+ "lib_status", # the status of the instance per the library's revision history
49
51
  "lib_releaseticket", #documentation needed
50
- "lib_datestarted", #documentation needed
51
- "lib_datemodified", #documentation needed
52
- "lib_datereleased", #documentation needed
53
- "lib_drawnby", #documentation needed
54
- "lib_checkedby", #documentation needed
55
- "project_editable_lib_modified", #documentation needed
56
- "lib_build_notes", #documentation needed
57
- "lib_tools", #documentation needed
52
+ "lib_datestarted", # the date this instance was first added to the library
53
+ "lib_datemodified", # the date this instance was last modified in the library
54
+ "lib_datereleased", # the date this instance was released in the library, if applicable, per the library's revision history
55
+ "lib_drawnby", # the name of the person who drew the instance, per the library's revision history
56
+ "lib_checkedby", # the name of the person who checked the instance, per the library's revision history
57
+ "project_editable_lib_modified", # a flag to indicate if the imported contents do not match the library's version (it's been locally modified)
58
+ "lib_build_notes", # recommended build notes that come with the instance from the library
59
+ "lib_tools", # recommended tools that come with the instance from the library
58
60
  "this_instance_mating_device_refdes", # if connector, refdes of the device it plugs into
59
61
  "this_instance_mating_device_connector", # if connector, name of the connector it plugs into
60
62
  "this_instance_mating_device_connector_mpn", # if connector, mpn of the connector it plugs into
61
- "this_net_from_device_refdes", #documentation needed
62
- "this_net_from_device_channel_id", #documentation needed
63
- "this_net_from_device_connector_name", #documentation needed
64
- "this_net_to_device_refdes", #documentation needed
65
- "this_net_to_device_channel_id", #documentation needed
66
- "this_net_to_device_connector_name", #documentation needed
67
- "this_channel_from_device_refdes", # if channel, refdes of the device on one side of the channel
68
- "this_channel_from_device_channel_id", #documentation needed
69
- "this_channel_to_device_refdes", # if channel, refdes of the device on the other side of the channel
70
- "this_channel_to_device_channel_id", #documentation needed
71
- "this_channel_from_channel_type", #documentation needed
72
- "this_channel_to_channel_type", #documentation needed
73
- "signal_of_channel_type", #documentation needed
74
- "debug", #documentation needed
75
- "debug_cutoff", #documentation needed
63
+ "this_net_from_device_refdes", # if this instance is a channel, circuit, conductor, etc, the refdes of the device it interfaces with, just within this net
64
+ "this_net_from_device_channel_id", # if this instance is a channel, circuit, conductor, etc, the channel id in the device it interfaces with, just within this net
65
+ "this_net_from_device_connector_name", # if this instance is a channel, circuit, conductor, etc, the name of the connector it interfaces with, just within this net
66
+ "this_net_to_device_refdes", # if this instance is a channel, circuit, conductor, etc, the refdes of the device it plugs into just within this net
67
+ "this_net_to_device_channel_id", # if this instance is a channel, circuit, conductor, etc, the channel id in the device it plugs into, just within this net
68
+ "this_net_to_device_connector_name", # if this instance is a channel, circuit, conductor, etc, the name of the connector it plugs into, just within this net
69
+ "this_channel_from_device_refdes", # if this instance is a channel, circuit, conductor, etc, the refdes of the device it interfaces with, at the very end of the channel
70
+ "this_channel_from_device_channel_id", # if this instance is a channel, circuit, conductor, etc, the channel id in the device it interfaces with, at the very end of the channel
71
+ "this_channel_to_device_refdes", # if this instance is a channel, circuit, conductor, etc, the refdes of the device it plugs into, at the very end of the channel
72
+ "this_channel_to_device_channel_id", # if this instance is a channel, circuit, conductor, etc, the channel id in the device it plugs into, at the very end of the channel
73
+ "this_channel_from_channel_type", # if this instance is a channel, circuit, conductor, etc, the type of the channel it interfaces with, at the very end of the channel
74
+ "this_channel_to_channel_type", # if this instance is a channel, circuit, conductor, etc, the type of the channel it plugs into, at the very end of the channel
75
+ "signal_of_channel_type", # if this instance is a channel, circuit, conductor, etc, the signal of the channel it interfaces with, at the very end of the channel
76
+ "debug", # the call chain of the function that last modified this instance row
77
+ "debug_cutoff", # blank cell to visually cut off the previous column
76
78
  ]
77
79
 
78
80