[Pychord-commits] r58 - in trunk: . pgui pychord2
danilo at garage.maemo.org
danilo at garage.maemo.org
Mon Mar 17 15:06:55 EET 2008
Author: danilo
Date: 2008-03-17 15:06:54 +0200 (Mon, 17 Mar 2008)
New Revision: 58
Modified:
trunk/pgui/container.py
trunk/pgui/list.py
trunk/pychord.py
trunk/pychord2/pysql.py
trunk/pychord2/window_search.py
trunk/pychord2/window_show.py
Log:
Search Engine Fixed
Modified: trunk/pgui/container.py
===================================================================
--- trunk/pgui/container.py 2008-03-16 19:14:42 UTC (rev 57)
+++ trunk/pgui/container.py 2008-03-17 13:06:54 UTC (rev 58)
@@ -89,4 +89,5 @@
for obj in self.objects:
# For widgets
if obj.rect.collidepoint(pygame.mouse.get_pos()):
- return obj
\ No newline at end of file
+ return obj
+ return None
\ No newline at end of file
Modified: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py 2008-03-16 19:14:42 UTC (rev 57)
+++ trunk/pgui/list.py 2008-03-17 13:06:54 UTC (rev 58)
@@ -42,7 +42,8 @@
if self.lastMove > -4 and self.lastMove < 4:
obj = self.whoIsPress()
- obj.click()
+ if obj != None:
+ obj.click()
container.onClickRelease(self)
@@ -89,9 +90,8 @@
else:
self.autoScrollEnabled = True
self.autoScrollSpeed = speed
+
- print speed
-
def increaseSpeed(self):
self.autoScroll(self.autoScrollSpeed + 1)
Modified: trunk/pychord.py
===================================================================
--- trunk/pychord.py 2008-03-16 19:14:42 UTC (rev 57)
+++ trunk/pychord.py 2008-03-17 13:06:54 UTC (rev 58)
@@ -85,8 +85,6 @@
self.home = home
self.file = file
- print home, file
-
if not os.path.isfile(file):
f = open (file, 'w')
f.write('db='+ os.path.join( home, '.pychord.db' )+'\n')
Modified: trunk/pychord2/pysql.py
===================================================================
--- trunk/pychord2/pysql.py 2008-03-16 19:14:42 UTC (rev 57)
+++ trunk/pychord2/pysql.py 2008-03-17 13:06:54 UTC (rev 58)
@@ -35,7 +35,7 @@
connection = None
def __init__(self, dbFileName, tdName):
- print dbFileName
+ print dbFileName, tdName
self.connection = sqlite3.connect(dbFileName)
self.tdName = tdName
@@ -88,8 +88,9 @@
cur.execute(sql)
return cur.fetchall()
- def get (self, id):
+ def get (self, song):
cur = self.connection.cursor()
- sql = 'select tab from tabs where id=%s LIMIT 1'
- cur.execute(sql,(id))
+ sql = u'select tab from tabs where id=? LIMIT 1'
+ s = (song,)
+ cur.execute(sql,s)
return cur.fetchall()
\ No newline at end of file
Modified: trunk/pychord2/window_search.py
===================================================================
--- trunk/pychord2/window_search.py 2008-03-16 19:14:42 UTC (rev 57)
+++ trunk/pychord2/window_search.py 2008-03-17 13:06:54 UTC (rev 58)
@@ -2,6 +2,7 @@
from pgui import label
from pgui import input
from pgui import Ibutton
+from pgui import list
from pysql import *
import pygame
@@ -38,17 +39,28 @@
lblSearch = label(self, [10,10],"Searching", ptsize = 40)
self.addElement(lblSearch)
+ lst = list(self, [10,60], width=700, height=400, ptsize=35) # creating the widget
+ lst.setBackground((10,10,10))
+ self.addElement(lst)
+
i = 0
for l in res:
- j = label(self, [20, 80 + 50*i],l[2] + ' by ' + l[1] + '.',ptsize = 25)
- j.value = l[0]
- self.addElement(j)
+ j = l[2] + ', by ' + l[1] + ''
+ lbl = lst.addLine(j)
+ lbl.registerClickSlot(self.openSong, l[0])
i += 1
# If there ae no results
if i == 0:
- noresult = pywilabel([20, 200],'No result found',35)
+ noresult = label(self, [20, 200],'No result found',ptsize=35)
self.addElement(noresult)
+
+ def openSong(self, song):
+ from window_show import window_show
+ window = window_show(self.screen, self.pyc, song)
+ window.show()
+ self.repaint()
+
\ No newline at end of file
Modified: trunk/pychord2/window_show.py
===================================================================
--- trunk/pychord2/window_show.py 2008-03-16 19:14:42 UTC (rev 57)
+++ trunk/pychord2/window_show.py 2008-03-17 13:06:54 UTC (rev 58)
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
from pgui import window
-#from pgui import box
-#from pgui import label
-#from pgui import input
-#from pgui import locale
-#from pgui import Tbutton
+
from pgui import Ibutton
-#from pgui import combo
+
from chordlist import chordlist
+from pysql import *
+
from pygame.locals import *
@@ -25,7 +23,7 @@
self.pyc = pyc
self.SongCod = SongCod
p = pysql(pyc.opt['db'],pyc.opt['datadir'])
- res = p.get(id)
+ res = p.get(SongCod)
lines = res[0][0]
lines = lines.replace("\t"," ") # tabs -> 4 spaces
More information about the Pychord-commits
mailing list