[ANN] sqlkit 0.8.5

2009-01-16 Thread Sandro Dentella
I'm pleased to announce rel 0.8.5 of sqlkit, that adds many improvements.

In this release localization has been added. I'd be very pleased if someone
would like to contribute localization file for any language (but italian).

Changes in this release:

sqlkit 0.8.5 - 16.1.09  

* localization: added localization for numbers and dates
added localization for messages
-- now waiting for translations  ;-)  --
* table: - added a smart way to automatically set dimentions of the
   table based on info retrieved from the database
   (thanks to Pietro Battiston)
 - complete rewrite of the column setup function
 - added a basic multiline cellRenderer
 - grately improved the navigation with Tab that now
   correctly triggers validation/completion
* fields: many improvements in clean_value/validation
* mask: - added handling of comments
- fixed integer/float miniwiget (0 was rendered as  '')
- text now uses gtk.WRAP_WORD
- fixed current_idx was a class attribute not an instance attr
* layout: added check and hints on errors for Panes widgets
* django_syntax: fix in typo
* filters: fixed handlung of boolena & NULL check in related tables
* signals: - record_selected -> record-selected to follow gtk standard
   - added records-displayed
* widgets/layout: added label_map support
* sqlwidget: rationalized menu entries


The package
---
SQLkit PyGtk package provides Mask and Table widgets to edit database
data. It's meant as a base for database desktop applications.

The application
---
It also provides 'sqledit' a PyGTK application based on sqlkit that can be
used from command line to browse and edit data.

The package has 2 very rich demo suites for sql widgets (the main one in
sqlkit/demo/sql/demo.py) and for layout creation
  
Main features of sqlkit:


  * editor of databases in 2 modes: table & mask
  * based on sqlalchemy: can cope with many different databases
  * very powerfull filtering capabilities:
- each field can be used to filter records
- filter may span relationship
- date filtering possible also on relative basis (good for saved 
  queries)
  * completion on all text field and foreign keys
  * very easy way to draw a layout for mask views
  * completely effortless editing of relationships
  * very easy way to set defaults
  * possibility to display totals of numeric fields
  * any possible sql constraint can be attached to a Mask or a 
Table. It can be expressed a s a normal sqlalchemy query or with 
django-like syntax
  * sqledit: python script to edit db
  

Sqlkit is based on:
---
  * python (>= 2.4) 
  * PyGtk   
  * Sqlalchemy (>= 0.5)
  * glade
  * dateutils


Dowload & more:
---

  * http://docs.argolinux.org/sqlkit/sqlkit/download.html
  * hg clone http://hg.argolinux.org/py/sqlkit
  * google group: http://groups.google.it/group/sqlkit/
  * License: GNU GPL


-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy
--
http://mail.python.org/mailman/listinfo/python-list


Re: emacs python modes [was Re: python/python output buffers]

2008-08-15 Thread sandro dentella


>
> This has been the subject of a recent thread here. Emacs now ships with
> a different python mode named python.el. You'll have to manually
> (re)install the original python-mode.el.
>
> HTH

Thanks. I did search for it and got lost in too many different post on
python mode... Now I found it.

sandro
--
http://mail.python.org/mailman/listinfo/python-list


python/python output buffers

2008-08-15 Thread sandro dentella
Hi,

  I'm having a little problem while using python mode. I'm used to hit
C-c C-c and have a Python Output buffer opened with the output. Now,
on Ubuntu 7.10 and  8.04, C-c C-c sends to the Python buffer that is
not raised in a window. I need to hit C-c C-z to see it.

  First of all I'm puzzled and would like to understand what makes the
difference. I guess is some defaults that changed in the system
configuration.

  What makes the difference between the two behaviors?

Thanks in advance
sandro
*:-)
--
http://mail.python.org/mailman/listinfo/python-list


psycopg2, gtk and float

2006-06-14 Thread Sandro Dentella
Hi all,

while building an applycation in pygtk I noticed that psycopg2 returns the
floats rouded (eg: 4.123 -> 4.0).

This turns out to be a problem of psycopg2 (psycopg behaves correctly) when
you 'import gtk' !!! It behaves correctly with numeric/decimal, though.

I'm totally clueless. Any hints?

TIA
sandro
*:-)




import gtk
import psycopg2 as ps2

DB = "host=localhost dbname=test user=test port=5432 password=xxx"
conn = ps2.connect(DB)
cursor = conn.cursor()
cursor.executeq("SELECT DISTINCT a_float FROM numbers ")
conn.commit()

rows = cursor.fetchall()
for row in rows:
print row[0]


-- 
Sandro Dentella  *:-)
e-mail: [EMAIL PROTECTED] 
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __init__.py, __path__ and packaging

2006-05-05 Thread Sandro Dentella
>   Now, why you couldn't do "dbg.DBG = ..."? Very simple... "from
> module import *" doesn't give you a dbg /module/, it only gives you
> references to each piece inside the module.

  really the reason why I wanted that should probably be solved in other
  ways. I just wanted to split my dbg module in different files but load the
  dbg module in one single operation:

  dbg/
  |-- __init__.py
  |-- lib
 |-- __init__.py
 |-- debug.py
 |-- gtk_dbg.py

  and inside dbg/__init__.py I used "from dbg.debug import *" so that a single 
  'import dbg' could present me the module 'debug' (of course in this simple
  case seems easier to put debug.py directly under dbg, but my main case is
  a much more complex module, with a tree structure that reflects the
  relation between modules that I want to hide to the end user).

  But to summarize, if I use 'from my_module import *' there is no way to reach 
  directly 'my_module' and set a variable there?

Thanks again
sandro
*:-)

> I'm trying to fix the packaging of a very simple package, but some problem
> show me that I have not well understood 
> 
> the structure of my package (some debug functions) is as follows:
> 
> python/
> `-- dbg/
>|-- __init__.py
>`-- lib
>|-- __init__.py
>|-- debug.py
>`-- gtk_dbg.py
> 
> 
> my sys.path includes 'python' and I wanted that the content of debug.py was
> simply included by: 'import dbg', so I wrote dbg/__init__.py as follows:
> 
> import os
> Dir = os.path.dirname(__file__)
> __path__ = [os.path.join(Dir, 'lib')]
> from debug import *
> 
> 
-- 
Sandro Dentella  *:-)
e-mail: [EMAIL PROTECTED] 
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __init__.py, __path__ and packaging

2006-05-04 Thread Sandro Dentella
In comp.lang.python, hai scritto:
> Sandro Dentella wrote:
>> The structure of my package:
>> 
>> python/
>> `-- dbg/
>>|-- __init__.py
>>`-- lib
>>|-- __init__.py
>>|-- debug.py
>>`-- gtk_dbg.py
>> 
>> my sys.path includes 'python' and I wanted that the content of debug.py was
>> simply included by: 'import dbg', so I wrote dbg/__init__.py as follows:
>> 
>> import os
>> Dir = os.path.dirname(__file__)
>> __path__ = [os.path.join(Dir, 'lib')]
>> from debug import *
>
> What you probably want in python/dbg/__init__.py to get values is:
>
>  from dbg.lib.debug import *

This does not work:

   Traceback (most recent call last):
 File "", line 1, in ?
 File "dbg/__init__.py", line 8, in ?
   from dbg.lib.debug import *
   ImportError: No module named lib.debug



>
>> BUT, if I set some variables they are not correctly seen:
>> import dbg
>> dbg.DBG = 1
>> function test included in debug.py raises NameError:
>> def test():
>> print DBG
>> NameError: global name 'DBG' is not defined`
>> 
>> What's happening? DBG seems to be set, as shown by dir(dbg)... any hints?
> You misunderstand modules and python variables.  Each module has a
> dictionary associating the names of its globals and their current
> values.  After:
>  import dbg.lib.debug, dbg.lib.gtk_dbg
> you have four modules:
>  dbg # Corresponds to python/dbg/__init__.py
>  dbg.lib # Corresponds to python/dbg/lib/__init__.py
>  dbg.lib.debug   # Corresponds to python/dbg/lib/debug.py
>  dbg.lib.gtk_dbg # Corresponds to python/dbg/lib/gtk_dbg.py
> Each has its own globals.
> after:
>  dbg.DBG = 1
> the dbg module's global dictionary contains an entry mapping 'DBG' to 1
> after:
>  dbg.DBG = 1+2
> the dbg module's global dictionary contains an entry mapping 'DBG' to 3
>
> In no case will an assignment to a global in dbg cause an assignment to
> anything in dbg.lib.debug.  The "from dbg.lib.debug import *" statement
> can be seen as a module import followed by a fancy multiple assignment,
> where module dbg.lib.debug is first imported, then its globals are
> assigned to globals of the same names in module dbg.

This confirms to me that I'm seriously confused... so I started with a very
simple setup:
$ cat dbg.py
DBG = 1
def test():
global DBG
print DBG

def set():
global DBG
DBG = 3


$ cat m.py
from  dbg import *

test()
#dbg.DBG = 2   ## does not work, no way to assign in module dbg
set()  # this acts in dbg module and sets 'DBG = 3'
test() # test the value of DBG
print DBG


$ python m.py
1
3  # changed by 'set' that was 'imported'
1  # value of local DBG

isn't this contraddicting you words:

> can be seen as a module import followed by a fancy multiple assignment,
> where module dbg.lib.debug is first imported, then its globals are
> assigned to globals of the same names in module dbg.

So: which is the way I can change a value of a package 'imported', only with
a function that sets it? is there a way to assign the value directly?
is there any way to make some introspection of what is really there (in
dbg)?

Thanks angain for any possible hint.

sandro
*:-)



-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


__init__.py, __path__ and packaging

2006-05-03 Thread Sandro Dentella

Hi everybody,

I'm trying to fix the packaging of a very simple package, but some problem
show me that I have not well understood the whole mechanism

The structure of my package (some debug functions) is as follows:

python/
`-- dbg/
   |-- __init__.py
   `-- lib
   |-- __init__.py
   |-- debug.py
   `-- gtk_dbg.py


my sys.path includes 'python' and I wanted that the content of debug.py was
simply included by: 'import dbg', so I wrote dbg/__init__.py as follows:

import os
Dir = os.path.dirname(__file__)
__path__ = [os.path.join(Dir, 'lib')]
from debug import *

It seems to work:

python$ python -c 'import dbg; print dir(dbg)'
['DBG', 'Dir', '__builtins__', '__doc__', '__file__', '__name__', \
'__path__', 'caller', 'debug', 'dshow', 'os', 're', 'show_caller', \
'sql_debug', 'sys']

BUT, if I set some variables they are not correctly seen:

import dbg
dbg.DBG = 1


function test included in debug.py raises NameError:

def test():
print DBG

NameError: global name 'DBG' is not defined`

What's happening? DBG seems to be set, as shown by dir(dbg)... any hints?
I'd also accept a hint for a different approch, if it's the case, but I'd
really would also understant this issue

Thanks in advance
sandro
*:-)

--
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


gtk.spinbutton and set_value

2006-03-29 Thread Sandro Dentella
Hi all,

  why my spinbutton doesn't show '120'?
  why, if I write in a number, it is reset to 0 wen Enter is pressed?

  TYA
  sandro


   import gtk

   w = gtk.Window()
   spin = gtk.SpinButton()
   w.add(spin)
   w.show_all()
   spin.set_value(120)
   gtk.main()


-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


gtk tooltips and toolbutton

2006-03-29 Thread Sandro Dentella
Hi all,

Why doesn't the tooltip show up in this toolbutton?
Thanks in advance 

  import gtk

  w = gtk.Window()
  T = gtk.Toolbar()
  T.set_show_arrow(False)

  tb = gtk.ToolButton('gtk-refresh')

  tt = gtk.Tooltips()
  tt.set_tip(tb, "tooltip...")

  w.add(T)
  T.add(tb)
  w.show_all()
  gtk.main()



-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


beginner question on dinamin buiding of arg list

2006-03-05 Thread Sandro Dentella

I need to build-up an arg list to pass to a function. 

Suppose I have a dictionary:

  opts = { 'user' : 'jack', 'addr' : 'Green Str.'}

and I want to build a cmd line like this:

  select( user='jack', addr='Green Str.' )

I'm clueless...

TIA
sandro
*:-)


-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


lists: += vs. .append() & oddness with scope of variables

2006-03-05 Thread Sandro Dentella
I'd like to understand why += operator raises an error while .append() does
not. My wild guess is the parses treats them differently but I cannot
understand why this depends on scope of the variables (global or class
variables):


a = [0]

class foo(object): 

def __init__(self):
print "a: ", a
# += does not work if 'a' is global
#a += [1]
a.append(2)
print "a= ", a

class bar(object): 

b = [0]

def __init__(self):
print "b: ", self.b
# += *does* work if 'a' is class var
self.b += [1]
self.b.append(2)
print "b= ", self.b


if __name__ == '__main__':
x = foo()
y = bar()

a:  [0]
a=  [0, 2]
b:  [0]
b=  [0, 1, 2]

uncommenting 'a += [1]' would raise:

a:
Traceback (most recent call last):
  File "c1.py", line 26, in ?
x = foo()
  File "c1.py", line 7, in __init__
print "a: ", a
UnboundLocalError: local variable 'a' referenced before assignment

TIA
sandro
*:-)


-- 
Sandro Dentella  *:-)
e-mail: [EMAIL PROTECTED] 
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 2D canvas for GTK

2006-01-09 Thread Sandro Dentella
Il 2006-01-09, John Bauman <[EMAIL PROTECTED]> ha scritto:
>
> "Sandro Dentella" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>>I need a (decent) canvas for PyGTK. I used tkinter.canvas with real 
>>pleasure
>> in the past but now I need to use the canvas in a Gtk application. Does
>> anybody know of one with similar capabilities? It must work on Windows 
>> too.
>> It must be able to produce postscript output.
>
> I think that PyCairo might be what you're looking for, at least if you're 
> using gtk 2.8.

No, that's definitely a lower level tool. I need someting that has
rectangles, lines, possibility to move object around, easy bindings, tags
for objects, grouping. All that is already in tkinter.canvas but I need to
use it from a GTK application.

Any other ideas?

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


2D canvas for GTK

2006-01-08 Thread Sandro Dentella
I need a (decent) canvas for PyGTK. I used tkinter.canvas with real pleasure
in the past but now I need to use the canvas in a Gtk application. Does
anybody know of one with similar capabilities? It must work on Windows too.
It must be able to produce postscript output.

Thanks

sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


project-like or plan extension?

2006-01-08 Thread Sandro Dentella

I'd like to find a plan or project-like extension to use in a PyGtk
application. I need very basic functionaluties: time-zooming, possibility to
set tooltip for objects, possibility to move around chunks of a job.

Any ideas?

TIA
sandro

-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter & GTK in the same application?

2006-01-08 Thread Sandro Dentella

I need to use tkinter.canvas in a gtk application. Is that any possible. I
guess I should use threads: is there any example of how to start the 2
mainloops? 

Thanks for any possible hint
sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.tksql.orgTkSQL Home page - My GPL work
-- 
http://mail.python.org/mailman/listinfo/python-list