forked from openlp/openlp
Head
This commit is contained in:
commit
76726e263e
@ -1,58 +0,0 @@
|
||||
This content can be found at this URL:
|
||||
http://netsuperbrain.com/Postmodern%20PostgreSQL%20Application%20Development.pdf
|
||||
|
||||
Page 11-15: QtDesigner
|
||||
Page 18-20: SQLAlchemy
|
||||
Page 21-23: PyQt - widget
|
||||
Page 24 : main
|
||||
Page 28 : py2exe and release
|
||||
|
||||
|
||||
==============================
|
||||
This is the destilled content.
|
||||
==============================
|
||||
|
||||
----------------
|
||||
** sqlalchemy **
|
||||
----------------
|
||||
from sqlalchemy import create_engine, MetaData, Table
|
||||
from sqlalchemy.orm import sessionmaker, mapper
|
||||
engine = create_engine( 'postgres://postgres@localhost/customers' )
|
||||
metadata = MetaData( bind=engine, reflect=True)
|
||||
Session = sessionmaker(bind=engine, autoflush=True,
|
||||
transactional=True)
|
||||
|
||||
class Customer(object): pass
|
||||
mapper( Customer, Table('customers', metadata ) )
|
||||
|
||||
session = Session()
|
||||
customer = Customer( businessName=“Jamb Safety”,
|
||||
website=“www.jamb.com” )
|
||||
session.save( customer )
|
||||
for customer in Session.query(Customer).filter(
|
||||
Customer.businessName.like(“Jamb%”)):
|
||||
print customer.businessName
|
||||
session.commit()
|
||||
|
||||
------------------------
|
||||
** release and py2exe **
|
||||
------------------------
|
||||
|
||||
from distutils.core import setup
|
||||
import py2exe
|
||||
import glob
|
||||
setup(
|
||||
name="Customers",
|
||||
author="Sankel Software",
|
||||
author_email="david@sankelsoftware.com",
|
||||
url="http://sankelsoftware.com",
|
||||
license=“GPL",
|
||||
version=“1.0.0",
|
||||
windows=[ { "script":"main.py“,}],
|
||||
options={"py2exe":{"includes":["sip”]}},
|
||||
data_files=[
|
||||
("forms",glob.glob("forms/*.ui")),
|
||||
] )
|
||||
|
||||
release:
|
||||
python setup.py py2exe --quiet --dist-dir=dist
|
Binary file not shown.
@ -58,6 +58,7 @@ create_statements = [
|
||||
id INTEGER NOT NULL,
|
||||
song_book_id INTEGER,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
alternate_title VARCHAR(255),
|
||||
lyrics TEXT NOT NULL,
|
||||
verse_order VARCHAR(128),
|
||||
copyright VARCHAR(255),
|
||||
@ -183,16 +184,18 @@ def import_songs():
|
||||
xml_verse_template = u'<verse label="%d" type="Verse"><![CDATA[%s]]></verse>'
|
||||
for row in rows:
|
||||
clean_title = unicode(row[1], u'cp1252')
|
||||
clean_lyrics = unicode(row[2], u'cp1252')
|
||||
clean_lyrics = unicode(row[2], u'cp1252').replace(u'\r\n', u'\n')
|
||||
clean_copyright = unicode(row[3], u'cp1252')
|
||||
verse_order = u''
|
||||
text_lyrics = clean_lyrics.split(u'\n\n')
|
||||
xml_verse = u''
|
||||
verses = []
|
||||
for line, verse in enumerate(text_lyrics):
|
||||
if not verse:
|
||||
continue
|
||||
xml_verse += (xml_verse_template % (line + 1, verse))
|
||||
verse_order += '%d ' % (line + 1)
|
||||
verses.append(u'V%d' % (line + 1))
|
||||
verse_order = u' '.join(verses)
|
||||
xml_lyrics = xml_lyrics_template % xml_verse
|
||||
search_title = prepare_string(clean_title)
|
||||
search_lyrics = prepare_string(clean_lyrics)
|
||||
|
@ -38,7 +38,7 @@ def sendData(options, message):
|
||||
print u'Errow thrown ', sys.exc_info()[1]
|
||||
|
||||
def format_message(options):
|
||||
return u'%s:%s' % (options.event, options.message)
|
||||
return u'%s:%s' % (u'alert', options.message)
|
||||
|
||||
def main():
|
||||
usage = "usage: %prog [options] arg1 arg2"
|
3
setup.py
3
setup.py
@ -68,7 +68,8 @@ OpenLP (previously openlp.org) is free church presentation software, or lyrics p
|
||||
url='http://openlp.org/',
|
||||
license='GNU General Public License',
|
||||
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
|
||||
scripts=['openlp.pyw', 'scripts/openlp-1to2-converter.py', 'scripts/bible-1to2-converter.py'],
|
||||
scripts=['openlp.pyw', 'scripts/openlp-1to2-converter.py',
|
||||
'scripts/bible-1to2-converter.py','scripts/openlp-remoteclient.py'],
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
install_requires=[
|
||||
|
Loading…
Reference in New Issue
Block a user