Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from MaxIV-KitsControls/class_prop_diff
Browse files Browse the repository at this point in the history
Class prop diff
  • Loading branch information
13bscsaamjad authored Oct 2, 2019
2 parents 10a4c57 + e2be7fc commit 77ea047
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions dsconfig/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,32 @@ def show_actions(data, calls):
if lines:
print("{}Attribute properties:".format(indent))
print("\n".join(lines))

for clss in sorted(changes["classes"]):
info = changes["classes"][clss]

if info.get("properties"):
lines = []
for prop, change in sorted(info.get("properties", {}).items()):
if change.get("value"):
value = change.get("value")
old_value = change.get("old_value")
if old_value is not None:
if old_value != value:
# change property
lines.append(yellow("{}= {}".format(indent*2, prop)))
lines.append(property_diff(
change["old_value"], change["value"], indent*3))
else:
# new property
lines.append(green("{}+ {}".format(indent*2, prop)))
lines.append(green(format_property(change["value"],
indent*3)))
else:
# delete property
lines.append(red("{}- {}".format(indent*2, prop)))
lines.append(red(format_property(change["old_value"], indent*3)))
if lines:
print("{} Class Properties:".format(indent*1))
print("\n".join(lines))
print
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
setup(
# Package
name="python-dsconfig",
version="1.3.1",
version="1.4.0",
packages=['dsconfig', 'dsconfig.appending_dict'],
description="Library and utilities for Tango device configuration.",
# Requirements
Expand Down

0 comments on commit 77ea047

Please sign in to comment.