Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

2.0 does not allow reloading of custom conversions #4

Closed
phone8588 opened this issue Nov 8, 2019 · 7 comments
Closed

2.0 does not allow reloading of custom conversions #4

phone8588 opened this issue Nov 8, 2019 · 7 comments

Comments

@phone8588
Copy link

Cvt: Reload custom coversions action is not working in 2.0 so cannot load back custom conversions for new measures.

@DrorHarari
Copy link
Owner

Yes, with 2.0 the menu option for reloading was disabled (through Keypirinha's global menu Reload Configuration does do the reload, along with all other plugins). I have pushed an update to bring back that menu option.

Note that with 2.0, you can have in the custom conversion definition file just the measure you want to add (it will take the rest from the built-in one) and also that its format has changed.

By the way, I'm curious about the measure you add - is it worth sharing?

@phone8588
Copy link
Author

I am not sure if worth sharing outside my work - I am converting volumes of specifics gases into tonnage based on their molecular weights. For example, how much 5L of oxygen weigh and how much 10,000 gal on nitrogen weigh. Your package was a godsend to do this on the fly in KP’s accessible platform.

@phone8588
Copy link
Author

I like the idea of 2.0.2 to use the cvt.ini file to add new measure and still get new default conversions that you might add to main package. I am having a tough time following directions to add this conversion to cvt.ini. Can you please show how to do this? Below is the custom conversion that I had added to my old cvtdefs.json -

"measures": [
{
"name": "Nitrogen Gas Volume",
"desc": "Convert units of nitrogen volume",
"units": [
{"name": "Tons (N2)", "factor": "1", "aliases": ["N2t"]},
{"name": "Pounds (N2)", "factor": "1/2000", "aliases": ["N2lb"]},
{"name": "Metric Tons (N2)", "factor": "1/0.9072", "aliases": ["N2mt"]},
{"name": "Nm3 (N2,NTP)", "factor": "38.044/27610", "aliases": ["N2Nm3"]},
{"name": "Nm3h (N2,NTP)", "factor": "(38.04424)/27610", "aliases": ["N2Nm3h"]},
{"name": "SCF (N2,NTP)", "factor": "1/27610", "aliases": ["N2scf"]},
{"name": "SCFH (N2,NTP)", "factor": "24/27610", "aliases": ["N2scfh"]},
{"name": "SCF PER MO (N2,NTP)", "factor": "24/(27610
730)", "aliases": ["N2scfmo"]},
{"name": "Liters (N2, nbp)", "factor": "1/1122", "aliases": ["N2L"]},
{"name": "Gallons (N2, nbp)", "factor": "1/296.5", "aliases": ["N2gal"]}
]
},
{
"name": "Oxygen Gas Volume",
"desc": "Convert units of oxygen volume",
"units": [
{"name": "Tons (O2)", "factor": "1", "aliases": ["O2t"]},
{"name": "Pounds (O2)", "factor": "1/2000", "aliases": ["O2lb"]},
{"name": "Metric Tons (O2)", "factor": "1/0.9072", "aliases": ["O2mt"]},
{"name": "Nm3 (O2,NTP)", "factor": "38.044/24150", "aliases": ["O2Nm3"]},
{"name": "Nm3h (O2,NTP)", "factor": "(38.04424)/24150", "aliases": ["O2Nm3h"]},
{"name": "SCF (O2,NTP)", "factor": "1/24150", "aliases": ["O2scf"]},
{"name": "SCFH (O2,NTP)", "factor": "24/24150", "aliases": ["O2scfh"]},
{"name": "SCF PER MO (O2,NTP)", "factor": "24/(24150
730)", "aliases": ["O2scfmo"]},
{"name": "Liters (O2, nbp)", "factor": "1/794.6", "aliases": ["O2L"]},
{"name": "Gallons (O2, nbp)", "factor": "1/209.9", "aliases": ["O2gal"]}
]
},

@DrorHarari
Copy link
Owner

Hi p...8, I actually considered doing that kind of conversion but got discouraged because it was endless - each molecule has its own measure...

I was not aware that anyone actually used my KP plugin and in V2 I changed the format of the conversion definition file in an incompatible way (noted in the change log), hence your issue.

You should use the new simplified format (a couple of minutes of edit with regex), for example:

	"measures": {
		"Nitrogen Gas Volume": {
			"desc": "Convert units of nitrogen volume",
			"units": {
				"Tons (N2)": 		{"factor": "1", "aliases": ["N2t"]},
				"Pounds (N2)", 		{"factor": "1/2000", "aliases": ["N2lb"]},
				"Metric Tons (N2)": {"factor": "1/0.9072", "aliases": ["N2mt"]},
				"Nm3 (N2,NTP)":		{"factor": "38.044/27610", "aliases": ["N2Nm3"]},
				"Nm3h (N2,NTP)": 	{"factor": "(38.04424)/27610", "aliases": ["N2Nm3h"]},
				"SCF (N2,NTP)": 	{"factor": "1/27610", "aliases": ["N2scf"]},
				"SCFH (N2,NTP)": 	{"factor": "24/27610", "aliases": ["N2scfh"]},
				"SCF PER MO (N2,NTP)": {"factor": "24/(27610730)", "aliases": ["N2scfmo"]},
				"Liters (N2, nbp)": {"factor": "1/1122", "aliases": ["N2L"]},
				"Gallons (N2, nbp)": {"factor": "1/296.5", "aliases": ["N2gal"]}
			}
		},
		...
	}
}

@phone8588
Copy link
Author

Hi p...8, I actually considered doing that kind of conversion but got discouraged because it was endless - each molecule has its own measure...

I was not aware that anyone actually used my KP plugin and in V2 I changed the format of the conversion definition file in an incompatible way (noted in the change log), hence your issue.

You should use the new simplified format (a couple of minutes of edit with regex), for example:

	"measures": {
		"Nitrogen Gas Volume": {
			"desc": "Convert units of nitrogen volume",
			"units": {
				"Tons (N2)": 		{"factor": "1", "aliases": ["N2t"]},
				"Pounds (N2)", 		{"factor": "1/2000", "aliases": ["N2lb"]},
				"Metric Tons (N2)": {"factor": "1/0.9072", "aliases": ["N2mt"]},
				"Nm3 (N2,NTP)":		{"factor": "38.044/27610", "aliases": ["N2Nm3"]},
				"Nm3h (N2,NTP)": 	{"factor": "(38.04424)/27610", "aliases": ["N2Nm3h"]},
				"SCF (N2,NTP)": 	{"factor": "1/27610", "aliases": ["N2scf"]},
				"SCFH (N2,NTP)": 	{"factor": "24/27610", "aliases": ["N2scfh"]},
				"SCF PER MO (N2,NTP)": {"factor": "24/(27610730)", "aliases": ["N2scfmo"]},
				"Liters (N2, nbp)": {"factor": "1/1122", "aliases": ["N2L"]},
				"Gallons (N2, nbp)": {"factor": "1/296.5", "aliases": ["N2gal"]}
			}
		},
		...
	}
}

Back in business! Thank you, you have to believe me - your tool is so very helpful!

Now that I am geek mode - what syntax do I use to define this new measure on the cvt.ini file?

@DrorHarari
Copy link
Owner

Hi p..8. I have added a definition= item in the [main] section of Cvt.ini that can point to a conversion definition file in the User profile folder. It is easier than adding all the units in the Cvt.ini file because teh conversion definition file format is simpler and loading it is faster. This is still not a production release so if you want to test it, you'll need to comment it out in your PackageControl.ini and download a version from https://github.com/DrorHarari/keypirinha-cvt/releases/download/2.1.0/Cvt.keypirinha-package

I am closing this issue.

@phone8588
Copy link
Author

Hi p..8. I have added a definition= item in the [main] section of Cvt.ini that can point to a conversion definition file in the User profile folder. It is easier than adding all the units in the Cvt.ini file because teh conversion definition file format is simpler and loading it is faster. This is still not a production release so if you want to test it, you'll need to comment it out in your PackageControl.ini and download a version from https://github.com/DrorHarari/keypirinha-cvt/releases/download/2.1.0/Cvt.keypirinha-package

I am closing this issue.

2.1.0 working just fine. I was easily able to create a custom list. Thanks for the update.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants