Posts Tagged ‘SPHYRA’

SPHYRA idea dump: core ideas; templates

Tuesday, January 2nd, 2007

(Edit 2007-12-11: I no longer work for this company or on this project.)

One of the concepts in SPHYRA is that the main type of data that the user works with is an Item entity, which has only a name and a creation timestamp. (See the schema source for the code behind all this.)

Everything else related to the item is available using the m (many) namespace provided by Schevo. Right now this includes Tag entities, related via TaggedItem entities.

Ultimately, this will also include relationships with other items, things like contact information, notes, journal entries, appointments, invoices, and so forth. What the user sees in the UI as far as what you can do with an item is based on the items tags, which always include one FeaturedTag.

Examples of FeaturedTag would be person, place, thing, job, appointment, or whatever the user's needs and imagination come up with. More on this as it gets implemented...

Templates

SPHYRA, much like Schevo, is heavily driven by business use cases, and recently also driven by personal use cases. Either way, everything that has gone into each product has.

Now that the backstory is there to get people up to speed, here is the 'template' idea that I'm elaborating on here mostly for my own remembrance. :)

SPHYRA v1 is has been in use for the last few months to track customers and jobs at a retail computer sales/repair shop. Most recently, the techs have stopped using the work order paper forms used to track progress on jobs, and are now simply printing out the job view in SPHYRA.

Humans forget things; that's why we use machines to run software and store loads of information about all sorts of things :)

One of the things that a human could forget in this case would be specific steps involved in a task such as routine Windows XP maintenance (virus scan, anti-spyware, registry fixes, driver updates, etc.)

To make this easier for the techs, we'll add a feature to SPHYRA where an item tagged "template" would be available to quickly create a new item. For instance, a job might be named "Windows XP Maintenance", tagged "job template winxp", and have a todo list with the tasks listed above, some links to commonly-used resources, and so on. SPHYRA copies the information associated with the template to the new job, remove the "template" tag, and the user proceeds with editing the new job.

“searchhi” wrapped using ToscaWidgets

Sunday, December 31st, 2006

I wanted to make sure search terms were highlighted when searching for items in SPHYRA, so I set off to find something that would help me do so. I came across Trac's implementation, which uses JavaScript and is based on the one here.

In those cases, the code is used to highlight search terms that were entered by the user in a referring page, such as a Google search result page. What I desired was a way to specify my own words, and only highlight within a certain area.

Here's the first pass of a ToscaWidgets based widget I came up with for doing this.

Taking ToscaWidgets for a spin

Thursday, December 28th, 2006

I finally had the time to fiddle around with ToscaWidgets inside Pylons recently, and came up with a top bar for SPHYRA that is driven by information in a Schevo database.

  • The widget class takes care of converting parameters given to the widget to data structures usable by the Genshi template.
  • The widget template converts it into a fairly simple navigation bar.
  • The controller base class populates a widget using the database and makes it available to every controller.

Notes

Some notes for my own edification, as I learn this from the ground up as it's being developed. (Thanks, Alberto, et al, for doing all the hard work!)

Creating a simple widget class usually involves the following:

from toscawidgets.core import Widget

class MyWidget(Widget):

    # 'params' are the valid keyword arguments that can be passed to
    # __init__ and __call__
    params = [
        'abc',
        ]

    # 'template' is 'templatetype:templatename'
    template = 'genshi:myapp.widgets.templates.mywidget'

    # Set default values for parameters.
    abc = 123

    # When ToscaWidgets prepares a dictionary to be sent to the
    # template specified above, it calls update_params against
    # that dictionary.  Use update_params to modify the parameters
    # set on the widget to a form that is 'massaged' enough for
    # the template to make proper use of.
    def update_params(self, d):
        d['abc'] = d.get('abc', 0) * 2

To include a widget in the final HTML, given that c.widget is an instance of a ToscaWidget:

${c.widget}

To create a new widget based on an existing one, just call the widget instance with the parameters you want to override:

c.widget = c.widget(some_param=some_new_value)

Questions and thoughts

Is there a way for the TopBar widget to include an image resource for the logo, and then be configured in such a way that it is used as the default unless overridden by a parameter that contains the URL for a different image?

I'd also like to get my TopBar-specific CSS packaged up with the TopBar widget itself, and simplify it a little more.

I'm sure I'll figure these out in time but if anyone responds to this I'll give them a free cookie. (*)

(*) Cookies not guaranteed to be edible. Cookies may consist of electronic transactions already made in the course of reading this text.

Introducing SPHYRA

Thursday, December 28th, 2006

(Edit 2007-12-11: I no longer work for this company or on this project.)

OST Systems (the company I work for), is opening the code and development of version 2 of its SPHYRA product to the free software community. I'm excited by this, since SPHYRA is the main software project I've been working on for the last several months.

The code is available at our OSTcode site, as well as instructions for installing and running it on Ubuntu and OSX platforms.