Esempio n. 1
0
 def url(self):  #添加url
     try:
         x, y = ui.multi_query(cn('链接名称'), cn('链接地址'))
         if x and y:
             self.t.add('(url=%s)%s(/url)' % (y, x))
     except:
         pass
Esempio n. 2
0
 def bto_url(self):  #添加文章链接
     try:
         x, y = ui.multi_query(cn('链接名称'), cn('帖子ID:'))
         if x and y:
             self.t.add('(url=bto:%s)%s(/url)' % (y, x))
     except:
         pass
def test_appuifw():
    """ Call different api's of appuifw like query, multi_query,
        selection_list, multi_selection_list, popup_menu and check if these
        respond to user input appropriately.

    """
    first, last = appuifw.multi_query(u"First Name", u"Last Name")
    appuifw.note(u"Enter these fields to proceed, " + first, "info")
    query_func()
    selected_team = appuifw.selection_list(choices=teams, search_field=1)
    if selected_team == 1:
        appuifw.note(u"Nice team to be in", "info")
        team_members_list = appuifw.multi_selection_list(team_members,
                                                         style='checkbox',
                                                         search_field=1)
        appuifw.note(u"Lets verify it again", "info")
        team_members_list = appuifw.multi_selection_list(team_members,
                                                         style='checkmark',
                                                         search_field=1)
        appuifw.note(u"Verification Done", "conf")
    option = appuifw.popup_menu(choice_list, u"How was the experience?")
    if option == 0:
        appuifw.note(u"Thank You", "info")
    else:
        appuifw.note(u"Loads to improve on!!", "error")
Esempio n. 4
0
def yiji():
    (
        a,
        b,
    ) = appuifw.multi_query(cn('菜单名'), cn('定义动作'))
    m.add(((((cn("\nmenu = [(cn('") + a) + cn("'),")) + b) + cn(')')))
    while 1:
        if aq(cn('继续添加菜单?'), 'query'):
            (
                a,
                b,
            ) = appuifw.multi_query(cn('新增菜单'), cn('定义动作'))
            m.add(((((cn(",(cn('") + a) + cn("'),")) + b) + cn(')')))
        else:
            break

    m.add(cn(']'))
Esempio n. 5
0
 def getAccount(self):
     '''GetAccount via multi_query'''
     try:
         user,passwd=appuifw.multi_query(uni("学号:"),uni("密码:"))
     except:
         sys.exit()
     else:
         return user,passwd
Esempio n. 6
0
 def getAccount(self):
     '''GetAccount via multi_query'''
     try:
         user, passwd = appuifw.multi_query(uni("学号:"), uni("密码:"))
     except:
         sys.exit()
     else:
         return user, passwd
Esempio n. 7
0
def test_change():
    c = ui.multi_query(u'Old', u'New')
    o = c[0]
    n = c[1]
    try:
        o = int(float(o))
    except:
        pass
    t.change_tab(o, n)
Esempio n. 8
0
 def _add_store(self, dataman):
     try:
         store_name, store_address = appuifw.multi_query(u"Store Name:", u"Address:")
     except ValueError:
         return
     try:
         return dataman.stores.add(store_name + u'\n' + store_address)
     except ConnectionError, e:
         appuifw.note(unicode(e), 'error')
Esempio n. 9
0
 def replace(self,limit=1,rep=None):
  if not rep:rep=ui.multi_query(u'Replace',u'With')
  if not rep:return
  self.r=rep
  t=self.t.get()
  t=t.replace(rep[0],rep[1],limit)
  self.t.set(t)
  self.r_ind=self.build_search([0],t,rep[1])
  if self.r_ind:
   self.t.set_pos(self.r_ind[-1])
Esempio n. 10
0
def erji():
    a = aq(cn('主菜单名'), 'text', cn('主菜单'))
    m.add(((cn("\nmenu = [(cn('") + a) + cn("'),")))
    (
        a,
        b,
    ) = appuifw.multi_query(cn('二级菜单'), cn('定义动作'))
    m.add(((((cn("((cn('") + a) + cn("'),")) + b) + cn(')')))
    while 1:
        if aq(cn('继续添加二级菜单?'), 'query'):
            (
                a,
                b,
            ) = appuifw.multi_query(cn('新增菜单'), cn('定义动作'))
            m.add(((((cn(",(cn('") + a) + cn("'),")) + b) + cn(')')))
        else:
            m.add(cn('))'))
            zhu()
            break
Esempio n. 11
0
 def replace(self, limit=1, rep=None):
     if not rep: rep = ui.multi_query(u'Replace', u'With')
     if not rep: return
     self.r = rep
     t = self.t.get()
     t = t.replace(rep[0], rep[1], limit)
     self.t.set(t)
     self.r_ind = self.build_search([0], t, rep[1])
     if self.r_ind:
         self.t.set_pos(self.r_ind[-1])
 def replace(self, all):
     repby = appuifw.multi_query(u"Replace", u"by")
     if repby != None:
         rep, by = repby
         text1 = appuifw.app.body.get(0, appuifw.app.body.get_pos())
         text2 = appuifw.app.body.get(appuifw.app.body.get_pos(),
                                      appuifw.app.body.len())
         if not all:
             if text2.find(rep) == -1:
                 if appuifw.query(u"Not found. Search from the begin?",
                                  'query'):
                     if text1.find(rep) == -1:
                         appuifw.note(u"Not found.", 'info')
                     else:
                         pos = text1.find(rep) + len(rep)
                         text1 = text1.replace(rep, by)
                         appuifw.app.body.set(text1 + text2)
                         appuifw.app.body.set_pos(pos)
                         appuifw.note(u"Replaced succesfully", 'conf')
             else:
                 pos = text2.find(rep) + len(rep)
                 text2 = text2.replace(rep, by)
                 appuifw.app.body.set(text1 + text2)
                 appuifw.app.body.set_pos(pos)
                 appuifw.note(u"Replaced succesfully", 'conf')
         else:
             if text2.find(rep) == -1:
                 if appuifw.query(u"Not found. Search from the begin?",
                                  'query'):
                     if text1.find(rep) == -1:
                         appuifw.query(u"Not found.", 'info')
                     else:
                         c = text1.count(rep)
                         text1 = text1.replace(rep, by)
                         pos = text1.rfind(rep) + len(rep)
                         appuifw.app.body.set(text1 + text2)
                         appuifw.app.body.set_pos(pos)
                         appuifw.note(u"Replaced %d times" % c, 'conf')
             else:
                 c = text2.count(rep)
                 pos = text2.rfind(rep) + len(rep)
                 text2 = text2.replace(rep, by)
                 appuifw.app.body.set(text1 + text2)
                 appuifw.app.body.set_pos(pos)
                 if appuifw.query(
                         u"Replaced %d times. Search from the begin?" % c,
                         'query'):
                     c = text1.count(rep)
                     pos = text1.rfind(rep) + len(rep)
                     text1 = text1.replace(rep, by)
                     appuifw.app.body.set(text1 + text2)
                     appuifw.app.body.set_pos(pos)
                     appuifw.note(u"Replaced %d times" % c, 'conf')
Esempio n. 13
0
def insert():
    global dict
    try:
        key, volume = appuifw.multi_query(
            u'\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430:',
            u'\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430:'
        )
    except:
        pass
    else:
        dict[key] = volume
        form.insert(len(dict) - 1, (key, 'text', volume))
    def add_server(self):
        address_port = appuifw.multi_query(u"Endereço IP:", u"Porta")

        if address_port:
            address, port = address_port

        port = port
        server_name = appuifw.query(u"Nome do Servidor",u"text")
        if address and port and server_name:
            self.servers[server_name] = dict(address=address,port=port)
            self.save_servers()
        
        self.home()
Esempio n. 15
0
 def linecol(self):
  line,col=ui.multi_query(u'Line',u'Column') or (None,None)
  try:
   line=int(line)
   col=int(col)
  except:
   if line:ui.note(u'Line & column must be integers','error')
   return False
  line=self.toLine(line)[0]
  if not line:return False
  index=line[col:]
  if index:
   self.t.set_pos(self.t.get_pos()+col)
Esempio n. 16
0
 def linecol(self):
     line, col = appuifw.multi_query(u'Line', u'Column') or (None, None)
     try:
         line = int(line)
         col = int(col)
     except:
         if line: appuifw.note(u'Line & column must be integers', 'error')
         return False
     line = self.toLine(line)[0]
     if not line: return False
     index = line[col:]
     if index:
         self.t.set_pos(self.t.get_pos() + col)
Esempio n. 17
0
 def linecol(self):
     line, col = appuifw.multi_query(u"Line", u"Column") or (None, None)
     try:
         line = int(line)
         col = int(col)
     except:
         if line:
             appuifw.note(u"Line & column must be integers", "error")
         return False
     line = self.toLine(line)[0]
     if not line:
         return False
     index = line[col:]
     if index:
         self.t.set_pos(self.t.get_pos() + col)
Esempio n. 18
0
def tanchu():
    (
        a,
        b,
    ) = appuifw.multi_query(cn('菜单名一'), cn('菜单名二'))
    m.add((((("\ndef pop():\n    w = [cn('" + a) + "'),cn('") + b) + "')"))
    while 1:
        if aq(cn('继续添加菜单?'), 'query'):
            a = aq(cn('新增菜单'), 'text')
            m.add(((",cn('" + a) + "')"))
        else:
            break

    m.add(
        cn("]\n    c = appuifw.popup_menu(w,cn('\xe8\xaf\xb7\xe9\x80\x89\xe6\x8b\xa9'))\n    if c == 0:\n    elif c == 1:\n    elif c == 2:"
           ))
Esempio n. 19
0
 def replace(self, limit=1, rep=None):
     if not rep: rep = appuifw.multi_query(u'Replace', u'With')
     if not rep: return
     self.r = rep
     t = self.t.get()
     matches = []
     for match in re.finditer(rep[0], t):
         matches.append(match.span())
     if limit: matches = matches[:limit]
     for pos in matches:
         before = t[:pos[0]]
         after = t[pos[1]:]
         middle = rep[1]
         t = before + middle + after
     self.t.set(t)
     self.r_ind = self.build_search([0], t, rep[1])
     if self.r_ind:
         self.t.set_pos(self.r_ind[-1])
Esempio n. 20
0
 def get_sid(self):  #获取SID函数
     x, y = ui.multi_query(cn('乐讯帐号:'), cn('密码:'))
     if x and y:
         from urllib import urlencode
         data = urlencode({"Num": en(x), "PWD": en(y)})
         url = 'http://117.135.136.38/login/login.aspx'
         res = self.send(data, url)
         if res[0] == 200 and res[2]:
             import re
             re_get_sid = re.compile('\w{25}')
             sid = re_get_sid.findall(res[2])
             if sid:
                 self.setting[2] = cn(sid[0])
                 ui.note(cn('成功获取LXT并以设置成功!'))
             else:
                 ui.note(cn('获取LXT失败,请重试或手动设置!'))
         else:
             ui.note(cn('网络连接出错!请重试!'))
Esempio n. 21
0
def test_form_insert_pop():
    def menu_callback1():
        appuifw.note(u"Menu callback1 hit!")

    def menu_callback2():
        appuifw.note(u"Menu callback2 hit!")

    f = appuifw.Form(get_simple_form(), FFormEditModeOnly)
    f.menu = [(u'Menu Item 1', menu_callback1),
              (u'Menu Item 2', menu_callback2)]
    f.execute()
    # Insert an item into the form
    item_value = appuifw.multi_query(u'Item index', u'Field descriptor')
    if item_value is not None:
        f.insert(int(item_value[0]), (u'Text', 'text', unicode(item_value[1])))
        appuifw.note(u"Item inserted!")
    f.execute()
    # Remove a field from the form
    item = f.pop()
    appuifw.note(u"Item : " + unicode(item) + u"popped!")
    f.execute()
Esempio n. 22
0
 def replace(self, limit=1, rep=None):
     if not rep:
         rep = appuifw.multi_query(u"Replace", u"With")
     if not rep:
         return
     self.r = rep
     t = self.t.get()
     matches = []
     for match in re.finditer(rep[0], t):
         matches.append(match.span())
     if limit:
         matches = matches[:limit]
     for pos in matches:
         before = t[: pos[0]]
         after = t[pos[1] :]
         middle = rep[1]
         t = before + middle + after
     self.t.set(t)
     self.r_ind = self.build_search([0], t, rep[1])
     if self.r_ind:
         self.t.set_pos(self.r_ind[-1])
Esempio n. 23
0
 def prompt2(self,label1,label2):
   return appuifw.multi_query(unicode(label1),unicode(label2))
Esempio n. 24
0
import appuifw

names = appuifw.multi_query(u"First name:", u" Last name:")
if names: 
        first, last = names
        appuifw.note(u"Your full name is: " + first + " " + last)
else:
        appuifw.note(u"Cancel!")
Esempio n. 25
0
# This script uses the multi_query function of the appuifw module

# import the application user interface framework module
import appuifw

# create 2 text input fields at the same time:  appuifw.multi_query(label1, label2)
input1, input2 = appuifw.multi_query(u"Type your first name:",
                                     u"Type your last name:")

# print the results on the screen
print input1
print input2
Esempio n. 26
0
import os, appuifw

def find(dir, filename):
	# print out the path currently examining
    # print dir
    for name in os.listdir(dir):
        path = os.path.join(dir.lower(), name)
        if name.lower() == filename:
            return path
        if os.path.isdir(path):
			# recursive find into each sub-dir
            r = find(path, filename)
            if r is not None:
                return r

info = appuifw.multi_query(u"Directory:", u"Filename:")
if info:
	my_dir, my_filename=info
	#print find('c:\\Data', 'hello.py')
	print find(my_dir.lower(), my_filename.lower())
Esempio n. 27
0
 def prompt2(self,label1,label2):
   return appuifw.multi_query(unicode(label1),unicode(label2))
Esempio n. 28
0
import appuifw
(a, b) = appuifw.multi_query(u"text1", u"text2")

#a,b分别是用户输入的两个值。输入文字系统会直接转换为“unicode”代码。按“否”,系统会报错。可改为下面的形式a=appuifw.multi_query(u"text1",u"text2")按否则返回0。输入后按是,返回一个二元序列。
Esempio n. 29
0
import appuifw, e32
appuifw.app.body.clear()
print 'Hello.'
e32.ao_sleep(1)
x = appuifw.multi_query(u"What's your:\nFirst name?",u"Last name?")
if x: appuifw.note('Hello, %s. %s.'%(x[0][0].capitalize(), x[1][0].capitalize()))
print 'Goodbye.'
e32.ao_sleep(2)
appuifw.app.body.clear()
Esempio n. 30
0
# This script uses the multi_query function of the appuifw module

# import the application user interface framework module
import appuifw

# create 2 text input fields at the same time:  appuifw.multi_query(label1, label2)
input1,input2 = appuifw.multi_query(u"Type your first name:",u"Type your last name:")

# print the results on the screen
print input1
print input2
Esempio n. 31
0
import appuifw

pwd = u"secret"

print "multi_query"

info = appuifw.multi_query(u"Username:"******"Password")
if info:	#returns a tuple with the info
	login_id, login_pwd = info
	if login_pwd == pwd:
		appuifw.note(u"Login successful", "conf")
	else:
		appuifw.note(u"Wrong password", "error")
else:
	appuifw.note(u"Cancelled")

Esempio n. 32
0
def multi_query():
    # create a double-field dialog (text input field):  appuifw.multi_query(label1, label2)
    data1,data2 = appuifw.multi_query(u"Type your first name:",u"Type your surname:")
    print data1
    print data2
Esempio n. 33
0
		while thetry != number:

			thetry = appuifw.query(u"Guess the number:", "number")

			if thetry > number:
				appuifw.note(u"Too high, try again", "error")
				tries = tries + 1
	
			if thetry < number:
				appuifw.note(u"Too low, try again", "error")
				tries = tries + 1

			if thetry == number:
				break

		appuifw.note(u"Victory!", "conf")
		appuifw.note(u"Right number was: " + number, "info")
		appuifw.note(u"Number of tries are " + tries, "info")
		appuifw.note(u"Thanks for playing!", "info")

	elif index == 1:
		data1,data2 = appuifw.multi_query(u"From",u"To")
		a = int(data1)
		b = int(data2)

	elif index == 2:
		appuifw.note(u"This game is made by Ernie using Python!", "info")

	elif index == 3:
		app.exit_key_handler=quit
Esempio n. 34
0
def test_change():
 c=ui.multi_query(u'Old',u'New')
 o=c[0];n=c[1]
 try:o=int(float(o))
 except:pass
 t.change_tab(o,n)
def multiQuery():
    appuifw.app.body = None
    valore = appuifw.multi_query(u'insert text 1', u'insert text 2')
Esempio n. 36
0
def send_text():
    resp = appuifw.multi_query(u"To", u"Message")
    if resp:
        dst, txt = resp
        thread_send_message({"!dst": dst, "txt": txt, "from": me})
Esempio n. 37
0
#
# Copyright (c) 2005 Nokia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import appuifw
from messaging import *

old_title = appuifw.app.set_title(u"Reitti interface")

dep = appuifw.multi_query(u"Departure address",u"h/e/v (Helsinki/Espoo/Vantaa)")
if dep != None:
    des = appuifw.multi_query(u"Destination address",u"h/e/v (Helsinki/Espoo/Vantaa)")
    if des != None:
        if appuifw.query(u"Send request as SMS to 16400","query") == True:
            sms_send("16400", u"reitti "+dep[0]+" "+dep[1]+", "+des[0]+" "+des[1])
            appuifw.note(u"Reitti request sent - reply comes per SMS", "info")
        
appuifw.app.set_title(old_title)
Esempio n. 38
0
import appuifw
def cn(x):return x.decode("utf-8")
#异常捕获,若不执行测试的内容就会捕获到异常
try:
    a,b=appuifw.multi_query(cn("乐讯昵称"), cn("乐讯ID"))
    appuifw.note(a+"\n"+b, "info")

except: 
   appuifw.note(cn("你选择了否"), "info")
Esempio n. 39
0
def c_6():
    (
        a,
        b,
    ) = appuifw.multi_query(cn('函数名:'), cn('定义动作:'))
    m.add((((cn('\ndef ') + a) + cn('():\n    ')) + b))