Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Database > Administrative frontents

    QtAlchemy 0.8.0

    Download button

    No screenshots available
    Downloads: 377  Tell us about an update
    User Rating:
    Rated by:
    Excellent (5.0/5)
    7 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Joel B. Mohler | More programs
    GPL / FREE
    June 28th, 2012, 05:32 GMT [view history]
    ROOT / Database / Administrative frontents

     Read user reviews (0)  Refer to a friend  Subscribe

    QtAlchemy description

    A framework for developing GUI database applications using SQLAlchemy and PyQt

    QtAlchemy is a collection of Qt Model-View classes and helper functions to aid in rapid development of desktop database applications. It aims to provide a strong API for exposing foreign key relationships in elegant and immediate ways to the user of applications. Context menus, searches and combo-boxes and tabbed interfaces are all utilized. The use of SQLAlchemy makes it possible that these features are supported on a variety of database backends with virtually no code changes.

    The Command class gives a way to construct menus and toolbars from decorated python functions. The power of this becomes more evident when bound to a view where the command function can then receive the identifier of the selected item of the view. This provides a flexible way to link commands to any sqlalchemy query generated views.

    Full documentation is available at http://qtalchemy.org .

    QtAlchemy has been developed with python 2.6.x, SQLAlchemy 0.6.x and PyQt 4.7.x. It is expected that it would be functional on all nearby versions. There is an effort made to make sure that feature parity is attained for windows and linux (and mac too, but I don't have one).

    QtAlchemy is expected to fully work with PySide as of version 1.0.4. PySide support can be enabled by running the use_pyside.sh shell script which merely changes the imports from PyQt4 to PySide.

    Example

    In the interests of being concise, the example given here does not reference a database.

    QtAlchemy using API2 of PyQt so we need to enable that before importing PyQt4

     >>> import sip
     >>> sip.setapi('QString', 2)
     >>> sip.setapi('QVariant', 2)


    The UserAttr property class provides yet another type defined python property. The purpose of reinventing this was to ensure that we could interact with our models sufficiently and provide a uniform experience for SQLAlchemy column properties and UserAttr properties.

     >>> from qtalchemy import UserAttr
     >>> import datetime
     >>> class Person(object):
     ... name=UserAttr(str,"Name")
     ... birth_date=UserAttr(datetime.date,"Birth Date")
     ... age=UserAttr(int,"Age (days)",readonly=True)
     ...
     ... @age.on_get
     ... def age_getter(self):
     ... return (datetime.date.today()-self.birth_date).days


    With this declaration, we can declare a person and compute their age:

     >>> me = Person()
     >>> me.name = "Joel"
     >>> me.birth_date = datetime.date(1979,1,9)
     >>> me.age #depends on today! -- #doctest: +SKIP
     11746
     >>> me.age-(datetime.date.today()-datetime.date(2011,1,9)).days # on birthday 1> from PyQt4 import QtCore, QtGui
     >>> from qtalchemy import MapperMixin, LayoutLayout, ButtonBoxButton, LayoutWidget
     >>>
     >>> class PersonEdit(QtGui.QDialog,MapperMixin):
     ... def __init__(self,parent,person):
     ... QtGui.QDialog.__init__(self,parent)
     ... MapperMixin.__init__(self)
     ...
     ... self.person = person
     ...
     ... vbox = QtGui.QVBoxLayout(self)
     ... mm = self.mapClass(Person)
     ... mm.addBoundForm(vbox,["name","birth_date"])
     ... mm.connect_instance(self.person)
     ...
     ... buttons = LayoutWidget(vbox,QtGui.QDialogButtonBox())
     ... self.close_button = ButtonBoxButton(buttons,QtGui.QDialogButtonBox.Ok)
     ... buttons.accepted.connect(self.btnClose)
     ...
     ... def btnClose(self):
     ... self.submit() # changes descend to model on focus-change; ensure receiving the current focus
     ... self.close()


    And, now, we only need some app code to actually kick this off

     >>> app = QtGui.QApplication([])
     >>> sam = Person()
     >>> sam.name = "Samuel"
     >>> d = PersonEdit(None,sam)
     >>> d.exec_() # gui interaction -- #doctest: +SKIP
     0
     >>> sam.age # assumes selection of yesterday in the gui -- #doctest: +SKIP
     1


    Development

    QtAlchemy is still in heavy core development as much as my work schedule allows. The documentation is growing as the ideas are fleshed out and I learn sphinx for the general documentation generation. We strive for full doc-test coverage as possible, but PyQt model-view and gui impose certain complications on doc-tests.

    My expectations for 0.7 continue to increase so I gave in to a 0.6.10 release under the new name of qtalchemy. This comes paired with a brand new (and not really finished) web page http://qtalchemy.org. Before a 0.7 release, I aim to have:

    - document InputYoke selection
    - PBMdiTable and PBSearchDialog move to qtalchemy.ext


    Product's homepage

    Requirements:

    · Python

    What's New in This Release: [ read full changelog ]

    · Change to PySide as default imports
    · Relax license from GPL to LGPL
    · Improve yoke change handling
    · Create new PopupKeyListing for foreign key entry

      


    TAGS:

    Python framework | database frontend | GUI database | SQLAlchemy | database | frontend

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM