Code Monkey home page Code Monkey logo

ulauncher-albert-calculate-anything's Introduction

drawing Calculate Anything

Platforms Python Versions License Latest Version

Linux CI Benchmark CodeQL Codecov

Code Style

Benchmarks

Ulauncher/Albert Calculate Anything is an extension for Ulauncher and Albert to calculate things like currency, time, percentage, units, complex equations, base-n expressions and more.

The calculate_anything module does not depend on Ulauncher or Albert so it is extensible for other use cases (see demo with prompt_toolkit).

See Features for supported features, Contents for installation instructions and more

Albert Demo

Albert Demo

Ulauncher Demo

Ulauncher Demo

Features

Calculator for Anything

  • Currency Converter: See Currency for examples
  • Time Converter: Convert time to other timezones and compute time expressions or find time remaining until any date-time. See Time for examples.
  • Units Converter: Compute and Convert units to other units. See Units for examples.
  • Normal Calculator: Supports functions such as cos, sin, tan. Check Calculator for examples.
  • Complex Numbers Calculator: Also supports Normal Calculator's functions. Check Calculator for examples.
  • Percentage Calculator Calculate percentages see Percentages for examples.
    • Supports all expressions that Normal Calculator and Complex Calculator Support
  • Base N Calculator: Calculate numbers and expressions to other number base. See Base N Calculator for examples.
    • Base 16 (hex): Calculates expression to decimal, biniary, octal, color (i.e RGB, YSV, etc), Bytes (representation of string)
    • Base 2 (bin), Base 8 (oct), Base 10 (dec)
    • Supports functions: or, xor, and, mod, div, +, -, /

The only launcher specific files for ulauncher and albert are main.py, __init__.py in the root of this project

Dependencies: simpleeval, pint parsedatetime and pytz (for parsedatetime) Currency and Unit converter as well as a Calculator for numbers, complex numbers, percentages and time that supports mathematical functions and Complex Numbers.

Optional Dependencies: babel. Installing this will format your results in your language/locale.

Contents

Install for Ulauncher

Thus extension depends on Pint, simpleeval and parsedatetime. Install them with:

# You probably have some of them already installed
/usr/bin/python3 -m pip install Pint simpleeval parsedatetime pytz

# Optionally for translations and formatting to your locale
/usr/bin/python3 -m pip install babel

Open Ulauncher go to Extensions > Add extension and paste https://github.com/tchar/ulauncher-albert-calculate-anything

Install for Albert

Similarly to Ulauncher the same dependencies are are required.

To install the extension for Albert run

# You probably have some of them already installed
/usr/bin/python3 -m pip install Pint simpleeval parsedatetime pytz

# Optionally for translations and formatting to your locale
/usr/bin/python3 -m pip install babel

# Determine Install location
[ -z "$XDG_DATA_HOME" ] && INSTALL_DIR=~/.local/share || INSTALL_DIR=$XDG_DATA_HOME

# Create module directory if not exists
mkdir -p $INSTALL_DIR/albert/org.albert.extension.python/modules/

# Install extension
git clone https://github.com/tchar/ulauncher-albert-calculate-anything $INSTALL_DIR/albert/org.albert.extension.python/modules/

Open albert, enable Python extensions and then enable the Calculate Anything extension.

You can double click it to open module's location and edit __init__.py to add your preferences.

How to Setup

Albert

If you are using Albert open the extension location normally at ~/.local/share/albert/org.albert.extension.python/modules/ulauncher-albert-calculate-anything/__init__.py and edit the preferences mentioned below in the apropriate variable API_KEY, CACHE, DEFAULT_CURRENCIES, DEFAULT_CITIES, SHOW_EMPTY_PLACEHOLDER or __triggers__ for the keyword

The extension can work in albert without keywords if you comment out the __triggers__ option, however if another extension has the keyword you type, Calculate Anything won't trigger (see relevant issue)

Ulauncher

If you are using Ulauncher use the extension preferences.

Set Currency Provider

You can select from different currency providers. Supported providers are:

Preferences:

  • ULauncher: Select one in currency provider
  • Albert: Modify the CURRENCY_PROVIDER in __init__.py to one of [fixerio, internal (European Central Bank)]

Set API Key

In order for the currency conversion to work for providers that need an API Key, you need to set it in the preferences.

  • ULauncher: Copy your api key to the API KEY box in preferences
  • Albert: Modify the API_KEY in __init__.py

Cache

For currency conversion you can enable the cache for a minimum of 1 day up to 1 year. This will store the results fetched by your currency provider to prevent redundant requests. This is especially helpful if you have a free plan on a paid currency provider that limits your requests. It will also display the results faster, since no request is made. If all requested currencies have been cached, no request is made.

  • Ulauncher: Edit Currency Cache in the extension preferences
  • Albert: Edit CACHE=86400 in __init__.py and set it to your interval in seconds

Default currency

In the preferences you can define a comma separated list of default currencies to show when typing conversion without target unit/currency. Defaults to USD,EUR,CAD,GBP,AUD

  • ULauncher: Edit in Default Currencies preferences
  • Albert: Edit DEFAULT_CURRENCIES in __init__.py

Default cities

In the preferences you can define a comma separated list of default cities when using the time command

  • ULauncher: Edit in Default Currencies preferences
  • Albert: Edit DEFAULT_CITIES in __init__.py

Units Conversion Mode

In the preferences you can define a units conversion mode. For now there is normal (default) and crazy.

Crazy means that the unit converter/calculator tries to convert all possible units (currency included) available under the name.

See Currency and Units for more

Crazy mode is experimental and bugs are to be expected

  • ULauncher: Edit in Units Conversion mode preferences
  • Albert: Edit UNITS_CONVERSION_MODE in __init__.py

Show Empty Placeholder

  • ULauncher: Default is No. Set to Yes to show an empty placeholder when extension doesn't return anything
  • Albert: Change SHOW_EMPTY_PLACEHOLDER=True in __init__.py

Commands and Syntax

To calculate/convert anything you can use the keywords

  • =: For currency, units and calculator
  • time: For time calculations
  • dec/hex/bin/oct: For base-n and calculations

You can go directly to examples or use the ones from the demo

To convert currency type your keyword and then

  • AMOUNT CURRENCY to get conversion in the default currencies set in the preferences (requires cache)
  • AMOUNT CURRENCY in(or to) CURRENCY1,CURRENCY2,CURRENCY3
  • CURRENCY in(or to) CURRENCY1,CURRENCY2,CURRENCY3

To convert units use

  • AMOUNT UNIT in(or to) UNIT1,UNIT2,UNIT3
  • UNIT in(or to) UNIT1,UNIT2,UNIT3

Comma separated units and currencies can have spaces between them.

For time you can use the time keyword with a syntax

  • time To get the current time plus the default cities you defined in the preferences
  • time at CITY,[COUNTRY|COUNTRY CODE|STATE CODE] to get the current time for a specified city
  • time + AMOUNT [MONTH|YEAR|WEEK|DAY|HOUR|MINUTE|SECOND] [+ AMOUNT ...] [at CITY, [COUNTRY|COUNTRY CODE|STATE CODE]] to get the time after the calculation at a specified city.

To calculate an expression just type your expression as in the demo

  • You can use functions such as tan,atan,asinh
  • You can use complex numbers too like 1 + 5i

To calculate percentages you can use one of the following

  • AMOUNT1% of AMOUNT2 to calculate the AMOUNT1 percent of AMOUNT2
  • AMOUNT1 as % of AMOUNT2 to calculate AMOUNT1 as a percentage of AMOUNT2

If you select one results it will be copied to clipboard.

Examples

Currency

Simple Conversion

  • Convert 10 euros to american dollars
    • 10 eur to USD
    • 10 euros to $
    • 10 eurs to dollars

Multiple Conversion

  • Convert 10 euros to american dollars, canadian dollars, bitcoin, and mexican pesos
    • 10 EUR to USD,canadian,bitcoin,mexican

Crazy Conversion

crazy mode must be enabled in preferences

  • Convert 1 us dollar per pound to euros per kilogram
    • 1 $ / pound to EUR / kg
  • Convert 10 us dollars per square foot squared to canadian dollars per meter squared
    • 10 $ / foot ^ 2 to CAD / meter ^ 2

Time

You can also add and subtract time For example if now is 2021-07-05 14:14:42 then you can use the following

Be careful to use date timespans like 2 years 5 months 2 weeks 3 days 1 hour 4 minutes 3 seconds and not dates like December 2022.

In the following examples the time returned is accompanied by the date time in the default cities you specified in the extension preferences

  • time: Returns 2021-07-05 14:14:42 as well as the date time in the default cities specified in settings
  • time plus 1 hour: Returns Today at 15:14:42
  • time + 1 day: Returns Tomorrow at 14:14:42
  • time minus 1 day: Returns Yesterday at 14:14:42
  • time + 2 hours 2 minutes 5 seconds: Returns Today at 15:16:47
  • time + 1 year: Returns 2022-07-05 14:14:42
  • time + 1 year 2 days 2 hours - 4 years 4 minutes: Returns 2018-07-07 16:10:42

Specifying a target city

You can use all the commands above followed by at CITY NAME or at CITY NAME, COUNTRY NAME|COUNTRY CODE|STATE CODE to get te result in your local time as well as the specified city

  • time at Prague
  • time + 2 hours at Madrid
  • time + 2 hours at Vancouver, CA: (There are two Vancouvers, so by specifying CA as returns the Canadian Vancouver)
  • time + 2 days 3 seconds at Vancouver, Canada
  • time + 1 hour + 3 years at Athens, AL: (Athens AL refers to Athens at Alabama)

Using until

You can also use the until command (Experimental) to calculate duration of time until a specific date

Note: The midnight keyword shifts one day after, so midnight is considered to belong in the next day

In the following examples you can specify a specific date and time or say for example a number of years months etc.

Keywords such as a/next/last/previous/ago, years/months/weeks/days/hours/minutes/seconds, morning/noon/afternoon/evening/night/midnight, tomorrow/yesterday and the combination of those will work like in the normal mode.

  • time until December 31 midnight: Returns remaining days, hours minutes until January 00:00:00 (end of day for December)
  • time until midnight: Returns remaining hours minutes seconds until midnight for this day (midnight is at 00:00:00)
  • time until tomorrow: Day starts at 09:00
  • time until tomorrow evening: Hours/Days until tomorrow at 18:00
  • time until a year ago: Negative result
  • time until 2000000 year: Easter egg

And many more combinations

Units

The units supported are all units that pint supports (which is quite a lot)

Simple Conversion

  • Convert 100 fahrenheit to celsius
    • 100 f to c

Multiple Conversion

  • Convert 20 centimeters to inches and meters
    • 20 cm to inches, m
    • 20 cm to inches,meters

Advanced Conversion

  • Convert kilometers per meter to centimeters per minute, kilometers per minute, inches per second and centimeters per second.
    • 20 km/h to cm/min, km/minute, in/s, cm/sec
  • Convert kilowhats per second to horsepower per hour and megawatts per second
    • 10 kw/sec to hp/h, mw/s
  • Convert meters per squared second to kilometers per squared hour
    • 10 m/s^2 to km/h^2
  • Convert megabytes per second to gigabytes per hour
    • 10 mb/s to gb/h

You can lieterally convert anything if the apropriate units match

  • Convert kilometer * centimeter * second per gibabyte to inches * meter * hour per megabyte
    • 10 km * cm * s / gb to inches * meter * hour / mb

Crazy Conversion

crazy mode must be enabled in preferences

  • 1 m to cm may have two compatible units meter and mole, so it will return both results

Percentages

Simple Cases

  • Calculate what is 10% of 40
    • 10% of 40: Answer is 4
  • To calculate what percentage of 30 is 5, any of the following works
    • 5 is what % of 30: Answer is 16.6667%
    • 5 is what % 30
    • 5 as % of 30
    • 5 in % of 30
    • 5 in % 30

Advanced Cases

  • 10% of cos(pi) + 5: Answer is 0.4
  • 3 + 2 * pi % of cos(pi) + 5: Answer is 0.371328
  • 5 as % sqrt(2) + 5: Answer is 77.9519%
  • 1 + sin(pi) as % sqrt(2) + 5: Answer is 15.5904%

Calculator

The calculator works like a normal calculator, but is able to work with complex numbers too.

The following constants exist: pi, e, tau and others from cmath

The following functions exist: phase, polar, rect, exp, log, log10, sqrt, acos, asin, atan, cos, sin, tan, acosh, asinh, atanh, cosh, sinh, tanh and others from cmath

Simple Cases

  • 10 + sqrt(2): Answer is 11.4142
  • 10 + cos(pi) + 30 * e ^ 2: Answer is 230.672

Complex Numbers

Use i as the imaginary unit

  • 10 + sqrt(2) + i: Answer is 11.4142 + i
  • cos(1 + i): Answer is 0.83373 - 0.988898i
  • e ^ (pi * i) + 1: Answer is 0 (Euler's identity)

Base N Calculator

Use with the keywords hex, dec, bin, oct by default.

Simple Cases

  • dec 1000: Returns result in hex, bin, oct
  • hex ffa12: Returns result in dec, bin, oct as well as bytes representation of the input query (including spaces)
  • bin 10101: Returns result in dec, hex, oct

Special cases with hex

The hex calculator will always produce the byte representation of its input query.

Color Conversion with hex

If the input is in the format of #xxxxxx where xxxxxx is a valid hex number, it will convert the number representing a color to other color formats.

  • hex #fa1234: Returns colors result in rgb, hsv, hsl, cmyk.

Advanced Cases

  • dec/hex/bin/oct 10101 and 10110 xor 10 + 1010 - 1010 div 10 and 10101: Returns the result in all available base-n (dec, hex, oct, bin)
    • Digits must be valid in the base you are using (e.g 2012 is invalid for bin)

Known Issues

If at any moment currency stops showing try removing the currency cache file and restart the Launcher/program

Linux

rm ~/.cache/com.github.tchar.calculate-anything/currency_data.json

Windows

rm ~\AppData\Local\tchar\com.github.tchar.calculate-anything\Cache\currency_data.json

macOS

rm ~/Library/Caches/com.github.tchar.calculate-anything/currency_data.json

Extending and More

The calculate_anything module does not depend on ulauncher or albert, only the main.py (for Ulauncher) and __init__.py (for albert) do. You can extend it for other cases.

See the documentation for API call examples

You can also find a sample usage of the API using prompt_toolkit at the prompt.py file.

Here is a demo

Adding flags

If your currencie's flag is missing you can place it in the extension's flags directory at calculate_anything/images/flags/ and restart your launcher or make a pull request to include it.

Make sure to name your flag image in uppercase 2 letter name of your country. To make a currency flag, simply link the country flag you want to the currency e.g ln -s US.svg USD.svg or add a completely new flag For example American Dollar's flag is in calculate_anything/images/flags/USD.svg. You can use most image formats (i.e svg, png)

Flag Icons made by Freepik from www.flaticon.com

ulauncher-albert-calculate-anything's People

Contributors

tchar avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

ulauncher-albert-calculate-anything's Issues

Feature request: weight units

I am unable to convert e.g. cups to grams. I've installed all prerequisites as per setup instructions.

= 1 cup to gram

Thanks

Proxy support [feature]

I don't like frequent requests from my computer to a web services, so I like to transfer the requests through Tor for this kind of tools, I usually use SOCKS5 tor proxy witch gives you socks5://127.0.0.1:9050 by default when you start tor serves.

Describe the solution you'd like

I would like to see a proxy section in the extention config page in ulauncher, or if it's hard to make it more customized you can just put an on/off button to use tor.

How to implement it?

I found thet you are using urllib to get data so you can use this solution for tor's SOCKS5 before importing urlopen:

import socket
import socks

def create_connection(addr, timeout=None, src=None):
    sock = socks.socksocket()
    sock.connect(addr)
    return sock

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9050, True)

socket.socket = socks.socksocket
socket.create_connection = create_connection

# then importing urlopen
from urllib.request import urlopen

Source: https://hackeradam.com/post/how-to-route-urllib2-through-tor/

🔴🔴 Be aware about the True in:

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9050, True)

If you don't use it the DNS will be leaked.

Source: https://security.stackexchange.com/questions/40414/tor-via-python-can-the-real-ip-address-leak

[feature] Enhance time with specific time/date and timezone conversion

Hi,

Thanks for the awesome extension!

Is your feature request related to a problem?

Currently its not possible to convert specific time/date in given timezone to system's time/date.

Describe the solution you'd like

By typing the 08:00 CEST will return - 9:00:00 EEST (EEST is my current system timezone).

Describe alternatives you've considered

Terminal command - date -d "08:00 CEST" or online tools / webpages

Cheers,
PY

[bug]

Describe the bug

Despite to have installed all required dependencies, I have still the issue:

looks like parsedatetime is not installed

To Reproduce

  • Install this extension.
  • Type "time"

Expected behavior

I can use the extension.

Logs

Nothing interesting in logs.

Screenshots

pip show pint simpleeval parsedatetime pytz
Name: Pint
Version: 0.17
Summary: Physical quantities module
Home-page: https://github.com/hgrecco/pint
Author: Hernan E. Grecco
Author-email: [email protected]
License: BSD
Location: /home/guillaumevauvert/.local/lib/python3.6/site-packages
Requires: importlib-metadata, importlib-resources, packaging
Required-by: 
---
Name: simpleeval
Version: 0.9.11
Summary: A simple, safe single expression evaluator library.
Home-page: https://github.com/danthedeckie/simpleeval
Author: Daniel Fairhead
Author-email: [email protected]
License: UNKNOWN
Location: /home/guillaumevauvert/.local/lib/python3.6/site-packages
Requires: 
Required-by: 
---
Name: parsedatetime
Version: 2.6
Summary: Parse human-readable date/time text.
Home-page: https://github.com/bear/parsedatetime
Author: Mike Taylor
Author-email: [email protected]
License: Apache License 2.0
Location: /home/guillaumevauvert/.local/lib/python3.6/site-packages
Requires: 
Required-by: 
---
Name: pytz
Version: 2021.1
Summary: World timezone definitions, modern and historical
Home-page: http://pythonhosted.org/pytz
Author: Stuart Bishop
Author-email: [email protected]
License: MIT
Location: /home/guillaumevauvert/.local/lib/python3.6/site-packages
Requires: 
Required-by: 

Desktop (please complete the following information)

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Additional context

Add any other context about the problem here.

An option to make outbound calls on-demand (or disable it totally)

Is your feature request related to a problem?

Somewhat related to #35, but even if that one is fixed, this feature is still nice to have.

The main reason for me is security and privacy. For example, I do not wish to create network activities in a public, or monitored environment. This plugin is the only one in my whole system making outbound calls on its own.

Describe the solution you'd like

I would like one of these solutions:

  1. The option to choose between on-demand (only call out whenever user demands it) and pre-cached data (current). This would be ideal.
  2. The option to turn off the periodic outbound calls in the background. When the user requests it, remind user to turn it back on first in order to use it. Or,
  3. The option to turn off services (right now only Currency) that make background calls. (probably easier to implement without having to change much)

Describe alternatives you've considered

Right now I just remove the currency part of the code. Not ideal.

[bug]

Describe the bug

Does not give time at any place except my own place. and if i gave it my place it does not work

To Reproduce

time at NYC or time at Calif gives my own timezone but time at cairo or time at cairo egypt does not give anything.

Expected behavior

Gives the current time at target city.

Logs

If possible please provide the logs from the log directory
Supose your username is username:

  • Linux: /home/username/.cache/com.github.tchar.calculate-anything/log
  • Windows: 'C:\Users\username\AppData\Local\tchar\com.github.tchar.calculate-anything\Logs
  • macOS: /Users/username/Library/Logs/com.github.tchar.calculate-anything
    You can get then in a zip file and post it with the issue.

Screenshots

NYC time example

Desktop (please complete the following information)

  • OS: Elementary OS 5.1.7 (based on Ubuntu Bionic 18.04 LTS)

Cannot install the extension

Describe the bug

Cannot install the extension

To Reproduce

Steps to reproduce the behavior:

  1. Open "Ulauncher Preferences"
  2. Enter the "Extensions" tab
  3. Select the option "Add extension"
  4. Paste the repository link (https://github.com/tchar/ulauncher-albert-calculate-anything)

Expected behavior

Extension installed

Logs

Message: undefined
Error Name: undefined
Type: undefined

Stacktrace:

undefined

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information)

  • OS: [Ubuntu Mate 20.04 ]
  • Linux: Ubuntu 20.04.2 LTS

Additional context

Add any other context about the problem here.

[bug] Extension crashed after updating and saving new settings and then crashes instantly on reload

Describe the bug

After updating the extension to the latest version (cdc539c), then trying to change values for Default Cities (added salt lake city for e.g.), it wouldn't save the settings. Now, it crashes on reload.

To Reproduce

Steps to reproduce the behavior:

  • Added Salt Lake City US to Default cities
  • Save settings

Expected behavior

Save the settings and be able to run the extension. Now it crashes on reload with following error in ulauncher:
ERROR | ulauncher.api.server.ExtensionRunner: _run_process() | Extension "com.github.tchar.ulauncher-albert-calculate-anything" failed with an error: locale.Error: unsupported locale setting

Error in preferences pane when saving (first time)

Message: 'com.github.tchar.ulauncher-albert-calculate-anything'
Error Name: UnhandledError
Type: KeyError

Stacktrace:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/ulauncher/ui/windows/PreferencesUlauncherDialog.py", line 198, in on_scheme_callback
    resp = rt.dispatch(self, scheme_request.get_uri())
  File "/usr/lib/python3.9/site-packages/ulauncher/utils/Router.py", line 49, in dispatch
    return callback(context, url_params)
  File "/usr/lib/python3.9/site-packages/ulauncher/ui/windows/PreferencesUlauncherDialog.py", line 444, in prefs_extension_update_prefs
    controller = ExtensionServer.get_instance().get_controller(ext_id)
  File "/usr/lib/python3.9/site-packages/ulauncher/api/server/ExtensionServer.py", line 76, in get_controller
    return self.controllers[extension_id]
KeyError: 'com.github.tchar.ulauncher-albert-calculate-anything'

Logs

If possible please provide the logs from the log directory

  • Linux: /home/username/.cache/com.github.tchar.calculate-anything/log
    Directory is empty

Screenshots

screenshot-2021_08_12-14_00_34+1000

Desktop (please complete the following information)

  • OS:
                   -`                    user@archripper
                  .o+`                   -----------------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Kernel: 5.13.9-zen1-1-zen
               `+oooooo:                 Uptime: 4 hours, 17 mins
               -+oooooo+:                Packages: 903 (pacman)
             `/:-:++oooo+:               Shell: zsh 5.8
            `/++++/+++++++:              Resolution: 2560x1440
           `/++++++++++++++:             WM: sway
          `/+++ooooooooooooo/`           Theme: Adwaita [GTK2/3]
         ./ooosssso++osssssso+`          Icons: Adwaita [GTK2/3]
        .oossssso-````/ossssss+`         Terminal: alacritty
       -osssssso.      :ssssssso.        CPU: AMD Ryzen Threadripper 1950X (16) @ 3.750GHz
      :osssssss/        osssso+++.       CPU Usage: 1%
     /ossssssss/        +ssssooo/-       GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590
   `/ossssso+/:-        -:/+osssso+-     GPU Driver: amdgpu
  `+sso+:-`                 `.-/+oso:    Memory: 9.65GiB / 125.66GiB (7%)
 `++:.                           `-/+/
 .`                                 `/

[bug] Calculation error sin(2*pi)

Describe the bug

= sin(2*pi) gives 1 instead of 0 on ULauncher

Expected behavior

Should be 0.

Logs

runtime.log

Screenshots

grafik

Desktop (please complete the following information)

  • OS: Xubuntu 5.4.0-97-generic #110-Ubuntu SMP Thu Jan 13 18:22:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[feature] Converstion of time to time unit like ms

Is your feature request related to a problem?

I would like to convert time to any unit (ms) for instance.

Describe the solution you'd like

time + 1 hour to ms

Describe alternatives you've considered

None with this tool.

Additional context

Not needed.

[bug] Crashed on Ulauncher 5.14.7

Describe the bug

Calculate anything crashes everytime ulauncher is launched.

To Reproduce

Steps to reproduce the behavior:
Just add the extension for Calculate Anything on Ulauncher.

Expected behavior

Proper output when given command.

Logs

runtime.log.zip

Screenshots

Screenshot_20220808_151723
Screenshot_20220808_151753

Desktop (please complete the following information)

Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.8
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.15.0-43-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i3-8130U CPU @ 2.20GHz
Memory: 15.4 GiB of RAM

[feature] Timestamp calculation (not from today)

Is your feature request related to a problem?

I would like to do addition and subtraction using timestamps.

Describe the solution you'd like

= 1:8:59 + 8:11:32. The result would be 9:20:31.

This is a simple example with hours, minutes and seconds, but the idea is to extend this to multiple timestamps, support for timezones and milliseconds.

This is different from the time command in which you add or subtract from today as a timestamp, which is an awesome tool.

Describe alternatives you've considered

None that I've considered.

Additional context

Just a question, if it is possible. May I create a PR for this feature request? Do you think what I'm asking is possible within the constraints of this project? Thanks.

And thanks for this plugin. Really looking forward for this feature. It would help me a lot.

[bug] Crashed on Ulauncher 5.14.4

Describe the bug

Ulauncher displays Calculate Anything as Crashed.

To Reproduce

Just install Calculate Anything in the Ulauncher

Expected behavior

Working as non crashed

Logs

If possible please provide the logs from the log directory:
runtime.zip

Screenshots

calculate_anything

Desktop (please complete the following information)

  • OS: Debian Bookworm

Additional context

Wanted to make sure pytz is satisfied:
pip3 install pytz --user
Requirement already satisfied: pytz in ./.local/lib/python3.9/site-packages (2021.3)

[bug] If pint is not installed, suggest user restarts ulauncher after install

Describe the bug

The message reminding the user to install pint does not also suggest that the user restarts ulauncher to get around the error, but it is necessary (at least is was for me).

To Reproduce

Steps to reproduce the behavior:

  1. Install extension but do not install pint
  2. Open ulauncher and type =
  3. Notice a message saying something like "Install pint by running pip install pint"
  4. Install pint by running pip install pint.
  5. Open ulauncher and type =

Expected behavior

I expect newly installed pint to be recognized, since I followed the directions.

What happened instead

  1. Got the same message saying "Install pint by running pip install pint"
  2. Start fiddling with it to get it to work, which starts with restarting ulauncher process.
  3. Notice that there is no more error message about pint

Logs

Sorry I don't have logs, please let me know if you actually need them for this.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information)

  • OS: [e.g. Ubuntu Linux 20.04 ]
    • Linux: If you don't know the version, these commands may help: cat /etc/os-release lsb_release -a hostnamectl
~ % uname --all
Linux m 6.0.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 08 Dec 2022 11:03:38 +0000 x86_64 GNU/Linux
~ % cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
~ % lsb_release -a
LSB Version:    n/a
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a
~ % hostnamectl
Static hostname: m
Icon name: computer-laptop
Chassis: laptop 💻Machine ID: ac2d7008d3874e7292bcc4dfcb25d7d7
Boot ID: 17c682032a2147a88df688bb7d6b5fd7
Operating System: Arch Linux
Kernel: Linux 6.0.12-arch1-1
Architecture: x86-64
Hardware Vendor: Dell Inc.
Hardware Model: XPS 13 9300
Firmware Version: 1.15.0

Additional context

Add any other context about the problem here.

Calculate Anything extension crashed [ULauncher]

Describe the bug

Calculate Anything extension crashed after I added it to ULauncher

To Reproduce

I just added the extension and that happened.

Logs

I couldn't find any logs at ~/.cache/com.github.tchar.calculate-anything/log.

Screenshots

image

Desktop

  • OS: Debian 12
  • Linux: Linux 6.1.0-22-amd64
  • Desktop: GNOME Wayland

Additional context

I am not a expert when it comes to installing python packages... especially on linux.
I don't know what is the best way to install pip packages as of PEP668.
I tried to install the dependencies (requests pint simpleeval parsedatetime) by creating a venv in /usr/local/venv.
If you have any better way of installing pip packages, feel free to tell me... Maybe the dependencies aren't recognised by the extension.

[bug] zombie process

Describe the bug

When Ulauncher exits, all other extensions exit as expected, but calculate-anything lingers. If I start another Ulauncher, there will be two calculate-anything instances running. If I exit Ulauncher again, two calculate-anything instances are lingering.

To Reproduce

# run it for the first time
sh-5.1$ ulauncher --hide-window
# then hit ctrl-c
sh-5.1$ ps axl | grep -i ulauncher
0  1000   45551       1  20   0 500544 74852 futex_ Sl   pts/1      0:00 /bin/python /home/user/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/main.py
0  1000   45609   44870  20   0   6672  2680 pipe_r S+   pts/1      0:00 grep -i ulauncher

# run again
sh-5.1$ ulauncher --hide-window
# then hit ctrl-c
sh-5.1$ ps axl | grep -i ulauncher
0  1000   45551       1  20   0 500544 74944 futex_ Sl   pts/1      0:00 /bin/python /home/user/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/main.py
0  1000   46220       1  20   0 501564 74716 futex_ Sl   pts/1      0:00 /bin/python /home/user/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/main.py
0  1000   46276   44870  20   0   6672  2684 pipe_r S+   pts/1      0:00 grep -i ulauncher

Same result with these alternatives:

  • GDK_BACKEND=wayland.
  • exec GDK_BACKEND=wayland ulauncher --hide-window in sway config and exit from widget menu

Expected behavior

com.github.tchar.ulauncher-albert-calculate-anything/main.py should terminate like other extensions.

Desktop (please complete the following information)

  • Arch Linux
  • sway

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.