Showing posts with label gseos. Show all posts
Showing posts with label gseos. Show all posts

Wednesday, November 14, 2012

Python one-line if statement

After days of fiddling, I finally broke the code for the one-line if syntax in Python. This is so that my gseos menu options can call a python routine, and have the result from that routine be the condition for calling other functions. I had previously already figured out that these menu options were essentially just python statements and that I could have multiple statements by linking them together with semicolons. This extends it even further, probably further than the gseos architects even intended.

My menu items now look like this:

if routine(): statement1;statement2;statement3

The key breakthrough was that after the semicolon had to be one space (a tab did not work) and to give up using curly braces around the three statements.

Friday, August 31, 2012

Secret Gseos methods?

Found this in some of Martin's Python code, looks like exactly what we should have been using for many of our prompt boxes:

Gseos.MB_YESNO

Thursday, August 30, 2012

argument after * must be a sequence

While trying to call my new python code through a Gseos.Tsequencer, I kept getting this error: "argument after * must be a sequence". The code runs fine when called directly. It turns out the problem was because my routine had only one argument aside from the sequence ID. When you call a routine through the Tsequencer, you feed in your arguments and it prepends the sequence ID as the first argument. Other routines are called in the Tsequencer like: Gseos.Tsequencer("name", routine(argument1, argument2, argument3, argument4)). I was calling mine this way: Gseos.Tsequencer("name", routine(argument)). According to this site:

https://code.djangoproject.com/ticket/14088

I have to have the arguments to the routine in the format of a "tuple" (or maybe it's a "list"). I think this might be so that the overloading with the sequence ID can work. That would be like: Gseos.Tsequencer("name", routine(argument,)).

Sure enough, it worked!