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")
Exemple #2
0
def test_list_query():
    query_types = ['text', 'code', 'number', 'query', 'float', 'date', 'time']
    for query in query_types:
        appuifw.note(u'Testing query type: ' + unicode(query))
        value = appuifw.query(u'Test query', query)
        if value is not None:
            if query == 'date':
                value = time.strftime("%d/%m/%y", time.localtime(value))
            elif query == 'time':
                value = time.strftime("%H:%M", time.gmtime(value))
            appuifw.note(u'Value : ' + unicode(value))
        else:
            appuifw.note(u'Query cancelled')

    single_item_list = [unicode(x) for x in range(10)]
    double_item_list = [(unicode(x), unicode(x + 1)) for x in range(10)]
    appuifw.note(u'Testing single item list')
    value = appuifw.popup_menu(single_item_list, u'Single item list')
    appuifw.note(u'Selected item : ' + unicode(value))
    appuifw.note(u'Testing double item list')
    value = appuifw.popup_menu(double_item_list, u'Double item list')
    appuifw.note(u'Selected item : ' + unicode(value))

    appuifw.note(u'Testing selection list with search field')
    value = appuifw.selection_list(single_item_list, search_field=1)
    appuifw.note(u'Selected item : ' + unicode(value))

    for selection_style in ['checkbox', 'checkmark']:
        appuifw.note(u'Testing multi-selection list, style - ' +
                     unicode(selection_style))
        value = appuifw.multi_selection_list(single_item_list,
                                             style=selection_style)
        appuifw.note(u'Selected items : ' + unicode(value))
Exemple #3
0
def menu_list1():
    ''' Built-in multi-selection listbox '''
    items = appuifw.multi_selection_list(my_list,
                                         style='checkbox',
                                         search_field=1)
    # Show what happened
    appuifw.note(u"Selected: %s" % unicode(str(items)))
def multiSelectionListWithCheckmarkNoSearch():
    appuifw.app.body = None
    myList = [
        u'apple', u'banana', u'cherry', u'orange', u'pear', u'strawberry'
    ]
    valore = appuifw.multi_selection_list(myList,
                                          style='checkmark',
                                          search_field=0)
Exemple #5
0
 def ask_tags(self):
     """Test function to select file tags from a selection list."""
     if self.current_img < 0 or len(self.IMG_LIST) == 0: 
         appuifw.note(u"No image selected", 'error')
         return
     # TODO: editable tags
     selected = appuifw.multi_selection_list(self.tags, style="checkbox", search_field=1)
     # appuifw.note(u"Selected %s" % str(selected), 'conf')
     self.IMG_LIST[self.current_img]["tags"] = ','.join([self.tags[i] for i in selected]) # Ah, I love python
     self.update()
Exemple #6
0
 def removeExceptionMenu(self):
     if len(self.exceptions) == 0 :
         info(u("გამონაკლისები არ არის!"))
         return
     items = appuifw.multi_selection_list(self.exceptions, style='checkbox', search_field=1)
     if len(items) == 0:
         return
     apps_to_remove = []
     for i in items:
         apps_to_remove.append(self.exceptions[i])
     self.removeExceptions(apps_to_remove)
     info(u("წაიშალა"))
Exemple #7
0
    def hidecat(self):
      # we're in execute_dialog i.e. we're in unicode world now!
      dispcat = eval(self.dispcat)
      if dispcat == []:
        appuifw.note(u"No categories displayed", "error")
        return
      if dispcat == None:
        dispcat = [ c[1] for c in self.categories[2:]]

      choicecat = [ c for c in self.categories if c[1] in dispcat]
      choicecat.sort()

      choices = [ unicode(c[0]) for c in choicecat ]
      sel = appuifw.multi_selection_list(choices, style="checkbox", search_field=True)
      if not sel: return # Cancel

      hidden = [ choicecat[c][1] for c in sel ]
      rest = [ c for c in dispcat if not c in hidden ]
      rest.sort()
      self.dispcat = str(repr(rest))
Exemple #8
0
    def showcat(self):
      # we're in execute_dialog i.e. we're in unicode world now!
      # and, 'None' means all, '[]' means None ;-)
      dispcat = eval(self.dispcat)
      allcat    = self.categories[2:]
      if dispcat != None:
        choicecat = [ c for c in allcat if not c[1] in dispcat ]
        choicecat.sort()
        if len(choicecat) == 0: # something happened...
          dispcat = None;  self.dispcat = "None"

      if dispcat == None:
        appuifw.note(u"All categories already displayed", "error")
        return
      
      choices = [ unicode(c[0]) for c in choicecat ]
      sel = appuifw.multi_selection_list(choices, style="checkbox", search_field=True)
      if not sel: return # Cancel
      
      dispcat += [ choicecat[c][1] for c in sel ]
      if len(dispcat) == len(allcat): dispcat = None
      self.dispcat = str(repr(dispcat))
Exemple #9
0
    def captureExceptionMenu(self):
        import applist
        a = applist.applist()
        if len(a) == 0:
            return
        apps = []
        for i in a:
            apps.append(i[1])
        for ex in self.exceptions:
            if ex in apps:
                apps.remove(ex)
        self.stopMainCapturer()

        items = appuifw.multi_selection_list(apps, style='checkbox', search_field =  1)
        self.startMainCapturer()
        if len(items) == 0:
            return
        apps_to_add = []
        for i in items:
            apps_to_add.append(apps[i])
        self.addExceptions(apps_to_add)
        info(u("დაემატა"))
Exemple #10
0
    def get_list_img(self):
	self.filelist = [x.decode('utf-8') for x in os.listdir(IN_PATH) \
				if os.path.isfile(IN_PATH + x.decode('utf-8')) and \
				(os.path.splitext(x.decode('utf-8'))[1][1:3]).lower() == "jp" ]
	if self.filelist == []:
		self.disp_msg(['', '**No JPG File in dir**'],fontsize='normal')
                self.set_dirmenu()
                return

	self.filelist.sort()
	self.filelist.reverse()

	menu_list = [u'file select',u'all files',u'cancel']
	menu = appuifw.selection_list(menu_list)
	if menu == 0:
        	self.index = appuifw.multi_selection_list(choices=self.filelist)
	if not self.index:
		self.refresh()
		return #exit
	elif menu == 1:
		self.index = [x for x in range(len(self.filelist))]
	else:
		self.refresh()
		return #exit
def AddEditScheduledSMS(EditScheduledSMS):
	if EditScheduledSMS:
		appuifw.app.title = u'Edit scheduled SMS'
	else:
		appuifw.app.title = u'Schedule new SMS'
		
	Message = u''
	Date = time()
	Time = float(12 * 60 * 60)
	Repeat = 0
	
	if EditScheduledSMS:
		Message = EditScheduledSMS.Message
		Date = EditScheduledSMS.Date
		Time = EditScheduledSMS.Time
		Repeat = EditScheduledSMS.Repeat

	Message = appuifw.query(u'Enter message', 'text', Message)
	
	if Message != None:
		Date = appuifw.query(u'Enter send date', 'date', Date)
		
		if Date != None:
			Time = appuifw.query(u'Enter send time', 'time', Time)
			
			if Time != None:
				Repeat = appuifw.selection_list([u'Never', u'Hourly', u'Daily', u'Weekly', u'Fortnightly', u'Monthly', u'Yearly'], 0)
				
				if Repeat!=None:
					ContactNames = []
					for C in Contacts:
						ContactNames.append(C[0])
					SelectedContacts = appuifw.multi_selection_list(ContactNames, style='checkmark', search_field=1)
	
					if len(SelectedContacts) > 0:
						SSMS = None
						
						if EditScheduledSMS:
							SSMS = EditScheduledSMS
						else:
							SSMS = SMS()
							
						SSMS.Contacts = []

						for i in SelectedContacts:
							if -1 == Contacts[i][1]:
								FirstTime = True
								while True:
									if True == FirstTime:
										MobileNumber = appuifw.query(u'Enter mobile number', 'text')
									else:
										MobileNumber = appuifw.query(u'Enter another mobile number', 'text')
									if None != MobileNumber:
										SSMS.Contacts.append((unicode(MobileNumber), MobileNumber))
									else:
										break
									FirstTime = False
							else:
								SSMS.Contacts.append(Contacts[i])
			
						if len(SSMS.Contacts) > 0:
							SSMS.Message = Message
							SSMS.Date = Date
							SSMS.Time = Time
							SSMS.Repeat = Repeat
			
						if EditScheduledSMS == None:
							ScheduledSMSList.append(SSMS)
				
						RefreshScheduledListBox()
			
						InitTimer()

	appuifw.app.title = u'SMSScheduler'
    def doCleanup(self):
        self.info(self.S_HELP_LANGUAGES)
        result = appuifw.multi_selection_list(self.langlist, search_field=1)
        languages = []
        for index in result:
            languages.append(self.langindex2code[index])
        if len(languages) == 0:
            self.error(self.S_ERROR_NO_LANGUAGES)
            return

        self.info(self.S_HELP_DRIVES)
        result = appuifw.multi_selection_list(self.drivelist)
        drives = []
        for index in result:
            drives.append(self.drivelist[index])
        if len(drives) == 0:
            self.error(self.S_ERROR_NO_DRIVES)
            return

        self.info(self.S_HELP_BACKUP)
        result = appuifw.selection_list(self.backuplist)
        if result is None:
            self.error(self.S_ERROR_NO_BACKUP)
            return

        self.backupEnabled = (result == 0)
        if self.backupEnabled:
            squestion = self.S_CONFIRM_CLEANUP_WBACKUP
        else:
            squestion = self.S_CONFIRM_CLEANUP_NOBACKUP

        if True != self.question(squestion):
            return

        if self.backupEnabled:
            if not self.makedir(self.backupdir):
                return

        txt = self.screens[self.SCREEN_CLEANUP].uicontrol
        txt.clear()
        txt.add(self.S_CLEANUP)
        self.showScreen(self.SCREEN_CLEANUP)
        self.working = True
        self.abort = False
        data = [0, 0]
        for drive in drives:
            e32.ao_yield()
            if self.abort:
                break
            if self.backupEnabled:
                newdir = self.backupdir + "\\" + drive[0] + "\\Resource"
                if not self.makedir(newdir):
                    txt.add(self.S_ERROR_FAILED_TO_CREATE_DIR %
                            (unicode(newdir)))
                    break
            if not self.cleanupFolder(drive + "\\Resource", languages, data,
                                      txt):
                break
        inf = unicode(self.S_CLEANUP_DONE % (data[0], bytestr(data[1])))
        txt.add(inf)
        self.info(inf)
        self.working = False
import appuifw, messaging, sysinfo

# can use dict too, but here is more straightforward later on
infoNames = [u"Profile", u"Battery", u"Signal DBM"]
infoCalls = ["sysinfo.active_profile()", \
				"sysinfo.battery()", "sysinfo.signal_dbm()"]

# let the user choose the info 
choices = appuifw.multi_selection_list(infoNames, 'checkbox', 1)
infoSms = ""
for idx in choices:
	# Execute the statement(s) stored the in infoCalls-list thru eval
	# convert the result to a string and append it to the sms text
	infoSms += infoNames[idx] + ";" + str(eval(infoCalls[idx])) + ";"

# Query the telephone number
smsNum = appuifw.query(u"Number:", "text", u"56765767")
if smsNum:
	# send the sms if the user didn't cancel
	messaging.sms_send(smsNum, infoSms)
	print infoSms
Exemple #14
0
def menu_list2():
    """ Built-in multi-selection listbox """
    items = appuifw.multi_selection_list(my_list, style="checkmark")
    # Show what happened
    appuifw.note(u"Selected: %s" % unicode(str(items)))
Exemple #15
0
 def run(self):
     self._f = appuifw.multi_selection_list(self.data,
                                            style='checkbox',
                                            search_field=1)
    def open_s(self, fm):
        self.num = 0
        in_ = open(fm, "rb")
        if fm.lower()[-3:] == 'znd':
            self.hz = struct.unpack('h', in_.read(2))[0]
            buf = in_.read()
            if len(buf) < 175:
                top_w.note([' ', 'Размер менее 175'], 0)
                in_.close()
                return
            self.size = len(buf)
            top_w.t = 1
            d = range(self.size / 20, self.size, self.size / 20)

            self.num = [
                ord(buf[i]) and
                (ord(buf[i]) < 128 and ~ord(buf[i]) + 1 or 255 - ord(buf[i]))
                for i in xrange(self.size) if
                (i in d and top_w.progress(int(100 /
                                               (self.size / float(i))))) or 1
            ]

            self.zoom(0, len(self.num), 0)
            top_w.t = 0
            top_w.pause(1)
            in_.close()
            return

        header = in_.read(44)
        f = struct.unpack('h', header[20:22])[0]
        if f != 1:
            format_w(f)
            in_.close()
            return  # # # # #
        self.size = struct.unpack('l', header[40:44])[0]
        self.hz = struct.unpack('l', header[24:28])[0]
        bit = struct.unpack('h', header[34:36])[0]
        kk = struct.unpack('h', header[22:24])[0] - 1
        bit2 = struct.unpack('h', header[32:34])[0]
        buf = in_.read(self.size)
        in_.close()

        if self.hz > 32000:
            top_w.note([' ', 'Частота больше 32000'], 0)
            return
        if len(buf) < 175:
            top_w.note([' ', 'Размер менее 175'], 0)
            return
        if kk:
            appuifw.app.screen = 'normal'
            k = appuifw.multi_selection_list(
                [unicode('левый'), unicode('правый')], style='checkbox')
            appuifw.app.screen = 'full'
            if k: k = k[0]
            else: return
        top_w.t = 1
        L = self.size
        d = range(L / 20, L, L / 20)

        if bit == 8:
            self.num = [
                255 - (ord(buf[x]) + 127) for x in xrange(L)
                if (x in d and top_w.progress(int(100 / (L / float(x))))) or (
                    ~kk + 2) or (kk and divmod(x + k, 2)[1])
            ]

        elif bit == 16:
            self.num = [
                ord(buf[x]) != 255
                and (ord(buf[x]) > 127 and ord(buf[x]) - 255 or ord(buf[x]))
                for x in xrange(L)
                if (x in d and top_w.progress(int(100 / (L / float(x))))) or
                (~kk + 2 and divmod(x, 2)[1]) or (kk and divmod(x, 4)[1] == 3 -
                                                  (k + k))
            ]

        top_w.t = 0
        top_w.pause(1)
        self.zoom(0, len(self.num), 0)
Exemple #17
0
import appuifw
import messaging

foods = [u"cheese", u"sausage", u"milk", u"banana", u"bread"]

choices = appuifw.multi_selection_list(foods,'checkbox',1)

items_to_buy = []
for x in choices:
    items_to_buy.append(foods[x])

greetings = appuifw.query(u"Add some greetings?", "text", u"thanks!")
if greetings:
        items_to_buy.append(greetings)

shoppinglist = ", ".join(items_to_buy)

### SMS sending code commented
#print "Sending SMS: " + shoppinglist
#messaging.sms_send("+1234567", shoppinglist)
#appuifw.note(u"Shoppinglist sent")
Exemple #18
0
import appuifw

names = [u"AA", u"BB", u"CC", u"DD"]
selections = appuifw.multi_selection_list(names, 'checkbox', 1)
print selections
Exemple #19
0
import appuifw

colors = [u"red", u"green", u"blue", u"brown"]

selections = appuifw.multi_selection_list(colors, 'checkbox', 1)
print "Checkbox selected:", selections

selections = appuifw.multi_selection_list(colors, 'checkmark', 1)
print "Checkmark selected:", selections

def  multi_selectionlist_checkbox():
    # define the list of items
    L = [u'cakewalk', u'com-port', u'computer', u'bluetooth', u'mobile', u'screen', u'camera', u'keys']
    # create the multi-selection list with checkbox
    index = appuifw.multi_selection_list(L , style='checkbox', search_field=1)
# This script executes a dialog that allows the users to make multiple selections
# of items in a list via checkbox. It returns the indexes (of the list) of the chosen items
# It uses the .multi_selection_list() function of the appuifw module
# appuifw.multi_selection_list(choices=list , style='checkbox', search_field=1)

# import the application user interface framework module
import appuifw

# define the list of items (items must written in unicode! -> put a u in front)
L = [
    u'cakewalk', u'com-port', u'computer', u'bluetooth', u'mobile', u'screen',
    u'camera', u'keys'
]

# create the multi-selection list
index = appuifw.multi_selection_list(L, style='checkbox', search_field=1)

# create a new list (Lnew) that inlcudes only the selected items and print the new list (Lnew)
Lnew = index
print Lnew
Exemple #22
0
 def run(self):
     self._f = appuifw.multi_selection_list(
         self.data, style='checkbox', search_field=1)