Re: Calculator
On April 1, 2010, you wrote: > Hi, > > I am currently working on improving the calculator runner, by adding an > optional dependency on libqalculate. If the library is found, the > calculator runner will be built against libqalculate and it will support > "advanced" operations (such as currency conversion, unit conversion, > equation solving, ...). Otherwise it will fall back to the existing code > that uses QtScript. I have tested the runner for some weeks now and it is > stable. great; can you post a patch to review-board for this so we can triage it in asap? > I would like to hear some opinions about these points: > - currently there are two calculator plasmoids, with and without > libqalculate support (btw I am the author of the qalculate one). I think > that we could use a similar approach here as with the runner, i.e. have a > unified calculator plasmoid that optionally depends on libqalculate. agreed > - a Qalculate backend for Cantor is currently in playground (not developed > by me). It is already quite stable and I think It would be nice to have it > included in SC 4.5. > > - one problem is that the runner, applet and Cantor backend have some > duplicate code (e.g. evaluation options, support for QString, ...). As > Aaron suggested some time ago, maybe it is worth it to add a wrapper > library for libqalculate use in KDE (something like libkdeqalculate, feel > free to suggest a nicer name ;). Where should this library be placed? > Would > kdebase/workspace/libs be an appropriate place? only if it is used by things in kdebase-workspace alone. otherwise, i'd recommend kdesupport and ship it as a separate library. > Of course I volunteer to take care of these tasks before 4.5 freeze ;) terrific :) -- Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Development Frameworks ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator
On Thu, Apr 1, 2010 at 1:15 PM, Matteo Agostinelli wrote: > I am currently working on improving the calculator runner, by adding an > optional dependency on libqalculate. If the library is found, the calculator > runner will be built against libqalculate and it will support "advanced" > operations (such as currency conversion, unit conversion, equation solving, > ...). Otherwise it will fall back to the existing code that uses QtScript. I > have tested the runner for some weeks now and it is stable. Is the qalculate syntax backwards compatible with the existing calculator runner syntax? If not then perhaps there should be two separate calculator runners. Cheers Rich. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator
Yes, it is backwards compatible. The runner is executued when you put a '=' at the beginning or at the end of the expression. The syntax for common math operations is the same. Cheers, Matteo On Sat, Apr 3, 2010 at 17:35, Richard Moore wrote: > On Thu, Apr 1, 2010 at 1:15 PM, Matteo Agostinelli > wrote: >> I am currently working on improving the calculator runner, by adding an >> optional dependency on libqalculate. If the library is found, the calculator >> runner will be built against libqalculate and it will support "advanced" >> operations (such as currency conversion, unit conversion, equation solving, >> ...). Otherwise it will fall back to the existing code that uses QtScript. I >> have tested the runner for some weeks now and it is stable. > > Is the qalculate syntax backwards compatible with the existing > calculator runner syntax? If not then perhaps there should be two > separate calculator runners. > > Cheers > > Rich. > ___ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator
On Thursday 01 April 2010 20:11:41 Aaron J. Seigo wrote: > On April 1, 2010, you wrote: > > Hi, > > > > I am currently working on improving the calculator runner, by adding an > > optional dependency on libqalculate. If the library is found, the > > calculator runner will be built against libqalculate and it will support > > "advanced" operations (such as currency conversion, unit conversion, > > equation solving, ...). Otherwise it will fall back to the existing code > > that uses QtScript. I have tested the runner for some weeks now and it is > > stable. > > great; can you post a patch to review-board for this so we can triage it in > asap? > > > I would like to hear some opinions about these points: > > - currently there are two calculator plasmoids, with and without > > libqalculate support (btw I am the author of the qalculate one). I think > > that we could use a similar approach here as with the runner, i.e. have a > > unified calculator plasmoid that optionally depends on libqalculate. > > agreed > > > - a Qalculate backend for Cantor is currently in playground (not > > developed by me). It is already quite stable and I think It would be > > nice to have it included in SC 4.5. > > > > - one problem is that the runner, applet and Cantor backend have some > > duplicate code (e.g. evaluation options, support for QString, ...). As > > Aaron suggested some time ago, maybe it is worth it to add a wrapper > > library for libqalculate use in KDE (something like libkdeqalculate, feel > > free to suggest a nicer name ;). Where should this library be placed? > > Would > > kdebase/workspace/libs be an appropriate place? > > only if it is used by things in kdebase-workspace alone. otherwise, i'd > recommend kdesupport and ship it as a separate library. > > > Of course I volunteer to take care of these tasks before 4.5 freeze ;) > > terrific :) So, the proposed patch has been sitting in reviewboard for a couple of weeks now (http://reviewboard.kde.org/r/3483/). Did someone test it? I would appreciate some feedback before going on with the other points I mentioned. Thanks, Matteo signature.asc Description: This is a digitally signed message part. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator
Hi Markus, Please file a bugzilla ticket at bugs.kde.org to request this new feature. The product is "kdeplasma-addons" FWIW, a slightly easier way to accomplish what you want to do today is to use KRunner, which has a built-in calculator that accepts pasted text at least. Nate On Thu, 12 Jul 2018 01:30:06 -0700 Markus Döbele wrote > Hy Plasma Team, > I use the calculator mini program and I would like to suggest an > improvement.It would be nice if I could copy numbers from e.g. a website to > the calculator input fieldthen make a calculation and afterwards copy the > resulting number form the calculator to e.g. an editor. > Thanks,Markus
Re: Calculator runner
On Tue, Oct 6, 2009 at 7:09 PM, Matteo Agostinelli wrote: > Hello, > > as suggested by Aaron in a previous discussion, I am having a look at the > calculator runner with the purpose of extending the capabilities of the > runner > by using libqalculate when it is available, otherwise falling back to the > currently used 'qscript' method. So here are my questions (sorry if some of > them are stupid ones...): > * how should I detect the presence of qalculate on the system? Should I let > CMake find the library and then use the preprocessor (#ifdef, ) thus > making > it a compile-time optional dependency? > * it was mentioned that thread safety is important in this case. How can I > find > out if libqalculate is thread safe? > * I think it would be nice if the runner respects the same settings of the > plasmoid (if it's being used). Is there a way to do this, apart from > reading > the plasma-desktop-appletsrc file? > > BTW, while looking at the code I found a bug in the runner. The expression > 'e+' is interpreted as '^' instead of '*10^'. So if you type 2e+2 you > currently get the wrong result (4 instead of 200). The same applies to > 'e-'. > ___ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > You can use KAlgebra code which is inside kdeedu. If you're interested, tell me and i'll give you some pointers. Aleix ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On October 6, 2009, Aleix Pol wrote: > You can use KAlgebra code which is inside kdeedu. instead of libqalculate? besides creating an odd dependency, what would the benefits be? -- Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Development Frameworks signature.asc Description: This is a digitally signed message part. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
Well, depends a lot on how odd it is, you could install it within kdeedu the same way we do with the kalgebra plasmoid. There's no odd dependency crossing here. Benefits, you would be using some maintained code inside KDE. Technically kalgebra still lacks some features though, but I'm working on it. Aleix On Tue, Oct 6, 2009 at 8:47 PM, Aaron J. Seigo wrote: > On October 6, 2009, Aleix Pol wrote: > > You can use KAlgebra code which is inside kdeedu. > > instead of libqalculate? besides creating an odd dependency, what would the > benefits be? > > -- > Aaron J. Seigo > humru othro a kohnu se > GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 > > KDE core developer sponsored by Qt Development Frameworks > > ___ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > > ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
In data martedì 6 ottobre 2009 20:57:00, Aleix Pol ha scritto: : > Well, depends a lot on how odd it is, you could install it within kdeedu > the same way we do with the kalgebra plasmoid. There's no odd dependency > crossing here. > > Benefits, you would be using some maintained code inside KDE. Technically > kalgebra still lacks some features though, but I'm working on it. > > Aleix > > On Tue, Oct 6, 2009 at 8:47 PM, Aaron J. Seigo wrote: > > On October 6, 2009, Aleix Pol wrote: > > > You can use KAlgebra code which is inside kdeedu. > > > > instead of libqalculate? besides creating an odd dependency, what would > > the benefits be? > > > > -- > > Aaron J. Seigo > > humru othro a kohnu se > > GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 > > > > KDE core developer sponsored by Qt Development Frameworks > > > > ___ > > Plasma-devel mailing list > > Plasma-devel@kde.org > > https://mail.kde.org/mailman/listinfo/plasma-devel > Well, ATM I would prefer to stick to libqalculate, since I already have some experience with it. I will have a look at the KAlgebra code anyway. Thanks for the suggestion. Matteo ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
In data martedì 6 ottobre 2009 20:56:07, Aaron J. Seigo ha scritto: : > On October 6, 2009, Matteo Agostinelli wrote: > > * how should I detect the presence of qalculate on the system? Should I > > let CMake find the library and then use the preprocessor (#ifdef, ) > > thus making it a compile-time optional dependency? > > yes, i think it should be compile time. easiest way would probably be to > create two classes, one with a libqalculate implementation and one with the > qscript implementation and use one or the other in the #ifdef. Ok, so I will take this approach. > > * it was mentioned that thread safety is important in this case. How can > > I find out if libqalculate is thread safe? > > the inexact way would be to try it out in krunner ;) > > the more exact way requires looking at the code in libqalculate itself and > seeing if any non-local state (e.g. global or class variables) exist and if > so if the code that uses them are protected against reentrancy issues. I'll try following the more exact way ;) > > * I think it would be nice if the runner respects the same settings of > > the plasmoid (if it's being used). Is there a way to do this, apart from > > reading the plasma-desktop-appletsrc file? > > right now the settings aren't even kept between applets; if you want that, > then you need to change the calls to m_applet->config() in > QalculateSettings to m_applet->globalConfig(). > > as for sharing the settings between plasmoids and runners in krunner, you'd > have to do that manually in some fashion. > > you can't, however, assume plasma-desktop-appletsrc exists. safest would be > to create a separate config file for qalculate usage in kde > (libqalculaterc?). > > BTW, while looking at the code I found a bug in the runner. The > > expression 'e+' is interpreted as '^' instead of '*10^'. So if you type > > 2e+2 you currently get the wrong result (4 instead of 200). The same > > applies to 'e-'. > > please feel free to fix that :) done :) Matteo ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On Tuesday 06 October 2009 19:09:02 Matteo Agostinelli wrote: > Hello, > > as suggested by Aaron in a previous discussion, I am having a look at the > calculator runner with the purpose of extending the capabilities of the > runner by using libqalculate when it is available... There already is such an animal. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On October 6, 2009, Aleix Pol wrote: > Well, depends a lot on how odd it is, you could install it within kdeedu > the same way we do with the kalgebra plasmoid. There's no odd dependency > crossing here. the problem would be that we would then have two calculation plugins: one in kdebase (because a calculator isn't really optional in krunner) and one in kdeedu. we'd either need to ship both together (which means kdebase) or we need to provide a way for one plugin to automatically deactivate another. that would probably mean implementing a category system for specific types of functionality for which only one plugin should be active for (e.g. "Calculator") and a ranking system as we have with KTrader (so the kalgebra runner could install at a higher rank than the default qscript one). before we go through all that trouble: is is there a way we can use KAlgebra from multiple threads without problems? it's perfectly fine to instantiate some state object(s) in each call to AbstractRunner::match, but they need to either not have any shared data with other classes (which may contain code executed in a different thread) or be thread safe. -- Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Development Frameworks signature.asc Description: This is a digitally signed message part. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On October 6, 2009, David Baron wrote: > On Tuesday 06 October 2009 19:09:02 Matteo Agostinelli wrote: > > Hello, > > > > as suggested by Aaron in a previous discussion, I am having a look at the > > calculator runner with the purpose of extending the capabilities of the > > runner by using libqalculate when it is available... > > There already is such an animal. where? (i love it when people say such things but don't actually say where so we can all go on a merry hunt ;) i see the one in playground/base/plasma/runners/qalculate, but it's Matteo's runner. so i assume he's aware of it ;) is there another one somewhere? -- Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Development Frameworks signature.asc Description: This is a digitally signed message part. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On Tuesday 06 October 2009 22:36:52 Aaron J. Seigo wrote: > On October 6, 2009, David Baron wrote: > > On Tuesday 06 October 2009 19:09:02 Matteo Agostinelli wrote: > > > Hello, > > > > > > as suggested by Aaron in a previous discussion, I am having a look at > > > the calculator runner with the purpose of extending the capabilities of > > > the runner by using libqalculate when it is available... > > > > There already is such an animal. > > where? > > (i love it when people say such things but don't actually say where so we > can all go on a merry hunt ;) > > i see the one in playground/base/plasma/runners/qalculate, but it's > Matteo's runner. so i assume he's aware of it ;) > > is there another one somewhere? > Sorry 'bout that. This is another thing that is not eye-candly on kde-look http://www.kde-look.org/content/show.php/Qalculator+Runner?content=106649 Listed as a "plasmoid binary" but it is a runner. This apparanlty runs qalc (from libqalculate project). Mayb this is the source to teach me how to run recoll from a runner. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On Tue, Oct 6, 2009 at 10:27 PM, Aaron J. Seigo wrote: > On October 6, 2009, Aleix Pol wrote: > > Well, depends a lot on how odd it is, you could install it within kdeedu > > the same way we do with the kalgebra plasmoid. There's no odd dependency > > crossing here. > > the problem would be that we would then have two calculation plugins: one > in > kdebase (because a calculator isn't really optional in krunner) and one in > kdeedu. we'd either need to ship both together (which means kdebase) or we > need to provide a way for one plugin to automatically deactivate another. > > that would probably mean implementing a category system for specific types > of > functionality for which only one plugin should be active for (e.g. > "Calculator") and a ranking system as we have with KTrader (so the kalgebra > runner could install at a higher rank than the default qscript one). > > before we go through all that trouble: is is there a way we can use > KAlgebra > from multiple threads without problems? it's perfectly fine to instantiate > some state object(s) in each call to AbstractRunner::match, but they need > to > either not have any shared data with other classes (which may contain code > executed in a different thread) or be thread safe. > > -- > Aaron J. Seigo > humru othro a kohnu se > GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 > > KDE core developer sponsored by Qt Development Frameworks > > ___ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > > As for thread safety, there should be not much of a problem, most of the code is not very interdepent. I'm actually already calculating 3D graphs and it simply works (there's an ugly hack to be able to use the same variable set, but that will be solved in an upcoming patch). Well anyway I planned to write the runner at some point, I just have a too large todo list right now (as everyone else i guess). Maybe I'll come up with it at some point before 4.5. Aleix ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
Yes, I am aware of the existence that runner, however I was not entirely satisfied by its functionality. First, instead of using libqalculate it uses an external 'qalc' process and then reads the result from standard output. Second, it is not easily configurable. Then there were probably other reasons that I cannot remember :) That's why I started writing my own runner in playground. Moreover, the idea now is to have just a *single* calculator runner that optionally uses libqalculate. Matteo On Tue, Oct 6, 2009 at 23:04, David Baron wrote: > On Tuesday 06 October 2009 22:36:52 Aaron J. Seigo wrote: >> On October 6, 2009, David Baron wrote: >> > On Tuesday 06 October 2009 19:09:02 Matteo Agostinelli wrote: >> > > Hello, >> > > >> > > as suggested by Aaron in a previous discussion, I am having a look at >> > > the calculator runner with the purpose of extending the capabilities of >> > > the runner by using libqalculate when it is available... >> > >> > There already is such an animal. >> >> where? >> >> (i love it when people say such things but don't actually say where so we >> can all go on a merry hunt ;) >> >> i see the one in playground/base/plasma/runners/qalculate, but it's >> Matteo's runner. so i assume he's aware of it ;) >> >> is there another one somewhere? >> > > Sorry 'bout that. This is another thing that is not eye-candly on kde-look > http://www.kde-look.org/content/show.php/Qalculator+Runner?content=106649 > > Listed as a "plasmoid binary" but it is a runner. This apparanlty runs qalc > (from libqalculate project). Mayb this is the source to teach me how to run > recoll from a runner. > ___ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: Calculator runner
On Wed, Oct 7, 2009 at 8:33 AM, Matteo Agostinelli wrote: > Yes, I am aware of the existence that runner, however I was not > entirely satisfied by its functionality. First, instead of using > libqalculate it uses an external 'qalc' process and then reads the > result from standard output. Second, it is not easily configurable. Running bc in the background like this was why I rewrote the calculator runner to use qtscript in the first place. Rich. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel