Skip to content

Commit 4bb6443

Browse files
authored
Merge pull request #18 from deefrawley/floxupdate
Refactor to use Flox. Add setting to control helper text Add ability to call units by their full name Unit abbrev. are now case sensitive Added new units Fixes #10, #16, #17
2 parents f8b4c85 + 0454284 commit 4bb6443

26 files changed

+1078
-586
lines changed

LICENSE

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 deefrawley
3+
Copyright (c) 2023 deefrawley
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -20,8 +20,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
2222

23-
Graduated Cylinder icon by AS Design from the Noun Project
24-
area icon by matteo manenti from the Noun Project
25-
distance icon by Anthony Ledoux from the Noun Project
26-
Weight icon by Adrien Coquet from the Noun Project
27-
Temperature icon by Alexander Skowalsky from the Noun Project
23+
Graduated Cylinder icon by AS Design from Noun Project
24+
Area icon by matteo manenti from Noun Project
25+
Distance icon by Anthony Ledoux from Noun Project
26+
Weight icon by Adrien Coquet from Noun Project
27+
Temperature icon by Alexander Skowalsky from Noun Project
28+
Speed icon by Fahmi Somdi Std from Noun Project
29+
Energy icon by Greg Cresnar from Noun Project

README.md

Lines changed: 110 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
22
# General Converter (Flow.Launcher.GenConvert)
33

4-
General weight, volume, distance, area, temperature converter for the [Flow Launcher](https://github.com/Flow-Launcher/Flow.Launcher)
4+
General weight, volume, distance, area, temperature, speed and energy converter for the [Flow Launcher](https://github.com/Flow-Launcher/Flow.Launcher)
55

66
### About
77

88
### Requirements
99

10-
Python 3.5 or later. As of Flow Launcher v1.8, Flow should take care of the installation of Python for you if it is not on your system.
10+
Python 3.9 or later. As of Flow Launcher v1.8, Flow should take care of the installation of Python for you if it is not on your system.
1111

1212
### Installing
1313

@@ -29,7 +29,10 @@ Currently English and Chinese language supported. Edit the .env file to change t
2929
| ------------------------------------------------------------- | -------------------------------------------------- |
3030
| `gc <amount> <from unit abbreviation> <to unit abbreviation>` | Convert the amount of the from unit to the to unit. |
3131

32-
Just entering the keyword will give you the full list of units to choose from in Flow.
32+
The from and to unit are case sensitive.
33+
34+
Just entering the keyword will give you the full list of units to choose from in Flow. If you want to remove the keyword for this plugin and have it return
35+
results when you simply start entering a number then go to the Plugin settings and turn this helper text off.
3336

3437
Entering the keyword, amount and from unit will give you a subset list of units the from unit can be converted to
3538
#### Units
@@ -41,10 +44,10 @@ The following units and their abbreviations can be used (each table can only con
4144
<th>Subject</th>
4245
<th>Unit</th>
4346
<th>Abbreviation</th>
44-
<th rowspan="9" align="center"><img src="assets/Distance.ico" alt="Distance Logo"></th>
47+
<th rowspan="10" align="center"><img src="assets/Distance.ico" alt="Distance Logo"></th>
4548
</tr>
4649
<tr>
47-
<td rowspan="8" align="center"> Distance</td>
50+
<td rowspan="9" align="center"> Distance</td>
4851
<td>millimetre</td>
4952
<td>mm</td>
5053
</tr>
@@ -56,6 +59,10 @@ The following units and their abbreviations can be used (each table can only con
5659
<td>metre</td>
5760
<td>m</td>
5861
</tr>
62+
<tr>
63+
<td>decimetre</td>
64+
<td>dm</td>
65+
</tr>
5966
<tr>
6067
<td>kilometre</td>
6168
<td>km</td>
@@ -83,10 +90,10 @@ The following units and their abbreviations can be used (each table can only con
8390
<th>Subject</th>
8491
<th>Unit</th>
8592
<th>Abbreviation</th>
86-
<th rowspan="189" align="center"><img src="assets/Volume.ico" alt="Volume Logo"></th>
93+
<th rowspan="27" align="center"><img src="assets/Volume.ico" alt="Volume Logo"></th>
8794
</tr>
8895
<tr>
89-
<td rowspan="17" align="center">Volume</td>
96+
<td rowspan="26" align="center">Volume</td>
9097
<td>millilitre</td>
9198
<td>ml</td>
9299
</tr>
@@ -98,6 +105,10 @@ The following units and their abbreviations can be used (each table can only con
98105
<td>litre</td>
99106
<td>l</td>
100107
</tr>
108+
<tr>
109+
<td>decalitre</td>
110+
<td>decal</td>
111+
</tr>
101112
<tr>
102113
<td>pint US</td>
103114
<td>pt</td>
@@ -154,6 +165,38 @@ The following units and their abbreviations can be used (each table can only con
154165
<td>fluid ounce Imperial</td>
155166
<td>flozimp</td>
156167
</tr>
168+
<tr>
169+
<td>cubic decimetre</td>
170+
<td>dm3</td>
171+
</tr>
172+
<tr>
173+
<td>cubic millimetre</td>
174+
<td>mm3</td>
175+
</tr>
176+
<tr>
177+
<td>cubic centimetre</td>
178+
<td>cm3</td>
179+
</tr>
180+
<tr>
181+
<td>cubic metre</td>
182+
<td>m3</td>
183+
</tr>
184+
<tr>
185+
<td>cubic inch</td>
186+
<td>in3</td>
187+
</tr>
188+
<tr>
189+
<td>cubic feet</td>
190+
<td>ft3</td>
191+
</tr>
192+
<tr>
193+
<td>bushel UK</td>
194+
<td>buuk</td>
195+
</tr>
196+
<tr>
197+
<td>bushel US</td>
198+
<td>buus</td>
199+
</tr>
157200
</table>
158201

159202
<table>
@@ -258,6 +301,66 @@ The following units and their abbreviations can be used (each table can only con
258301
</tr>
259302
</table>
260303

304+
<table>
305+
<tr>
306+
<th>Subject</th>
307+
<th>Unit</th>
308+
<th>Abbreviation</th>
309+
<th rowspan="4" align="center"><img src="assets/Speed.ico" alt="Speed Logo"></th>
310+
</tr>
311+
<tr>
312+
<td rowspan = "3" align="center">Speed</td>
313+
<td>kilometres per hour</td>
314+
<td>km/h</td>
315+
</tr>
316+
<tr>
317+
<td>miles per hour</td>
318+
<td>mp/h</td>
319+
</tr>
320+
<tr>
321+
<td>knots</td>
322+
<td>kt</td>
323+
</tr>
324+
</table>
325+
326+
<table>
327+
<tr>
328+
<th>Subject</th>
329+
<th>Unit</th>
330+
<th>Abbreviation</th>
331+
<th rowspan="8" align="center"><img src="assets/Energy.ico" alt="Energy Logo"></th>
332+
</tr>
333+
<tr>
334+
<td rowspan = "7" align="center">Energy</td>
335+
<td>calories</td>
336+
<td>cal</td>
337+
</tr>
338+
<tr>
339+
<td>kilocalories</td>
340+
<td>kcal</td>
341+
</tr>
342+
<tr>
343+
<td>kilojoules</td>
344+
<td>kJ</td>
345+
</tr>
346+
<tr>
347+
<td>megajoules</td>
348+
<td>MJ</td>
349+
</tr>
350+
<tr>
351+
<td>gigajoules</td>
352+
<td>Gj</td>
353+
</tr>
354+
<tr>
355+
<td>kilowatt hours</td>
356+
<td>kWh</td>
357+
</tr>
358+
<tr>
359+
<td>British thermal units</td>
360+
<td>BTU</td>
361+
</tr>
362+
</table>
363+
261364
### Problems, errors and feature requests
262365

263366
Open an issue in this repo.

SettingsTemplate.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
body:
2+
- type: textBlock
3+
attributes:
4+
name: description
5+
description: >
6+
Convert between different types of units.
7+
- type: checkbox
8+
attributes:
9+
name: show_helper_text
10+
label: "Show helper text of what can be converted"
11+
defaultValue: "true"
12+
description: "If you remove the keyword for this plugin so it triggers on any number then turn this off"

assets/Energy.ico

11.6 KB
Binary file not shown.

assets/Energy.png

18.3 KB
Loading

assets/Speed.ico

11.1 KB
Binary file not shown.

commands.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,8 @@
22

33
import json
44
import os
5-
65
import click
76

8-
from plugin import (
9-
ICON_PATH,
10-
PLUGIN_ACTION_KEYWORD,
11-
PLUGIN_AUTHOR,
12-
PLUGIN_EXECUTE_FILENAME,
13-
PLUGIN_ID,
14-
PLUGIN_PROGRAM_LANG,
15-
PLUGIN_URL,
16-
__long_description__,
17-
__package_name__,
18-
__package_title__,
19-
__short_description__,
20-
__version__,
21-
basedir,
22-
)
23-
247

258
@click.group()
269
def translate():
@@ -96,4 +79,4 @@ def gen_plugin_info():
9679
cli = click.CommandCollection(sources=[plugin, translate])
9780

9881
if __name__ == "__main__":
99-
cli()
82+
cli()

listfile.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
sys.path.append(os.path.join(parent_folder_path, "lib"))
88
sys.path.append(os.path.join(parent_folder_path, "plugin"))
99

10-
from plugin import Main
10+
from plugin.general_converter import GenConvert
1111

1212
if __name__ == "__main__":
13-
Main()
13+
GenConvert()

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "General Converter",
55
"Description": "General weights and measures converter",
66
"Author": "deefrawley",
7-
"Version": "1.1.4",
7+
"Version": "2.0.0",
88
"Language": "python",
99
"Website": "https://github.com/deefrawley/Flow.Launcher.Plugin.GenConvert",
1010
"IcoPath": "assets/favicon.ico",

plugin/__init__.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

plugin/extensions.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)