import os
import runtime, config
from basemodel import GaugeStage,ListStage, NotifyStage, Stage
import status, uiconfig
from setting import setting
class VideoSettingNotifyStage(NotifyStage):
def __init__(self, message, cb=None):
icon = uiconfig.baloon_video_setting_icon
NotifyStage.__init__(self, message, icon, cb=cb)
class TelnumStage(Stage):
def __init__(self):
import ui
self.ui = ui.NormalDigitEditUI(_('Tel: '), '', _('Tel number'))
if setting.tel_number:
self.ui.set_text(setting.tel_number)
def handle_key(self, key):
if key == config.Menu1:
str_tel = self.ui.get_text()
setting.set_tel_number(str_tel)
if str_tel:
message = _('Tel number set')
else:
message = _('Tel number deleted')
stage = VideoSettingNotifyStage(message)
runtime.manager.change_stage(stage)
return True
elif key == config.Menu2:
if self.ui.get_text():
self.ui.delete_backward()
return True
else:
runtime.manager.back_stage()
return True
else:
return self.ui.handle_key(key)
temp_fluency = 0
class VideoFluencyStage(GaugeStage):
# title = _('VIDEO FLUENCY')
title = _('VIDEO QUALITY')
titleimage = 'icon_video_setting.png'# please change titileimage
def __init__(self):
global temp_fluency
fluency = 0
if status.videocall_mode == status.VideoCallConnected:
if temp_fluency == 0:
temp_fluency = setting.video_fluency
fluency = temp_fluency
else:
fluency = setting.video_fluency
GaugeStage.__init__(self, fluency)
def activate(self, value):
global temp_fluency
if config.videocall_debug:
print 'video fluency set to', value
setting.set_video_fluency(value)
if status.videocall_mode == status.VideoCallConnected:
temp_fluency = value
stage = VideoSettingNotifyStage(_('Video Quality set'))
runtime.manager.change_stage(stage)
class VideoFluencyForAdminStage(GaugeStage):
# title = _('VIDEO FLUENCY')
domonitor_forbidden = True
title = _('VIDEO QUALITY')
titleimage = 'icon_video_setting.png'# please change titileimage
def __init__(self):
global temp_fluency
fluency = 0
if status.videocall_mode == status.VideoCallConnected:
if temp_fluency == 0:
temp_fluency = setting.video_fluency
fluency = temp_fluency
else:
fluency = setting.video_fluency
GaugeStage.__init__(self, fluency)
step = 39
level_text = runtime.evas.text(text='5',font=(uiconfig.def_font, 12),pos=(189, 172), color=uiconfig.list_text_color)
self.ui.add(level_text)
level_text = runtime.evas.text(text='10',font=(uiconfig.def_font, 12),pos=(189+step, 172), color=uiconfig.list_text_color)
self.ui.add(level_text)
level_text = runtime.evas.text(text='15',font=(uiconfig.def_font, 12),pos=(189+step*2, 172), color=uiconfig.list_text_color)
self.ui.add(level_text)
level_text = runtime.evas.text(text='20',font=(uiconfig.def_font, 12),pos=(189+step*3+2, 172), color=uiconfig.list_text_color)
self.ui.add(level_text)
level_text = runtime.evas.text(text='24',font=(uiconfig.def_font, 12),pos=(189+step*4+3, 172), color=uiconfig.list_text_color)
self.ui.add(level_text)
def activate(self, value):
global temp_fluency
if config.videocall_debug:
print 'video fluency set to', value
setting.set_video_fluency(value)
if status.videocall_mode == status.VideoCallConnected:
temp_fluency = value
stage = VideoSettingNotifyStage(_('Video Quality set'))
runtime.manager.change_stage(stage)
class PcmUpstreamStage(ListStage):
icon = uiconfig.video_setting_icon
def __init__(self):
self.title = _('PCM UPSTREAM')
if setting.pcm_upstream == 0: # current is On
self.choice = _('Off'),
else:
self.choice = _('On'),
ListStage.__init__(self, self.choice)
def update_menu(self):
if setting.pcm_upstream == 0: # on
ListStage.change_choice(self, (_('Off'),))
else:
ListStage.change_choice(self, (_('On'),))
def show(self):
self.update_menu()
ListStage.show(self)
def modem_reboot(self):
import time, sys
os.system('/usr/local/bin/modem_hw_reset')
time.sleep(1)
# phone reboot
#MMW 2008.06.25 when reboot is called, reset vega and DCP related GPIO pin
import utils
utils.vega_reset_together()
#end of MMW
#MMW 2008.07.07 when reboot send disassoc to AP and then unload the driver
os.system('wlstop')
#end of MMW
os.system('reboot')
sys.exit()
def activate(self, index):
def cb():
if setting.pcm_upstream == 0: # on
setting.set_pcm_upstream(1)
runtime.modem.write('AT+PIG=1\r')
else:
setting.set_pcm_upstream(0)
runtime.modem.write('AT+PIG=0\r')
setting._save()
runtime.manager.back_stage('videosettingstage')
stage = VideoSettingNotifyStage(_('PCM upstream set.') , cb=cb)
runtime.manager.stack_stage(stage)
class VideoDimensionStage(ListStage):
# title = _('VIDEO DIMENSION')
icon = uiconfig.video_setting_icon
domonitor_forbidden = True
def __init__(self):
self.title = _('VIDEO SIZE')
self.choice = (_('Remote full screen'), _('Remote CIF'), _('Remote big/local small top'),_('Remote big/local small bottom') )
ListStage.__init__(self)
self.ui.set_focus(setting.video_dimension-8)
def activate(self, index):
index2 = index + 8
print 'ka....#####index2=', index2
setting.set_video_dimension(index2)
if config.videocall_debug:
print 'video mode set to', index
if index == 0:
choice_str = _('Remote full screen set')
elif index == 1:
choice_str = _('Remote CIF set')
elif index == 2:
choice_str = _('Remote big/local small top set')
elif index ==3:
choice_str = _('Remote big/local small bottom set')
stage = VideoSettingNotifyStage(choice_str)
runtime.manager.change_stage(stage)
class SnapshotStage(Stage):
name = "Snapshot"
def __init__(self, from_phonebook=False):
import ui
self.ui = ui.SnapshotUI()
self.end_call_timer = None
self.current_dimension = status.videocall_dimension
status.precapture_dimension = status.videocall_dimension
runtime.vdciapp.change_dimension(config.DIMENSION_REMOTE_CENTER)
self.from_phonebook = from_phonebook
#ka...3800 2007.06.01 카메라를 앞으로
# os.system('fb0top 0')
def handle_key(self, key):
if key == config.Menu1:
#ka...3800 MMI를 앞으로 2007.05.03
# os.system('fb0top 1')
if status.videocall_remote_mute == status.VideoMuteOn:
runtime.vdciapp.change_dimension(status.precapture_dimension, True)
runtime.manager.change_stage(NotifyStage(\
_('Remote capture not available'),uiconfig.baloon_photo_icon))
else:
import model
stage = model.VideoCallNotifyStage2( _('Snapshot stored!') )
runtime.manager.change_stage( stage )
return True
if key == config.Menu2:
import model
runtime.vdciapp.change_dimension(self.current_dimension,True)
runtime.manager.back_stage()
return True
if key == config.Red:
if status.modem_audio_state == status.HS or status.modem_audio_state == status.SPK:
import model
runtime.vdciapp.change_dimension(self.current_dimension,True)
runtime.manager.back_stage()
return True
return False
def destroy(self):
Stage.destroy(self)
_stages_ip = VideoDimensionStage, VideoFluencyStage
_stages_pstn = VideoDimensionStage, VideoFluencyStage, PcmUpstreamStage
# mute: handled in options.py
_video_stages = None, VideoFluencyStage, SnapshotStage
def get_stage(index):
if status.videocall_mode == status.VideoCallConnected:
return _video_stages[index]
import profile
if profile.ip_mode == 0: # psptn
return _stages_pstn[index]
else:
return _stages_ip[index]