Layout when added in a nick - how to make it do something useful?

15 views
Skip to first unread message

Chris Green

unread,
Mar 11, 2013, 8:08:49 AM3/11/13
to sql...@googlegroups.com
I have added an empty layout template to one of my nicks:-

sqledit --create-template layout jessica

However I am now completely lost as to how to use it. I've looked at
the demo layouts by running the demo.py but all that does is create
standalaone layouts.

How do I, for example, change a date column in my sqledit display
created when I run:-

sqledit jessica

where nicks has:-

[jessica]
URL = sqlite:////home/chris/.sqledit/money.db
table = jessica
load = True

--
Chris Green

Alessandro Dentella

unread,
Mar 11, 2013, 3:35:48 PM3/11/13
to sql...@googlegroups.com
Hi Chris,

On Mon, Mar 11, 2013 at 12:08:49PM +0000, Chris Green wrote:
> I have added an empty layout template to one of my nicks:-
>
> sqledit --create-template layout jessica
>
> However I am now completely lost as to how to use it. I've looked at
> the demo layouts by running the demo.py but all that does is create
> standalaone layouts.

This should have created a directory named .sqledit/jessica
Within that directory you should find a file named layout.py with commented
code::

from sqlkit.db import utils

#LAYOUT =
#utils.register_layout('table_name', LAYOUT)

that you are supposed to uncomment and modify according to you're needs:

from sqlkit.db import utils

LAYOUT = """
field1, field2
"""
utils.register_layout('table_name', LAYOUT)


> How do I, for example, change a date column in my sqledit display
> created when I run:-
you want to change a date column into what?



cheers
sandro
*:-)


--
Sandro Dentella *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy



Chris Green

unread,
Mar 11, 2013, 4:12:37 PM3/11/13
to sql...@googlegroups.com
On Mon, Mar 11, 2013 at 08:35:48PM +0100, Alessandro Dentella wrote:
> Hi Chris,
>
> On Mon, Mar 11, 2013 at 12:08:49PM +0000, Chris Green wrote:
> > I have added an empty layout template to one of my nicks:-
> >
> > sqledit --create-template layout jessica
> >
> > However I am now completely lost as to how to use it. I've looked at
> > the demo layouts by running the demo.py but all that does is create
> > standalaone layouts.
>
> This should have created a directory named .sqledit/jessica
> Within that directory you should find a file named layout.py with commented
> code::
>
> from sqlkit.db import utils
>
> #LAYOUT =
> #utils.register_layout('table_name', LAYOUT)
>
Yes, OK, I have that - so far so good.


> that you are supposed to uncomment and modify according to you're needs:
>
> from sqlkit.db import utils
>
> LAYOUT = """
> field1, field2
> """
> utils.register_layout('table_name', LAYOUT)
>
Yes, uncommented, but should it get used by the 'parent' nick
automatically or do I have to do something else as well?


>
> > How do I, for example, change a date column in my sqledit display
> > created when I run:-
> you want to change a date column into what?
>
I don't want to change it into anything really but it would be lovely to
have one of those little date selection widgets by it.

The table I'm playing with has the following columns:-
id
Date
Description
Credit
Debit

I'd like to have a date selection widget for the Date column and also
make the Description column wider when the table is opened by sqledit.

--
Chris Green
Reply all
Reply to author
Forward
0 new messages