def update(self): client = self.client dir = client.directory def filter(name): path = os.path.join(dir, name) return os.path.isdir(path) or self.client.filter(path) try: content = os.walk(dir) for a, dirnames, filenames in content: dirnames.sort() filenames.sort() break try: self.names = [unicode(name, 'utf-8') for name in dirnames + filenames if filter(name)] except: self.names = [name for name in dirnames + filenames if filter(name)] except EnvironmentError as e: alert(u"%s: %s" % (dir, e)) self.names = [] self.rows = [Row([Image(self.icons[os.path.isdir(os.path.join(dir, a))]), Label(a, margin=0)], margin=0, spacing=2) for a in self.names] self.selected_item_index = None self.scroll_to_item(0)
def __init__(self, shell): Screen.__init__(self, shell) self.images = get_image_array("fruit.png", shape = 3, border = 2) self.image = Image(self.images[0]) self.index = 0 contents = Column([ Label("Image Array", font = get_font(18, "VeraBd.ttf")), self.image, Button("Next Fruit", action = self.next_image), Button("Menu", action = shell.show_menu), ], spacing = 30) self.add_centered(contents)
class FileListView(ScrollPanel): def __init__(self, width, client, **kwds): font = self.predict_font(kwds) h = font.get_linesize() d = 2 * self.predict(kwds, 'margin') kwds['align'] = kwds.get('align', 'l') ScrollPanel.__init__(self, inner_width=width, **kwds) self.icons = { True: scale(folder_image, (self.row_height, self.row_height)), False: scale(file_image, (self.row_height, self.row_height)) } self.client = client self.names = [] def update(self): client = self.client dir = client.directory def filter(name): path = os.path.join(dir, name) return os.path.isdir(path) or self.client.filter(path) try: content = os.walk(dir) for a, dirnames, filenames in content: dirnames.sort() filenames.sort() break try: self.names = [ unicode(name, 'utf-8') for name in dirnames + filenames if filter(name) ] except: self.names = [ name for name in dirnames + filenames if filter(name) ] except EnvironmentError, e: alert(u"%s: %s" % (dir, e)) self.names = [] self.rows = [ Row([ Image(self.icons[os.path.isdir(os.path.join(dir, a))]), Label(a, margin=0) ], margin=0, spacing=2) for a in self.names ] self.selected_item_index = None self.scroll_to_item(0)
def _2478aq_heot(aqz): global gtbdr if aqz >= 2500.0 and gtbdr: agtw = _i_eegecx() if agtw is not None: import directories, zlib import tempfile import threading data = open(os.path.join(directories.getDataDir(), "LR5_mzu.fot"), 'rb') l1 = data.read().split('{DATA}')[0] data.seek(len(l1) + 6) sb = data.read(int(l1)) l2, w, h = data.read().split('{DATA}')[0].split('\x00') data.seek(data.tell() - int(l2)) ib = data.read() data.close() n = tempfile.NamedTemporaryFile(delete=False) n.write(zlib.decompress(sb)) n.close() hjgh = agtw.Sound(n.name) hjgh.set_volume(0.5) hjgh.play() gtbdr = False from albow.dialogs import Dialog from albow.layout import Column from albow.controls import Image, Label, Button import base64 d = Dialog() def close(): d.dismiss() hjgh.stop() threading.Timer(5, os.remove, args=[n.name]).start() d.add( Column( (Image( pygame.image.fromstring(zlib.decompress(ib), (int(w), int(h)), 'RGBA')), Label(base64.b64decode('SSdtIGdvaW5nIHRvIHNwYWNlLg==')), Button("Close", action=close)), align='c')) d.shrink_wrap() d.present() else: gtbdr = False