Giter Site home page Giter Site logo

tchar / ulauncher-albert-calculate-anything Goto Github PK

View Code? Open in Web Editor NEW
95.0 4.0 13.0 31.41 MB

A ULauncher/Albert extension that supports currency, units and date time conversion, as well as a calculator that supports complex numbers and functions.

License: MIT License

Python 98.84% Shell 1.16%
conversion calculator converter ulauncher-extension ulauncher-extensions ulauncher albert albertlauncher albert-extensions launcher

ulauncher-albert-calculate-anything's People

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

Watchers

 avatar  avatar  avatar  avatar

ulauncher-albert-calculate-anything's Issues

[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

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

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

[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] 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

[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

[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)

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

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.

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

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

[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%)
 `++:.                           `-/+/
 .`                                 `/

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.

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.