Giter Site home page Giter Site logo

flow.launcher.plugin.genconvert's Introduction

Code style: black

General Converter (Flow.Launcher.GenConvert)

General weight, volume, distance, area, temperature, speed and energy converter for the Flow Launcher

About

Requirements

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

Package Manager

Use the pm install command from within Flow itself

Manual

Add the Flow.Launcher.Plugin.GenConvert directory to %APPDATA%\Roaming\FlowLauncher\Plugins\ and restart Flow.

Localisation

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

Usage

Keyword Description
gc <amount> <from unit abbreviation> <to unit abbreviation> Convert the amount of the from unit to the to unit.

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

The following units and their abbreviations can be used (each table can only convert among its' own units):

Subject Unit Abbreviation Distance Logo
Distance millimetre mm
centimetre cm
metre m
decimetre dm
kilometre km
inch in
foot/feet ft
yard yd
mile mi
Subject Unit Abbreviation Volume Logo
Volume millilitre ml
gram g
litre l
decalitre decal
pint US pt
pint Imperial ptimp
quart US qt
quart Imperial qtimp
cup US cup
cup Imperial cupimp
teaspoon US tsp
teaspoon Imperial tspimp
tablespoon US tbsp
tablespoon Imperial tbspimp
gallon US gal
gallon Imperial galimp
fluid ounce US floz
fluid ounce Imperial flozimp
cubic decimetre dm3
cubic millimetre mm3
cubic centimetre cm3
cubic metre m3
cubic inch in3
cubic feet ft3
bushel UK buuk
bushel US buus
Subject Unit Abbreviation Area Logo
Area square metre sqm
square centremetre sqcm
square kilometre sqkm
square inch sqin
square foot sqft
square mile sqmi
square yard sqyd
hectare h
acre ac
Subject Unit Abbreviation Weight Logo
Weight gram g
kilogram kg
pound lb
ounce oz
stone st
ton ton
Subject Unit Abbreviation Temperature Logo
Temperature celsius c
Farenheit f
Kelvin k
Subject Unit Abbreviation Speed Logo
Speed kilometres per hour km/h
miles per hour mp/h
knots kt
Subject Unit Abbreviation Energy Logo
Energy calories cal
kilocalories kcal
kilojoules kJ
megajoules MJ
gigajoules Gj
kilowatt hours kWh
British thermal units BTU

Problems, errors and feature requests

Open an issue in this repo.

flow.launcher.plugin.genconvert's People

Contributors

deefrawley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

garulf horridmodz

flow.launcher.plugin.genconvert's Issues

Copy value along with unit to clipboard

Not sure if I am missing something or if this feature doesn't exist yet,
But it would be great to have the value with the converted unit in clipboard after selecting the conversion

Add Units hints while typing

It would be very useful if instead of showing this while typing:
image

the plugin showed some hints for which units "codes" to use, for example if i'm trying to "convert 1 L" it would suggest gallons, milliliters etc.

With an empty query it could show a recap table like the readme of this repo does:
image

Only trigger plugin when number is entered

Hi,

I'd like to use this plugin with the wildcard action keyword, so I don't have to type in 'gc' or remember it. It would operate how the calculator operates: checks if the input is a number and only activate if so.

I'm not sure if this can be done through the plugin itself or must be done through the flow app, but this is an annoyance because if you have it set to * the following happens for any input into the launcher:

image

There could also be added the option to not show any of those

Add imperial and metric ton units

G'day Damien,

First off – thanks for this plugin! It's very handy once you get used to the syntax.

For consistency and completeness, you may want to add imperial and metric ton units:

Unit / Abbreviation
US ton / ton
Imperial ton / tonimp
Metric ton / t

  • "ton" is already there, but its unit name is ambiguous; I'd suggest changing from "ton" to "US ton". 1 US ton = 2,000 pounds.
  • 1 Imperial ton = 2,240 pounds.
  • "Metric ton" is otherwise known as "tonne", but former more descriptive – take your pick. Its metric abbreviation is "t", which is unused elsewhere in this plugin. 1 tonne = 1000 kg = 2,204.6226218488 pounds.

-jim.

General converter exception

After installing the extension, and typing gc, i get this error:

Please open new issue in: https://github.com/deefrawley/Flow.Launcher.Plugin.GenConvert/issues/new
1. upload log file: C:\Users\cecco\AppData\Roaming\FlowLauncher\Logs\1.9.5\2022-10-07.txt
2. copy below exception message

Flow Launcher version: 1.9.5
OS Version: Microsoft Windows NT 10.0.22621.0
IntPtr Length: 8
x64: True

Python Path: 
Date: 10/07/2022 15:25:42
Exception:
General Converter Exception: 
Websites: https://github.com/deefrawley/Flow.Launcher.Plugin.GenConvert
Author: deefrawley
Version: 1.1.2
Flow.Launcher.Core.ExternalPlugins.FlowPluginException: Access is denied.
 ---> System.ComponentModel.Win32Exception (5): Access is denied.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 247
   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.<<QueryForPluginAsync>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 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 190
   --- 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 210
   at Flow.Launcher.ViewModel.MainViewModel.<>c__DisplayClass137_0.<<QueryResults>g__QueryTask|2>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 616
--- End of stack trace from previous location ---
   at Flow.Launcher.ViewModel.MainViewModel.QueryResults() in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 590
   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)

I'm attaching also the log file 2022-10-07.txt
2022-10-07.txt
The last fatality is the one im talking about

AttributeError

Please type any relevant information here

Trace Log

Traceback (most recent call last):
  File "C:\Users\TruongN\AppData\Roaming\FlowLauncher\Plugins\General Converter-2.0.1\plugin\general_converter.py", line 63, in query
    do_convert = gen_convert(float(args[0]), args[1], args[2])
                             ^^^^^^^^^^^^^^
ValueError: could not convert string to float: '25lb'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\TruongN\AppData\Roaming\FlowLauncher\Plugins\General Converter-2.0.1\lib\flox\launcher.py", line 44, in run
    results = request_method(*request_parameters) or self._results
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\TruongN\AppData\Roaming\FlowLauncher\Plugins\General Converter-2.0.1\lib\flox\__init__.py", line 132, in _query
    self.query(query)
  File "C:\Users\TruongN\AppData\Roaming\FlowLauncher\Plugins\General Converter-2.0.1\plugin\general_converter.py", line 95, in query
    self.add_item(title="Error - {}").format(repr(e), subtitle="")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'format'

Rounding issue in certain scenarios

test.mp4

While lb -> g is quite precise, the opposite g -> lb has its issues where anything below 227 g calculates as 0, additionally rounding in this case results in not very good precision.

I haven't tested or encountered any other 'wrong' conversions, but it's possible that it behaves similary in other scenarios.

gm abbreviation for gram?!

The official SI abbreviation for gram is g. Every other metric abbreviation in this plugin uses its proper SI abbreviation. "g" isn't used as an abbreviation for any other unit in this plugin. Can this abbreviation please be changed to its only logical one – "g"? Thanks.

list all available convertions

can we add the listing of all available conversions with this plugin, i.e. i type the gc action keyword then a list of available conversions show up like the bookmarks plugin. Can also be a dedicated way of listing the conversions as well.

List by subject should be sufficient I suppose.

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.