move sqlite db to mediacard

git-svn-id: http://www.neo1973-germany.de/svn@229 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
fgau 2009-01-13 18:07:35 +00:00
parent 34ce50a97c
commit c57f7e0695
11 changed files with 115 additions and 155 deletions

View file

@ -9,10 +9,12 @@ from epydial import *
class AudioScreen(EdjeGroup): class AudioScreen(EdjeGroup):
toggle = 0 toggle = 0
volume = 0.9
def __init__(self, screen_manager): def __init__(self, screen_manager):
EdjeGroup.__init__(self, screen_manager, AUDIO_SCREEN_NAME) EdjeGroup.__init__(self, screen_manager, AUDIO_SCREEN_NAME)
PyneoController.get_mp3_tags() PyneoController.set_volume(self.volume)
self.part_text_set("volume_label", "volume %d%%" % (self.volume*100))
def register_pyneo_callbacks(self): def register_pyneo_callbacks(self):
PyneoController.register_callback("on_get_mp3_tags", self.on_get_mp3_tags) PyneoController.register_callback("on_get_mp3_tags", self.on_get_mp3_tags)
@ -22,10 +24,9 @@ class AudioScreen(EdjeGroup):
@edje.decorators.signal_callback("music_player_send", "*") @edje.decorators.signal_callback("music_player_send", "*")
def on_edje_signal_audio_screen_triggered(self, emission, source): def on_edje_signal_audio_screen_triggered(self, emission, source):
# if source == "button_play_pause": if source == "headline":
# self.signal_emit("button_play_pause", " ") PyneoController.pause_music()
# PyneoController.pause_music() PyneoController.show_dialer_screen()
# PyneoController.show_dialer_screen()
if source == "play_pause": if source == "play_pause":
if self.toggle == 0: if self.toggle == 0:
self.signal_emit("key1", "") self.signal_emit("key1", "")
@ -38,14 +39,19 @@ class AudioScreen(EdjeGroup):
PyneoController.get_mp3_tags() PyneoController.get_mp3_tags()
if source == "stop": if source == "stop":
self.signal_emit("key2", "") self.signal_emit("key2", "")
PyneoController.pause_music()
self.toggle = 0 self.toggle = 0
PyneoController.stop_music() PyneoController.stop_music()
PyneoController.get_mp3_tags() PyneoController.get_mp3_tags()
if source == "track_right": if source == "track_right":
PyneoController.next_music() PyneoController.next_music()
PyneoController.get_mp3_tags()
if source == "track_left": if source == "track_left":
PyneoController.previous_music() PyneoController.previous_music()
PyneoController.get_mp3_tags() if source == "player-plus":
self.volume = self.volume + 0.1
PyneoController.set_volume(self.volume)
self.part_text_set("volume_label", "volume %d%%" % (self.volume*100))
if source == "player-minus":
self.volume = self.volume - 0.1
PyneoController.set_volume(self.volume)
self.part_text_set("volume_label", "volume %d%%" % (self.volume*100))
print 'source: ', source print 'source: ', source

View file

@ -19,6 +19,8 @@ images {
image: "track_left.png" COMP; image: "track_left.png" COMP;
image: "track_right.png" COMP; image: "track_right.png" COMP;
image: "stop.png" COMP; image: "stop.png" COMP;
image: "player-plus.png" COMP;
image: "player-minus.png" COMP;
} }
color_classes { color_classes {
@ -87,6 +89,33 @@ program { \
action: SIGNAL_EMIT "music_player_send" n; \ action: SIGNAL_EMIT "music_player_send" n; \
} \ } \
#define key1(n, x, y)\
part {\
name: n;\
type: IMAGE;\
description {\
image {\
normal: n".png";\
}\
rel1 {\
to: pad1;\
relative: (x+1)/4-1/8 (y+1)/5-1/10;\
offset: -50 -50;\
}\
rel2 {\
to: pad1;\
relative: (x+1)/4-1/8 (y+1)/5-1/10;\
offset: 50 50;\
}\
}\
}\
program { \
name: "button_"n"_signal_emit"; \
signal: "mouse,down,*"; \
source: n; \
action: SIGNAL_EMIT "music_player_send" n; \
} \
#define key_play_pause(n, n1, n2, x, y)\ #define key_play_pause(n, n1, n2, x, y)\
part {\ part {\
name: n;\ name: n;\
@ -143,138 +172,6 @@ program { \
target: n; \ target: n; \
} \ } \
#define HBAR(barname, bordercolor, borderwidth, rel1x, rel1y, rel2x, rel2y, left_right_offset) \
part { \
name: "description_"barname; \
type: TEXT; \
mouse_events: 0; \
description { \
color_class: bordercolor; \
rel1 { relative: rel1x rel1y; }; \
rel2 { relative: rel2x rel2y; }; \
text { \
text: barname; \
font: "VeraBd"; \
size: 16; \
} \
} \
} \
part { \
name: "button_left_bg_"barname; \
type: RECT; \
description { \
state: "default" 0; \
color_class: "unvisible"; \
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
rel2 { relative: rel2x/4 rel2y; offset: 0 0; }; \
} \
description { \
state: "default" 0.5; \
inherit: "default" 0; \
color_class: "unvisible"; \
rel1.offset: 0 -5; \
rel2.offset: 0 5; \
} \
description { \
state: "default" 1; \
inherit: "default" 0; \
} \
} \
part { \
name: "button_right_bg_"barname; \
type: RECT; \
description { \
state: "default" 0; \
color_class: "unvisible"; \
rel1 { relative: 1-rel2x/4 rel1y; offset: 0 0; }; \
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
} \
description { \
state: "default" 0.5; \
inherit: "default" 0; \
color_class: "unvisible"; \
rel1.offset: 0 -5; \
rel2.offset: 0 5; \
} \
description { \
state: "default" 1; \
inherit: "default" 0; \
} \
} \
part { \
name: "button_left_"barname; \
type: TEXT; \
mouse_events: 0; \
description { \
state: "default" 0; \
color_class: bordercolor; \
rel1 { to: "button_left_bg_"barname; relative: 0 0; }; \
rel2 { to: "button_left_bg_"barname; relative: 1 1; }; \
text { \
text: "-"; \
font: "VeraBd"; \
size: 52; \
fit: 1 1; \
} \
} \
} \
part { \
name: "button_right_"barname; \
type: TEXT; \
mouse_events: 0; \
description { \
state: "default" 0; \
color_class: bordercolor; \
rel1 { to: "button_right_bg_"barname; relative: 0 0; }; \
rel2 { to: "button_right_bg_"barname; relative: 1 1; }; \
text { \
text: "+"; \
font: "VeraBd"; \
size: 52; \
fit: 1 1; \
} \
} \
} \
part { \
name: "scale_fg_"barname; \
type: RECT; \
mouse_events: 0; \
description { \
color_class: scale; \
rel1 { relative: rel2x/4 (rel1y+((rel2y-rel1y)/4)); }; \
rel2 { relative: 1-rel2x/4 (rel2y-((rel2y-rel1y)/4)); }; \
} \
} \
program { \
name: "button_left_bg_"barname"_animation"; \
signal: "mouse,down,*"; \
source: "button_left_bg_"barname; \
action: STATE_SET "default" 0.5; \
target: "button_left_bg_"barname; \
} \
program { \
name: "button_left_bg_"barname"_animation_end"; \
signal: "mouse,up,*"; \
source: "button_left_bg_"barname; \
action: STATE_SET "default" 1; \
target: "button_left_bg_"barname; \
transition: DECELERATE 0.1; \
} \
program { \
name: "button_right_bg_"barname"_animation"; \
signal: "mouse,down,*"; \
source: "button_right_bg_"barname; \
action: STATE_SET "default" 0.5; \
target: "button_right_bg_"barname; \
} \
program { \
name: "button_right_bg_"barname"_animation_end"; \
signal: "mouse,up,*"; \
source: "button_right_bg_"barname; \
action: STATE_SET "default" 1; \
target: "button_right_bg_"barname; \
transition: DECELERATE 0.1; \
} \
collections { collections {
group { group {
@ -309,6 +206,12 @@ collections {
} }
} }
} }
program {
name: "button_headline_signal_emit";
signal: "mouse,down,*";
source: "headline";
action: SIGNAL_EMIT "music_player_send" "headline";
}
part { part {
name: "mp3_tags"; name: "mp3_tags";
type: TEXTBLOCK; type: TEXTBLOCK;
@ -334,13 +237,45 @@ collections {
rel2 { relative: 1.0 1.0; offset: -25 -25; } rel2 { relative: 1.0 1.0; offset: -25 -25; }
} }
} }
part {
name: "pad1";
type: RECT;
description {
visible: 0;
rel1 { relative: 0.0 1.0; offset: 25 -275; }
rel2 { relative: 1.0 1.0; offset: -25 -175; }
}
}
part {
name: "volume_label";
type: TEXT;
description {
state: "default" 0;
color_class: "button_inactive";
rel1 {
to: pad1;
relative: 1/2 1/2;
offset: -90 -90;
}
rel2 {
to: pad1;
relative: 1/2 1/2;
offset: 90 90;
}
text {
text: "volume 100%";
size: 20;
font: "VeraBd";
fit: 1 1;
}
}
}
key("track_left", 0, 2) key("track_left", 0, 2)
key("stop", 1, 2) key("stop", 1, 2)
key_play_pause("play_pause", "play", "pause", 2, 2) key_play_pause("play_pause", "play", "pause", 2, 2)
key("track_right", 3, 2) key("track_right", 3, 2)
key1("player-minus", 0, 2)
HBAR("volume", button_inactive, 1, 0, 46/70, 1, 56/70, 10); key1("player-plus", 3, 2)
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -19,7 +19,8 @@ WM_INFO = ("epydial", "epydial")
EDJE_FILE_PATH = "data/themes/blackwhite/" EDJE_FILE_PATH = "data/themes/blackwhite/"
PIX_FILE_PATH = "/media/card/hon/" PIX_FILE_PATH = "/media/card/hon/"
TRACK_FILE_PATH = "/media/card/track/" TRACK_FILE_PATH = "/media/card/track/"
DB_FILE_PATH = "data/db/my.sqlite" DB_FILE_PATH = "/media/card/epydialdb/epydial.sqlite"
DB_PATH = "/media/card/epydialdb/"
PIX_WEATHER_FILE_PATH = "data/themes_data/blackwhite/images/stardock_weather/" PIX_WEATHER_FILE_PATH = "data/themes_data/blackwhite/images/stardock_weather/"
MP3_FILE_PATH = "/media/card/mp3/" MP3_FILE_PATH = "/media/card/mp3/"
@ -153,11 +154,12 @@ class PyneoController(object):
# No error (anymore) # No error (anymore)
if class_._dbus_timer: class_._dbus_timer.stop() if class_._dbus_timer: class_._dbus_timer.stop()
# Register our own D-Bus callbacks (device status, new calls, power status, new sms) # Register our own D-Bus callbacks (device status, new calls, power status, new sms, new music title)
class_.gsm_wireless.connect_to_signal("Status", class_.on_gsm_wireless_status, dbus_interface=DIN_WIRELESS) class_.gsm_wireless.connect_to_signal('Status', class_.on_gsm_wireless_status, dbus_interface=DIN_WIRELESS)
class_.gsm_wireless.connect_to_signal('New', class_.check_new_call, dbus_interface=DIN_WIRELESS) class_.gsm_wireless.connect_to_signal('New', class_.check_new_call, dbus_interface=DIN_WIRELESS)
class_.pwr.connect_to_signal("Status", class_.on_pwr_status, dbus_interface=DIN_POWERED) class_.pwr.connect_to_signal('Status', class_.on_pwr_status, dbus_interface=DIN_POWERED)
class_.gsm_sms.connect_to_signal('New', class_.check_new_sms, dbus_interface=DIN_STORAGE) class_.gsm_sms.connect_to_signal('New', class_.check_new_sms, dbus_interface=DIN_STORAGE)
class_.mp3.connect_to_signal('Status', class_.on_mp3_status, dbus_interface='org.pyneo.Music')
@classmethod @classmethod
def get_pwr_status(class_): def get_pwr_status(class_):
@ -447,41 +449,45 @@ class PyneoController(object):
class_.callsigs.append(class_.call.connect_to_signal('Status', CallStatus, dbus_interface=DIN_CALL, )) class_.callsigs.append(class_.call.connect_to_signal('Status', CallStatus, dbus_interface=DIN_CALL, ))
class_.callsigs.append(class_.call.connect_to_signal('End', CallEnd, dbus_interface=DIN_CALL, )) class_.callsigs.append(class_.call.connect_to_signal('End', CallEnd, dbus_interface=DIN_CALL, ))
@classmethod
def on_mp3_status(class_, newmap):
newmap = dedbusmap(newmap)
print 'Music MP3 Status: %s' %newmap
class_.notify_callbacks("on_get_mp3_tags", newmap)
@classmethod @classmethod
def check_new_sms(class_, newmap,): def check_new_sms(class_, newmap,):
def InsertSms(status, from_msisdn, time, text): def InsertSms(status, from_msisdn, time, text):
connection = connect(DB_FILE_PATH) connection = connect(DB_FILE_PATH)
cursor = connection.cursor() cursor = connection.cursor()
cursor.execute("INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES ('" \ cursor.execute('INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES (?, ?, ?, ?)', (status, from_msisdn, time, text,))
+ status + "', '" + from_msisdn + "', '" + time + "', '" + text + "')")
connection.commit() connection.commit()
res = dedbusmap(newmap) res = dedbusmap(newmap)
for n in res: for n in res:
sm = object_by_url(n) sm = object_by_url(n)
content = dedbusmap(sm.GetContent()) content = dedbusmap(sm.GetContent(dbus_interface=DIN_ENTRY))
InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8')) InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8'))
print '--- NEW SMS:', content['from_msisdn'], content['time'], content['text'].encode('utf-8') print '--- NEW SMS:', content['from_msisdn'], content['time'], content['text'].encode('utf-8')
# class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE) class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE)
@classmethod @classmethod
def first_check_new_sms(class_): def first_check_new_sms(class_):
def InsertSms(status, from_msisdn, time, text): def InsertSms(status, from_msisdn, time, text):
connection = connect(DB_FILE_PATH) connection = connect(DB_FILE_PATH)
cursor = connection.cursor() cursor = connection.cursor()
cursor.execute("INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES ('" \ cursor.execute('INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES (?, ?, ?, ?)', (status, from_msisdn, time, text,))
+ status + "', '" + from_msisdn + "', '" + time + "', '" + text + "')")
connection.commit() connection.commit()
try: try:
res = class_.gsm_sms.ListAll(dbus_interface=DIN_STORAGE) res = class_.gsm_sms.ListAll(dbus_interface=DIN_STORAGE)
for n in res: for n in res:
sm = object_by_url(n) sm = object_by_url(n)
content = dedbusmap(sm.GetContent()) content = dedbusmap(sm.GetContent(dbus_interface=DIN_ENTRY))
InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8')) InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8'))
except: except:
print '--- NULL new sms' print '--- NULL new sms'
# class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE) class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE)
@classmethod @classmethod
def show_sms_screen(class_): def show_sms_screen(class_):
@ -535,6 +541,18 @@ class PyneoController(object):
def get_mp3_tags(class_): def get_mp3_tags(class_):
class_.notify_callbacks("on_get_mp3_tags", class_.mp3.GetStatus(dbus_interface='org.pyneo.Music')) class_.notify_callbacks("on_get_mp3_tags", class_.mp3.GetStatus(dbus_interface='org.pyneo.Music'))
@classmethod
def set_volume(class_, status):
class_.mp3.SetVolume(status, dbus_interface='org.pyneo.Music')
@classmethod
def db_check(class_):
if not os.path.exists(DB_FILE_PATH):
os.mkdir(DB_PATH)
print '--- Add db path: ', DB_PATH
os.system('cp %s %s' % ('./data/db/epydial.sqlite', DB_PATH))
print '--- Add sqlite'
from dialer_screen import * from dialer_screen import *
from incall_screen import * from incall_screen import *
from gsm_status_screen import * from gsm_status_screen import *
@ -587,6 +605,7 @@ class Dialer(object):
self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self)) self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self))
self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self)) self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self))
PyneoController.db_check()
PyneoController.set_playlist_from_dir() PyneoController.set_playlist_from_dir()
PyneoController.power_up_gsm() PyneoController.power_up_gsm()
PyneoController.get_gsm_keyring() PyneoController.get_gsm_keyring()