Giter Club home page Giter Club logo

flow.launcher.plugin.currency's Introduction

Currency Converter (Flow.Launcher.Plugin.Currency)

Currency conversion for the Flow Launcher

screenshot

About

Uses the European Central Bank daily rates to get and convert currency exchange rates.

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'

Requirements

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. A local copy of the local XML file froma previous download can be used if it exists.

Plugin Settings

Type settings in Flow to access the settings window, then go to Plugins - Currency Converter

Keyword (default 'cc') - change this to set a new keyword to activate the plugin

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

Installing

Package Manager

Use the pm install command from within Flow itself.

Localisation

Currently English and Chinese language supported. Edit the .env file to change the language.

Usage

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

flow.launcher.plugin.currency's People

Contributors

deefrawley avatar jjw24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pc223 imsh

flow.launcher.plugin.currency's Issues

New verion 2.0.1 crashes

I installed new version of Currency plugin and after plugin activation (via cc shortcut) plugin crashed.

Flow Launcher version: 1.9.3
OS Version: Microsoft Windows NT 10.0.19041.0
IntPtr Length: 8
x64: True

Python Path: C:\Users\WDAGUtilityAccount\Downloads\Flow-Launcher-Portable\FlowLauncher\app-1.9.3\UserData\PythonEmbeddable\pythonw.exe
Date: 04/22/2022 19:15:37
Exception:
System.IO.InvalidDataException: Currency Converter|Traceback (most recent call last):
  File "C:\Users\WDAGUtilityAccount\Downloads\Flow-Launcher-Portable\FlowLauncher\app-1.9.3\UserData\Plugins\Currency Converter-2.0.1\main.py", line 9, in <module>
    from plugin.currency_converter import Currency
  File "C:\Users\WDAGUtilityAccount\Downloads\Flow-Launcher-Portable\FlowLauncher\app-1.9.3\UserData\Plugins\Currency Converter-2.0.1\plugin\currency_converter.py", line 10, in <module>
    from flox import Flox
  File "C:\Users\WDAGUtilityAccount\Downloads\Flow-Launcher-Portable\FlowLauncher\app-1.9.3\UserData\Plugins\Currency Converter-2.0.1\lib\flox\__init__.py", line 57, in <module>
    APP_ICONS = os.path.join(APP_DIR, "Images")
  File "ntpath.py", line 78, in join
TypeError: expected str, bytes or os.PathLike object, not tuple

   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 287
   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 301
   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.QueryAsync(Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 321
   at Flow.Launcher.Core.Plugin.PluginManager.<>c__DisplayClass22_0.<<QueryForPluginAsync>b__0>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 192
--- End of stack trace from previous location ---
   at Flow.Launcher.Infrastructure.Stopwatch.DebugAsync(String message, Func`1 action) in C:\projects\flow-launcher\Flow.Launcher.Infrastructure\Stopwatch.cs:line 40
   at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 191
   at Flow.Launcher.ViewModel.MainViewModel.<>c__DisplayClass153_0.<<QueryResults>g__QueryTask|2>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 649
--- End of stack trace from previous location ---
   at Flow.Launcher.ViewModel.MainViewModel.QueryResults() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 623
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Update the plugin to use flow-lib==0.20.1?

As the title say:

why should it be updated to v0.20.1?
Another plugin also uses flow-lib package: Github Notification. which requests v0.20.1 and you could say it's a conflict package. I either have to use 0.14.1 for currency or 0.20.1 for Github notification

Flow dev branch: .NET crash

For the CC plugin, I display the command syntax in the query response until the correct number of arguments are found like so

image

If you right click on this result, a .NET exception is thrown which kills Flow and I have to kill the process in Task Manager and restart.

'''Flow Launcher version: 1.7.2
OS Version: Microsoft Windows NT 10.0.19042.0
IntPtr Length: 8
x64: True

Python Path:
Date: 07/01/2021 12:45:38
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Flow.Launcher.ViewModel.MainViewModel.QueryContextMenu() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 387
at Flow.Launcher.ViewModel.MainViewModel.Query() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 368
at Flow.Launcher.ViewModel.MainViewModel.set_QueryText(String value) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 282
at Flow.Launcher.ViewModel.MainViewModel.set_SelectedResults(ResultsViewModel value) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 330
at Flow.Launcher.ViewModel.MainViewModel.b__19_8(Object _) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 222
at Flow.Launcher.ViewModel.RelayCommand.Execute(Object parameter) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\RelayCommand.cs:line 25
at Flow.Launcher.MainWindow.OnPreviewMouseButtonDown(Object sender, MouseButtonEventArgs e) in C:\projects\flow-launcher\Flow.Launcher\MainWindow.xaml.cs:line 234
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)'''

This doesn't happen with other plugins, even Python ones though there query result is 'activate plugin' (I used the RollDice plugin as a comparison).

@jjw24 can you decipher the .NET exception to see what is going here?

flow launcher got an error (un- & reinstall does not work)

Flow Launcher version: 1.16.2
OS Version: 22621.2715
IntPtr Length: 8
x64: True

Python Path: C:\Users\klr\AppData\Local\Programs\Python\Python311\python.exe
Node Path:
Date: 11/17/2023 08:24:26
Exception:
Currency Converter Exception:
Websites: https://github.com/deefrawley/Flow.Launcher.Plugin.Currency
Author: deefrawley
Version: 2.0.6
Flow.Launcher.Core.ExternalPlugins.FlowPluginException: C:\Users\klr\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.6\lib\requests_init_.py:102: RequestsDependencyWarning: urllib3 (2.0.7) or chardet (None)/charset_normalizer (2.0.12) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "

---> System.IO.InvalidDataException: C:\Users\klr\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.6\lib\requests_init_.py:102: RequestsDependencyWarning: urllib3 (2.0.7) or chardet (None)/charset_normalizer (2.0.12) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "

at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 291
at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 296
at Flow.Launcher.Core.Plugin.JsonRPCPlugin.QueryAsync(Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 311
at Flow.Launcher.Core.Plugin.PluginManager.<>c__DisplayClass22_0.<b__0>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 194
--- End of stack trace from previous location ---
at Flow.Launcher.Infrastructure.Stopwatch.DebugAsync(String message, Func`1 action) in C:\projects\flow-launcher\Flow.Launcher.Infrastructure\Stopwatch.cs:line 34
at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 193
--- End of inner exception stack trace ---
at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 213
at Flow.Launcher.ViewModel.MainViewModel.<>c__DisplayClass139_0.<g__QueryTask|2>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 839
--- End of stack trace from previous location ---
at Flow.Launcher.ViewModel.MainViewModel.QueryResults(Boolean isReQuery) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 813
at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

"cc" not being registered

The command 'cc' is not being registered. It used to work in Wox.

image

image

Flow v 1.7.1

Please let me know what details you need for the debug.

flow launcher got an error

2022-12-06.txt

Exception message
Flow Launcher version: 1.9.5
OS Version: Microsoft Windows NT 10.0.22000.0
IntPtr Length: 8
x64: True

Python Path:
Date: 12/06/2022 12:23:22
Exception:
Currency Converter Exception:
Websites: https://github.com/deefrawley/Flow.Launcher.Plugin.Currency
Author: deefrawley
Version: 2.0.4
Flow.Launcher.Core.ExternalPlugins.FlowPluginException: Currency Converter|Traceback (most recent call last):
File "C:\Users\barua\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.4\main.py", line 9, in
from plugin.currency_converter import Currency
File "C:\Users\barua\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.4\plugin\currency_converter.py", line 9, in
from plugin.translation import _
File "C:\Users\barua\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.4\plugin\translation.py", line 17, in
translation = gettext.translation("messages", "plugin/translations/", languages=[LOCAL])
File "gettext.py", line 588, in translation
FileNotFoundError: [Errno 2] No translation file found for domain: 'messages'

---> System.IO.InvalidDataException: Currency Converter|Traceback (most recent call last):
File "C:\Users\barua\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.4\main.py", line 9, in
from plugin.currency_converter import Currency
File "C:\Users\barua\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.4\plugin\currency_converter.py", line 9, in
from plugin.translation import _
File "C:\Users\barua\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-2.0.4\plugin\translation.py", line 17, in
translation = gettext.translation("messages", "plugin/translations/", languages=[LOCAL])
File "gettext.py", line 588, in translation
FileNotFoundError: [Errno 2] No translation file found for domain: 'messages'

at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 288
at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 302
at Flow.Launcher.Core.Plugin.JsonRPCPlugin.QueryAsync(Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 322
at Flow.Launcher.Core.Plugin.PluginManager.<>c__DisplayClass22_0.<b__0>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 191
--- End of stack trace from previous location ---
at Flow.Launcher.Infrastructure.Stopwatch.DebugAsync(String message, Func`1 action) in C:\projects\flow-launcher\Flow.Launcher.Infrastructure\Stopwatch.cs:line 40
at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 213
--- End of inner exception stack trace ---
at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 213
at Flow.Launcher.ViewModel.MainViewModel.<>c__DisplayClass137_0.<g__QueryTask|2>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 626
--- End of stack trace from previous location ---
at Flow.Launcher.ViewModel.MainViewModel.QueryResults() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 627
at System.Threading.Tasks.Task.<>c.b__140_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Got FileNotFoundError because missing `messages.mo` files

The new release have this error, because it's missing messages.mo files in Currency Converter-1.2.0\plugin\translations

2021Jun23 - 12:56:32.3180953+07:00 - DEBUG - PluginManager - QueryForPluginAsync|"Cost for Currency Converter <393ms>"
2021Jun23 - 12:56:32.6906172+07:00 - ERROR - JsonRPCPlugin - ExecuteAsync|"Traceback (most recent call last):
  File "C:\Users\user1\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-1.2.0\main.py", line 9, in <module>
    from plugin import Main
  File "C:\Users\user1\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-1.2.0\plugin\__init__.py", line 24, in <module>
    from plugin.ui import Main
  File "C:\Users\user1\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-1.2.0\plugin\ui.py", line 10, in <module>
    from plugin.extensions import _
  File "C:\Users\user1\AppData\Roaming\FlowLauncher\Plugins\Currency Converter-1.2.0\plugin\extensions.py", line 8, in <module>
    translation = gettext.translation("messages", "plugin/translations/", languages=[LOCAL])
  File "gettext.py", line 588, in translation
FileNotFoundError: [Errno 2] No translation file found for domain: 'messages'

@jjw24 Can CI deal with this automatically? Probably have to run command like this:

sudo apt-get install -y gettext
msgfmt messages.po -o messages.mo

About the license

Copyright (c) 2020 Flow-Launcher

I saw Flow.Launcher.Plugin.Currency own to Flow-Launcher.

Are there some mistakes?

image

Flow.Launcher.Plugin.PythonTemplate rep has two LICENSE.

So do you really want to let this plugin copyright own to Flow-Launcher?

[Feature request] An option to set default currency

Right now I always have to type cc 123 usd dkk even though 95% of the requests I'm interested in converting some foreign currency to my country's currency - DKK in my case.
It would be nice if there was a way to set the default currency (like, in settings) so that as soon as I type cc 123 usd the result of usd to dkk conversion is shown. Of course, if I just continue to type the 2nd currency, it should still do the conversion to that currency.

[Bug/Feature request] Currency convertor returns values after a small delay

Bug/Feature request hybrid for the currency convertor plugin.

Currently the currency convertor has a small delay before it returns the converted value.

I used to use a plugin on Wox which used to give instant results.

Wanted to ask if the same would be possible in the currency convertor plugin included with flow.

Thanks.

Plugin crashes when converting 0

I was changing the wrong amount I had converted which accidentally led to 0 usd being converted, which led to a plugin crash.

ImportError

Please type any relevant information here

Trace Log

Traceback (most recent call last):
  File "xml\etree\ElementTree.py", line 1500, in __init__
  File "<frozen zipimport>", line 259, in load_module
  File "xml\parsers\expat.py", line 4, in <module>
ModuleNotFoundError: No module named 'pyexpat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "xml\etree\ElementTree.py", line 1503, in __init__
ModuleNotFoundError: No module named 'pyexpat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\chenf\PA\PortableApps\FlowLauncher\app-1.10.1\UserData\Plugins\Currency Converter-2.0.3\lib\flox\launcher.py", line 43, in __call__
    results = request_method(*request_parameters) or self._results
  File "C:\Users\chenf\PA\PortableApps\FlowLauncher\app-1.10.1\UserData\Plugins\Currency Converter-2.0.3\lib\flox\__init__.py", line 118, in _query
    self.query(query)
  File "C:\Users\chenf\PA\PortableApps\FlowLauncher\app-1.10.1\UserData\Plugins\Currency Converter-2.0.3\plugin\currency_converter.py", line 120, in query
    ratedict = self.populate_rates("eurofxref-daily.xml")
  File "C:\Users\chenf\PA\PortableApps\FlowLauncher\app-1.10.1\UserData\Plugins\Currency Converter-2.0.3\plugin\currency_converter.py", line 162, in populate_rates
    tree = ET.parse(xml)
  File "xml\etree\ElementTree.py", line 1202, in parse
  File "xml\etree\ElementTree.py", line 589, in parse
  File "xml\etree\ElementTree.py", line 1505, in __init__
ImportError: No module named expat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.