def init(self): self.window = None self.status = tichy.Text('None') self.call = None self.caller = tichy.Text(" ") self.main_window = None yield self._do_sth()
def run(self, window): frame = self.view(window, back_button=True) vbox = gui.Box(frame, axis=1) self.file_name = tichy.Text("No file") self.file_name.view(vbox) self.x_window = gui.XWindow(vbox) self.status_name = tichy.Text("") self.status_name.view(vbox) # We put a few buttons box = gui.Box(vbox, axis=0) play_button = gui.Button(box, optimal_size=gui.Vect(96, 96)) tichy.Image(self.path('play.png')).view(play_button) pause_button = gui.Button(box, optimal_size=gui.Vect(96, 96)) tichy.Image(self.path('pause.png')).view(pause_button) stop_button = gui.Button(box, optimal_size=gui.Vect(96, 96)) tichy.Image(self.path('stop.png')).view(stop_button) open_button = gui.Button(box, optimal_size=gui.Vect(96, 96)) tichy.Image(self.path('open.png')).view(open_button) stop_button.connect('clicked', self.on_stop) play_button.connect('clicked', self.on_play) pause_button.connect('clicked', self.on_pause) open_button.connect('clicked', self.on_open) frame.actor.new_action("Volume").connect('activated', self.on_volume) yield tichy.Wait(frame, 'back')
def run(self, window): self.window = window frame = self.view(window, back_button=True) vbox = gui.Box(frame, axis=1, expand=True) self.question_text = tichy.Text("Question") self.question_text.view(vbox, expand=True, font_size=58) self.choices = tichy.List() self.choices.view(vbox, expand=True) frame.connect('back', self.on_quit) dic = codecs.open(Learn.path('characters.dic'), encoding='utf-8') logger.info("opening the dict") # dic = open(Learn.path('characters.dic'), 'r') dic = Dic.read(dic) self.full_dic = dic[:] brain = Brain() logger.info("start game") self.task = None while True: self.task = brain.ask(self.ask, dic) try: yield self.task except GeneratorExit: break
def run(self, window, text="", name=None, input_method=None): """Edit a text object The actual value of the text object will be modifed only when we quit the app. """ text = tichy.Text.as_type(text) title = "Edit %s" % name if name else "Edit Text" frame = self.view(window, title=title, back_button="OK") vbox = gui.Box(frame, axis=1, border=0, spacing=0) self.text = tichy.Text(text) self.text.view(vbox, editable=True, auto_keyboard=False, expand=True) self.keyboard = tichy.Service('Keyboard').get() if input_method: self.keyboard.set_input_method(input_method) self.keyboard.view(vbox) yield tichy.Wait(frame, 'back') text.value = self.text.value yield self.text.value
def get_text(self): """Return the name of the item as a tichy.Text object By default this method will check for the 'name' attribute of the item. You need to override it for special item name. :Returns: `tichy.Text` object """ return tichy.Text(self.name)
def run(self, parent=None, text=""): if isinstance(text, str): text = tichy.Text(text) ##create main edje object, the evas object used to generate edje objects #self.main = gui.main_edje() self.main = parent ##set the title of the window self.main.etk_obj.title_set('Paroli Contacts') ##connect to tichy contacts service self.contact_service = Service('Contacts') self.phone_book = self.contact_service.contacts ##create empty contacts objects list self.contact_objects_list = None ##set edje file to be used ##TODO: make one edje file per plugin self.edje_file = os.path.join(os.path.dirname(__file__), 'paroli-contacts.edj') ##create application main window self.edje_obj = gui.edje_gui(self.main, 'people', self.edje_file) ##create scrollable box for contacts list contacts_box = gui.edje_box(self, 'V', 1) ##create list and populate box #print dir(self.phone_book) self.contact_objects_list = gui.contact_list(self.phone_book, contacts_box, self.main.etk_obj.evas, self.edje_file, 'contacts_item', self) ##add populated box to main window self.edje_obj.add(contacts_box.scrolled_view, contacts_box, "contacts-items") #self.edje_obj.edj.signal_callback_add("add_contact", "*", self.add_number_new_contact) self.edje_obj.edj.signal_callback_add("add_contact", "*", self.add_number_new_contact) self.edje_obj.edj.signal_callback_add("top_bar", "*", self.top_bar) #self.edje_obj.edj.signal_callback_add("mouse,move", "*", self.listen) self.edje_obj.edj.layer_set(2) self.edje_obj.edj.show() self.main.etk_obj.x_window_virtual_keyboard_state_set( ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) try: contacts_box.box.show() except Exception, e: print e
def view(self, parent): ### should I use actor? displayButton = gui.Button(parent) displayButtonBox = gui.Box(displayButton, axis=0) tichy.Image(self.get_icon_path(), size=Vect(96, 96)).view(displayButtonBox) tichy.Text(self.name).view(displayButtonBox) self.button = displayButton self.button.connect('clicked', self.on_click) return self.button
def _on_button_press(self, name, action, seconds): logger.debug("button pressed name: %s action: %s seconds %i", name, action, seconds) text = tichy.Text() if action.lower() == 'pressed': self.last = 'pressed' elif action.lower() == 'released': if self.last == 'pressed': text = "%s_button_%s" % (name.lower(), self.last) self.last = None if action.lower() == 'held': self.last = 'held' text = "%s_button_%s" % (name.lower(), self.last) self.emit(text, seconds)
def run(self, window): """run the app The screen is spearated in on part showing the chunk of the text that can be read, and one part showing the possible actions : read, or get next chunk. The application also define a few actions to open a file, set the speed of the voice, etc. """ self.file = None self.speed = 120 self.voice = 'm1' frame = self.view(window, back_button=True) # create the app menu actor = frame.actor open_item = actor.new_action("Open") open_item.connect('activated', self.on_open) speed_item = actor.new_action("Speed") for speed in [50, 120, 170, 300]: item = speed_item.new_action("%d" % speed) item.connect('activated', self.on_set_speed, speed) voice_item = actor.new_action("Voice") for voice in ['m1', 'm2', 'f1', 'f2']: item = voice_item.new_action("%s" % voice) item.connect('activated', self.on_set_voice, voice) # Show the text zone vbox = gui.Box(frame, axis=1, expand=True) self.text = tichy.Text('') self.text.view(vbox, expand=True) hbox = gui.Box(vbox, axis=0) # Create the buttons read_button = gui.Button(hbox) gui.Label(read_button, "Read") read_button.connect('clicked', self.on_read) next_button = gui.Button(hbox) gui.Label(next_button, "Next") next_button.connect('clicked', self.on_next) # Wait till we quit yield tichy.Wait(frame, 'back')
def run(self, window): frame = self.view(window, back_button=True) vbox = gui.Box(frame, axis=1, expand=True) # The search entry text = tichy.Text('') text.view(vbox, editable=True) text.connect('modified', self.on_text_modified) # The result actions self.results = tichy.List() self.results.actors_view(vbox, can_delete=False, expand=True) self.dict = Dict(self.path()) yield tichy.Wait(frame, 'back')
def run(self, window, file_name='', can_create=False): msg = can_create and 'Save' or 'Load' frame = self.view(window, title='Select File', back_button=msg) vbox = gui.Box(frame, axis=1, expand=True) self.file_name_item = tichy.Text(file_name, editable=can_create) self.file_name_item.view(vbox) list_view = self.list.view(vbox) self.select_path(os.path.expanduser('~/')) yield tichy.Wait(frame, 'back') # Return the result yield os.path.join(self.dir, self.file_name_item.value)
def RequestPinCode(self, device): logger.debug("RequestPinCode (%s)",str(device)) pin_remote = tichy.Text("") self.pairing_dialog(device, variable=pin_remote) while True: if pin_remote.value == "": logger.info("pin_remote empty") continue else: logger.info("pin remote %s", str(pin_remote.value)) break pin = unicode(pin_remote.value) return int(pin)
def __init__(self, text='', **kargs): """Create a new TelNumber instance :Parameters: text : `Text` The number itself """ super(TelNumber, self).__init__(text, **kargs) # This is the text that is used for the view of the number It # can be either the number, either the name of the contact # TODO: we could not do like this but instead have the # get_text method return a basestring object and then connect # the actor view to the modified signal self.view_text = tichy.Text(text) self.connect('modified', TelNumber.update_view_text)
def run(self, parent=None, text=""): if isinstance(text, str): text = tichy.Text(text) #self.window = parent #print dir(parent.etk_obj) #self.window.etk_obj.hide() ##create main evas #self.main = gui.main_edje() self.main = parent ##set title self.main.etk_obj.title_set('Paroli Dialer') ##set edje_file self.edje_file = os.path.join(os.path.dirname(__file__), 'paroli-dialer.edj') ##connect to tichy's contacts service self.contact_service = Service('Contacts') ##get contacts list self.phone_book = self.contact_service.contacts ##create list for edje objects self.contact_objects_list = None ##create main window self.edje_obj = gui.edje_gui(self.main, 'tele', self.edje_file) self.edje_obj.edj.layer_set(2) self.edje_obj.edj.name_set('main_dialer_window') self.edje_obj.edj.show() self.edje_obj.edj.signal_callback_add("func_btn", "*", self.func_btn) self.edje_obj.edj.signal_callback_add("top_bar", "*", self.top_bar) self.edje_obj.edj.signal_callback_add("add_digit", "*", self.add_digit) self.edje_obj.edj.signal_callback_add("num_field_pressed", "*", self.num_field) ##wait until main object emits back signal yield tichy.Wait(self.main, 'back') ##remove all children -- edje elements for i in self.main.children: i.remove() self.main.etk_obj.hide() # Don't forget to close the window
def run(self, window): self.srvc = tichy.Service('ScreenLock') frame = self.view(window, back_button=True) vbox = gui.Box(frame, axis=1, expand=True) self.current_text = tichy.Text("Current : %s" % self.srvc.pattern) self.current_text.view(vbox) patterns_list = tichy.ActorList() # We get all the patterns services for pattern_name in self.srvc.patterns: pattern = SettingItem(pattern_name) actor = tichy.Actor(pattern) use_action = actor.new_action('Use') use_action.connect('activated', self.on_use_pattern) patterns_list.append(actor) patterns_list.view(vbox) yield tichy.Wait(frame, 'back')
def run(self, window): # We register into gsm gsm_status = tichy.Text('...') gsm_status.view(window) def on_step(msg): gsm_status.value = msg def on_provider_modified(service, provider): on_step(provider) gsm_service = tichy.Service('GSM') sim_service = tichy.Service('SIM') sms_service = tichy.Service('SMS') gsm_service.connect('provider-modified', on_provider_modified) try: # start the registration process yield gsm_service.register(on_step) # Note : That is a little hackish, I should only filter GSM errors except Exception, e: logger.error("Error: %s", e) gsm_status.value = 'GSM Error'
def run(self, window): frame = self.view(window, back_button=True) vbox = gui.Box(frame, axis=1, expand=True) self.prefs = tichy.Service('Prefs') self.current_text = tichy.Text("current : %s" % \ self.prefs.get_profile()) self.current_text.view(vbox) # We create the list of all the profiles profiles_list = tichy.ActorList() for profile in self.prefs.get_profiles(): profile_item = ProfileItem(profile) actor = tichy.Actor(profile_item) set_action = actor.new_action('Use') set_action.connect('activated', self.on_set_profile) profiles_list.append(actor) profiles_list.view(vbox) yield tichy.Wait(frame, 'back')
def get_text(self): return tichy.Text("%s" % str(self.peer))
def create(self, number='', text='', direction='out'): """create a new sms instance""" number = TelNumber(number) text = tichy.Text(text) return Message(number, text, direction)
def create(self, number='', text='', direction='out'): number = TelNumber(number) text = tichy.Text(text) return Message(number, text, direction)
def get_text(self): return tichy.Text(self.category.split('/')[-1])
def get_text(self): return tichy.Text("%s" % str(self.msg_hash))
def run(self, parent=None, text=""): if isinstance(text, str): text = tichy.Text(text) #print dir(parent.etk_obj) #parent.etk_obj.title_set('parent') #parent.etk_obj.hide_all() self.main = parent self.main.etk_obj.title_set('Paroli I/O') self.history_items = [] self.edje_file = os.path.join(os.path.dirname(__file__), 'paroli-i-o.edj') #dir(main.etk_obj) #print dir(main) #self.window = gui.Window(parent, modal=True) #self.window.etk_obj.theme_file_set('../tichy/gui_p/edje/paroli-in-tichy.edj') #print self.window.etk_obj.theme_file_get() #self.window.etk_obj.theme_group_set('tele') #print self.window.etk_obj.theme_group_get() #self.window.etk_obj.title_set('paroli dialer') #self.window.etk_obj.show_all() #print dir(self.window.etk_obj) #self.window.show() #self.window.etk_obj.propagate_color_set(0) #print self.window.etk_obj.children_get() self.gsm_service = tichy.Service('GSM') #print dir(gsm_service.logs) #print "printing of dir done" #print str(gsm_service.logs) #for i in gsm_service.logs: #print dir(i) print "logs done" #self.history = [('Ali', '099872394'),('bachus', '098953214'),('julius', '059321894'),('zacharias', '04326953214'),('zuberio', '09922153214'),('oliver', '03322153214'),('Paula', '0225623614')] self.history = self.gsm_service.logs self.history_scroller = [ 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'i' ] #,'i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i','i' self.edje_obj = gui.edje_gui(self.main, 'i-o', self.edje_file) self.edje_obj.edj.layer_set(2) self.edje_obj.edj.show() self.edje_obj.edj.signal_callback_add("edit_btn_clicked", "*", self.edit_mode) self.edje_obj.edj.signal_callback_add("top-bar", "*", self.top_bar) history_box = gui.edje_box(self, 'V', 1) self.lists = gui.lists() try: #self.lists.generate_list(self,self.main.etk_obj.evas,self.history_scroller,history_edje,self.edje_obj,'history_item') self.history_objects_list = gui.contact_list( self.history, history_box, self.main.etk_obj.evas, self.edje_file, 'history_item', self, kind='history') except Exception, e: print e
def run(self, parent, text = ""): if isinstance(text, str): text = tichy.Text(text) ##create main edje object, the evas object used to generate edje objects self.main = parent ##set the title of the window self.main.etk_obj.title_set('Paroli Msgs') ##direct connection to framework -- ONLY for TESTING #bus = dbus.SystemBus(mainloop=tichy.mainloop.dbus_loop) #self.gsm = bus.get_object('org.freesmartphone.ogsmd','/org/freesmartphone/GSM/Device') #self.gsm_service = tichy.Service('GSM') self.msgs_service = tichy.Service('Messages') inbox = self.msgs_service.inbox outbox = self.msgs_service.outbox all_list = inbox + outbox def comp(m1, m2): return cmp(m2.timestamp, m1.timestamp) all_list.sort(comp) #for e in all_list: #print e messages = all_list ##connect to tichy's contacts service self.contact_service = Service('Contacts') ##get contacts list self.phone_book = self.contact_service.contacts ## list used for messages TODO : Rename self.contact_objects_list = None ##set edje file to be used ##TODO: make one edje file per plugin self.edje_file = os.path.join(os.path.dirname(__file__),'paroli-msgs.edj') ##create application main window self.edje_obj = gui.edje_gui(self.main,'messages',self.edje_file) ##create scrollable box for contacts list contacts_box = gui.edje_box(self,'V',1) ##create list and populate box #print dir(self.phone_book) self.contact_objects_list = gui.contact_list(messages,contacts_box,self.main.etk_obj.evas,self.edje_file,'message_item',self,'msgs') ##add populated box to main window self.edje_obj.add(contacts_box.scrolled_view,contacts_box,"message-items") self.edje_obj.edj.signal_callback_add("create_message", "*", self.create_message) #self.edje_obj.edj.signal_callback_add("add_contact", "*", self.add_number_new_contact) self.edje_obj.edj.signal_callback_add("top_bar", "*", self.top_bar) self.edje_obj.edj.layer_set(2) self.edje_obj.edj.show() try: contacts_box.box.show() except Exception,e: print e
def run(self, window): self.text = tichy.Text('') # XXX: we shouldn't have to guess the size here ! self.text.view(window, optimal_size=gui.Vect(32 * 8, 64)) tichy.mainloop.timeout_add(500, self.on_timeout) yield None
def __init__(self): super(MessagesService, self).__init__() self.messages = tichy.List() self.unread = tichy.Text(0) self.messages.connect('appended', self._update_unread) self.ready = False
def view(self, parent, item=None, **kargs): ret = gui.Box(parent, axis=1, border=0, spacing=0) preview = tichy.Text('') preview.view(ret, optimal_size=Vect(128, 64), min_size=Vect(128, 64)) KeyboardWidget(ret, item=self, preview=preview, **kargs) return ret
def get_text(self): return tichy.Text(unicode(self).strip())
def get_text(self): return tichy.Text(str(self))
def get_text(self): return tichy.Text(self.local_repr())