Skip to content

Commit

Permalink
Merge pull request #18 from deefrawley/floxupdate
Browse files Browse the repository at this point in the history
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
  • Loading branch information
deefrawley authored Apr 12, 2023
2 parents f8b4c85 + 0454284 commit 4bb6443
Show file tree
Hide file tree
Showing 26 changed files with 1,078 additions and 586 deletions.
14 changes: 8 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 deefrawley
Copyright (c) 2023 deefrawley

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

Graduated Cylinder icon by AS Design from the Noun Project
area icon by matteo manenti from the Noun Project
distance icon by Anthony Ledoux from the Noun Project
Weight icon by Adrien Coquet from the Noun Project
Temperature icon by Alexander Skowalsky from the Noun Project
Graduated Cylinder icon by AS Design from Noun Project
Area icon by matteo manenti from Noun Project
Distance icon by Anthony Ledoux from Noun Project
Weight icon by Adrien Coquet from Noun Project
Temperature icon by Alexander Skowalsky from Noun Project
Speed icon by Fahmi Somdi Std from Noun Project
Energy icon by Greg Cresnar from Noun Project
117 changes: 110 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
# General Converter (Flow.Launcher.GenConvert)

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

### About

### Requirements

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.
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.

### Installing

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

Just entering the keyword will give you the full list of units to choose from in Flow.
The from and to unit are case sensitive.

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
results when you simply start entering a number then go to the Plugin settings and turn this helper text off.

Entering the keyword, amount and from unit will give you a subset list of units the from unit can be converted to
#### Units
Expand All @@ -41,10 +44,10 @@ The following units and their abbreviations can be used (each table can only con
<th>Subject</th>
<th>Unit</th>
<th>Abbreviation</th>
<th rowspan="9" align="center"><img src="assets/Distance.ico" alt="Distance Logo"></th>
<th rowspan="10" align="center"><img src="assets/Distance.ico" alt="Distance Logo"></th>
</tr>
<tr>
<td rowspan="8" align="center"> Distance</td>
<td rowspan="9" align="center"> Distance</td>
<td>millimetre</td>
<td>mm</td>
</tr>
Expand All @@ -56,6 +59,10 @@ The following units and their abbreviations can be used (each table can only con
<td>metre</td>
<td>m</td>
</tr>
<tr>
<td>decimetre</td>
<td>dm</td>
</tr>
<tr>
<td>kilometre</td>
<td>km</td>
Expand Down Expand Up @@ -83,10 +90,10 @@ The following units and their abbreviations can be used (each table can only con
<th>Subject</th>
<th>Unit</th>
<th>Abbreviation</th>
<th rowspan="189" align="center"><img src="assets/Volume.ico" alt="Volume Logo"></th>
<th rowspan="27" align="center"><img src="assets/Volume.ico" alt="Volume Logo"></th>
</tr>
<tr>
<td rowspan="17" align="center">Volume</td>
<td rowspan="26" align="center">Volume</td>
<td>millilitre</td>
<td>ml</td>
</tr>
Expand All @@ -98,6 +105,10 @@ The following units and their abbreviations can be used (each table can only con
<td>litre</td>
<td>l</td>
</tr>
<tr>
<td>decalitre</td>
<td>decal</td>
</tr>
<tr>
<td>pint US</td>
<td>pt</td>
Expand Down Expand Up @@ -154,6 +165,38 @@ The following units and their abbreviations can be used (each table can only con
<td>fluid ounce Imperial</td>
<td>flozimp</td>
</tr>
<tr>
<td>cubic decimetre</td>
<td>dm3</td>
</tr>
<tr>
<td>cubic millimetre</td>
<td>mm3</td>
</tr>
<tr>
<td>cubic centimetre</td>
<td>cm3</td>
</tr>
<tr>
<td>cubic metre</td>
<td>m3</td>
</tr>
<tr>
<td>cubic inch</td>
<td>in3</td>
</tr>
<tr>
<td>cubic feet</td>
<td>ft3</td>
</tr>
<tr>
<td>bushel UK</td>
<td>buuk</td>
</tr>
<tr>
<td>bushel US</td>
<td>buus</td>
</tr>
</table>

<table>
Expand Down Expand Up @@ -258,6 +301,66 @@ The following units and their abbreviations can be used (each table can only con
</tr>
</table>

<table>
<tr>
<th>Subject</th>
<th>Unit</th>
<th>Abbreviation</th>
<th rowspan="4" align="center"><img src="assets/Speed.ico" alt="Speed Logo"></th>
</tr>
<tr>
<td rowspan = "3" align="center">Speed</td>
<td>kilometres per hour</td>
<td>km/h</td>
</tr>
<tr>
<td>miles per hour</td>
<td>mp/h</td>
</tr>
<tr>
<td>knots</td>
<td>kt</td>
</tr>
</table>

<table>
<tr>
<th>Subject</th>
<th>Unit</th>
<th>Abbreviation</th>
<th rowspan="8" align="center"><img src="assets/Energy.ico" alt="Energy Logo"></th>
</tr>
<tr>
<td rowspan = "7" align="center">Energy</td>
<td>calories</td>
<td>cal</td>
</tr>
<tr>
<td>kilocalories</td>
<td>kcal</td>
</tr>
<tr>
<td>kilojoules</td>
<td>kJ</td>
</tr>
<tr>
<td>megajoules</td>
<td>MJ</td>
</tr>
<tr>
<td>gigajoules</td>
<td>Gj</td>
</tr>
<tr>
<td>kilowatt hours</td>
<td>kWh</td>
</tr>
<tr>
<td>British thermal units</td>
<td>BTU</td>
</tr>
</table>

### Problems, errors and feature requests

Open an issue in this repo.
12 changes: 12 additions & 0 deletions SettingsTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
body:
- type: textBlock
attributes:
name: description
description: >
Convert between different types of units.
- type: checkbox
attributes:
name: show_helper_text
label: "Show helper text of what can be converted"
defaultValue: "true"
description: "If you remove the keyword for this plugin so it triggers on any number then turn this off"
Binary file added assets/Energy.ico
Binary file not shown.
Binary file added assets/Energy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Speed.ico
Binary file not shown.
19 changes: 1 addition & 18 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,8 @@

import json
import os

import click

from plugin import (
ICON_PATH,
PLUGIN_ACTION_KEYWORD,
PLUGIN_AUTHOR,
PLUGIN_EXECUTE_FILENAME,
PLUGIN_ID,
PLUGIN_PROGRAM_LANG,
PLUGIN_URL,
__long_description__,
__package_name__,
__package_title__,
__short_description__,
__version__,
basedir,
)


@click.group()
def translate():
Expand Down Expand Up @@ -96,4 +79,4 @@ def gen_plugin_info():
cli = click.CommandCollection(sources=[plugin, translate])

if __name__ == "__main__":
cli()
cli()
9 changes: 0 additions & 9 deletions listfile.txt

This file was deleted.

4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sys.path.append(os.path.join(parent_folder_path, "lib"))
sys.path.append(os.path.join(parent_folder_path, "plugin"))

from plugin import Main
from plugin.general_converter import GenConvert

if __name__ == "__main__":
Main()
GenConvert()
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Name": "General Converter",
"Description": "General weights and measures converter",
"Author": "deefrawley",
"Version": "1.1.4",
"Version": "2.0.0",
"Language": "python",
"Website": "https://github.com/deefrawley/Flow.Launcher.Plugin.GenConvert",
"IcoPath": "assets/favicon.ico",
Expand Down
25 changes: 0 additions & 25 deletions plugin/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions plugin/extensions.py

This file was deleted.

Loading

0 comments on commit 4bb6443

Please sign in to comment.