Skip to content

Commit

Permalink
Merge pull request #13 from deefrawley/flox_conversion
Browse files Browse the repository at this point in the history
v2.0 - Update to use the Flox library. Fixes #10 , #11 , and #12
  • Loading branch information
deefrawley authored Apr 22, 2022
2 parents 23770ee + 0f51210 commit ad7b6ec
Show file tree
Hide file tree
Showing 22 changed files with 479 additions and 503 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 deefrawley
Copyright (c) 2022 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 Down
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,28 @@ Uses the [European Central Bank](https://www.ecb.europa.eu/stats/policy_and_exch

Currency code that can be used are:

'AUD' , 'BGN' , 'BRL' , 'CAD' , 'CHF' , 'CNY' , 'CZK' , 'DKK' , 'GBP', 'HKD' , 'HRK' , 'HUF' , 'IDR' , 'ILS' , 'INR' , 'ISK' , 'JPY' , 'KRW', 'MXN','MYR' , 'NOK' , 'NZD' , 'PHP' , 'PLN' , 'RON' , 'RUB' , 'SEK', 'SGD' , 'THB' , 'TRY' , 'USD' , 'ZAR' , 'EUR'
'AUD' , 'BGN' , 'BRL' , 'CAD' , 'CHF' , 'CNY' , 'CZK' , 'DKK' , 'GBP', 'HKD' , 'HRK' , 'HUF' , 'IDR' , 'ILS' , 'INR' , 'ISK' , 'JPY' , 'KRW', 'MXN', 'MYR' , 'NOK' , 'NZD' , 'PHP' , 'PLN' , 'RON' , 'RUB' , 'SEK', 'SGD' , 'THB' , 'TRY' , 'USD' , 'ZAR' , 'EUR'

### Requirements

Python 3.5 or later installed on your system, with python.exe in your PATH variable and this path updated in the Flow Launcher settings (this is a general requirement to use Python plugins with Flow). As of v1.8, Flow Launcher should take care of the installation of Python for you if it is not on your system.
Flow Launcher should take care of the installation of Python for you if it is not on your system, as well as the libraries needed by this plugin.

You must be online when you run the plugin in Flow to download the currency XML file, or you will get a connection error. If the local XML file is 2 hours or less old (that is, you've run the plugin before in the previous two hours), it will just use the local file.
You must be online when you run the plugin in Flow to download the currency XML file, or you will get a connection error. A local copy of the local XML file froma previous download can be used if it exists.

### Installing

#### Package Manager

Use the `pm install` command from within Flow itself.

#### Manual
### Plugin Settings

Add the Flow.Launcher.Plugin.Currency directory to %APPDATA%\Roaming\FlowLauncher\Plugins\ and restart Flow.
Type `settings` in Flow to access the settings window, then go to Plugins - Currency Converter

#### Python Package Requirements
__Keyword (default 'cc')__ - change this to set a new keyword to activate the plugin

There is no requirement to install the packages as they will be packed with the release.
__File age (default 6)__ - the age in hours for the local copy of the rates file to be used before the plugin downloads a fresh copy

If you still want to manually pip install them:

The `requirements.txt` file in this repo outlines which packages are needed. This can be found online here on Github, as well as in the local plugin directory once installed (%APPDATA%\Roaming\FlowLauncher\Plugins\Currency Converter-X.X.X\ where X.X.X is the currently installed version)

The easiest way to manually install these packages is to use the following command in a Windows Command Prompt or Powershell Prompt
### Installing

`pip install -r requirements.txt -t ./lib`
#### Package Manager

Remember you need to be in the local directory containing the requirements text file.
Use the `pm install` command from within Flow itself.

### Localisation

Expand All @@ -52,6 +43,10 @@ Currently English and Chinese language supported. Edit the .env file to change t
| ---------------------------------------------------------------- | ------------------------------------------- |
| `cc {amount} {source currency code} {destination currency code}` | Convert amount from source to dest currency |

When typing the source or destination currency the plugin will show what currencies are available.

Decimal precision is based on the input amount however the base rate is always a minimum of three decimal places.

### Problems, errors and feature requests

Open an issue in this repo.
36 changes: 36 additions & 0 deletions SettingsTemplate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
body:
- type: textBlock
attributes:
name: description
description: >
Choose the age, in hours, of the downloaded currency rates file before the plugin will download a new version.
The reference rates are usually updated around 16:00 CET on every working day, except on TARGET closing days.
See https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html for more details.
- type: dropdown
attributes:
name: max_age
label: "File age:"
defaultValue: 3
options:
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
Binary file modified assets/cc_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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.currency_converter import Currency

if __name__ == "__main__":
Main()
Currency()
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": "Currency Converter",
"Description": "Currency converter using the euro and rates at https://www.ecb.europa.eu/",
"Author": "deefrawley",
"Version": "1.2.2",
"Version": "2.0.0",
"Language": "python",
"Website": "https://github.com/deefrawley/Flow.Launcher.Plugin.Currency",
"IcoPath": "assets/favicon.ico",
Expand Down
24 changes: 0 additions & 24 deletions plugin/__init__.py

This file was deleted.

Loading

0 comments on commit ad7b6ec

Please sign in to comment.