### Author Topic: ticalc.org "Package Manager"  (Read 18699 times)

0 Members and 1 Guest are viewing this topic.

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
##### Re: ticalc.org "Package Manager"
« Reply #30 on: December 05, 2010, 05:30:11 pm »
Also, the new version has been uploaded to ticalc.org here. And there's a version with the Unix line endings here. (Copies are also available in Cemetech's archives- and I'll replace the one in the first post in a second with a link to ticalc.org).

#### TC01

• LV6 Super Member (Next: 500)
• Posts: 344
• Rating: +9/-0
##### Re: ticalc.org "Package Manager"
« Reply #31 on: December 05, 2010, 05:35:44 pm »
Also, the new version has been uploaded to ticalc.org here. And there's a version with the Unix line endings here. (Copies are also available in Cemetech's archives- and I'll replace the one in the first post in a second with a link to ticalc.org).

No, it's not... but you should be able to just do this if you want to run a search (although, you probably don't want to be printing to a command line in a wxPython GUI):

Code: [Select]
import calcpkgdata = calcpkg.ticalcSearchIndex(msg[14:])print calcpkg.structureSearchOutput("File Path/Category:", "File Name:")print "======================================================================================================================="for datum in data: print calcpkg.structureSearchOutput(datum[0], datum[1])
There are other functions too, for everything that can be called without needing a command line.

So you probably could make a GUI for it now without any further changes.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

#### DJ Omnimaga

• Now active at https://codewalr.us
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55821
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: ticalc.org "Package Manager"
« Reply #32 on: December 05, 2010, 06:17:58 pm »
Cool update! I was gonna say maybe you could put it in Omnimaga archives, but unfortunately it's not very programming-oriented, so it wouldn't fit in any category.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
##### Re: ticalc.org "Package Manager"
« Reply #33 on: December 05, 2010, 06:25:21 pm »
Also, the new version has been uploaded to ticalc.org here. And there's a version with the Unix line endings here. (Copies are also available in Cemetech's archives- and I'll replace the one in the first post in a second with a link to ticalc.org).

No, it's not... but you should be able to just do this if you want to run a search (although, you probably don't want to be printing to a command line in a wxPython GUI):

Code: [Select]
import calcpkgdata = calcpkg.ticalcSearchIndex(msg[14:])print calcpkg.structureSearchOutput("File Path/Category:", "File Name:")print "======================================================================================================================="for datum in data: print calcpkg.structureSearchOutput(datum[0], datum[1])
There are other functions too, for everything that can be called without needing a command line.

So you probably could make a GUI for it now without any further changes.

I will have a look at the code later and see if it possible to make a wxPython program out of it.

#### TC01

• LV6 Super Member (Next: 500)
• Posts: 344
• Rating: +9/-0
##### Re: ticalc.org "Package Manager"
« Reply #34 on: December 15, 2010, 06:57:22 pm »
I've been working on a new version lately. Here are some of the changes:

A list switch (-f) which lets you search for the file name rather than the program name. For instance, if you want to search for all ticalc.org files containing "quadratic" in the filename rather than the name of the program, you'd use -f with list.

I've been typing "search" instead of "list", so I've redirected the "search" command to "list"- both calcpkg.py search and calcpkg.py list will do the same things.

The searching options can now be ran with calcpkg.py get as well.

I also added a logging system, so if you run it with the -l switch every text message printed to the terminal will also be written to calcpkg.log (with a note indicating the date ran).

I added a "clean" command that deletes all .tar.gz and .zip files from the folder that calcpkg.py is in (it also removes the calcpkg.log file). Please note: the files are not sent to the recycle bin/trash, so they're deleted for good.

And finally, I added options to disable the confirmation prompts when running calcpkg.py get (-n) and calcpkg.py update (-p). I'd have preferred them to be the same letter but optparse wouldn't let me.

For people who wish to use calcpkg as part of another program (*cough* making a GUI *cough*), there are several other changes.

The options are now parsed in main(), and then passed as boolean or string arguments to various functions (unlike before, when the opts object was passed directly to each function using it). This will make it easier for another program to search using options.

Finally, I rewrote the text output system. An end user shouldn't notice any changes, but you will if you look at the code. (This is a bit complex). Python will let you redirect print to any object with a write() function. I've done the following:

1. Changed (almost) all instances of "print" to "printcalcpkg()", a custom-defined function.
2. printcalcpkg() will print it's text to whatever object is stored in "calcpkg.output" (the global variable output from inside the program)
3. Set the default output to a "calcpkgOutput" object I've included- which prints to the terminal and has an option to also log output to a logfile (how logging works)

If you want to see an example of how to make a custom "printing" object look at the code.

What does this mean? It means that you could redirect all the print statements to some kind of GUI- a big textbox or something.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

#### DJ Omnimaga

• Now active at https://codewalr.us
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55821
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: ticalc.org "Package Manager"
« Reply #35 on: December 16, 2010, 04:24:55 am »
Nice update.

I also just remembered something: Ticalc won't let you search words shorter than 4 words. I assume your package manager can, right? Because this was annoying on ticalc when you wanted to search for "RPG" for example but it told you your query was too short. X.x
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### TC01

• LV6 Super Member (Next: 500)
• Posts: 344
• Rating: +9/-0
##### Re: ticalc.org "Package Manager"
« Reply #36 on: December 16, 2010, 07:55:18 am »
Nice update.

I also just remembered something: Ticalc won't let you search words shorter than 4 words. I assume your package manager can, right? Because this was annoying on ticalc when you wanted to search for "RPG" for example but it told you your query was too short. X.x

Yes, it can.

Because this doesn't (any more) go through ticalc.org's search engine and instead searches through the index files directly, and the searching code I wrote doesn't limit the length of a query.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

#### TC01

• LV6 Super Member (Next: 500)
• Posts: 344
• Rating: +9/-0
##### Re: ticalc.org "Package Manager"
« Reply #37 on: December 19, 2010, 11:17:27 am »
I've released version 0.7 (To the Cemetech archives, and it will be sitting on ticalc.org's pending file list in a bit). Download link is: here (and here)

I might as well just post the changelog from the readme:

-Added an option to search the file index rather than the name index (-f)
-Added logging functionality (-l) that logs output to a textfile, calcpkg.log
-Added clean command, which removes all .zip, .tar.gz, and .log files from the current folder
-Added mechanism for easily redirecting output (allowing another program to make all the print statements go somewhere else)
-Added a fake "search" command that does the same thing as "list"
-Included a sample script that shows how calcpkg can be imported in a module and used as part of another program
-Fixed bug where -g and -m searching options ran together would not work
-The searching options now work with the count and get commands as well

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
##### Re: ticalc.org "Package Manager"
« Reply #38 on: December 19, 2010, 11:20:03 am »
Nice  TC01!!! Now it'll be really easy to work on it and make it GUI!

#### DJ Omnimaga

• Now active at https://codewalr.us
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55821
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: ticalc.org "Package Manager"
« Reply #39 on: December 19, 2010, 11:53:31 am »
Cool! When it is finished someone could indeed make a GUI. Not that it's fully necessary, though. I like the features so far.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
##### Re: ticalc.org "Package Manager"
« Reply #40 on: December 19, 2010, 01:52:25 pm »
Cool! When it is finished someone could indeed make a GUI. Not that it's fully necessary, though. I like the features so far.

The GUI will basically be an easier way to choose options (a choice list, you can choose 1,2, or 3 options at the same time), a text control to input text, and a button that lists, allows download and counts, all the features in one button

#### Netham45

• LV11 Super Veteran (Next: 3000)
• Posts: 2103
• Rating: +213/-4
• *explodes*
##### Re: ticalc.org "Package Manager"
« Reply #41 on: December 19, 2010, 01:55:23 pm »
Could you make it poll the new files xml feed to get new data?

If it doesn't at least know the last file in the xml feed, assume the data is old and needs updated, and prompt?

#### TC01

• LV6 Super Member (Next: 500)
• Posts: 344
• Rating: +9/-0
##### Re: ticalc.org "Package Manager"
« Reply #42 on: December 19, 2010, 02:03:31 pm »
Could you make it poll the new files xml feed to get new data?

If it doesn't at least know the last file in the xml feed, assume the data is old and needs updated, and prompt?

Hmm... I could, yes. But it would mean I'd need to make at least two web requests (one to the feed, one to the fileinfo page of the last file) each time it runs. Before, the only thing that was making web requests was the updating and the downloading (to save on bandwith).

What I could do is add an opt switch to do this when it starts. Or an opt switch to stop it from doing this.

Cool! When it is finished someone could indeed make a GUI. Not that it's fully necessary, though. I like the features so far.

The GUI will basically be an easier way to choose options (a choice list, you can choose 1,2, or 3 options at the same time), a text control to input text, and a button that lists, allows download and counts, all the features in one button

Well, easier is subjective. But yes.

Also, the GUI will just be a choice- the command-line program will still work separately.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

#### DJ Omnimaga

• Now active at https://codewalr.us
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55821
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: ticalc.org "Package Manager"
« Reply #43 on: December 19, 2010, 03:57:29 pm »
Yeah it depends of people. I myself can,t stand doing everything through command prompt if it means navigating through directories and stuff, and I never remember the batch file syntax. Some people prefer guis, but guis means lower compatibility.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF