예제 #1
0
def load_comic(view, num):
    if num == 404:
        #view['comic'].image = ui.Image('loading.png')
        view['wv'].load_url(os.path.abspath('loading.png'))
        view.current = num
        view['comic_num'].text = str(num)
        view['slider'].value = num / latest
        view.comic = None
        objc_util.ObjCInstance(view.navigation_view).navigationController(
        ).topViewController().title = objc_util.ns('404 - Not Found')
        return
    console.show_activity()
    comic = get_info(num)
    if comic:
        if num in faves:
            view['fav'].image = ui.Image('iob:ios7_heart_32')
        else:
            view['fav'].image = ui.Image('iob:ios7_heart_outline_32')
        #view['comic'].image = ui.Image('loading.png')
        view['wv'].load_url(os.path.abspath('loading.png'))
        view.current = num
        view['comic_num'].text = str(num)
        view['slider'].value = num / latest
        view.comic = comic

        #view['comic'].image = get_comic(view.comic['img'])
        view['wv'].load_url(get_comic(view.comic['img']))
        objc_util.ObjCInstance(view.navigation_view).navigationController(
        ).topViewController().title = objc_util.ns(view.comic['title'])

    console.hide_activity()
예제 #2
0
def Create_Room_Button(v, l, label, a, x, y, m):
    n_lights = a
    lname = ''
    if l[0] in kitchen:
        lname = 'KC'
    elif l[0] in living_room:
        lname = 'LR'
    elif l[0] in bedroom:
        lname = 'BR'

    n = 0
    for a in l:
        if a.on:
            n = l.index(a)
            break

    button = ui.Button(image=ui.Image(Light_On_Texture(l[n])))
    button.title = lname
    button.action = Room_Toggle
    button.image = ui.Image(Light_On_Texture(l[n]))
    button.tint_color = '#ffffff'

    button.center = ((x / 2) - 3 * label.width,
                     (y / 2) + (n_lights / 2) - m * 40)

    v.add_subview(button)
예제 #3
0
def check_button_touch_up_inside(sender):
    # this functionchecks and compares the final values. it also reveals the dealers cards.

    global dealer_total
    #global computer_card_one_value
    #global computer_card_two_value
    #global computer_card_three_value

    #dealer_total = computer_card_one_value + computer_card_two_value + computer_card_three_value

    view['computer_card_one_imageview'].image = ui.Image(
        'card:' + str(computer_card_one_image))
    view['computer_card_two_imageview'].image = ui.Image(
        'card:' + str(computer_card_two_image))
    view['computer_card_three_imageview'].image = ui.Image(
        'card:' + str(computer_card_three_image))
    view['computer_total_label'].text = 'Dealer Total: ' + str(dealer_total)

    if player_total <= 21:
        if dealer_total > 21:
            view['result_label'].text = 'You Win!'
        elif dealer_total <= 21:
            if dealer_total < player_total:
                view['result_label'].text = 'You Win!'
            elif dealer_total > player_total:
                view['result_label'].text = 'You Lose!'
            elif dealer_total == player_total:
                view['result_label'].text = 'It is a Tie! Dealer Wins!'
    if player_total > 21:
        view['result_label'].text = 'You Lose!'
        if dealer_total > 21:
            view['result_label'].text = 'You both Lose!'
	def button_tapped(self,sender):
		#actions related to the buttons: screenshot & zoom
		if sender.name=='screenshot':
			if self.img_data!=None:
				if self.screenshot_i<10:
					name='screenshot'+str('0')+str(self.screenshot_i)+'.jpg'
				else:
					name='screenshot'+str(self.screenshot_i)+'.jpg'
				f=open(name,'wb')
				f.write(self.img_data)
				f.close()
				self.screenshot_i+=1
		elif sender.name=='zoom':
			if self.scale in self.zoom_l:
				j=self.zoom_l.index(self.scale)
				j=(j+1) % len(self.zoom_l)
				self.scale=self.zoom_l[j]
			else:
				self.scale=1
			self.calculate_frame()
			self.img_view.frame=(self.img_x,self.img_y,self.img_w,self.img_h)
		elif sender.name=='v_rec':
			if self.is_recording==False:
				if self.init_video_rec():
					self.v_rec.image=ui.Image('iow:stop_32')
					self.is_recording=True
					self.video_thread=threading.Thread(target=self.handle_queue_v)
					self.video_thread.start()
					
			else:
				self.v_rec.image=ui.Image('iow:record_32')
				self.is_recording=False
				self.close_video()
예제 #5
0
 def __init__(self, frame, colorName, using, colorHex=None):
     if colorName == "yellow" or colorName == "lightgrey":
         self.dark = True
     else:
         self.dark = False
     self.name = colorName
     self.colorName = colorName
     self.frame = frame
     self.background_color = self.colorName
     self.using = using
     if self.using == True:
         self.checkmark = ui.ImageView()
         if self.dark == True:
             self.checkmark.image = ui.Image('iob:checkmark_32')
         else:
             self.checkmark.image = ui.Image('iow:checkmark_32')
         self.checkmark.frame = (105, 60, 40, 40)
         self.add_subview(self.checkmark)
     self.nameLabel = ui.Label()
     self.nameLabel.text = "   " + self.colorName
     self.nameLabel.frame = (0, self.frame[3] - 40, self.frame[2], 40)
     if self.colorName == "lightgrey" or self.colorName == "yellow":
         self.nameLabel.text_color = "black"
     else:
         self.nameLabel.text_color = "white"
     self.add_subview(self.nameLabel)
예제 #6
0
def start_game():
    #for x in dealtCards:
    del dealtCards[0:len(dealtCards)]
    
    del compCards[0:len(compCards)]
    del userCards[0:len(userCards)]
    
    view['compCardOne_image'].image = None
    view['compCardTwo_image'].image = None
    view['compCardThree_image'].image = None
    
    view['answer_label'].text = ' '
    view['userCardSum_label'].text = ' '
    view['compCardSum_label'].text = ' '
    
    userCards.append(card_dealer())
    userCards.append(card_dealer())
    #print userCards
    #print deck[userCards[0]]
    #print './assets/deck/' + deck[userCards[0]]
    
    view['userCardOne_image'].image = ui.Image('./assets/deck/' + deck[userCards[0]])
    view['userCardTwo_image'].image = ui.Image('./assets/deck/' + deck[userCards[1]])
    view['userCardThree_image'].image = None
    
    #to do disable play again button
    view['play_again_button'].enabled = False
    
    #to do enable extra card and check buttons
    view['extra_button'].enabled = True
    view['check_button'].enabled = True
예제 #7
0
    def create_graphical_goal(self, page, index_goal, map_image):

        if (cmp(self.game.type_to_associate, "image_on_map") <> 0):
            goal = self.game.goals[index_goal]

            if (goal.text != None):
                goal = ui.TextBox(page, goal.text, goal.pos, goal.size,
                                  page.fonts, constants.text_color, 1)
            else:
                goal = ui.Image(page, goal.pos, goal.size, goal.image_file)

            if (self.selected_item_to_associate in self.image_sounds):
                goal.associated_sounds = self.image_sounds[
                    self.selected_item_to_associate]

        else:
            goal = self.associated_goal

            goal.place_on_map(map_image)

            # TODO : implement textbox
            # goal = ui.TextBox(page, goal.text, goal.pos, goal.size, page.fonts, constants.text_color, 1, goal.image_file, 0)

            goal = ui.Image(page, goal.pos, goal.size, goal.image_file)

        goal.set_associated_object(self)

        return goal
예제 #8
0
 def __init__(self, root, tableview, **kwargs):
     super().__init__(**kwargs)
     self.tableview = tableview
     self.recognized_text = []
     
     self.camera_button = ui.ButtonItem(
       tint_color='black',
       image=ui.Image('iob:camera_32'),
       action=partial(
           self.get_photo_action,
           picker_camera
       )
     )
     self.photos_button = ui.ButtonItem(
       tint_color='black',
       image=ui.Image('iob:ios7_photos_32'),
       action=partial(
           self.get_photo_action,
           picker_photos
       )
     )
   
     root.left_button_items = [
         self.photos_button
     ]
     root.right_button_items = [
         self.camera_button
     ]
예제 #9
0
def favorite(sender):
    try:
        faves.remove(main_view.comic['num'])
        main_view['fav'].image = ui.Image('iob:ios7_heart_outline_32')
    except ValueError:
        faves.append(main_view.comic['num'])
        main_view['fav'].image = ui.Image('iob:ios7_heart_32')
    with open('data/faves.json', 'w') as f:
        json.dump(faves, f)
예제 #10
0
파일: menu.py 프로젝트: edupals/omnitux
    def display_games_by_type(self):

        self.fade_out()

        self.remove_all()

        self.append(self.second_background_image)

        self.append(
            ui.Box(self, self.legend_text_pos, self.legend_text_size,
                   constants.button_box_color))

        if (len(self.games_to_display) > 0):

            circle_icons = Circle_icons(self,
                                        self.omnitux_logo_image.rect.center,
                                        self.omnitux_logo_image.rect.size, 2.1,
                                        len(self.games_to_display))

            index = 0

            for games in self.games_to_display:

                #x_pos = index % amount_x
                #y_pos = index // amount_x

                #offset_x = step_x * x_pos
                #offset_y = step_y * y_pos

                text = games.get_title(self.language)

                icon = ui.Image(self, (0, 0), (11, 11), games.get_thumb())

                icon.set_associated_text(text)

                self.listen_to_mouse_over(icon)

                icon.set_associated_object(games)

                icon.set_center_abs(circle_icons.get_center())

                self.append(icon)

                index = index + 1

        self.go_back_icon = ui.Image(self, constants.go_left_icon_pos,
                                     constants.go_left_icon_size,
                                     constants.go_left_icon)
        self.append(self.go_back_icon)

        self.draw()

        self.page_type = "GAME_SELECTION"

        return [self.screen.get_rect()]
예제 #11
0
    def update(self):
        ui.Page.update(self)

        self.big_image = ui.Image(self, constants.big_pos, constants.big_size,
                                  self.image_file)
        self.append(self.big_image)

        self.next_icon = ui.Image(self, constants.go_next_icon_pos,
                                  constants.go_next_icon_size,
                                  constants.go_next_icon)
        self.append(self.next_icon)
예제 #12
0
 def touch_began(self, touch):
     if self.using != True:
         self.checkmark = ui.ImageView()
         if self.dark == True:
             self.checkmark.image = ui.Image('iob:checkmark_32')
         else:
             self.checkmark.image = ui.Image('iow:checkmark_32')
         self.checkmark.frame = (105, 60, 40, 40)
         self.add_subview(self.checkmark)
         self.superview[CURRENTCOLOR].set_using(False)
     self.using = True
예제 #13
0
    def _set(self, title, message, type=DialogType.Info):
        self.button.action = lambda a: self.close()
        self.message.text = message
        self.title.text = title

        if type == DialogType.Info:
            self.icon.image = ui.Image('iob:information_circled_256')
        elif type == DialogType.Error:
            self.icon.image = ui.Image('iob:alert_256')
        elif type == DialogType.Warning:
            self.icon.image = ui.Image('iob:alert_circled_256')
예제 #14
0
    def __init__(self):

        self.animate_demo = True
        self.flex = 'WH'
        self.name = 'AWS Image Export'
        self.background_color = '#fff'
        w, h = ui.get_window_size()
        self.frame = (0, 0, w, h)
        buffer = 20

        # Setup Exporter

        self.exporter = AWSImageExporter()

        # Setup images
        self.image_list = {}
        self.all_images = []

        # Setup Categories
        self.categories = []

        # Grab Images into above vars
        self.load_images()

        # Remove duplicates in categories, and sort
        self.categories = sorted(list(set(self.categories)))

        pyui = bz2.decompress(b64decode(self._load_ui()))
        self.content_view = ui.load_view_str(pyui.decode('utf-8'))
        self.content_view.background_color = '#333'
        self.content_view.frame = self.frame
        self.content_view.flex = 'WH'
        self.add_subview(self.content_view)

        # Setup the various connections
        self.main = self.content_view['main']
        self.label_image_num = self.main['image_num']
        self.preview_image = self.main['preview_image']
        self.preview_category = self.main['preview_category']
        self.list_set = self.main['list_set']
        self.list_view = self.main['list_view']
        self.label_category_preview = self.main['label_category_preview']
        self.label_image_preview = self.main['label_image_preview']

        # Default View
        self.preview_category.image = ui.Image(
            'images/Database_AmazonElasticCache_Memcached.png')
        self.preview_image.image = ui.Image(
            'images/Database_AmazonElasticCache_Redis.png')

        self.label_image_num.text = str(len(self.all_images))
예제 #15
0
 def __init__(self, **kvargs):
     super().__init__(self, **kvargs)
     self.frame = (0, 0, 500, 500)
     self.wmin = 300
     self.hmin = 300
     iv = ui.ImageView()
     iv.image = ui.Image('iob:arrow_expand_24')
     iv.frame = (500 - 28, 500 - 28, 24, 24)
     iv.flex = 'LT'
     self.add_subview(iv)
     iv = ui.ImageView()
     iv.image = ui.Image('iob:ios7_circle_outline_32')
     iv.frame = (500 - 32, 500 - 32, 32, 32)
     iv.flex = 'LT'
     self.add_subview(iv)
예제 #16
0
 def check_mark(self, sender):
     try:
         if self.is_marked:  #unmark
             sender.image = ui.Image('iob:ios7_star_outline_' +
                                     self.app.icon_size)
             self.app.favorite_dict.pop(self.anime_title)
             console.hud_alert('Unmarked', 'success', 0.5)
         else:  #mark
             sender.image = ui.Image('iob:star_' + self.app.icon_size)
             self.app.favorite_dict[self.anime_title] = self.anime_infos
             console.hud_alert('Marked', 'success', 0.5)
     except Exception as e:
         print_msg('Error!', e)
     else:
         self.app.save_favor()
예제 #17
0
def MasterSwitch(sender):
    switches = sender.superview.subviews

    for l in all_lights:
        l.on = sender.value
        time.sleep(0.2)
        switches[all_lights.index(l)].image = ui.Image(Light_On_Texture(l))
예제 #18
0
    def create_graphical_representation(self, page, index_goal, map_image):

        if (cmp(self.game.type_to_associate, "image_on_map") <> 0):
            (image_pos,
             image_size) = self.game.item_to_associate_parameters[index_goal]
        else:
            (image_pos, image_size) = self.image_to_associate_pos_size

            coords_converter = ui.Coordinates_converter(
                page, Rect((0, 0), map_image.original_size), map_image.rect)

            image_pos = coords_converter.get_coords_pc_org2pc(image_pos)
            image_size = coords_converter.get_size_pc_org2pc(image_size)

        image = ui.Image(page, image_pos, image_size,
                         self.selected_item_to_associate)

        image.set_associated_object(self)

        if (self.selected_item_to_associate in self.image_sounds):
            image.associated_sounds = self.image_sounds[
                self.selected_item_to_associate]

        if (self.selected_item_to_associate in self.image_text_legends):
            # MAYBETODO : allow various text legends ?
            image.set_associated_text(
                self.image_text_legends[self.selected_item_to_associate][0])

            page.listen_to_mouse_over(image)

        return image
예제 #19
0
def animate():
    globals()

    frame = 1

    while frame <= 10:
        #makes a variable to store mans x (easier than typing view['blablabla']) everytime
        x = view['man_imageview'].x

        #sets the path to the image to the current frame by mashing the frame variable into the file paths string
        path = 'Resources/walk' + str(frame) + '.bmp'

        #sets the image/frame to the path
        view['man_imageview'].image = ui.Image(path)

        #moves the man to his left
        x = x - SPEED

        #delays it so its not instant
        time.sleep(0.05)

        #updates frame and keeps it looping
        frame = frame + 1
        if frame >= 10:
            frame = 1

        #wraps man around when he hits the edge
        if x < 0:
            x = 540

        #sets the mans x to the stored and now modified x
        view['man_imageview'].x = x
예제 #20
0
파일: menu.py 프로젝트: milkmull/Card-Game
def card_edit_menu(card):
    objects = []

    t = ui.Textbox.static_textbox(card['name'] + ':', tsize=30)
    t.rect.centerx = width // 2
    objects.append(t)
    
    i = ui.Image(CUSTOMSHEET.get_image(card['name'], size=(card_width // 3, card_height // 3)))
    i.rect.midtop = objects[-1].rect.midbottom
    i.rect.y += 5
    objects.append(i)
    
    b = ui.Button.text_button('edit card', func=run_builder, kwargs={'card_info': card}, tag='break')
    b.rect.centerx = width // 2
    b.rect.y = objects[-1].rect.bottom + b.rect.height
    objects.append(b)
    
    if card['id'] != 0:
        b = ui.Button.text_button('delete card', func=del_card, args=[card], tag='break')
        b.rect.centerx = width // 2
        b.rect.y = objects[-1].rect.bottom + 5
        objects.append(b)
    
    b = ui.Button.text_button('back', tag='break')
    b.rect.centerx = width // 2
    b.rect.y = objects[-1].rect.bottom + b.rect.height
    objects.append(b)
    
    ui.Position.center_objects_y(objects)
    
    return objects
예제 #21
0
파일: menu.py 프로젝트: milkmull/Card-Game
def join_game_menu(name, ip):
    objects = []
    
    window = ui.Image_Manager.get_surface((350, 150), color=(100, 100, 100), border_radius=10, olcolor=(0, 0, 128), width=5)
    window = ui.Image(window)
    window.rect.center = (width // 2, height // 2)
    objects.append(window)
    body = window.rect
    
    x0 = body.centerx - 10
    x1 = body.centerx + 10
    y0 = body.top + body.height // 4
    y1 = body.centery
    y2 = body.bottom - body.height // 4
    
    t = ui.Textbox.static_textbox('name: ')
    t.rect.midright = (x0, y0)
    objects.append(t)
    
    t = ui.Textbox.static_textbox(name)
    t.rect.midleft = (x1, y0)
    objects.append(t)

    t = ui.Textbox.static_textbox('ip: ')
    t.rect.midleft = (objects[-2].rect.x, y1)
    objects.append(t)
    
    t = ui.Textbox.static_textbox(ip)
    t.rect.midleft = (x1, y1)
    objects.append(t)
    
    t = ui.Textbox.static_textbox('port: ')
    t.rect.midleft = (objects[-2].rect.x, y2)
    objects.append(t)
    
    input_box = ui.Image_Manager.get_surface((60, 30), color=(0, 0, 0), width=1, olcolor=(255, 255, 255))
    
    i = ui.Input.from_image(input_box, message=str(SAVE.get_data('port')), length=4, check=ui.Input.positive_int_check, tsize=20)
    i.rect.midleft = (x1 - 5, y2)
    objects.append(i)
    
    for o in objects[1:]:
        o.rect.x -= 30
        
    b = ui.Button.text_button('back', size=(100, 24), color1=(0, 0, 0), color2=(255, 0, 0))
    b.set_tag('break')
    b.rect.midtop = (body.right - (body.width * 0.33), body.bottom + 15)
    objects.append(b)
        
    b = ui.Button.text_button('join game', size=(100, 24), color1=(0, 0, 0), color2=(0, 255, 0), func=join_game, args=[ip, objects[-2]])
    b.rect.midtop = (body.left + (body.width * 0.33), body.bottom + 15)
    objects.append(b)
    
    b = ui.Button.image_button(IMAGE_HANDLER.get_image('trash'), padding=(5, 5), color1=(0, 0, 0, 0), color2=(128, 0, 0), border_radius=5,
                               func=del_ip, args=[{'name': name, 'ip': ip}])
    b.set_tag('break')
    b.rect.topright = (body.right - 10, body.y + 10)
    objects.append(b)
    
    return objects
예제 #22
0
def player_card_one_touch_up_inside(sender):
    # this function flips over the first card when it is touched.

    global player_card_one_value
    #global player_card_one_image
    global player_total

    view['player_card_one_imageview'].image = ui.Image(
        'card:' + str(player_card_one_image))
    if player_card_one_value == 1:
        ace = console.alert('info',
                            'would you like 1 or 11',
                            '1',
                            '11',
                            hide_cancel_button=True)
        if ace == 1:
            player_total = player_total + player_card_one_value
            view['player_total_label'].text = 'Player Total: ' + str(
                player_total)
        else:
            player_total = int(player_total) + 11
            view['player_total_label'].text = 'Player Total: ' + str(
                player_total)
    else:
        player_total = player_total + player_card_one_value
        view['player_total_label'].text = 'Player Total: ' + str(player_total)
예제 #23
0
파일: menu.py 프로젝트: edupals/omnitux
    def update(self):

        ui.Page.update(self)

        # adding the omnitux logo
        self.omnitux_logo_image = ui.Image(self, (35, 35), (30, 30),
                                           constants.omnitux_logo)

        self.append_back(self.omnitux_logo_image)

        self.draw_back()

        # TODO clean next line someday (split in two pages ?)
        self.second_background_image = ui.Image(
            self, (0, 0), (100, 100), constants.main_menu_second_back, 255,
            100, "FILL")
예제 #24
0
    def __init__(self,
                 parent,
                 title,
                 text,
                 stockimage,
                 buttons=(),
                 default=None):
        Dialog.__init__(self, parent, "", buttons, default)

        # hbox with image and contents
        hbox = ui.HBox()
        hbox.set_spacing(12)
        self.vbox.pack_start(hbox)
        self.vbox.set_spacing(24)

        # set up image
        if stockimage != None:
            image = ui.Image(stockimage, gtk.ICON_SIZE_DIALOG)
            image.set_alignment(0.5, 0)
            hbox.pack_start(image, False, False)

        # set up message
        self.contents = ui.VBox()
        self.contents.set_spacing(10)
        hbox.pack_start(self.contents)

        label = ui.Label(
            "<span size=\"larger\" weight=\"bold\">%s</span>\n\n%s" %
            (util.escape_markup(title), text))
        label.set_alignment(0, 0)
        label.set_selectable(True)
        self.contents.pack_start(label)
 def __init__(self, **kvargs):
     super().__init__(self, **kvargs)
     self.button = ui.Button()
     self.button.image = ui.Image("iob:arrow_resize_24")
     self.button.frame = (10, 10, 24, 24)
     self.button.touch_enabled = False
     self.add_subview(self.button)
예제 #26
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.times = []
        for i in range(len(self.default_times)):
            time_value = self.default_times[i]
            b = ui.Button(
                tint_color='black',
                #tint_color='white',
                background_color='white',
                #border_color='lightgrey',
                #border_width=1,
                corner_radius=10,
                flex='WH')
            if time_value == 'theme':
                b.image = ui.Image('iob:waterdrop_32')
                b.action = self.toggle_theme
            else:
                b.title = str(time_value)
                b.action = self.go_to_timer
            #b.objc_instance.setClipsToBounds_(False)
            bl = b.objc_instance.layer()
            bl.setMasksToBounds_(False)
            bl.setShadowOpacity_(1)
            bl.setShadowRadius_(1)
            bl.setShadowOffset_(objc_util.CGSize(2, 2))
            bl.setShadowColor_(objc_black)

            b.font = (font, self.cell_font)
            #if i % 2 == 1:
            #  b.background_color = 'darkgrey'
            self.times.append(b)
            self.add_subview(b)
        self.set_theme()
def restoreState():

    global fields
    global totals

    with open('.totals.txt') as f_totals:
        totals = json.load(f_totals)

    for i in totals:
        v[i].text = str(totals[i])

    with open('.fields.txt') as f_fields:
        fields = json.load(f_fields)

    for f in fields:
        v[f].state = fields[f]['state']
        v[f].title = str(fields[f]['num'])
        if v[f].state == 'inactive':
            v[f].tint_color = (0, 0, 0, 1)
            v[f].image = None
        elif v[f].state == 'active':
            v[f].tint_color = (0, 0, 255, 1)
        elif v[f].state == 'locked':
            v[f].tint_color = (0, 0, 0, 1)
            v[f].image = ui.Image('iob:ios7_locked_24')
예제 #28
0
    def get_items(self):
        tmp = []
        for n in self.list_names:
            tmp.append([])

        cals = reminders.get_all_calendars()
        for c in cals:
            #print(c.title)
            if c.title in self.list_names:
                section = self.list_names.index(c.title)
                self.cal_dict[str(section)] = c
                #print('{} is section number {}'.format(c.title, section))
                self.rem_dict[str(section)] = reminders.get_reminders(
                    calendar=c, completed=False)
                tmplist = []
                for r in self.rem_dict[str(section)]:
                    #print(r)
                    im = ui.Image('iob:drag_24')
                    tmplist.append({
                        'title': r.title,
                        'image': im,
                        'accessory_type': 'disclosure_indicator',
                        'subtitle': r.notes
                    })
                tmp[section] = tmplist

            #print('=========')
        return tmp
예제 #29
0
 def add(type, img):
     # spacing here are hard-coded so the layout breaks when font is changed
     img = img.scale((30, 45))
     line = ui.HorizontalLayoutWidget()
     img_l = ui.LinearLayoutWidget()
     img_l.add(ui.Image(img))
     img_l.add(ui.Spacing(0, 6))
     line.add(img_l)
     if type != 0:
         line.add(ui.Spacing(10, 0))
         w = 40
         line.add(
             ui.Button(' - ',
                       functools.partial(change, type, -1),
                       font=font,
                       force_width=w))
         line.add(ui.Spacing(10, 0))
         line.add(
             ui.Button(' + ',
                       functools.partial(change, type, +1),
                       font=font,
                       force_width=w))
     else:
         line.add(ui.Spacing(116, 0))
     line.add(ui.Spacing(10, 0))
     line.add(ui.Label('%d%%' % tpl[type], font=font))
     panel.add(line)
 def __init__(self, image_mask = None, *args, **kwargs):
     ui.View.__init__(self, *args, **kwargs)      
     self.iv = ui.ImageView()
     self.iv.image = ui.Image('test:Mandrill')
     self.iv.frame = self.bounds
     self.add_subview(self.iv)
     self.add_subview(image_mask)