Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Hunt <ghunt@ghunt-desktop.(none)>2010-06-09 17:56:47 (GMT)
committer George Hunt <ghunt@ghunt-desktop.(none)>2010-06-09 17:56:47 (GMT)
commitc66d824660bdd9709bde659daf97c0a4017acfcc (patch)
tree9e2c0818767fc6e6aa1606c0aa7073377f2472bb
parent9d6532ee816a8d7ee51de06293f379125bec5c59 (diff)
startup problems
-rw-r--r--assets/190x152shadow.pngbin0 -> 1981 bytes
-rw-r--r--assets/stack_background.pngbin0 -> 11113 bytes
-rw-r--r--assets/trash_empty.pngbin0 -> 64751 bytes
-rw-r--r--assets/trash_full.pngbin0 -> 75031 bytes
-rw-r--r--display.py54
-rw-r--r--ezscroll/__init__.py0
-rw-r--r--sources.py4
7 files changed, 34 insertions, 24 deletions
diff --git a/assets/190x152shadow.png b/assets/190x152shadow.png
new file mode 100644
index 0000000..a5eb36e
--- /dev/null
+++ b/assets/190x152shadow.png
Binary files differ
diff --git a/assets/stack_background.png b/assets/stack_background.png
new file mode 100644
index 0000000..1aa0c95
--- /dev/null
+++ b/assets/stack_background.png
Binary files differ
diff --git a/assets/trash_empty.png b/assets/trash_empty.png
new file mode 100644
index 0000000..0aefec7
--- /dev/null
+++ b/assets/trash_empty.png
Binary files differ
diff --git a/assets/trash_full.png b/assets/trash_full.png
new file mode 100644
index 0000000..41764e9
--- /dev/null
+++ b/assets/trash_full.png
Binary files differ
diff --git a/display.py b/display.py
index 077d21c..758e79d 100644
--- a/display.py
+++ b/display.py
@@ -49,7 +49,8 @@ import gobject
#application imports
from dbphoto import *
from sources import *
-from ezscroll import ScrollBar
+import ezscroll
+from ezscroll.ezscroll import ScrollBar
#pick up activity globals
@@ -413,7 +414,7 @@ class DisplayAlbums():
global background_color
global album_background_color
global album_selected_color
- self.album_rows = None
+ self.album_rows = []
self.album_column_width = album_column_width
self.db = db #pointer to the open database
self._activity = activity #pointer to the top level activity
@@ -522,11 +523,11 @@ class DisplayAlbums():
if album_id == self.trash_id:
if count > 0:
- fn = os.path.join('startup_images','trash_full.png')
+ fn = os.path.join('assets','trash_full.png')
else:
- fn = os.path.join('startup_images','trash_empty.png')
+ fn = os.path.join('assets','trash_empty.png')
else:
- fn = os.path.join('startup_images','stack_background.png')
+ fn = os.path.join('assets','stack_background.png')
stack = pygame.image.load(fn)
frame = pygame.transform.scale(stack,(180,155))
surf.blit(frame,(0,0))
@@ -629,13 +630,7 @@ class DisplayAlbums():
self.accumulation_target,id = self.db.get_last_album()
_logger.debug('last album id was %s and id was %s'%(self.accumulation_target,id))
if not self.accumulation_target:
- self.accumulation_target = str(datetime.datetime.today())
- _logger.debug('new album is:%s'%self.accumulation_target)
- self.db.create_update_album(self.accumulation_target,name)
-
- #save off the unique id(timestamp)as a continuing target
- self.db.set_last_album(self.accumulation_target)
-
+ self.create_new_album()
else: #see if this is a request to change name
if jobject_id == '':
jobject_id = self.accumulation_target
@@ -645,7 +640,14 @@ class DisplayAlbums():
self.refresh_album_rows()
self.paint_albums()
-
+ def create_new_album(self):
+ self.accumulation_target = str(datetime.datetime.today())
+ _logger.debug('new album is:%s'%self.accumulation_target)
+ self.db.create_update_album(self.accumulation_target,name)
+
+ #save off the unique id(timestamp)as a continuing target
+ self.db.set_last_album(self.accumulation_target)
+
def change_name_of_current_album(self,name):
"""create a 'current' album (if necessary) and name it"""
self.add_to_current_album('',name)
@@ -678,7 +680,11 @@ class DisplayAlbums():
index = self.get_album_index_at_xy(album_x, album_y)
jobject_id = self.disp_many.get_jobject_id_at_xy(img_x,img_y)
if not index or not jobject_id: return
- self.db.add_image_to_album(self.album_rows[index]['subcategory'], jobject_id)
+ #if index is larger than max, we want a new album
+ if index > len(self.album_rows):
+ self.create_new_album()
+ else:
+ self.db.add_image_to_album(self.album_rows[index]['subcategory'], jobject_id)
##################### ALERT ROUTINES ##################################
@@ -742,7 +748,8 @@ class Application():
db = None
def __init__(self, activity):
self._activity = activity
- self.in_grab = False
+ self.in_grab = False
+ self.file_tree = None
def first_run_setup(self):
#scan the datastore and add new images as required
@@ -750,7 +757,8 @@ class Application():
number_of_pictures = self.ds_sql.scan_images()
if number_of_pictures < 10: #put 11 images for learning and demo
source = os.path.join(os.environ['SUGAR_BUNDLE_PATH'],'startup_images')
- self.ds_sql.copy_tree_to_ds(source)
+ self.file_tree = FileTree(self.db)
+ self.file_tree.copy_tree_to_ds(source)
number_of_pictures = self.ds_sql.scan_images()
if number_of_pictures < 10:
_logger.debug('failed to initalize the datastore with at least 10 pictures')
@@ -797,10 +805,6 @@ class Application():
exit()
self.db = self.DbAccess_object
- #if the picture table is empty, populate it from the journal, and initialize
- if ds_count < 10:
- self.first_run_setup()
-
running = True
do_display = True
@@ -812,8 +816,14 @@ class Application():
# Clear Display
screen.fill((255,255,255)) #255 for white
- pygame.display.flip()
-
+ x = 0
+ pygame.display.flip()
+
+ #if the picture table is empty, populate it from the journal, and initialize
+ if ds_count < 10:
+
+ self.first_run_setup()
+
self.albums = DisplayAlbums(self.db, self._activity)
self.albums.paint_albums()
diff --git a/ezscroll/__init__.py b/ezscroll/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ezscroll/__init__.py
diff --git a/sources.py b/sources.py
index 44733f2..674e088 100644
--- a/sources.py
+++ b/sources.py
@@ -174,7 +174,7 @@ class FileTree():
added = 0
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
- abs_path = os.path.join(dirpath, filename)
+ abspath = os.path.join(dirpath, filename)
#print abs_path
mtype = ''
chunks = abspath.split('.')
@@ -198,7 +198,7 @@ class FileTree():
shutil.copyfile(abspath,dest)
ds.set_file_path(dest)
datastore.write(ds,transfer_ownership=True)
- self.db.update_picture(ds.object_id,abspath)
+ self.db.create_picture_record(ds.object_id,abspath)
ds.destroy()
added += 1
return added